[lldb][NFC] Fix all formatting errors in .cpp file headers
Summary:
A *.cpp file header in LLDB (and in LLDB) should like this:
```
//===-- TestUtilities.cpp -------------------------------------------------===//
```
However in LLDB most of our source files have arbitrary changes to this format and
these changes are spreading through LLDB as folks usually just use the existing
source files as templates for their new files (most notably the unnecessary
editor language indicator `-*- C++ -*-` is spreading and in every review
someone is pointing out that this is wrong, resulting in people pointing out that this
is done in the same way in other files).
This patch removes most of these inconsistencies including the editor language indicators,
all the different missing/additional '-' characters, files that center the file name, missing
trailing `===//` (mostly caused by clang-format breaking the line).
Reviewers: aprantl, espindola, jfb, shafik, JDevlieghere
Reviewed By: JDevlieghere
Subscribers: dexonsmith, wuzish, emaste, sdardis, nemanjai, kbarton, MaskRay, atanasyan, arphaman, jfb, abidh, jsji, JDevlieghere, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D73258
2020-01-24 15:23:27 +08:00
|
|
|
//===-- CommandObjectPlatform.cpp -----------------------------------------===//
|
2011-03-19 09:12:21 +08:00
|
|
|
//
|
2019-01-19 16:50:56 +08:00
|
|
|
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
|
|
|
// See https://llvm.org/LICENSE.txt for license information.
|
|
|
|
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
2011-03-19 09:12:21 +08:00
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
#include "CommandObjectPlatform.h"
|
2021-01-21 01:33:00 +08:00
|
|
|
#include "CommandOptionsProcessLaunch.h"
|
2011-03-19 09:12:21 +08:00
|
|
|
#include "lldb/Core/Debugger.h"
|
<rdar://problem/11757916>
Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes:
- Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file".
- modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly
- Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was.
- modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()
Cleaned up header includes a bit as well.
llvm-svn: 162860
2012-08-30 05:13:06 +08:00
|
|
|
#include "lldb/Core/Module.h"
|
2011-03-19 09:12:21 +08:00
|
|
|
#include "lldb/Core/PluginManager.h"
|
2017-03-23 07:33:16 +08:00
|
|
|
#include "lldb/Host/OptionParser.h"
|
2011-03-19 09:12:21 +08:00
|
|
|
#include "lldb/Interpreter/CommandInterpreter.h"
|
2014-07-10 00:31:49 +08:00
|
|
|
#include "lldb/Interpreter/CommandOptionValidators.h"
|
2011-03-19 09:12:21 +08:00
|
|
|
#include "lldb/Interpreter/CommandReturnObject.h"
|
2013-11-21 05:07:01 +08:00
|
|
|
#include "lldb/Interpreter/OptionGroupFile.h"
|
Centralized a lot of the status information for processes,
threads, and stack frame down in the lldb_private::Process,
lldb_private::Thread, lldb_private::StackFrameList and the
lldb_private::StackFrame classes. We had some command line
commands that had duplicate versions of the process status
output ("thread list" and "process status" for example).
Removed the "file" command and placed it where it should
have been: "target create". Made an alias for "file" to
"target create" so we stay compatible with GDB commands.
We can now have multple usable targets in lldb at the
same time. This is nice for comparing two runs of a program
or debugging more than one binary at the same time. The
new command is "target select <target-idx>" and also to see
a list of the current targets you can use the new "target list"
command. The flow in a debug session can be:
(lldb) target create /path/to/exe/a.out
(lldb) breakpoint set --name main
(lldb) run
... hit breakpoint
(lldb) target create /bin/ls
(lldb) run /tmp
Process 36001 exited with status = 0 (0x00000000)
(lldb) target list
Current targets:
target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
* target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) target select 0
Current targets:
* target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) bt
* thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1
frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16
frame #1: 0x0000000100000b64 a.out`start + 52
Above we created a target for "a.out" and ran and hit a
breakpoint at "main". Then we created a new target for /bin/ls
and ran it. Then we listed the targest and selected our original
"a.out" program, so we showed two concurent debug sessions
going on at the same time.
llvm-svn: 129695
2011-04-18 16:33:37 +08:00
|
|
|
#include "lldb/Interpreter/OptionGroupPlatform.h"
|
2011-03-19 09:12:21 +08:00
|
|
|
#include "lldb/Target/ExecutionContext.h"
|
|
|
|
#include "lldb/Target/Platform.h"
|
2011-04-08 06:46:35 +08:00
|
|
|
#include "lldb/Target/Process.h"
|
2018-04-18 02:53:35 +08:00
|
|
|
#include "lldb/Utility/Args.h"
|
2011-03-19 09:12:21 +08:00
|
|
|
|
2016-09-20 01:54:06 +08:00
|
|
|
#include "llvm/ADT/SmallString.h"
|
|
|
|
|
2011-03-19 09:12:21 +08:00
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2016-09-24 01:48:13 +08:00
|
|
|
static mode_t ParsePermissionString(const char *) = delete;
|
|
|
|
|
|
|
|
static mode_t ParsePermissionString(llvm::StringRef permissions) {
|
|
|
|
if (permissions.size() != 9)
|
2013-08-27 07:57:52 +08:00
|
|
|
return (mode_t)(-1);
|
|
|
|
bool user_r, user_w, user_x, group_r, group_w, group_x, world_r, world_w,
|
|
|
|
world_x;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
user_r = (permissions[0] == 'r');
|
|
|
|
user_w = (permissions[1] == 'w');
|
|
|
|
user_x = (permissions[2] == 'x');
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
group_r = (permissions[3] == 'r');
|
|
|
|
group_w = (permissions[4] == 'w');
|
|
|
|
group_x = (permissions[5] == 'x');
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
world_r = (permissions[6] == 'r');
|
|
|
|
world_w = (permissions[7] == 'w');
|
|
|
|
world_x = (permissions[8] == 'x');
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
mode_t user, group, world;
|
|
|
|
user = (user_r ? 4 : 0) | (user_w ? 2 : 0) | (user_x ? 1 : 0);
|
|
|
|
group = (group_r ? 4 : 0) | (group_w ? 2 : 0) | (group_x ? 1 : 0);
|
|
|
|
world = (world_r ? 4 : 0) | (world_w ? 2 : 0) | (world_x ? 1 : 0);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
return user | group | world;
|
|
|
|
}
|
|
|
|
|
2019-07-24 20:05:42 +08:00
|
|
|
#define LLDB_OPTIONS_permissions
|
2019-07-24 20:08:08 +08:00
|
|
|
#include "CommandOptions.inc"
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2016-09-24 01:48:13 +08:00
|
|
|
class OptionPermissions : public OptionGroup {
|
2013-08-27 07:57:52 +08:00
|
|
|
public:
|
2016-02-23 03:02:01 +08:00
|
|
|
OptionPermissions() {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
~OptionPermissions() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
lldb_private::Status
|
2016-09-24 01:48:13 +08:00
|
|
|
SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
|
2016-08-12 07:51:28 +08:00
|
|
|
ExecutionContext *execution_context) override {
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error;
|
2013-08-27 07:57:52 +08:00
|
|
|
char short_option = (char)GetDefinitions()[option_idx].short_option;
|
|
|
|
switch (short_option) {
|
|
|
|
case 'v': {
|
2016-09-24 01:48:13 +08:00
|
|
|
if (option_arg.getAsInteger(8, m_permissions)) {
|
|
|
|
m_permissions = 0777;
|
2013-08-27 07:57:52 +08:00
|
|
|
error.SetErrorStringWithFormat("invalid value for permissions: %s",
|
2016-09-24 01:48:13 +08:00
|
|
|
option_arg.str().c_str());
|
|
|
|
}
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
} break;
|
2013-08-27 07:57:52 +08:00
|
|
|
case 's': {
|
|
|
|
mode_t perms = ParsePermissionString(option_arg);
|
|
|
|
if (perms == (mode_t)-1)
|
|
|
|
error.SetErrorStringWithFormat("invalid value for permissions: %s",
|
2016-09-24 01:48:13 +08:00
|
|
|
option_arg.str().c_str());
|
2016-09-07 04:57:50 +08:00
|
|
|
else
|
2013-08-27 07:57:52 +08:00
|
|
|
m_permissions = perms;
|
2016-09-07 04:57:50 +08:00
|
|
|
} break;
|
2013-08-27 07:57:52 +08:00
|
|
|
case 'r':
|
2013-11-21 05:07:01 +08:00
|
|
|
m_permissions |= lldb::eFilePermissionsUserRead;
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2013-08-27 07:57:52 +08:00
|
|
|
case 'w':
|
2013-11-21 05:07:01 +08:00
|
|
|
m_permissions |= lldb::eFilePermissionsUserWrite;
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2013-08-27 07:57:52 +08:00
|
|
|
case 'x':
|
2013-11-21 05:07:01 +08:00
|
|
|
m_permissions |= lldb::eFilePermissionsUserExecute;
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2013-08-27 07:57:52 +08:00
|
|
|
case 'R':
|
2013-11-21 05:07:01 +08:00
|
|
|
m_permissions |= lldb::eFilePermissionsGroupRead;
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2013-08-27 07:57:52 +08:00
|
|
|
case 'W':
|
2013-11-21 05:07:01 +08:00
|
|
|
m_permissions |= lldb::eFilePermissionsGroupWrite;
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2013-08-27 07:57:52 +08:00
|
|
|
case 'X':
|
2013-11-21 05:07:01 +08:00
|
|
|
m_permissions |= lldb::eFilePermissionsGroupExecute;
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2013-08-27 07:57:52 +08:00
|
|
|
case 'd':
|
2013-11-21 05:07:01 +08:00
|
|
|
m_permissions |= lldb::eFilePermissionsWorldRead;
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2013-08-27 07:57:52 +08:00
|
|
|
case 't':
|
2013-11-21 05:07:01 +08:00
|
|
|
m_permissions |= lldb::eFilePermissionsWorldWrite;
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2013-08-27 07:57:52 +08:00
|
|
|
case 'e':
|
2013-11-21 05:07:01 +08:00
|
|
|
m_permissions |= lldb::eFilePermissionsWorldExecute;
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
default:
|
2019-08-22 16:08:05 +08:00
|
|
|
llvm_unreachable("Unimplemented option");
|
2013-08-27 07:57:52 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
|
|
|
return error;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2016-08-12 07:51:28 +08:00
|
|
|
void OptionParsingStarting(ExecutionContext *execution_context) override {
|
2013-08-27 07:57:52 +08:00
|
|
|
m_permissions = 0;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
|
2016-09-23 05:06:13 +08:00
|
|
|
return llvm::makeArrayRef(g_permissions_options);
|
2013-08-27 07:57:52 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// Instance variables to hold the values for command options.
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
uint32_t m_permissions;
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
private:
|
[lldb] NFC remove DISALLOW_COPY_AND_ASSIGN
Summary:
This is how I applied my clang-tidy check (see
https://reviews.llvm.org/D80531) in order to remove
`DISALLOW_COPY_AND_ASSIGN` and have deleted copy ctors and deleted
assignment operators instead.
```
lang=bash
grep DISALLOW_COPY_AND_ASSIGN /opt/notnfs/kkleine/llvm/lldb -r -l | sort | uniq > files
for i in $(cat files);
do
clang-tidy \
--checks="-*,modernize-replace-disallow-copy-and-assign-macro" \
--format-style=LLVM \
--header-filter=.* \
--fix \
-fix-errors \
$i;
done
```
Reviewers: espindola, labath, aprantl, teemperor
Reviewed By: labath, aprantl, teemperor
Subscribers: teemperor, aprantl, labath, emaste, sbc100, aheejin, MaskRay, arphaman, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D80543
2020-06-03 00:19:55 +08:00
|
|
|
OptionPermissions(const OptionPermissions &) = delete;
|
|
|
|
const OptionPermissions &operator=(const OptionPermissions &) = delete;
|
2013-08-27 07:57:52 +08:00
|
|
|
};
|
2011-04-13 08:18:08 +08:00
|
|
|
|
Centralized a lot of the status information for processes,
threads, and stack frame down in the lldb_private::Process,
lldb_private::Thread, lldb_private::StackFrameList and the
lldb_private::StackFrame classes. We had some command line
commands that had duplicate versions of the process status
output ("thread list" and "process status" for example).
Removed the "file" command and placed it where it should
have been: "target create". Made an alias for "file" to
"target create" so we stay compatible with GDB commands.
We can now have multple usable targets in lldb at the
same time. This is nice for comparing two runs of a program
or debugging more than one binary at the same time. The
new command is "target select <target-idx>" and also to see
a list of the current targets you can use the new "target list"
command. The flow in a debug session can be:
(lldb) target create /path/to/exe/a.out
(lldb) breakpoint set --name main
(lldb) run
... hit breakpoint
(lldb) target create /bin/ls
(lldb) run /tmp
Process 36001 exited with status = 0 (0x00000000)
(lldb) target list
Current targets:
target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
* target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) target select 0
Current targets:
* target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) bt
* thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1
frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16
frame #1: 0x0000000100000b64 a.out`start + 52
Above we created a target for "a.out" and ran and hit a
breakpoint at "main". Then we created a new target for /bin/ls
and ran it. Then we listed the targest and selected our original
"a.out" program, so we showed two concurent debug sessions
going on at the same time.
llvm-svn: 129695
2011-04-18 16:33:37 +08:00
|
|
|
// "platform select <platform-name>"
|
2012-06-09 05:56:10 +08:00
|
|
|
class CommandObjectPlatformSelect : public CommandObjectParsed {
|
2011-03-19 09:12:21 +08:00
|
|
|
public:
|
2011-04-13 08:18:08 +08:00
|
|
|
CommandObjectPlatformSelect(CommandInterpreter &interpreter)
|
2012-06-09 05:56:10 +08:00
|
|
|
: CommandObjectParsed(interpreter, "platform select",
|
|
|
|
"Create a platform if needed and select it as the "
|
|
|
|
"current platform.",
|
|
|
|
"platform select <platform-name>", 0),
|
2016-08-12 07:51:28 +08:00
|
|
|
m_option_group(),
|
2011-04-13 08:18:08 +08:00
|
|
|
m_platform_options(
|
|
|
|
false) // Don't include the "--platform" option by passing false
|
2011-03-19 09:12:21 +08:00
|
|
|
{
|
2011-04-14 06:47:15 +08:00
|
|
|
m_option_group.Append(&m_platform_options, LLDB_OPT_SET_ALL, 1);
|
2011-04-13 08:18:08 +08:00
|
|
|
m_option_group.Finalize();
|
2011-03-19 09:12:21 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformSelect() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
[lldb][NFC] Remove WordComplete mode, make result array indexed from 0 and remove any undocumented/redundant return values
Summary:
We still have some leftovers of the old completion API in the internals of
LLDB that haven't been replaced by the new CompletionRequest. These leftovers
are:
* The return values (int/size_t) in all completion functions.
* Our result array that starts indexing at 1.
* `WordComplete` mode.
I didn't replace them back then because it's tricky to figure out what exactly they
are used for and the completion code is relatively untested. I finally got around
to writing more tests for the API and understanding the semantics, so I think it's
a good time to get rid of them.
A few words why those things should be removed/replaced:
* The return values are really cryptic, partly redundant and rarely documented.
They are also completely ignored by Xcode, so whatever information they contain will end up
breaking Xcode's completion mechanism. They are also partly impossible to even implement
as we assign negative values special meaning and our completion API sometimes returns size_t.
Completion functions are supposed to return -2 to rewrite the current line. We seem to use this
in some untested code path to expand the history repeat character to the full command, but
I haven't figured out why that doesn't work at the moment.
Completion functions return -1 to 'insert the completion character', but that isn't implemented
(even though we seem to activate this feature in LLDB sometimes).
All positive values have to match the number of results. This is obviously just redundant information
as the user can just look at the result list to get that information (which is what Xcode does).
* The result array that starts indexing at 1 is obviously unexpected. The first element of the array is
reserved for the common prefix of all completions (e.g. "foobar" and "footar" -> "foo"). The idea is
that we calculate this to make the life of the API caller easier, but obviously forcing people to have
1-based indices is not helpful (or even worse, forces them to manually copy the results to make it
0-based like Xcode has to do).
* The `WordComplete` mode indicates that LLDB should enter a space behind the completion. The
idea is that we let the top-level API know that we just provided a full completion. Interestingly we
`WordComplete` is just a single bool that somehow represents all N completions. And we always
provide full completions in LLDB, so in theory it should always be true.
The only use it currently serves is providing redundant information about whether we have a single
definitive completion or not (which we already know from the number of results we get).
This patch essentially removes `WordComplete` mode and makes the result array indexed from 0.
It also removes all return values from all internal completion functions. The only non-redundant information
they contain is about rewriting the current line (which is broken), so that functionality was moved
to the CompletionRequest API. So you can now do `addCompletion("blub", "description", CompletionMode::RewriteLine)`
to do the same.
For the SB API we emulate the old behaviour by making the array indexed from 1 again with the common
prefix at index 0. I didn't keep the special negative return codes as we either never sent them before (e.g. -2) or we
didn't even implement them in the Editline handler (e.g. -1).
I tried to keep this patch minimal and I'm aware we can probably now even further simplify a bunch of related code,
but I would prefer doing this in follow-up NFC commits
Reviewers: JDevlieghere
Reviewed By: JDevlieghere
Subscribers: arphaman, abidh, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D66536
llvm-svn: 369624
2019-08-22 15:41:23 +08:00
|
|
|
void HandleCompletion(CompletionRequest &request) override {
|
2018-07-14 02:28:14 +08:00
|
|
|
CommandCompletions::PlatformPluginNames(GetCommandInterpreter(), request,
|
|
|
|
nullptr);
|
2012-06-09 05:56:10 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2012-06-09 05:56:10 +08:00
|
|
|
Options *GetOptions() override { return &m_option_group; }
|
|
|
|
|
|
|
|
protected:
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2011-03-19 09:12:21 +08:00
|
|
|
if (args.GetArgumentCount() == 1) {
|
2011-04-14 06:47:15 +08:00
|
|
|
const char *platform_name = args.GetArgumentAtIndex(0);
|
|
|
|
if (platform_name && platform_name[0]) {
|
|
|
|
const bool select = true;
|
Centralized a lot of the status information for processes,
threads, and stack frame down in the lldb_private::Process,
lldb_private::Thread, lldb_private::StackFrameList and the
lldb_private::StackFrame classes. We had some command line
commands that had duplicate versions of the process status
output ("thread list" and "process status" for example).
Removed the "file" command and placed it where it should
have been: "target create". Made an alias for "file" to
"target create" so we stay compatible with GDB commands.
We can now have multple usable targets in lldb at the
same time. This is nice for comparing two runs of a program
or debugging more than one binary at the same time. The
new command is "target select <target-idx>" and also to see
a list of the current targets you can use the new "target list"
command. The flow in a debug session can be:
(lldb) target create /path/to/exe/a.out
(lldb) breakpoint set --name main
(lldb) run
... hit breakpoint
(lldb) target create /bin/ls
(lldb) run /tmp
Process 36001 exited with status = 0 (0x00000000)
(lldb) target list
Current targets:
target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
* target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) target select 0
Current targets:
* target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) bt
* thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1
frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16
frame #1: 0x0000000100000b64 a.out`start + 52
Above we created a target for "a.out" and ran and hit a
breakpoint at "main". Then we created a new target for /bin/ls
and ran it. Then we listed the targest and selected our original
"a.out" program, so we showed two concurent debug sessions
going on at the same time.
llvm-svn: 129695
2011-04-18 16:33:37 +08:00
|
|
|
m_platform_options.SetPlatformName(platform_name);
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error;
|
2012-05-08 09:45:38 +08:00
|
|
|
ArchSpec platform_arch;
|
|
|
|
PlatformSP platform_sp(m_platform_options.CreatePlatformWithOptions(
|
|
|
|
m_interpreter, ArchSpec(), select, error, platform_arch));
|
2011-04-14 06:47:15 +08:00
|
|
|
if (platform_sp) {
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().SetSelectedPlatform(platform_sp);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-04-14 06:47:15 +08:00
|
|
|
platform_sp->GetStatus(result.GetOutputStream());
|
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
|
|
|
} else {
|
|
|
|
result.AppendError(error.AsCString());
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
result.AppendError("invalid platform name");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2011-03-19 09:12:21 +08:00
|
|
|
}
|
|
|
|
} else {
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
result.AppendError(
|
|
|
|
"platform create takes a platform name as an argument\n");
|
2011-03-19 09:12:21 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
Centralized a lot of the status information for processes,
threads, and stack frame down in the lldb_private::Process,
lldb_private::Thread, lldb_private::StackFrameList and the
lldb_private::StackFrame classes. We had some command line
commands that had duplicate versions of the process status
output ("thread list" and "process status" for example).
Removed the "file" command and placed it where it should
have been: "target create". Made an alias for "file" to
"target create" so we stay compatible with GDB commands.
We can now have multple usable targets in lldb at the
same time. This is nice for comparing two runs of a program
or debugging more than one binary at the same time. The
new command is "target select <target-idx>" and also to see
a list of the current targets you can use the new "target list"
command. The flow in a debug session can be:
(lldb) target create /path/to/exe/a.out
(lldb) breakpoint set --name main
(lldb) run
... hit breakpoint
(lldb) target create /bin/ls
(lldb) run /tmp
Process 36001 exited with status = 0 (0x00000000)
(lldb) target list
Current targets:
target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
* target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) target select 0
Current targets:
* target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) bt
* thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1
frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16
frame #1: 0x0000000100000b64 a.out`start + 52
Above we created a target for "a.out" and ran and hit a
breakpoint at "main". Then we created a new target for /bin/ls
and ran it. Then we listed the targest and selected our original
"a.out" program, so we showed two concurent debug sessions
going on at the same time.
llvm-svn: 129695
2011-04-18 16:33:37 +08:00
|
|
|
|
2011-04-13 08:18:08 +08:00
|
|
|
OptionGroupOptions m_option_group;
|
Centralized a lot of the status information for processes,
threads, and stack frame down in the lldb_private::Process,
lldb_private::Thread, lldb_private::StackFrameList and the
lldb_private::StackFrame classes. We had some command line
commands that had duplicate versions of the process status
output ("thread list" and "process status" for example).
Removed the "file" command and placed it where it should
have been: "target create". Made an alias for "file" to
"target create" so we stay compatible with GDB commands.
We can now have multple usable targets in lldb at the
same time. This is nice for comparing two runs of a program
or debugging more than one binary at the same time. The
new command is "target select <target-idx>" and also to see
a list of the current targets you can use the new "target list"
command. The flow in a debug session can be:
(lldb) target create /path/to/exe/a.out
(lldb) breakpoint set --name main
(lldb) run
... hit breakpoint
(lldb) target create /bin/ls
(lldb) run /tmp
Process 36001 exited with status = 0 (0x00000000)
(lldb) target list
Current targets:
target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
* target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) target select 0
Current targets:
* target #0: /tmp/args/a.out ( arch=x86_64-apple-darwin, platform=localhost, pid=35999, state=stopped )
target #1: /bin/ls ( arch=x86_64-apple-darwin, platform=localhost, pid=36001, state=exited )
(lldb) bt
* thread #1: tid = 0x2d03, 0x0000000100000b9a a.out`main + 42 at main.c:16, stop reason = breakpoint 1.1
frame #0: 0x0000000100000b9a a.out`main + 42 at main.c:16
frame #1: 0x0000000100000b64 a.out`start + 52
Above we created a target for "a.out" and ran and hit a
breakpoint at "main". Then we created a new target for /bin/ls
and ran it. Then we listed the targest and selected our original
"a.out" program, so we showed two concurent debug sessions
going on at the same time.
llvm-svn: 129695
2011-04-18 16:33:37 +08:00
|
|
|
OptionGroupPlatform m_platform_options;
|
2011-03-19 09:12:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// "platform list"
|
2012-06-09 05:56:10 +08:00
|
|
|
class CommandObjectPlatformList : public CommandObjectParsed {
|
2011-03-19 09:12:21 +08:00
|
|
|
public:
|
|
|
|
CommandObjectPlatformList(CommandInterpreter &interpreter)
|
2016-02-23 03:02:01 +08:00
|
|
|
: CommandObjectParsed(interpreter, "platform list",
|
|
|
|
"List all platforms that are available.", nullptr,
|
|
|
|
0) {}
|
2011-03-19 09:12:21 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformList() override = default;
|
2011-03-19 09:12:21 +08:00
|
|
|
|
2012-06-09 05:56:10 +08:00
|
|
|
protected:
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2011-03-19 09:12:21 +08:00
|
|
|
Stream &ostrm = result.GetOutputStream();
|
|
|
|
ostrm.Printf("Available platforms:\n");
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2014-09-20 04:11:50 +08:00
|
|
|
PlatformSP host_platform_sp(Platform::GetHostPlatform());
|
2013-05-11 05:47:16 +08:00
|
|
|
ostrm.Printf("%s: %s\n", host_platform_sp->GetPluginName().GetCString(),
|
2011-03-19 09:12:21 +08:00
|
|
|
host_platform_sp->GetDescription());
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-03-19 09:12:21 +08:00
|
|
|
uint32_t idx;
|
2019-05-24 08:44:33 +08:00
|
|
|
for (idx = 0; true; ++idx) {
|
2011-03-19 09:12:21 +08:00
|
|
|
const char *plugin_name =
|
|
|
|
PluginManager::GetPlatformPluginNameAtIndex(idx);
|
2016-02-23 03:02:01 +08:00
|
|
|
if (plugin_name == nullptr)
|
2011-03-19 09:12:21 +08:00
|
|
|
break;
|
|
|
|
const char *plugin_desc =
|
|
|
|
PluginManager::GetPlatformPluginDescriptionAtIndex(idx);
|
2016-02-23 03:02:01 +08:00
|
|
|
if (plugin_desc == nullptr)
|
2011-03-19 09:12:21 +08:00
|
|
|
break;
|
|
|
|
ostrm.Printf("%s: %s\n", plugin_name, plugin_desc);
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-03-19 09:12:21 +08:00
|
|
|
if (idx == 0) {
|
2011-03-24 12:28:38 +08:00
|
|
|
result.AppendError("no platforms are available\n");
|
2013-08-27 07:57:52 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2016-09-07 04:57:50 +08:00
|
|
|
} else
|
2011-03-31 05:19:59 +08:00
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
2011-03-19 09:12:21 +08:00
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2011-03-19 09:12:21 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// "platform status"
|
2012-06-09 05:56:10 +08:00
|
|
|
class CommandObjectPlatformStatus : public CommandObjectParsed {
|
2011-03-19 09:12:21 +08:00
|
|
|
public:
|
2016-07-15 06:03:10 +08:00
|
|
|
CommandObjectPlatformStatus(CommandInterpreter &interpreter)
|
|
|
|
: CommandObjectParsed(interpreter, "platform status",
|
|
|
|
"Display status for the current platform.", nullptr,
|
|
|
|
0) {}
|
2011-03-19 09:12:21 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformStatus() override = default;
|
2011-03-19 09:12:21 +08:00
|
|
|
|
2012-06-09 05:56:10 +08:00
|
|
|
protected:
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2011-03-19 09:12:21 +08:00
|
|
|
Stream &ostrm = result.GetOutputStream();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-04-27 14:19:42 +08:00
|
|
|
Target *target = GetDebugger().GetSelectedTarget().get();
|
2013-04-05 10:59:09 +08:00
|
|
|
PlatformSP platform_sp;
|
2011-04-01 08:29:43 +08:00
|
|
|
if (target) {
|
|
|
|
platform_sp = target->GetPlatform();
|
2011-03-19 09:12:21 +08:00
|
|
|
}
|
2013-04-05 10:59:09 +08:00
|
|
|
if (!platform_sp) {
|
2019-04-27 14:19:42 +08:00
|
|
|
platform_sp = GetDebugger().GetPlatformList().GetSelectedPlatform();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2011-04-01 08:29:43 +08:00
|
|
|
if (platform_sp) {
|
|
|
|
platform_sp->GetStatus(ostrm);
|
2011-03-31 05:19:59 +08:00
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
2016-09-07 04:57:50 +08:00
|
|
|
} else {
|
2017-07-21 15:08:20 +08:00
|
|
|
result.AppendError("no platform is currently selected\n");
|
2013-08-27 07:57:52 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2011-03-19 09:12:21 +08:00
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2011-03-19 09:12:21 +08:00
|
|
|
};
|
|
|
|
|
2011-03-23 08:09:55 +08:00
|
|
|
// "platform connect <connect-url>"
|
2012-06-09 05:56:10 +08:00
|
|
|
class CommandObjectPlatformConnect : public CommandObjectParsed {
|
2011-03-23 08:09:55 +08:00
|
|
|
public:
|
2016-07-15 06:03:10 +08:00
|
|
|
CommandObjectPlatformConnect(CommandInterpreter &interpreter)
|
|
|
|
: CommandObjectParsed(
|
|
|
|
interpreter, "platform connect",
|
|
|
|
"Select the current platform by providing a connection URL.",
|
|
|
|
"platform connect <connect-url>", 0) {}
|
2011-03-23 08:09:55 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformConnect() override = default;
|
2011-03-23 08:09:55 +08:00
|
|
|
|
2012-06-09 05:56:10 +08:00
|
|
|
protected:
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2011-03-23 08:09:55 +08:00
|
|
|
Stream &ostrm = result.GetOutputStream();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-04-01 08:29:43 +08:00
|
|
|
PlatformSP platform_sp(
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2011-04-01 08:29:43 +08:00
|
|
|
if (platform_sp) {
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error(platform_sp->ConnectRemote(args));
|
2011-03-23 08:09:55 +08:00
|
|
|
if (error.Success()) {
|
2011-04-01 08:29:43 +08:00
|
|
|
platform_sp->GetStatus(ostrm);
|
2015-12-08 22:08:19 +08:00
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2019-04-27 14:19:42 +08:00
|
|
|
platform_sp->ConnectToWaitingProcesses(GetDebugger(), error);
|
2015-12-08 22:08:19 +08:00
|
|
|
if (error.Fail()) {
|
|
|
|
result.AppendError(error.AsCString());
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2011-03-23 08:09:55 +08:00
|
|
|
}
|
|
|
|
} else {
|
2011-03-24 12:28:38 +08:00
|
|
|
result.AppendErrorWithFormat("%s\n", error.AsCString());
|
2015-12-08 22:08:19 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2011-03-23 08:09:55 +08:00
|
|
|
}
|
|
|
|
} else {
|
2013-08-27 07:57:52 +08:00
|
|
|
result.AppendError("no platform is currently selected\n");
|
2011-03-23 08:09:55 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
2011-03-19 09:12:21 +08:00
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
Options *GetOptions() override {
|
2013-08-27 07:57:52 +08:00
|
|
|
PlatformSP platform_sp(
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2016-02-23 03:02:01 +08:00
|
|
|
OptionGroupOptions *m_platform_options = nullptr;
|
2013-08-27 07:57:52 +08:00
|
|
|
if (platform_sp) {
|
|
|
|
m_platform_options = platform_sp->GetConnectionOptions(m_interpreter);
|
2016-02-23 03:02:01 +08:00
|
|
|
if (m_platform_options != nullptr && !m_platform_options->m_did_finalize)
|
2013-08-27 07:57:52 +08:00
|
|
|
m_platform_options->Finalize();
|
|
|
|
}
|
|
|
|
return m_platform_options;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2011-03-23 08:09:55 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// "platform disconnect"
|
2012-06-09 05:56:10 +08:00
|
|
|
class CommandObjectPlatformDisconnect : public CommandObjectParsed {
|
2011-03-23 08:09:55 +08:00
|
|
|
public:
|
2016-07-15 06:03:10 +08:00
|
|
|
CommandObjectPlatformDisconnect(CommandInterpreter &interpreter)
|
|
|
|
: CommandObjectParsed(interpreter, "platform disconnect",
|
|
|
|
"Disconnect from the current platform.",
|
|
|
|
"platform disconnect", 0) {}
|
2011-03-23 08:09:55 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformDisconnect() override = default;
|
2011-03-23 08:09:55 +08:00
|
|
|
|
2012-06-09 05:56:10 +08:00
|
|
|
protected:
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2011-04-01 08:29:43 +08:00
|
|
|
PlatformSP platform_sp(
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2011-04-01 08:29:43 +08:00
|
|
|
if (platform_sp) {
|
2011-03-23 08:09:55 +08:00
|
|
|
if (args.GetArgumentCount() == 0) {
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-04-01 08:29:43 +08:00
|
|
|
if (platform_sp->IsConnected()) {
|
2018-05-01 00:49:04 +08:00
|
|
|
// Cache the instance name if there is one since we are about to
|
|
|
|
// disconnect and the name might go with it.
|
2011-04-01 08:29:43 +08:00
|
|
|
const char *hostname_cstr = platform_sp->GetHostname();
|
2011-03-24 12:28:38 +08:00
|
|
|
std::string hostname;
|
|
|
|
if (hostname_cstr)
|
|
|
|
hostname.assign(hostname_cstr);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-05-11 05:47:16 +08:00
|
|
|
error = platform_sp->DisconnectRemote();
|
2011-03-23 08:09:55 +08:00
|
|
|
if (error.Success()) {
|
|
|
|
Stream &ostrm = result.GetOutputStream();
|
2011-03-24 12:28:38 +08:00
|
|
|
if (hostname.empty())
|
2013-05-11 05:47:16 +08:00
|
|
|
ostrm.Printf("Disconnected from \"%s\"\n",
|
|
|
|
platform_sp->GetPluginName().GetCString());
|
2011-03-23 08:09:55 +08:00
|
|
|
else
|
2011-03-24 12:28:38 +08:00
|
|
|
ostrm.Printf("Disconnected from \"%s\"\n", hostname.c_str());
|
2011-03-19 09:12:21 +08:00
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
2011-03-23 08:09:55 +08:00
|
|
|
} else {
|
|
|
|
result.AppendErrorWithFormat("%s", error.AsCString());
|
2013-08-27 07:57:52 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
} else {
|
2011-03-23 08:09:55 +08:00
|
|
|
// Not connected...
|
2013-11-21 05:07:01 +08:00
|
|
|
result.AppendErrorWithFormat(
|
2013-08-27 07:57:52 +08:00
|
|
|
"not connected to '%s'",
|
2013-05-11 05:47:16 +08:00
|
|
|
platform_sp->GetPluginName().GetCString());
|
2013-08-27 07:57:52 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
} else {
|
2011-03-23 08:09:55 +08:00
|
|
|
// Bad args
|
2013-11-21 05:07:01 +08:00
|
|
|
result.AppendError(
|
2011-03-23 08:09:55 +08:00
|
|
|
"\"platform disconnect\" doesn't take any arguments");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
|
|
|
} else {
|
2011-03-24 12:28:38 +08:00
|
|
|
result.AppendError("no platform is currently selected");
|
2011-03-23 08:09:55 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2011-03-23 08:09:55 +08:00
|
|
|
};
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-11-21 05:07:01 +08:00
|
|
|
// "platform settings"
|
|
|
|
class CommandObjectPlatformSettings : public CommandObjectParsed {
|
|
|
|
public:
|
|
|
|
CommandObjectPlatformSettings(CommandInterpreter &interpreter)
|
|
|
|
: CommandObjectParsed(interpreter, "platform settings",
|
|
|
|
"Set settings for the current target's platform, "
|
|
|
|
"or for a platform by name.",
|
|
|
|
"platform settings", 0),
|
2016-08-12 07:51:28 +08:00
|
|
|
m_options(),
|
2020-08-24 23:34:32 +08:00
|
|
|
m_option_working_dir(LLDB_OPT_SET_1, false, "working-dir", 'w',
|
|
|
|
CommandCompletions::eRemoteDiskDirectoryCompletion,
|
2013-11-21 05:07:01 +08:00
|
|
|
eArgTypePath,
|
|
|
|
"The working directory for the platform.") {
|
|
|
|
m_options.Append(&m_option_working_dir, LLDB_OPT_SET_ALL, LLDB_OPT_SET_1);
|
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
|
|
|
~CommandObjectPlatformSettings() override = default;
|
|
|
|
|
2013-11-21 05:07:01 +08:00
|
|
|
protected:
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2013-11-21 05:07:01 +08:00
|
|
|
PlatformSP platform_sp(
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2013-11-21 05:07:01 +08:00
|
|
|
if (platform_sp) {
|
|
|
|
if (m_option_working_dir.GetOptionValue().OptionWasSet())
|
2015-05-30 03:52:29 +08:00
|
|
|
platform_sp->SetWorkingDirectory(
|
|
|
|
m_option_working_dir.GetOptionValue().GetCurrentValue());
|
2013-11-21 05:07:01 +08:00
|
|
|
} else {
|
|
|
|
result.AppendError("no platform is currently selected");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
2011-03-23 08:09:55 +08:00
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
Options *GetOptions() override {
|
2016-02-23 03:02:01 +08:00
|
|
|
if (!m_options.DidFinalize())
|
2013-11-21 05:07:01 +08:00
|
|
|
m_options.Finalize();
|
|
|
|
return &m_options;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2013-11-21 05:07:01 +08:00
|
|
|
OptionGroupOptions m_options;
|
|
|
|
OptionGroupFile m_option_working_dir;
|
|
|
|
};
|
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// "platform mkdir"
|
|
|
|
class CommandObjectPlatformMkDir : public CommandObjectParsed {
|
2011-04-12 13:54:46 +08:00
|
|
|
public:
|
2013-08-27 07:57:52 +08:00
|
|
|
CommandObjectPlatformMkDir(CommandInterpreter &interpreter)
|
2016-02-23 03:02:01 +08:00
|
|
|
: CommandObjectParsed(interpreter, "platform mkdir",
|
|
|
|
"Make a new directory on the remote end.", nullptr,
|
|
|
|
0),
|
2016-08-12 07:51:28 +08:00
|
|
|
m_options() {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformMkDir() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2016-08-12 07:51:28 +08:00
|
|
|
PlatformSP platform_sp(
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2013-08-27 07:57:52 +08:00
|
|
|
if (platform_sp) {
|
|
|
|
std::string cmd_line;
|
|
|
|
args.GetCommandString(cmd_line);
|
2013-11-21 05:07:01 +08:00
|
|
|
uint32_t mode;
|
2015-02-03 15:59:26 +08:00
|
|
|
const OptionPermissions *options_permissions =
|
|
|
|
(const OptionPermissions *)m_options.GetGroupWithOption('r');
|
2013-08-27 07:57:52 +08:00
|
|
|
if (options_permissions)
|
2013-11-21 05:07:01 +08:00
|
|
|
mode = options_permissions->m_permissions;
|
2016-09-07 04:57:50 +08:00
|
|
|
else
|
2013-11-21 05:07:01 +08:00
|
|
|
mode = lldb::eFilePermissionsUserRWX | lldb::eFilePermissionsGroupRWX |
|
|
|
|
lldb::eFilePermissionsWorldRX;
|
2018-11-02 05:05:36 +08:00
|
|
|
Status error = platform_sp->MakeDirectory(FileSpec(cmd_line), mode);
|
2011-04-12 13:54:46 +08:00
|
|
|
if (error.Success()) {
|
2013-11-21 05:07:01 +08:00
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
2016-09-07 04:57:50 +08:00
|
|
|
} else {
|
2013-11-21 05:07:01 +08:00
|
|
|
result.AppendError(error.AsCString());
|
2013-08-27 07:57:52 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
} else {
|
2013-08-27 07:57:52 +08:00
|
|
|
result.AppendError("no platform currently selected\n");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2011-04-12 13:54:46 +08:00
|
|
|
}
|
2011-03-23 08:09:55 +08:00
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2015-02-03 15:59:26 +08:00
|
|
|
Options *GetOptions() override {
|
2013-08-27 07:57:52 +08:00
|
|
|
if (!m_options.DidFinalize()) {
|
2013-11-21 05:07:01 +08:00
|
|
|
m_options.Append(new OptionPermissions());
|
2013-08-27 07:57:52 +08:00
|
|
|
m_options.Finalize();
|
2012-06-09 05:56:10 +08:00
|
|
|
}
|
2013-11-21 05:07:01 +08:00
|
|
|
return &m_options;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
OptionGroupOptions m_options;
|
|
|
|
};
|
|
|
|
|
|
|
|
// "platform fopen"
|
|
|
|
class CommandObjectPlatformFOpen : public CommandObjectParsed {
|
|
|
|
public:
|
|
|
|
CommandObjectPlatformFOpen(CommandInterpreter &interpreter)
|
2016-02-23 03:02:01 +08:00
|
|
|
: CommandObjectParsed(interpreter, "platform file open",
|
|
|
|
"Open a file on the remote end.", nullptr, 0),
|
2016-08-12 07:51:28 +08:00
|
|
|
m_options() {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformFOpen() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2020-08-24 23:34:32 +08:00
|
|
|
void
|
|
|
|
HandleArgumentCompletion(CompletionRequest &request,
|
|
|
|
OptionElementVector &opt_element_vector) override {
|
|
|
|
if (request.GetCursorIndex() == 0)
|
|
|
|
CommandCompletions::InvokeCommonCompletionCallbacks(
|
|
|
|
GetCommandInterpreter(),
|
|
|
|
CommandCompletions::eRemoteDiskFileCompletion, request, nullptr);
|
|
|
|
}
|
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2013-08-27 07:57:52 +08:00
|
|
|
PlatformSP platform_sp(
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2011-04-12 13:54:46 +08:00
|
|
|
if (platform_sp) {
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error;
|
2013-08-27 07:57:52 +08:00
|
|
|
std::string cmd_line;
|
|
|
|
args.GetCommandString(cmd_line);
|
|
|
|
mode_t perms;
|
2015-02-03 15:59:26 +08:00
|
|
|
const OptionPermissions *options_permissions =
|
|
|
|
(const OptionPermissions *)m_options.GetGroupWithOption('r');
|
2013-08-27 07:57:52 +08:00
|
|
|
if (options_permissions)
|
|
|
|
perms = options_permissions->m_permissions;
|
|
|
|
else
|
2013-11-21 05:07:01 +08:00
|
|
|
perms = lldb::eFilePermissionsUserRW | lldb::eFilePermissionsGroupRW |
|
|
|
|
lldb::eFilePermissionsWorldRead;
|
2013-08-27 07:57:52 +08:00
|
|
|
lldb::user_id_t fd = platform_sp->OpenFile(
|
2018-11-02 05:05:36 +08:00
|
|
|
FileSpec(cmd_line),
|
2013-08-27 07:57:52 +08:00
|
|
|
File::eOpenOptionRead | File::eOpenOptionWrite |
|
|
|
|
File::eOpenOptionAppend | File::eOpenOptionCanCreate,
|
|
|
|
perms, error);
|
|
|
|
if (error.Success()) {
|
|
|
|
result.AppendMessageWithFormat("File Descriptor = %" PRIu64 "\n", fd);
|
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
|
|
|
} else {
|
|
|
|
result.AppendError(error.AsCString());
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
result.AppendError("no platform currently selected\n");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
2013-11-21 05:07:01 +08:00
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
Options *GetOptions() override {
|
2016-02-23 03:02:01 +08:00
|
|
|
if (!m_options.DidFinalize()) {
|
2013-08-27 07:57:52 +08:00
|
|
|
m_options.Append(new OptionPermissions());
|
|
|
|
m_options.Finalize();
|
|
|
|
}
|
2013-11-21 05:07:01 +08:00
|
|
|
return &m_options;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
OptionGroupOptions m_options;
|
|
|
|
};
|
2011-04-12 13:54:46 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// "platform fclose"
|
|
|
|
class CommandObjectPlatformFClose : public CommandObjectParsed {
|
|
|
|
public:
|
|
|
|
CommandObjectPlatformFClose(CommandInterpreter &interpreter)
|
2016-02-23 03:02:01 +08:00
|
|
|
: CommandObjectParsed(interpreter, "platform file close",
|
|
|
|
"Close a file on the remote end.", nullptr, 0) {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformFClose() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2013-08-27 07:57:52 +08:00
|
|
|
PlatformSP platform_sp(
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2013-08-27 07:57:52 +08:00
|
|
|
if (platform_sp) {
|
|
|
|
std::string cmd_line;
|
|
|
|
args.GetCommandString(cmd_line);
|
2020-07-01 23:00:12 +08:00
|
|
|
lldb::user_id_t fd;
|
|
|
|
if (!llvm::to_integer(cmd_line, fd)) {
|
|
|
|
result.AppendErrorWithFormatv("'{0}' is not a valid file descriptor.\n",
|
|
|
|
cmd_line);
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
return result.Succeeded();
|
|
|
|
}
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error;
|
2013-08-27 07:57:52 +08:00
|
|
|
bool success = platform_sp->CloseFile(fd, error);
|
|
|
|
if (success) {
|
|
|
|
result.AppendMessageWithFormat("file %" PRIu64 " closed.\n", fd);
|
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
2011-04-12 13:54:46 +08:00
|
|
|
} else {
|
2013-08-27 07:57:52 +08:00
|
|
|
result.AppendError(error.AsCString());
|
2011-04-12 13:54:46 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
|
|
|
} else {
|
2013-08-27 07:57:52 +08:00
|
|
|
result.AppendError("no platform currently selected\n");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2011-04-12 13:54:46 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2011-04-12 13:54:46 +08:00
|
|
|
};
|
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// "platform fread"
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
|
2019-07-24 20:05:42 +08:00
|
|
|
#define LLDB_OPTIONS_platform_fread
|
|
|
|
#include "CommandOptions.inc"
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
class CommandObjectPlatformFRead : public CommandObjectParsed {
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
public:
|
2013-08-27 07:57:52 +08:00
|
|
|
CommandObjectPlatformFRead(CommandInterpreter &interpreter)
|
2016-02-23 03:02:01 +08:00
|
|
|
: CommandObjectParsed(interpreter, "platform file read",
|
|
|
|
"Read data from a file on the remote end.", nullptr,
|
|
|
|
0),
|
2016-08-12 07:51:28 +08:00
|
|
|
m_options() {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformFRead() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2016-08-12 07:51:28 +08:00
|
|
|
PlatformSP platform_sp(
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2013-08-27 07:57:52 +08:00
|
|
|
if (platform_sp) {
|
|
|
|
std::string cmd_line;
|
|
|
|
args.GetCommandString(cmd_line);
|
2020-07-01 23:00:12 +08:00
|
|
|
lldb::user_id_t fd;
|
|
|
|
if (!llvm::to_integer(cmd_line, fd)) {
|
|
|
|
result.AppendErrorWithFormatv("'{0}' is not a valid file descriptor.\n",
|
|
|
|
cmd_line);
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
return result.Succeeded();
|
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
std::string buffer(m_options.m_count, 0);
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error;
|
2013-08-27 07:57:52 +08:00
|
|
|
uint32_t retcode = platform_sp->ReadFile(
|
|
|
|
fd, m_options.m_offset, &buffer[0], m_options.m_count, error);
|
|
|
|
result.AppendMessageWithFormat("Return = %d\n", retcode);
|
|
|
|
result.AppendMessageWithFormat("Data = \"%s\"\n", buffer.c_str());
|
2013-11-21 05:07:01 +08:00
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
} else {
|
2013-08-27 07:57:52 +08:00
|
|
|
result.AppendError("no platform currently selected\n");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
|
|
|
Options *GetOptions() override { return &m_options; }
|
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
protected:
|
|
|
|
class CommandOptions : public Options {
|
2016-09-07 04:57:50 +08:00
|
|
|
public:
|
2013-08-27 07:57:52 +08:00
|
|
|
CommandOptions() : Options() {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
~CommandOptions() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
|
|
|
|
ExecutionContext *execution_context) override {
|
|
|
|
Status error;
|
2013-08-27 07:57:52 +08:00
|
|
|
char short_option = (char)m_getopt_table[option_idx].val;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
switch (short_option) {
|
|
|
|
case 'o':
|
2016-11-13 00:56:47 +08:00
|
|
|
if (option_arg.getAsInteger(0, m_offset))
|
|
|
|
error.SetErrorStringWithFormat("invalid offset: '%s'",
|
|
|
|
option_arg.str().c_str());
|
2013-08-27 07:57:52 +08:00
|
|
|
break;
|
|
|
|
case 'c':
|
2016-11-13 00:56:47 +08:00
|
|
|
if (option_arg.getAsInteger(0, m_count))
|
|
|
|
error.SetErrorStringWithFormat("invalid offset: '%s'",
|
|
|
|
option_arg.str().c_str());
|
2013-08-27 07:57:52 +08:00
|
|
|
break;
|
|
|
|
default:
|
2019-08-22 16:08:05 +08:00
|
|
|
llvm_unreachable("Unimplemented option");
|
2013-08-27 07:57:52 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
return error;
|
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
void OptionParsingStarting(ExecutionContext *execution_context) override {
|
2012-06-09 05:56:10 +08:00
|
|
|
m_offset = 0;
|
2013-08-27 07:57:52 +08:00
|
|
|
m_count = 1;
|
2012-06-09 05:56:10 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
|
2016-09-23 05:06:13 +08:00
|
|
|
return llvm::makeArrayRef(g_platform_fread_options);
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-08-12 07:51:28 +08:00
|
|
|
// Instance variables to hold the values for command options.
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
uint32_t m_offset;
|
|
|
|
uint32_t m_count;
|
|
|
|
};
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
CommandOptions m_options;
|
|
|
|
};
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// "platform fwrite"
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
|
2019-07-24 20:05:42 +08:00
|
|
|
#define LLDB_OPTIONS_platform_fwrite
|
|
|
|
#include "CommandOptions.inc"
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
class CommandObjectPlatformFWrite : public CommandObjectParsed {
|
|
|
|
public:
|
|
|
|
CommandObjectPlatformFWrite(CommandInterpreter &interpreter)
|
2016-02-23 03:02:01 +08:00
|
|
|
: CommandObjectParsed(interpreter, "platform file write",
|
|
|
|
"Write data to a file on the remote end.", nullptr,
|
|
|
|
0),
|
2016-08-12 07:51:28 +08:00
|
|
|
m_options() {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformFWrite() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2016-08-12 07:51:28 +08:00
|
|
|
PlatformSP platform_sp(
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2013-08-27 07:57:52 +08:00
|
|
|
if (platform_sp) {
|
|
|
|
std::string cmd_line;
|
|
|
|
args.GetCommandString(cmd_line);
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error;
|
2020-07-01 23:00:12 +08:00
|
|
|
lldb::user_id_t fd;
|
|
|
|
if (!llvm::to_integer(cmd_line, fd)) {
|
|
|
|
result.AppendErrorWithFormatv("'{0}' is not a valid file descriptor.",
|
|
|
|
cmd_line);
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
return result.Succeeded();
|
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
uint32_t retcode =
|
2011-04-12 13:54:46 +08:00
|
|
|
platform_sp->WriteFile(fd, m_options.m_offset, &m_options.m_data[0],
|
2013-08-27 07:57:52 +08:00
|
|
|
m_options.m_data.size(), error);
|
|
|
|
result.AppendMessageWithFormat("Return = %d\n", retcode);
|
2013-11-21 05:07:01 +08:00
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
2013-08-27 07:57:52 +08:00
|
|
|
} else {
|
|
|
|
result.AppendError("no platform currently selected\n");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
2011-04-12 13:54:46 +08:00
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
|
|
|
Options *GetOptions() override { return &m_options; }
|
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
protected:
|
|
|
|
class CommandOptions : public Options {
|
2016-09-07 04:57:50 +08:00
|
|
|
public:
|
2013-08-27 07:57:52 +08:00
|
|
|
CommandOptions() : Options() {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
~CommandOptions() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
|
|
|
|
ExecutionContext *execution_context) override {
|
|
|
|
Status error;
|
2015-01-16 04:08:35 +08:00
|
|
|
char short_option = (char)m_getopt_table[option_idx].val;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
switch (short_option) {
|
|
|
|
case 'o':
|
2016-11-13 00:56:47 +08:00
|
|
|
if (option_arg.getAsInteger(0, m_offset))
|
|
|
|
error.SetErrorStringWithFormat("invalid offset: '%s'",
|
|
|
|
option_arg.str().c_str());
|
2013-08-27 07:57:52 +08:00
|
|
|
break;
|
|
|
|
case 'd':
|
2020-01-29 03:23:46 +08:00
|
|
|
m_data.assign(std::string(option_arg));
|
2013-08-27 07:57:52 +08:00
|
|
|
break;
|
|
|
|
default:
|
2019-08-22 16:08:05 +08:00
|
|
|
llvm_unreachable("Unimplemented option");
|
2013-08-27 07:57:52 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
return error;
|
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
void OptionParsingStarting(ExecutionContext *execution_context) override {
|
2013-08-27 07:57:52 +08:00
|
|
|
m_offset = 0;
|
|
|
|
m_data.clear();
|
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
|
2016-09-23 05:06:13 +08:00
|
|
|
return llvm::makeArrayRef(g_platform_fwrite_options);
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-08-12 07:51:28 +08:00
|
|
|
// Instance variables to hold the values for command options.
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
uint32_t m_offset;
|
|
|
|
std::string m_data;
|
|
|
|
};
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
CommandOptions m_options;
|
|
|
|
};
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
class CommandObjectPlatformFile : public CommandObjectMultiword {
|
|
|
|
public:
|
|
|
|
// Constructors and Destructors
|
2016-07-15 06:03:10 +08:00
|
|
|
CommandObjectPlatformFile(CommandInterpreter &interpreter)
|
|
|
|
: CommandObjectMultiword(
|
|
|
|
interpreter, "platform file",
|
|
|
|
"Commands to access files on the current platform.",
|
|
|
|
"platform file [open|close|read|write] ...") {
|
2013-08-27 07:57:52 +08:00
|
|
|
LoadSubCommand(
|
|
|
|
"open", CommandObjectSP(new CommandObjectPlatformFOpen(interpreter)));
|
|
|
|
LoadSubCommand(
|
|
|
|
"close", CommandObjectSP(new CommandObjectPlatformFClose(interpreter)));
|
|
|
|
LoadSubCommand(
|
|
|
|
"read", CommandObjectSP(new CommandObjectPlatformFRead(interpreter)));
|
|
|
|
LoadSubCommand(
|
|
|
|
"write", CommandObjectSP(new CommandObjectPlatformFWrite(interpreter)));
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformFile() override = default;
|
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
private:
|
|
|
|
// For CommandObjectPlatform only
|
[lldb] NFC remove DISALLOW_COPY_AND_ASSIGN
Summary:
This is how I applied my clang-tidy check (see
https://reviews.llvm.org/D80531) in order to remove
`DISALLOW_COPY_AND_ASSIGN` and have deleted copy ctors and deleted
assignment operators instead.
```
lang=bash
grep DISALLOW_COPY_AND_ASSIGN /opt/notnfs/kkleine/llvm/lldb -r -l | sort | uniq > files
for i in $(cat files);
do
clang-tidy \
--checks="-*,modernize-replace-disallow-copy-and-assign-macro" \
--format-style=LLVM \
--header-filter=.* \
--fix \
-fix-errors \
$i;
done
```
Reviewers: espindola, labath, aprantl, teemperor
Reviewed By: labath, aprantl, teemperor
Subscribers: teemperor, aprantl, labath, emaste, sbc100, aheejin, MaskRay, arphaman, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D80543
2020-06-03 00:19:55 +08:00
|
|
|
CommandObjectPlatformFile(const CommandObjectPlatformFile &) = delete;
|
|
|
|
const CommandObjectPlatformFile &
|
|
|
|
operator=(const CommandObjectPlatformFile &) = delete;
|
2013-08-27 07:57:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// "platform get-file remote-file-path host-file-path"
|
|
|
|
class CommandObjectPlatformGetFile : public CommandObjectParsed {
|
|
|
|
public:
|
|
|
|
CommandObjectPlatformGetFile(CommandInterpreter &interpreter)
|
|
|
|
: CommandObjectParsed(
|
|
|
|
interpreter, "platform get-file",
|
|
|
|
"Transfer a file from the remote end to the local host.",
|
|
|
|
"platform get-file <remote-file-spec> <local-file-spec>", 0) {
|
|
|
|
SetHelpLong(
|
2015-07-14 13:48:36 +08:00
|
|
|
R"(Examples:
|
|
|
|
|
|
|
|
(lldb) platform get-file /the/remote/file/path /the/local/file/path
|
|
|
|
|
|
|
|
Transfer a file from the remote end with file path /the/remote/file/path to the local host.)");
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
CommandArgumentEntry arg1, arg2;
|
|
|
|
CommandArgumentData file_arg_remote, file_arg_host;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// Define the first (and only) variant of this arg.
|
|
|
|
file_arg_remote.arg_type = eArgTypeFilename;
|
|
|
|
file_arg_remote.arg_repetition = eArgRepeatPlain;
|
|
|
|
// There is only one variant this argument could be; put it into the
|
|
|
|
// argument entry.
|
|
|
|
arg1.push_back(file_arg_remote);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// Define the second (and only) variant of this arg.
|
|
|
|
file_arg_host.arg_type = eArgTypeFilename;
|
|
|
|
file_arg_host.arg_repetition = eArgRepeatPlain;
|
|
|
|
// There is only one variant this argument could be; put it into the
|
|
|
|
// argument entry.
|
|
|
|
arg2.push_back(file_arg_host);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2018-05-01 00:49:04 +08:00
|
|
|
// Push the data for the first and the second arguments into the
|
|
|
|
// m_arguments vector.
|
2013-08-27 07:57:52 +08:00
|
|
|
m_arguments.push_back(arg1);
|
|
|
|
m_arguments.push_back(arg2);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformGetFile() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2020-08-24 23:34:32 +08:00
|
|
|
void
|
|
|
|
HandleArgumentCompletion(CompletionRequest &request,
|
|
|
|
OptionElementVector &opt_element_vector) override {
|
|
|
|
if (request.GetCursorIndex() == 0)
|
|
|
|
CommandCompletions::InvokeCommonCompletionCallbacks(
|
|
|
|
GetCommandInterpreter(),
|
|
|
|
CommandCompletions::eRemoteDiskFileCompletion, request, nullptr);
|
|
|
|
else if (request.GetCursorIndex() == 1)
|
|
|
|
CommandCompletions::InvokeCommonCompletionCallbacks(
|
|
|
|
GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion,
|
|
|
|
request, nullptr);
|
|
|
|
}
|
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2013-08-27 07:57:52 +08:00
|
|
|
// If the number of arguments is incorrect, issue an error message.
|
|
|
|
if (args.GetArgumentCount() != 2) {
|
|
|
|
result.GetErrorStream().Printf("error: required arguments missing; "
|
|
|
|
"specify both the source and destination "
|
|
|
|
"file paths\n");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
return false;
|
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
|
|
|
PlatformSP platform_sp(
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2013-08-27 07:57:52 +08:00
|
|
|
if (platform_sp) {
|
|
|
|
const char *remote_file_path = args.GetArgumentAtIndex(0);
|
|
|
|
const char *local_file_path = args.GetArgumentAtIndex(1);
|
2018-11-02 05:05:36 +08:00
|
|
|
Status error = platform_sp->GetFile(FileSpec(remote_file_path),
|
|
|
|
FileSpec(local_file_path));
|
2013-08-27 07:57:52 +08:00
|
|
|
if (error.Success()) {
|
|
|
|
result.AppendMessageWithFormat(
|
|
|
|
"successfully get-file from %s (remote) to %s (host)\n",
|
|
|
|
remote_file_path, local_file_path);
|
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
|
|
|
} else {
|
|
|
|
result.AppendMessageWithFormat("get-file failed: %s\n",
|
|
|
|
error.AsCString());
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
result.AppendError("no platform currently selected\n");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// "platform get-size remote-file-path"
|
|
|
|
class CommandObjectPlatformGetSize : public CommandObjectParsed {
|
|
|
|
public:
|
|
|
|
CommandObjectPlatformGetSize(CommandInterpreter &interpreter)
|
|
|
|
: CommandObjectParsed(interpreter, "platform get-size",
|
|
|
|
"Get the file size from the remote end.",
|
|
|
|
"platform get-size <remote-file-spec>", 0) {
|
|
|
|
SetHelpLong(
|
2015-07-14 13:48:36 +08:00
|
|
|
R"(Examples:
|
|
|
|
|
|
|
|
(lldb) platform get-size /the/remote/file/path
|
|
|
|
|
|
|
|
Get the file size from the remote end with path /the/remote/file/path.)");
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
CommandArgumentEntry arg1;
|
2016-02-23 03:02:01 +08:00
|
|
|
CommandArgumentData file_arg_remote;
|
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// Define the first (and only) variant of this arg.
|
|
|
|
file_arg_remote.arg_type = eArgTypeFilename;
|
|
|
|
file_arg_remote.arg_repetition = eArgRepeatPlain;
|
|
|
|
// There is only one variant this argument could be; put it into the
|
|
|
|
// argument entry.
|
|
|
|
arg1.push_back(file_arg_remote);
|
|
|
|
|
|
|
|
// Push the data for the first argument into the m_arguments vector.
|
|
|
|
m_arguments.push_back(arg1);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
~CommandObjectPlatformGetSize() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2020-08-24 23:34:32 +08:00
|
|
|
void
|
|
|
|
HandleArgumentCompletion(CompletionRequest &request,
|
|
|
|
OptionElementVector &opt_element_vector) override {
|
|
|
|
if (request.GetCursorIndex() != 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
CommandCompletions::InvokeCommonCompletionCallbacks(
|
|
|
|
GetCommandInterpreter(), CommandCompletions::eRemoteDiskFileCompletion,
|
|
|
|
request, nullptr);
|
|
|
|
}
|
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
|
|
|
// If the number of arguments is incorrect, issue an error message.
|
2015-06-18 13:27:05 +08:00
|
|
|
if (args.GetArgumentCount() != 1) {
|
|
|
|
result.GetErrorStream().Printf("error: required argument missing; "
|
|
|
|
"specify the source file path as the only "
|
2013-08-27 07:57:52 +08:00
|
|
|
"argument\n");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
return false;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-08-12 07:51:28 +08:00
|
|
|
PlatformSP platform_sp(
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2013-08-27 07:57:52 +08:00
|
|
|
if (platform_sp) {
|
|
|
|
std::string remote_file_path(args.GetArgumentAtIndex(0));
|
2018-11-02 05:05:36 +08:00
|
|
|
user_id_t size = platform_sp->GetFileSize(FileSpec(remote_file_path));
|
2013-08-27 07:57:52 +08:00
|
|
|
if (size != UINT64_MAX) {
|
|
|
|
result.AppendMessageWithFormat("File size of %s (remote): %" PRIu64
|
2016-09-07 04:57:50 +08:00
|
|
|
"\n",
|
2013-08-27 07:57:52 +08:00
|
|
|
remote_file_path.c_str(), size);
|
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
2016-09-07 04:57:50 +08:00
|
|
|
} else {
|
2011-04-12 13:54:46 +08:00
|
|
|
result.AppendMessageWithFormat(
|
2015-06-18 13:27:05 +08:00
|
|
|
"Error getting file size of %s (remote)\n",
|
2013-08-27 07:57:52 +08:00
|
|
|
remote_file_path.c_str());
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
} else {
|
2013-08-27 07:57:52 +08:00
|
|
|
result.AppendError("no platform currently selected\n");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// "platform put-file"
|
|
|
|
class CommandObjectPlatformPutFile : public CommandObjectParsed {
|
|
|
|
public:
|
|
|
|
CommandObjectPlatformPutFile(CommandInterpreter &interpreter)
|
2016-02-23 03:02:01 +08:00
|
|
|
: CommandObjectParsed(
|
|
|
|
interpreter, "platform put-file",
|
|
|
|
"Transfer a file from this system to the remote end.", nullptr, 0) {
|
2013-08-27 07:57:52 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformPutFile() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2020-08-24 23:34:32 +08:00
|
|
|
void
|
|
|
|
HandleArgumentCompletion(CompletionRequest &request,
|
|
|
|
OptionElementVector &opt_element_vector) override {
|
|
|
|
if (request.GetCursorIndex() == 0)
|
|
|
|
CommandCompletions::InvokeCommonCompletionCallbacks(
|
|
|
|
GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion,
|
|
|
|
request, nullptr);
|
|
|
|
else if (request.GetCursorIndex() == 1)
|
|
|
|
CommandCompletions::InvokeCommonCompletionCallbacks(
|
|
|
|
GetCommandInterpreter(),
|
|
|
|
CommandCompletions::eRemoteDiskFileCompletion, request, nullptr);
|
|
|
|
}
|
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2013-08-27 07:57:52 +08:00
|
|
|
const char *src = args.GetArgumentAtIndex(0);
|
|
|
|
const char *dst = args.GetArgumentAtIndex(1);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2018-11-02 05:05:36 +08:00
|
|
|
FileSpec src_fs(src);
|
|
|
|
FileSystem::Instance().Resolve(src_fs);
|
|
|
|
FileSpec dst_fs(dst ? dst : src_fs.GetFilename().GetCString());
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
PlatformSP platform_sp(
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2013-08-27 07:57:52 +08:00
|
|
|
if (platform_sp) {
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error(platform_sp->PutFile(src_fs, dst_fs));
|
2013-08-27 07:57:52 +08:00
|
|
|
if (error.Success()) {
|
|
|
|
result.SetStatus(eReturnStatusSuccessFinishNoResult);
|
|
|
|
} else {
|
|
|
|
result.AppendError(error.AsCString());
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
result.AppendError("no platform currently selected\n");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// "platform process launch"
|
|
|
|
class CommandObjectPlatformProcessLaunch : public CommandObjectParsed {
|
|
|
|
public:
|
|
|
|
CommandObjectPlatformProcessLaunch(CommandInterpreter &interpreter)
|
|
|
|
: CommandObjectParsed(interpreter, "platform process launch",
|
|
|
|
"Launch a new process on a remote platform.",
|
|
|
|
"platform process launch program",
|
2015-05-27 13:04:35 +08:00
|
|
|
eCommandRequiresTarget | eCommandTryTargetAPILock),
|
2021-03-24 00:22:07 +08:00
|
|
|
m_options(), m_all_options() {
|
|
|
|
m_all_options.Append(&m_options);
|
|
|
|
m_all_options.Finalize();
|
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
|
|
|
~CommandObjectPlatformProcessLaunch() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2021-03-24 00:22:07 +08:00
|
|
|
Options *GetOptions() override { return &m_all_options; }
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
protected:
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2019-04-27 14:19:42 +08:00
|
|
|
Target *target = GetDebugger().GetSelectedTarget().get();
|
2013-08-27 07:57:52 +08:00
|
|
|
PlatformSP platform_sp;
|
|
|
|
if (target) {
|
|
|
|
platform_sp = target->GetPlatform();
|
|
|
|
}
|
|
|
|
if (!platform_sp) {
|
2019-04-27 14:19:42 +08:00
|
|
|
platform_sp = GetDebugger().GetPlatformList().GetSelectedPlatform();
|
2013-08-27 07:57:52 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
if (platform_sp) {
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error;
|
2013-08-27 07:57:52 +08:00
|
|
|
const size_t argc = args.GetArgumentCount();
|
|
|
|
Target *target = m_exe_ctx.GetTargetPtr();
|
|
|
|
Module *exe_module = target->GetExecutableModulePointer();
|
|
|
|
if (exe_module) {
|
|
|
|
m_options.launch_info.GetExecutableFile() = exe_module->GetFileSpec();
|
2018-12-11 01:23:28 +08:00
|
|
|
llvm::SmallString<128> exe_path;
|
2016-09-20 01:54:06 +08:00
|
|
|
m_options.launch_info.GetExecutableFile().GetPath(exe_path);
|
|
|
|
if (!exe_path.empty())
|
2013-08-27 07:57:52 +08:00
|
|
|
m_options.launch_info.GetArguments().AppendArgument(exe_path);
|
|
|
|
m_options.launch_info.GetArchitecture() = exe_module->GetArchitecture();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
if (argc > 0) {
|
|
|
|
if (m_options.launch_info.GetExecutableFile()) {
|
2018-05-01 00:49:04 +08:00
|
|
|
// We already have an executable file, so we will use this and all
|
|
|
|
// arguments to this function are extra arguments
|
2013-08-27 07:57:52 +08:00
|
|
|
m_options.launch_info.GetArguments().AppendArguments(args);
|
2016-09-07 04:57:50 +08:00
|
|
|
} else {
|
2013-08-27 07:57:52 +08:00
|
|
|
// We don't have any file yet, so the first argument is our
|
|
|
|
// executable, and the rest are program arguments
|
|
|
|
const bool first_arg_is_executable = true;
|
|
|
|
m_options.launch_info.SetArguments(args, first_arg_is_executable);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
if (m_options.launch_info.GetExecutableFile()) {
|
2019-04-27 14:19:42 +08:00
|
|
|
Debugger &debugger = GetDebugger();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
if (argc == 0)
|
|
|
|
target->GetRunArguments(m_options.launch_info.GetArguments());
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
ProcessSP process_sp(platform_sp->DebugProcess(
|
|
|
|
m_options.launch_info, debugger, target, error));
|
|
|
|
if (process_sp && process_sp->IsAlive()) {
|
|
|
|
result.SetStatus(eReturnStatusSuccessFinishNoResult);
|
|
|
|
return true;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
if (error.Success())
|
|
|
|
result.AppendError("process launch failed");
|
|
|
|
else
|
2012-04-14 09:42:46 +08:00
|
|
|
result.AppendError(error.AsCString());
|
2013-08-27 07:57:52 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
} else {
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
result.AppendError("'platform process launch' uses the current target "
|
2013-08-27 07:57:52 +08:00
|
|
|
"file and arguments, or the executable and its "
|
|
|
|
"arguments can be specified in this command");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
} else {
|
2013-08-27 07:57:52 +08:00
|
|
|
result.AppendError("no platform is selected\n");
|
|
|
|
}
|
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2021-01-21 01:33:00 +08:00
|
|
|
CommandOptionsProcessLaunch m_options;
|
2021-03-24 00:22:07 +08:00
|
|
|
OptionGroupOptions m_all_options;
|
2013-08-27 07:57:52 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
// "platform process list"
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
|
2019-07-26 19:46:21 +08:00
|
|
|
static PosixPlatformCommandOptionValidator posix_validator;
|
2019-07-24 20:05:42 +08:00
|
|
|
#define LLDB_OPTIONS_platform_process_list
|
|
|
|
#include "CommandOptions.inc"
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
class CommandObjectPlatformProcessList : public CommandObjectParsed {
|
|
|
|
public:
|
|
|
|
CommandObjectPlatformProcessList(CommandInterpreter &interpreter)
|
|
|
|
: CommandObjectParsed(interpreter, "platform process list",
|
|
|
|
"List processes on a remote platform by name, pid, "
|
|
|
|
"or many other matching attributes.",
|
|
|
|
"platform process list", 0),
|
2016-08-12 07:51:28 +08:00
|
|
|
m_options() {}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
|
|
|
~CommandObjectPlatformProcessList() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-08-27 07:28:47 +08:00
|
|
|
Options *GetOptions() override { return &m_options; }
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
protected:
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2019-04-27 14:19:42 +08:00
|
|
|
Target *target = GetDebugger().GetSelectedTarget().get();
|
2013-08-27 07:57:52 +08:00
|
|
|
PlatformSP platform_sp;
|
|
|
|
if (target) {
|
|
|
|
platform_sp = target->GetPlatform();
|
|
|
|
}
|
|
|
|
if (!platform_sp) {
|
2019-04-27 14:19:42 +08:00
|
|
|
platform_sp = GetDebugger().GetPlatformList().GetSelectedPlatform();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2011-04-12 13:54:46 +08:00
|
|
|
if (platform_sp) {
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error;
|
2011-04-12 13:54:46 +08:00
|
|
|
if (args.GetArgumentCount() == 0) {
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
if (platform_sp) {
|
|
|
|
Stream &ostrm = result.GetOutputStream();
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
lldb::pid_t pid =
|
2011-04-12 13:54:46 +08:00
|
|
|
m_options.match_info.GetProcessInfo().GetProcessID();
|
|
|
|
if (pid != LLDB_INVALID_PROCESS_ID) {
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
ProcessInstanceInfo proc_info;
|
2013-05-11 05:47:16 +08:00
|
|
|
if (platform_sp->GetProcessInfo(pid, proc_info)) {
|
2019-03-05 02:48:00 +08:00
|
|
|
ProcessInstanceInfo::DumpTableHeader(ostrm, m_options.show_args,
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
m_options.verbose);
|
2019-03-05 02:48:00 +08:00
|
|
|
proc_info.DumpAsTableRow(ostrm, platform_sp->GetUserIDResolver(),
|
2011-04-12 13:54:46 +08:00
|
|
|
m_options.show_args, m_options.verbose);
|
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
2016-09-07 04:57:50 +08:00
|
|
|
} else {
|
2011-04-12 13:54:46 +08:00
|
|
|
result.AppendErrorWithFormat(
|
|
|
|
"no process found with pid = %" PRIu64 "\n", pid);
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
}
|
|
|
|
} else {
|
|
|
|
ProcessInstanceInfoList proc_infos;
|
|
|
|
const uint32_t matches =
|
|
|
|
platform_sp->FindProcesses(m_options.match_info, proc_infos);
|
|
|
|
const char *match_desc = nullptr;
|
|
|
|
const char *match_name =
|
|
|
|
m_options.match_info.GetProcessInfo().GetName();
|
|
|
|
if (match_name && match_name[0]) {
|
2011-04-12 13:54:46 +08:00
|
|
|
switch (m_options.match_info.GetNameMatchType()) {
|
2017-02-20 19:35:33 +08:00
|
|
|
case NameMatch::Ignore:
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2017-02-20 19:35:33 +08:00
|
|
|
case NameMatch::Equals:
|
2011-04-12 13:54:46 +08:00
|
|
|
match_desc = "matched";
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2017-02-20 19:35:33 +08:00
|
|
|
case NameMatch::Contains:
|
2011-04-12 13:54:46 +08:00
|
|
|
match_desc = "contained";
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2017-02-20 19:35:33 +08:00
|
|
|
case NameMatch::StartsWith:
|
2011-04-12 13:54:46 +08:00
|
|
|
match_desc = "started with";
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2017-02-20 19:35:33 +08:00
|
|
|
case NameMatch::EndsWith:
|
2011-04-12 13:54:46 +08:00
|
|
|
match_desc = "ended with";
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2017-02-20 19:35:33 +08:00
|
|
|
case NameMatch::RegularExpression:
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
match_desc = "matched the regular expression";
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
}
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
|
|
|
if (matches == 0) {
|
2015-01-16 04:08:35 +08:00
|
|
|
if (match_desc)
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
result.AppendErrorWithFormat(
|
|
|
|
"no processes were found that %s \"%s\" on the \"%s\" "
|
|
|
|
"platform\n",
|
2015-01-16 04:08:35 +08:00
|
|
|
match_desc, match_name,
|
|
|
|
platform_sp->GetPluginName().GetCString());
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
else
|
|
|
|
result.AppendErrorWithFormat(
|
2015-01-16 04:08:35 +08:00
|
|
|
"no processes were found on the \"%s\" platform\n",
|
|
|
|
platform_sp->GetPluginName().GetCString());
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
} else {
|
|
|
|
result.AppendMessageWithFormat(
|
2015-01-16 04:08:35 +08:00
|
|
|
"%u matching process%s found on \"%s\"", matches,
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
matches > 1 ? "es were" : " was",
|
2016-08-12 07:51:28 +08:00
|
|
|
platform_sp->GetName().GetCString());
|
2011-11-15 11:53:30 +08:00
|
|
|
if (match_desc)
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
result.AppendMessageWithFormat(" whose name %s \"%s\"",
|
|
|
|
match_desc, match_name);
|
2011-11-15 11:53:30 +08:00
|
|
|
result.AppendMessageWithFormat("\n");
|
2019-03-05 02:48:00 +08:00
|
|
|
ProcessInstanceInfo::DumpTableHeader(ostrm, m_options.show_args,
|
2011-11-15 11:53:30 +08:00
|
|
|
m_options.verbose);
|
|
|
|
for (uint32_t i = 0; i < matches; ++i) {
|
2020-03-13 05:10:25 +08:00
|
|
|
proc_infos[i].DumpAsTableRow(
|
2019-03-05 02:48:00 +08:00
|
|
|
ostrm, platform_sp->GetUserIDResolver(),
|
|
|
|
m_options.show_args, m_options.verbose);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
2013-08-27 07:57:52 +08:00
|
|
|
result.AppendError("invalid args: process list takes only options\n");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
} else {
|
|
|
|
result.AppendError("no platform is selected\n");
|
2013-08-27 07:57:52 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
return result.Succeeded();
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-08-12 07:51:28 +08:00
|
|
|
class CommandOptions : public Options {
|
2016-09-07 04:57:50 +08:00
|
|
|
public:
|
2016-08-12 07:51:28 +08:00
|
|
|
CommandOptions()
|
2019-10-31 06:26:19 +08:00
|
|
|
: Options(), match_info(), show_args(false), verbose(false) {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandOptions() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
|
|
|
|
ExecutionContext *execution_context) override {
|
|
|
|
Status error;
|
2012-12-04 08:32:51 +08:00
|
|
|
const int short_option = m_getopt_table[option_idx].val;
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
bool success = false;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-11-13 00:56:47 +08:00
|
|
|
uint32_t id = LLDB_INVALID_PROCESS_ID;
|
|
|
|
success = !option_arg.getAsInteger(0, id);
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
switch (short_option) {
|
2016-11-13 00:56:47 +08:00
|
|
|
case 'p': {
|
|
|
|
match_info.GetProcessInfo().SetProcessID(id);
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
if (!success)
|
2016-08-12 07:51:28 +08:00
|
|
|
error.SetErrorStringWithFormat("invalid process ID string: '%s'",
|
2016-11-13 00:56:47 +08:00
|
|
|
option_arg.str().c_str());
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
break;
|
2016-11-13 00:56:47 +08:00
|
|
|
}
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
case 'P':
|
2016-11-13 00:56:47 +08:00
|
|
|
match_info.GetProcessInfo().SetParentProcessID(id);
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
if (!success)
|
|
|
|
error.SetErrorStringWithFormat(
|
2016-11-13 00:56:47 +08:00
|
|
|
"invalid parent process ID string: '%s'",
|
|
|
|
option_arg.str().c_str());
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
2016-03-25 05:49:22 +08:00
|
|
|
case 'u':
|
2016-11-13 00:56:47 +08:00
|
|
|
match_info.GetProcessInfo().SetUserID(success ? id : UINT32_MAX);
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
if (!success)
|
|
|
|
error.SetErrorStringWithFormat("invalid user ID string: '%s'",
|
2016-11-13 00:56:47 +08:00
|
|
|
option_arg.str().c_str());
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
2016-03-25 05:49:22 +08:00
|
|
|
case 'U':
|
2016-11-13 00:56:47 +08:00
|
|
|
match_info.GetProcessInfo().SetEffectiveUserID(success ? id
|
|
|
|
: UINT32_MAX);
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
if (!success)
|
|
|
|
error.SetErrorStringWithFormat(
|
2016-11-13 00:56:47 +08:00
|
|
|
"invalid effective user ID string: '%s'",
|
|
|
|
option_arg.str().c_str());
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
2016-03-25 05:49:22 +08:00
|
|
|
case 'g':
|
2016-11-13 00:56:47 +08:00
|
|
|
match_info.GetProcessInfo().SetGroupID(success ? id : UINT32_MAX);
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
if (!success)
|
|
|
|
error.SetErrorStringWithFormat("invalid group ID string: '%s'",
|
2016-11-13 00:56:47 +08:00
|
|
|
option_arg.str().c_str());
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
2016-03-25 05:49:22 +08:00
|
|
|
case 'G':
|
2016-11-13 00:56:47 +08:00
|
|
|
match_info.GetProcessInfo().SetEffectiveGroupID(success ? id
|
|
|
|
: UINT32_MAX);
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
if (!success)
|
|
|
|
error.SetErrorStringWithFormat(
|
2016-11-13 00:56:47 +08:00
|
|
|
"invalid effective group ID string: '%s'",
|
|
|
|
option_arg.str().c_str());
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
case 'a': {
|
2016-08-12 07:51:28 +08:00
|
|
|
TargetSP target_sp =
|
|
|
|
execution_context ? execution_context->GetTargetSP() : TargetSP();
|
|
|
|
DebuggerSP debugger_sp =
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
target_sp ? target_sp->GetDebugger().shared_from_this()
|
2016-08-12 07:51:28 +08:00
|
|
|
: DebuggerSP();
|
|
|
|
PlatformSP platform_sp =
|
2013-08-27 07:57:52 +08:00
|
|
|
debugger_sp ? debugger_sp->GetPlatformList().GetSelectedPlatform()
|
2016-08-12 07:51:28 +08:00
|
|
|
: PlatformSP();
|
2017-10-31 18:56:03 +08:00
|
|
|
match_info.GetProcessInfo().GetArchitecture() =
|
|
|
|
Platform::GetAugmentedArchSpec(platform_sp.get(), option_arg);
|
2016-09-07 04:57:50 +08:00
|
|
|
} break;
|
|
|
|
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
case 'n':
|
2018-06-14 06:08:14 +08:00
|
|
|
match_info.GetProcessInfo().GetExecutableFile().SetFile(
|
2018-11-02 05:05:36 +08:00
|
|
|
option_arg, FileSpec::Style::native);
|
2017-02-20 19:35:33 +08:00
|
|
|
match_info.SetNameMatchType(NameMatch::Equals);
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
2011-04-12 13:54:46 +08:00
|
|
|
case 'e':
|
2018-06-14 06:08:14 +08:00
|
|
|
match_info.GetProcessInfo().GetExecutableFile().SetFile(
|
2018-11-02 05:05:36 +08:00
|
|
|
option_arg, FileSpec::Style::native);
|
2017-02-20 19:35:33 +08:00
|
|
|
match_info.SetNameMatchType(NameMatch::EndsWith);
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
case 's':
|
2018-06-14 06:08:14 +08:00
|
|
|
match_info.GetProcessInfo().GetExecutableFile().SetFile(
|
2018-11-02 05:05:36 +08:00
|
|
|
option_arg, FileSpec::Style::native);
|
2017-02-20 19:35:33 +08:00
|
|
|
match_info.SetNameMatchType(NameMatch::StartsWith);
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
case 'c':
|
2018-06-14 06:08:14 +08:00
|
|
|
match_info.GetProcessInfo().GetExecutableFile().SetFile(
|
2018-11-02 05:05:36 +08:00
|
|
|
option_arg, FileSpec::Style::native);
|
2017-02-20 19:35:33 +08:00
|
|
|
match_info.SetNameMatchType(NameMatch::Contains);
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
case 'r':
|
2018-06-14 06:08:14 +08:00
|
|
|
match_info.GetProcessInfo().GetExecutableFile().SetFile(
|
2018-11-02 05:05:36 +08:00
|
|
|
option_arg, FileSpec::Style::native);
|
2017-02-20 19:35:33 +08:00
|
|
|
match_info.SetNameMatchType(NameMatch::RegularExpression);
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
case 'A':
|
|
|
|
show_args = true;
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
2011-04-12 13:54:46 +08:00
|
|
|
case 'v':
|
|
|
|
verbose = true;
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
2019-10-12 10:36:16 +08:00
|
|
|
case 'x':
|
|
|
|
match_info.SetMatchAllUsers(true);
|
|
|
|
break;
|
|
|
|
|
2016-09-07 04:57:50 +08:00
|
|
|
default:
|
2019-08-22 16:08:05 +08:00
|
|
|
llvm_unreachable("Unimplemented option");
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
return error;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2016-08-12 07:51:28 +08:00
|
|
|
void OptionParsingStarting(ExecutionContext *execution_context) override {
|
2013-08-27 07:57:52 +08:00
|
|
|
match_info.Clear();
|
2011-04-12 13:54:46 +08:00
|
|
|
show_args = false;
|
2016-08-27 07:28:47 +08:00
|
|
|
verbose = false;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
|
2016-09-23 05:06:13 +08:00
|
|
|
return llvm::makeArrayRef(g_platform_process_list_options);
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
// Instance variables to hold the values for command options.
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2011-04-12 13:54:46 +08:00
|
|
|
ProcessInstanceInfoMatch match_info;
|
|
|
|
bool show_args;
|
|
|
|
bool verbose;
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
};
|
2016-09-07 04:57:50 +08:00
|
|
|
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
CommandOptions m_options;
|
|
|
|
};
|
|
|
|
|
2011-04-01 08:29:43 +08:00
|
|
|
// "platform process info"
|
2012-06-09 05:56:10 +08:00
|
|
|
class CommandObjectPlatformProcessInfo : public CommandObjectParsed {
|
2011-04-01 08:29:43 +08:00
|
|
|
public:
|
|
|
|
CommandObjectPlatformProcessInfo(CommandInterpreter &interpreter)
|
2012-06-09 05:56:10 +08:00
|
|
|
: CommandObjectParsed(
|
|
|
|
interpreter, "platform process info",
|
|
|
|
"Get detailed information for one or more process by process ID.",
|
|
|
|
"platform process info <pid> [<pid> <pid> ...]", 0) {
|
2011-04-01 08:29:43 +08:00
|
|
|
CommandArgumentEntry arg;
|
|
|
|
CommandArgumentData pid_args;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// Define the first (and only) variant of this arg.
|
|
|
|
pid_args.arg_type = eArgTypePid;
|
|
|
|
pid_args.arg_repetition = eArgRepeatStar;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// There is only one variant this argument could be; put it into the
|
|
|
|
// argument entry.
|
|
|
|
arg.push_back(pid_args);
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// Push the data for the first argument into the m_arguments vector.
|
|
|
|
m_arguments.push_back(arg);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformProcessInfo() override = default;
|
|
|
|
|
2020-08-24 20:23:23 +08:00
|
|
|
void
|
|
|
|
HandleArgumentCompletion(CompletionRequest &request,
|
|
|
|
OptionElementVector &opt_element_vector) override {
|
|
|
|
CommandCompletions::InvokeCommonCompletionCallbacks(
|
|
|
|
GetCommandInterpreter(), CommandCompletions::eProcessIDCompletion,
|
|
|
|
request, nullptr);
|
|
|
|
}
|
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
protected:
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2019-04-27 14:19:42 +08:00
|
|
|
Target *target = GetDebugger().GetSelectedTarget().get();
|
2013-08-27 07:57:52 +08:00
|
|
|
PlatformSP platform_sp;
|
|
|
|
if (target) {
|
|
|
|
platform_sp = target->GetPlatform();
|
|
|
|
}
|
|
|
|
if (!platform_sp) {
|
2019-04-27 14:19:42 +08:00
|
|
|
platform_sp = GetDebugger().GetPlatformList().GetSelectedPlatform();
|
2013-08-27 07:57:52 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
if (platform_sp) {
|
|
|
|
const size_t argc = args.GetArgumentCount();
|
|
|
|
if (argc > 0) {
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
if (platform_sp->IsConnected()) {
|
|
|
|
Stream &ostrm = result.GetOutputStream();
|
2016-10-06 07:40:23 +08:00
|
|
|
for (auto &entry : args.entries()) {
|
|
|
|
lldb::pid_t pid;
|
2019-09-13 19:26:48 +08:00
|
|
|
if (entry.ref().getAsInteger(0, pid)) {
|
2016-10-06 07:40:23 +08:00
|
|
|
result.AppendErrorWithFormat("invalid process ID argument '%s'",
|
2019-09-13 19:26:48 +08:00
|
|
|
entry.ref().str().c_str());
|
2016-10-06 07:40:23 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
break;
|
|
|
|
} else {
|
2013-08-27 07:57:52 +08:00
|
|
|
ProcessInstanceInfo proc_info;
|
|
|
|
if (platform_sp->GetProcessInfo(pid, proc_info)) {
|
|
|
|
ostrm.Printf("Process information for process %" PRIu64 ":\n",
|
|
|
|
pid);
|
2019-03-05 02:48:00 +08:00
|
|
|
proc_info.Dump(ostrm, platform_sp->GetUserIDResolver());
|
2013-08-27 07:57:52 +08:00
|
|
|
} else {
|
|
|
|
ostrm.Printf("error: no process information is available for "
|
|
|
|
"process %" PRIu64 "\n",
|
|
|
|
pid);
|
|
|
|
}
|
|
|
|
ostrm.EOL();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// Not connected...
|
2013-11-21 05:07:01 +08:00
|
|
|
result.AppendErrorWithFormat(
|
2013-08-27 07:57:52 +08:00
|
|
|
"not connected to '%s'",
|
2013-05-11 05:47:16 +08:00
|
|
|
platform_sp->GetPluginName().GetCString());
|
2013-08-27 07:57:52 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
} else {
|
2016-09-07 04:57:50 +08:00
|
|
|
// No args
|
2013-08-27 07:57:52 +08:00
|
|
|
result.AppendError("one or more process id(s) must be specified");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
} else {
|
2013-08-27 07:57:52 +08:00
|
|
|
result.AppendError("no platform is currently selected");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
};
|
|
|
|
|
2019-07-24 20:05:42 +08:00
|
|
|
#define LLDB_OPTIONS_platform_process_attach
|
|
|
|
#include "CommandOptions.inc"
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
class CommandObjectPlatformProcessAttach : public CommandObjectParsed {
|
|
|
|
public:
|
|
|
|
class CommandOptions : public Options {
|
|
|
|
public:
|
2016-08-12 07:51:28 +08:00
|
|
|
CommandOptions() : Options() {
|
2013-08-27 07:57:52 +08:00
|
|
|
// Keep default values of all options in one place: OptionParsingStarting
|
|
|
|
// ()
|
2016-08-12 07:51:28 +08:00
|
|
|
OptionParsingStarting(nullptr);
|
2013-08-27 07:57:52 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
|
|
|
~CommandOptions() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
|
|
|
|
ExecutionContext *execution_context) override {
|
|
|
|
Status error;
|
2015-01-16 04:08:35 +08:00
|
|
|
char short_option = (char)m_getopt_table[option_idx].val;
|
2013-08-27 07:57:52 +08:00
|
|
|
switch (short_option) {
|
|
|
|
case 'p': {
|
2016-11-13 00:56:47 +08:00
|
|
|
lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
|
|
|
|
if (option_arg.getAsInteger(0, pid)) {
|
|
|
|
error.SetErrorStringWithFormat("invalid process ID '%s'",
|
|
|
|
option_arg.str().c_str());
|
2013-08-27 07:57:52 +08:00
|
|
|
} else {
|
|
|
|
attach_info.SetProcessID(pid);
|
|
|
|
}
|
2015-10-08 00:56:17 +08:00
|
|
|
} break;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
case 'P':
|
|
|
|
attach_info.SetProcessPluginName(option_arg);
|
|
|
|
break;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
case 'n':
|
2018-11-02 05:05:36 +08:00
|
|
|
attach_info.GetExecutableFile().SetFile(option_arg,
|
2018-06-14 06:08:14 +08:00
|
|
|
FileSpec::Style::native);
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
case 'w':
|
|
|
|
attach_info.SetWaitForLaunch(true);
|
|
|
|
break;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
default:
|
2019-08-22 16:08:05 +08:00
|
|
|
llvm_unreachable("Unimplemented option");
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
return error;
|
2011-04-01 08:29:43 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
|
|
|
void OptionParsingStarting(ExecutionContext *execution_context) override {
|
|
|
|
attach_info.Clear();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
|
2016-09-23 05:06:13 +08:00
|
|
|
return llvm::makeArrayRef(g_platform_process_attach_options);
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// Options table: Required for subclasses of Options.
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
static OptionDefinition g_option_table[];
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
// Instance variables to hold the values for command options.
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
ProcessAttachInfo attach_info;
|
2016-09-07 04:57:50 +08:00
|
|
|
};
|
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
CommandObjectPlatformProcessAttach(CommandInterpreter &interpreter)
|
2016-07-15 06:03:10 +08:00
|
|
|
: CommandObjectParsed(interpreter, "platform process attach",
|
2013-08-27 07:57:52 +08:00
|
|
|
"Attach to a process.",
|
|
|
|
"platform process attach <cmd-options>"),
|
2016-08-12 07:51:28 +08:00
|
|
|
m_options() {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
~CommandObjectPlatformProcessAttach() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
bool DoExecute(Args &command, CommandReturnObject &result) override {
|
2016-08-12 07:51:28 +08:00
|
|
|
PlatformSP platform_sp(
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2013-08-27 07:57:52 +08:00
|
|
|
if (platform_sp) {
|
2017-05-12 12:51:55 +08:00
|
|
|
Status err;
|
2013-08-27 07:57:52 +08:00
|
|
|
ProcessSP remote_process_sp = platform_sp->Attach(
|
2019-04-27 14:19:42 +08:00
|
|
|
m_options.attach_info, GetDebugger(), nullptr, err);
|
2012-04-14 09:42:46 +08:00
|
|
|
if (err.Fail()) {
|
|
|
|
result.AppendError(err.AsCString());
|
2013-08-27 07:57:52 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2016-02-23 03:02:01 +08:00
|
|
|
} else if (!remote_process_sp) {
|
2013-08-27 07:57:52 +08:00
|
|
|
result.AppendError("could not attach: unknown reason");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
2016-09-07 04:57:50 +08:00
|
|
|
} else
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
2016-09-07 04:57:50 +08:00
|
|
|
} else {
|
2011-04-01 08:29:43 +08:00
|
|
|
result.AppendError("no platform is currently selected");
|
2013-08-27 07:57:52 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2016-08-27 07:28:47 +08:00
|
|
|
Options *GetOptions() override { return &m_options; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
protected:
|
|
|
|
CommandOptions m_options;
|
2011-04-01 08:29:43 +08:00
|
|
|
};
|
|
|
|
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
class CommandObjectPlatformProcess : public CommandObjectMultiword {
|
|
|
|
public:
|
|
|
|
// Constructors and Destructors
|
2016-07-15 06:03:10 +08:00
|
|
|
CommandObjectPlatformProcess(CommandInterpreter &interpreter)
|
|
|
|
: CommandObjectMultiword(interpreter, "platform process",
|
|
|
|
"Commands to query, launch and attach to "
|
|
|
|
"processes on the current platform.",
|
|
|
|
"platform process [attach|launch|list] ...") {
|
2013-08-27 07:57:52 +08:00
|
|
|
LoadSubCommand(
|
|
|
|
"attach",
|
|
|
|
CommandObjectSP(new CommandObjectPlatformProcessAttach(interpreter)));
|
2011-04-12 13:54:46 +08:00
|
|
|
LoadSubCommand(
|
|
|
|
"launch",
|
|
|
|
CommandObjectSP(new CommandObjectPlatformProcessLaunch(interpreter)));
|
2011-04-01 08:29:43 +08:00
|
|
|
LoadSubCommand("info", CommandObjectSP(new CommandObjectPlatformProcessInfo(
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
interpreter)));
|
|
|
|
LoadSubCommand("list", CommandObjectSP(new CommandObjectPlatformProcessList(
|
2011-04-01 08:29:43 +08:00
|
|
|
interpreter)));
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformProcess() override = default;
|
|
|
|
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
private:
|
|
|
|
// For CommandObjectPlatform only
|
[lldb] NFC remove DISALLOW_COPY_AND_ASSIGN
Summary:
This is how I applied my clang-tidy check (see
https://reviews.llvm.org/D80531) in order to remove
`DISALLOW_COPY_AND_ASSIGN` and have deleted copy ctors and deleted
assignment operators instead.
```
lang=bash
grep DISALLOW_COPY_AND_ASSIGN /opt/notnfs/kkleine/llvm/lldb -r -l | sort | uniq > files
for i in $(cat files);
do
clang-tidy \
--checks="-*,modernize-replace-disallow-copy-and-assign-macro" \
--format-style=LLVM \
--header-filter=.* \
--fix \
-fix-errors \
$i;
done
```
Reviewers: espindola, labath, aprantl, teemperor
Reviewed By: labath, aprantl, teemperor
Subscribers: teemperor, aprantl, labath, emaste, sbc100, aheejin, MaskRay, arphaman, usaxena95, lldb-commits
Tags: #lldb
Differential Revision: https://reviews.llvm.org/D80543
2020-06-03 00:19:55 +08:00
|
|
|
CommandObjectPlatformProcess(const CommandObjectPlatformProcess &) = delete;
|
|
|
|
const CommandObjectPlatformProcess &
|
|
|
|
operator=(const CommandObjectPlatformProcess &) = delete;
|
Many improvements to the Platform base class and subclasses. The base Platform
class now implements the Host functionality for a lot of things that make
sense by default so that subclasses can check:
int
PlatformSubclass::Foo ()
{
if (IsHost())
return Platform::Foo (); // Let the platform base class do the host specific stuff
// Platform subclass specific code...
int result = ...
return result;
}
Added new functions to the platform:
virtual const char *Platform::GetUserName (uint32_t uid);
virtual const char *Platform::GetGroupName (uint32_t gid);
The user and group names are cached locally so that remote platforms can avoid
sending packets multiple times to resolve this information.
Added the parent process ID to the ProcessInfo class.
Added a new ProcessInfoMatch class which helps us to match processes up
and changed the Host layer over to using this new class. The new class allows
us to search for processs:
1 - by name (equal to, starts with, ends with, contains, and regex)
2 - by pid
3 - And further check for parent pid == value, uid == value, gid == value,
euid == value, egid == value, arch == value, parent == value.
This is all hookup up to the "platform process list" command which required
adding dumping routines to dump process information. If the Host class
implements the process lookup routines, you can now lists processes on
your local machine:
machine1.foo.com % lldb
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
94727 244 username usergroup username usergroup x86_64-apple-darwin Xcode
92742 92710 username usergroup username usergroup i386-apple-darwin debugserver
This of course also works remotely with the lldb-platform:
machine1.foo.com % lldb-platform --listen 1234
machine2.foo.com % lldb
(lldb) platform create remote-macosx
Platform: remote-macosx
Connected: no
(lldb) platform connect connect://localhost:1444
Platform: remote-macosx
Triple: x86_64-apple-darwin
OS Version: 10.6.7 (10J869)
Kernel: Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu-1504.9.37~1/RELEASE_I386
Hostname: machine1.foo.com
Connected: yes
(lldb) platform process list
PID PARENT USER GROUP EFF USER EFF GROUP TRIPLE NAME
====== ====== ========== ========== ========== ========== ======================== ============================
99556 244 username usergroup username usergroup x86_64-apple-darwin trustevaluation
99548 65539 username usergroup username usergroup x86_64-apple-darwin lldb
99538 1 username usergroup username usergroup x86_64-apple-darwin FileMerge
94943 1 username usergroup username usergroup x86_64-apple-darwin mdworker
94852 244 username usergroup username usergroup x86_64-apple-darwin Safari
The lldb-platform implements everything with the Host:: layer, so this should
"just work" for linux. I will probably be adding more stuff to the Host layer
for launching processes and attaching to processes so that this support should
eventually just work as well.
Modified the target to be able to be created with an architecture that differs
from the main executable. This is needed for iOS debugging since we can have
an "armv6" binary which can run on an "armv7" machine, so we want to be able
to do:
% lldb
(lldb) platform create remote-ios
(lldb) file --arch armv7 a.out
Where "a.out" is an armv6 executable. The platform then can correctly decide
to open all "armv7" images for all dependent shared libraries.
Modified the disassembly to show the current PC value. Example output:
(lldb) disassemble --frame
a.out`main:
0x1eb7: pushl %ebp
0x1eb8: movl %esp, %ebp
0x1eba: pushl %ebx
0x1ebb: subl $20, %esp
0x1ebe: calll 0x1ec3 ; main + 12 at test.c:18
0x1ec3: popl %ebx
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
0x1edb: leal 213(%ebx), %eax
0x1ee1: movl %eax, (%esp)
0x1ee4: calll 0x1f1e ; puts
0x1ee9: calll 0x1f0c ; getchar
0x1eee: movl $20, (%esp)
0x1ef5: calll 0x1e6a ; sleep_loop at test.c:6
0x1efa: movl $12, %eax
0x1eff: addl $20, %esp
0x1f02: popl %ebx
0x1f03: leave
0x1f04: ret
This can be handy when dealing with the new --line options that was recently
added:
(lldb) disassemble --line
a.out`main + 13 at test.c:19
18 {
-> 19 printf("Process: %i\n\n", getpid());
20 puts("Press any key to continue..."); getchar();
-> 0x1ec4: calll 0x1f12 ; getpid
0x1ec9: movl %eax, 4(%esp)
0x1ecd: leal 199(%ebx), %eax
0x1ed3: movl %eax, (%esp)
0x1ed6: calll 0x1f18 ; printf
Modified the ModuleList to have a lookup based solely on a UUID. Since the
UUID is typically the MD5 checksum of a binary image, there is no need
to give the path and architecture when searching for a pre-existing
image in an image list.
Now that we support remote debugging a bit better, our lldb_private::Module
needs to be able to track what the original path for file was as the platform
knows it, as well as where the file is locally. The module has the two
following functions to retrieve both paths:
const FileSpec &Module::GetFileSpec () const;
const FileSpec &Module::GetPlatformFileSpec () const;
llvm-svn: 128563
2011-03-31 02:16:51 +08:00
|
|
|
};
|
2011-03-19 09:12:21 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// "platform shell"
|
2019-07-24 20:05:42 +08:00
|
|
|
#define LLDB_OPTIONS_platform_shell
|
|
|
|
#include "CommandOptions.inc"
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
|
2012-06-09 05:56:10 +08:00
|
|
|
class CommandObjectPlatformShell : public CommandObjectRaw {
|
2012-04-14 09:42:46 +08:00
|
|
|
public:
|
2013-08-27 07:57:52 +08:00
|
|
|
class CommandOptions : public Options {
|
|
|
|
public:
|
2018-05-10 18:46:03 +08:00
|
|
|
CommandOptions() : Options() {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandOptions() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
llvm::ArrayRef<OptionDefinition> GetDefinitions() override {
|
2016-09-23 05:06:13 +08:00
|
|
|
return llvm::makeArrayRef(g_platform_shell_options);
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status SetOptionValue(uint32_t option_idx, llvm::StringRef option_arg,
|
|
|
|
ExecutionContext *execution_context) override {
|
|
|
|
Status error;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
Convert option tables to ArrayRefs.
This change is very mechanical. All it does is change the
signature of `Options::GetDefinitions()` and `OptionGroup::
GetDefinitions()` to return an `ArrayRef<OptionDefinition>`
instead of a `const OptionDefinition *`. In the case of the
former, it deletes the sentinel entry from every table, and
in the case of the latter, it removes the `GetNumDefinitions()`
method from the interface. These are no longer necessary as
`ArrayRef` carries its own length.
In the former case, iteration was done by using a sentinel
entry, so there was no knowledge of length. Because of this
the individual option tables were allowed to be defined below
the corresponding class (after all, only a pointer was needed).
Now, however, the length must be known at compile time to
construct the `ArrayRef`, and as a result it is necessary to
move every option table before its corresponding class. This
results in this CL looking very big, but in terms of substance
there is not much here.
Differential revision: https://reviews.llvm.org/D24834
llvm-svn: 282188
2016-09-23 04:22:55 +08:00
|
|
|
const char short_option = (char)GetDefinitions()[option_idx].short_option;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-28 05:01:01 +08:00
|
|
|
switch (short_option) {
|
2020-05-09 16:10:35 +08:00
|
|
|
case 'h':
|
|
|
|
m_use_host_platform = true;
|
|
|
|
break;
|
2016-11-13 00:56:47 +08:00
|
|
|
case 't':
|
2018-05-10 18:46:03 +08:00
|
|
|
uint32_t timeout_sec;
|
|
|
|
if (option_arg.getAsInteger(10, timeout_sec))
|
2013-08-28 05:01:01 +08:00
|
|
|
error.SetErrorStringWithFormat(
|
2016-11-13 00:56:47 +08:00
|
|
|
"could not convert \"%s\" to a numeric value.",
|
|
|
|
option_arg.str().c_str());
|
2018-05-10 18:46:03 +08:00
|
|
|
else
|
2020-05-09 16:10:35 +08:00
|
|
|
m_timeout = std::chrono::seconds(timeout_sec);
|
2016-09-07 04:57:50 +08:00
|
|
|
break;
|
2020-08-28 21:38:39 +08:00
|
|
|
case 's': {
|
|
|
|
if (option_arg.empty()) {
|
|
|
|
error.SetErrorStringWithFormat(
|
|
|
|
"missing shell interpreter path for option -i|--interpreter.");
|
|
|
|
return error;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_shell_interpreter = option_arg.str();
|
|
|
|
break;
|
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
default:
|
2019-08-22 16:08:05 +08:00
|
|
|
llvm_unreachable("Unimplemented option");
|
2013-08-27 07:57:52 +08:00
|
|
|
}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
return error;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2020-05-09 16:10:35 +08:00
|
|
|
void OptionParsingStarting(ExecutionContext *execution_context) override {
|
|
|
|
m_timeout.reset();
|
|
|
|
m_use_host_platform = false;
|
2020-08-28 21:38:39 +08:00
|
|
|
m_shell_interpreter.clear();
|
2020-05-09 16:10:35 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2020-05-09 16:10:35 +08:00
|
|
|
Timeout<std::micro> m_timeout = std::chrono::seconds(10);
|
|
|
|
bool m_use_host_platform;
|
2020-08-28 21:38:39 +08:00
|
|
|
std::string m_shell_interpreter;
|
2016-09-07 04:57:50 +08:00
|
|
|
};
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2016-07-15 06:03:10 +08:00
|
|
|
CommandObjectPlatformShell(CommandInterpreter &interpreter)
|
|
|
|
: CommandObjectRaw(interpreter, "platform shell",
|
2013-09-10 06:35:18 +08:00
|
|
|
"Run a shell command on the current platform.",
|
2016-07-15 06:03:10 +08:00
|
|
|
"platform shell <shell-command>", 0),
|
2013-09-10 06:35:18 +08:00
|
|
|
m_options() {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformShell() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
Options *GetOptions() override { return &m_options; }
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2018-07-13 06:28:52 +08:00
|
|
|
bool DoExecute(llvm::StringRef raw_command_line,
|
2013-09-10 06:35:18 +08:00
|
|
|
CommandReturnObject &result) override {
|
2016-08-12 07:51:28 +08:00
|
|
|
ExecutionContext exe_ctx = GetCommandInterpreter().GetExecutionContext();
|
2013-09-10 06:35:18 +08:00
|
|
|
m_options.NotifyOptionParsingStarting(&exe_ctx);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
// Print out an usage syntax on an empty command line.
|
2018-07-13 06:28:52 +08:00
|
|
|
if (raw_command_line.empty()) {
|
2016-11-15 08:45:18 +08:00
|
|
|
result.GetOutputStream().Printf("%s\n", this->GetSyntax().str().c_str());
|
2013-09-10 06:35:18 +08:00
|
|
|
return true;
|
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2020-05-09 16:10:35 +08:00
|
|
|
const bool is_alias = !raw_command_line.contains("platform");
|
2018-07-11 04:17:38 +08:00
|
|
|
OptionsWithRaw args(raw_command_line);
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2018-07-11 04:17:38 +08:00
|
|
|
if (args.HasArgs())
|
|
|
|
if (!ParseOptions(args.GetArgs(), result))
|
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2020-05-09 16:10:35 +08:00
|
|
|
if (args.GetRawPart().empty()) {
|
|
|
|
result.GetOutputStream().Printf("%s <shell-command>\n",
|
|
|
|
is_alias ? "shell" : "platform shell");
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2020-08-28 21:38:39 +08:00
|
|
|
llvm::StringRef cmd = args.GetRawPart();
|
|
|
|
|
2016-08-12 07:51:28 +08:00
|
|
|
PlatformSP platform_sp(
|
2020-05-09 16:10:35 +08:00
|
|
|
m_options.m_use_host_platform
|
|
|
|
? Platform::GetHostPlatform()
|
|
|
|
: GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error;
|
2013-08-27 07:57:52 +08:00
|
|
|
if (platform_sp) {
|
2015-05-30 03:52:29 +08:00
|
|
|
FileSpec working_dir{};
|
2013-08-27 07:57:52 +08:00
|
|
|
std::string output;
|
|
|
|
int status = -1;
|
|
|
|
int signo = -1;
|
2020-08-28 21:38:39 +08:00
|
|
|
error = (platform_sp->RunShellCommand(m_options.m_shell_interpreter, cmd,
|
|
|
|
working_dir, &status, &signo,
|
2020-05-09 16:10:35 +08:00
|
|
|
&output, m_options.m_timeout));
|
2013-08-27 07:57:52 +08:00
|
|
|
if (!output.empty())
|
2016-11-03 04:34:10 +08:00
|
|
|
result.GetOutputStream().PutCString(output);
|
2013-08-27 07:57:52 +08:00
|
|
|
if (status > 0) {
|
|
|
|
if (signo > 0) {
|
|
|
|
const char *signo_cstr = Host::GetSignalAsCString(signo);
|
|
|
|
if (signo_cstr)
|
|
|
|
result.GetOutputStream().Printf(
|
|
|
|
"error: command returned with status %i and signal %s\n",
|
|
|
|
status, signo_cstr);
|
2016-09-07 04:57:50 +08:00
|
|
|
else
|
2013-08-27 07:57:52 +08:00
|
|
|
result.GetOutputStream().Printf(
|
|
|
|
"error: command returned with status %i and signal %i\n",
|
|
|
|
status, signo);
|
2016-09-07 04:57:50 +08:00
|
|
|
} else
|
2013-08-27 07:57:52 +08:00
|
|
|
result.GetOutputStream().Printf(
|
|
|
|
"error: command returned with status %i\n", status);
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
} else {
|
2013-08-27 07:57:52 +08:00
|
|
|
result.GetOutputStream().Printf(
|
|
|
|
"error: cannot run remote shell commands without a platform\n");
|
|
|
|
error.SetErrorString(
|
|
|
|
"error: cannot run remote shell commands without a platform");
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
|
|
|
|
2012-04-14 09:42:46 +08:00
|
|
|
if (error.Fail()) {
|
|
|
|
result.AppendError(error.AsCString());
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
} else {
|
|
|
|
result.SetStatus(eReturnStatusSuccessFinishResult);
|
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
return true;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2013-08-27 07:57:52 +08:00
|
|
|
CommandOptions m_options;
|
|
|
|
};
|
|
|
|
|
|
|
|
// "platform install" - install a target to a remote end
|
|
|
|
class CommandObjectPlatformInstall : public CommandObjectParsed {
|
|
|
|
public:
|
|
|
|
CommandObjectPlatformInstall(CommandInterpreter &interpreter)
|
|
|
|
: CommandObjectParsed(
|
|
|
|
interpreter, "platform target-install",
|
|
|
|
"Install a target (bundle or executable file) to the remote end.",
|
|
|
|
"platform target-install <local-thing> <remote-sandbox>", 0) {}
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
~CommandObjectPlatformInstall() override = default;
|
2016-09-07 04:57:50 +08:00
|
|
|
|
2020-08-11 02:10:18 +08:00
|
|
|
void
|
|
|
|
HandleArgumentCompletion(CompletionRequest &request,
|
|
|
|
OptionElementVector &opt_element_vector) override {
|
|
|
|
if (request.GetCursorIndex())
|
|
|
|
return;
|
|
|
|
CommandCompletions::InvokeCommonCompletionCallbacks(
|
|
|
|
GetCommandInterpreter(), CommandCompletions::eDiskFileCompletion,
|
|
|
|
request, nullptr);
|
|
|
|
}
|
|
|
|
|
2015-10-08 00:56:17 +08:00
|
|
|
bool DoExecute(Args &args, CommandReturnObject &result) override {
|
2013-08-27 07:57:52 +08:00
|
|
|
if (args.GetArgumentCount() != 2) {
|
|
|
|
result.AppendError("platform target-install takes two arguments");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
// TODO: move the bulk of this code over to the platform itself
|
2018-11-02 05:05:36 +08:00
|
|
|
FileSpec src(args.GetArgumentAtIndex(0));
|
|
|
|
FileSystem::Instance().Resolve(src);
|
|
|
|
FileSpec dst(args.GetArgumentAtIndex(1));
|
2018-11-02 01:09:25 +08:00
|
|
|
if (!FileSystem::Instance().Exists(src)) {
|
2013-08-27 07:57:52 +08:00
|
|
|
result.AppendError("source location does not exist or is not accessible");
|
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
return false;
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2016-08-12 07:51:28 +08:00
|
|
|
PlatformSP platform_sp(
|
2019-04-27 14:19:42 +08:00
|
|
|
GetDebugger().GetPlatformList().GetSelectedPlatform());
|
2013-08-27 07:57:52 +08:00
|
|
|
if (!platform_sp) {
|
2011-04-01 08:29:43 +08:00
|
|
|
result.AppendError("no platform currently selected");
|
2013-08-27 07:57:52 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
return false;
|
|
|
|
}
|
2016-02-23 03:02:01 +08:00
|
|
|
|
2017-05-12 12:51:55 +08:00
|
|
|
Status error = platform_sp->Install(src, dst);
|
2013-08-27 07:57:52 +08:00
|
|
|
if (error.Success()) {
|
|
|
|
result.SetStatus(eReturnStatusSuccessFinishNoResult);
|
|
|
|
} else {
|
2013-11-21 05:07:01 +08:00
|
|
|
result.AppendErrorWithFormat("install failed: %s", error.AsCString());
|
2013-08-27 07:57:52 +08:00
|
|
|
result.SetStatus(eReturnStatusFailed);
|
|
|
|
}
|
2011-04-01 08:29:43 +08:00
|
|
|
return result.Succeeded();
|
2016-09-07 04:57:50 +08:00
|
|
|
}
|
2012-04-14 09:42:46 +08:00
|
|
|
};
|
|
|
|
|
2016-07-15 06:03:10 +08:00
|
|
|
CommandObjectPlatform::CommandObjectPlatform(CommandInterpreter &interpreter)
|
|
|
|
: CommandObjectMultiword(
|
|
|
|
interpreter, "platform", "Commands to manage and create platforms.",
|
|
|
|
"platform [connect|disconnect|info|list|status|select] ...") {
|
2013-11-21 05:07:01 +08:00
|
|
|
LoadSubCommand("select",
|
|
|
|
CommandObjectSP(new CommandObjectPlatformSelect(interpreter)));
|
|
|
|
LoadSubCommand("list",
|
|
|
|
CommandObjectSP(new CommandObjectPlatformList(interpreter)));
|
|
|
|
LoadSubCommand("status",
|
|
|
|
CommandObjectSP(new CommandObjectPlatformStatus(interpreter)));
|
|
|
|
LoadSubCommand("connect", CommandObjectSP(
|
|
|
|
new CommandObjectPlatformConnect(interpreter)));
|
|
|
|
LoadSubCommand(
|
|
|
|
"disconnect",
|
|
|
|
CommandObjectSP(new CommandObjectPlatformDisconnect(interpreter)));
|
|
|
|
LoadSubCommand("settings", CommandObjectSP(new CommandObjectPlatformSettings(
|
|
|
|
interpreter)));
|
|
|
|
LoadSubCommand("mkdir",
|
|
|
|
CommandObjectSP(new CommandObjectPlatformMkDir(interpreter)));
|
|
|
|
LoadSubCommand("file",
|
|
|
|
CommandObjectSP(new CommandObjectPlatformFile(interpreter)));
|
|
|
|
LoadSubCommand("get-file", CommandObjectSP(new CommandObjectPlatformGetFile(
|
|
|
|
interpreter)));
|
|
|
|
LoadSubCommand("get-size", CommandObjectSP(new CommandObjectPlatformGetSize(
|
|
|
|
interpreter)));
|
|
|
|
LoadSubCommand("put-file", CommandObjectSP(new CommandObjectPlatformPutFile(
|
|
|
|
interpreter)));
|
|
|
|
LoadSubCommand("process", CommandObjectSP(
|
|
|
|
new CommandObjectPlatformProcess(interpreter)));
|
|
|
|
LoadSubCommand("shell",
|
|
|
|
CommandObjectSP(new CommandObjectPlatformShell(interpreter)));
|
|
|
|
LoadSubCommand(
|
|
|
|
"target-install",
|
|
|
|
CommandObjectSP(new CommandObjectPlatformInstall(interpreter)));
|
2011-03-19 09:12:21 +08:00
|
|
|
}
|
|
|
|
|
2016-02-23 03:02:01 +08:00
|
|
|
CommandObjectPlatform::~CommandObjectPlatform() = default;
|