[Lldb-commits] [PATCH] D68354: [platform process list] add a flag for showing the processes of all users
walter erquinigo via Phabricator via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 2 13:07:57 PDT 2019
wallace created this revision.
wallace added reviewers: labath, xiaobai, aadsm, clayborg.
Herald added subscribers: lldb-commits, atanasyan, kristof.beyls, arichardson, sdardis.
Herald added a project: LLDB.
For context: https://reviews.llvm.org/D68293
We need a way to show all the processes on android regardless of the user id.
When you run `platform process list`, you only see the processes with the same user as the user that launched lldb-server. However, it's quite useful to see all the processes, though, and it will lay a foundation for full apk debugging support from lldb.
Before:
PID PARENT USER TRIPLE NAME
====== ====== ========== ======================== ============================
3234 1 aarch64-unknown-linux-android adbd
8034 3234 aarch64-unknown-linux-android sh
9096 3234 aarch64-unknown-linux-android sh
9098 9096 aarch64-unknown-linux-android lldb-server
(lldb) ^D
Now:
(lldb) platform process list -x
205 matching processes were found on "remote-android"
PID PARENT USER TRIPLE NAME
====== ====== ========== ======================== ============================
1 0 init
524 1 init
525 1 init
531 1 ueventd
568 1 logd
569 1 aarch64-unknown-linux-android servicemanager
570 1 aarch64-unknown-linux-android hwservicemanager
571 1 aarch64-unknown-linux-android vndservicemanager
577 1 aarch64-unknown-linux-android qseecomd
580 577 aarch64-unknown-linux-android qseecomd
...
23816 979 com.android.providers.calendar
24600 979 com.verizon.mips.services
27888 979 com.hualai
28043 2378 com.android.chrome:sandboxed_process0
31449 979 com.att.shm
31779 979 com.samsung.android.authfw
31846 979 com.samsung.android.server.iris
32014 979 com.samsung.android.MtpApplication
32045 979 com.samsung.InputEventApp
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D68354
Files:
lldb/source/Commands/CommandObjectPlatform.cpp
lldb/source/Commands/Options.td
lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
Index: lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
===================================================================
--- lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
+++ lldb/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp
@@ -2176,8 +2176,7 @@
if (match_info.GetProcessInfo().EffectiveGroupIDIsValid())
packet.Printf("egid:%u;",
match_info.GetProcessInfo().GetEffectiveGroupID());
- if (match_info.GetProcessInfo().EffectiveGroupIDIsValid())
- packet.Printf("all_users:%u;", match_info.GetMatchAllUsers() ? 1 : 0);
+ packet.Printf("all_users:%u;", match_info.GetMatchAllUsers() ? 1 : 0);
if (match_info.GetProcessInfo().GetArchitecture().IsValid()) {
const ArchSpec &match_arch =
match_info.GetProcessInfo().GetArchitecture();
Index: lldb/source/Commands/Options.td
===================================================================
--- lldb/source/Commands/Options.td
+++ lldb/source/Commands/Options.td
@@ -602,6 +602,9 @@
def platform_process_list_show_args : Option<"show-args", "A">,
GroupRange<1, 6>,
Desc<"Show process arguments instead of the process executable basename.">;
+ def platform_process_list_all_users: Option<"all-users", "x">,
+ GroupRange<1,6>,
+ Desc<"Show processes matching all user IDs.">;
def platform_process_list_verbose : Option<"verbose", "v">, GroupRange<1, 6>,
Desc<"Enable verbose output.">;
}
Index: lldb/source/Commands/CommandObjectPlatform.cpp
===================================================================
--- lldb/source/Commands/CommandObjectPlatform.cpp
+++ lldb/source/Commands/CommandObjectPlatform.cpp
@@ -1264,6 +1264,10 @@
verbose = true;
break;
+ case 'x':
+ match_info.SetMatchAllUsers(true);
+ break;
+
default:
llvm_unreachable("Unimplemented option");
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68354.222895.patch
Type: text/x-patch
Size: 1965 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191002/3e40824f/attachment.bin>
More information about the lldb-commits
mailing list