diff options
author | Walter Erquinigo <a20012251@gmail.com> | 2019-10-07 17:49:32 +0000 |
---|---|---|
committer | Walter Erquinigo <a20012251@gmail.com> | 2019-10-07 17:49:32 +0000 |
commit | 6e1a0cf46bae77e1a83416f9479884cbb5e0164a (patch) | |
tree | 7444df1da90a32123e2c34d6490648afd7ae37b7 /lldb/packages/Python/lldbsuite/test | |
parent | bebdab63e84ce058ee4ff8b37de48b73197ae24e (diff) | |
download | bcm5719-llvm-6e1a0cf46bae77e1a83416f9479884cbb5e0164a.tar.gz bcm5719-llvm-6e1a0cf46bae77e1a83416f9479884cbb5e0164a.zip |
[platform process list] add a flag for showing the processes of all users
Summary:
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
```
Reviewers: labath,xiaobai,aadsm,clayborg
Subscribers:
llvm-svn: 373931
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test')
2 files changed, 60 insertions, 2 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestPlatformClient.py b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestPlatformClient.py new file mode 100644 index 00000000000..d0087770256 --- /dev/null +++ b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/TestPlatformClient.py @@ -0,0 +1,34 @@ +import lldb +import binascii +import os +from lldbsuite.test.lldbtest import * +from lldbsuite.test.decorators import * +from gdbclientutils import * + + +class TestPlatformClient(GDBRemoteTestBase): + + def test_process_list_with_all_users(self): + """Test connecting to a remote linux platform""" + + class MyResponder(MockGDBServerResponder): + def qfProcessInfo(self, packet): + if "all_users:1" in packet: + return "pid:10;ppid:1;uid:1;gid:1;euid:1;egid:1;name:" + binascii.hexlify("/a/process") + ";args:" + else: + return "E04" + + self.server.responder = MyResponder() + + self.runCmd("platform select remote-linux") + + try: + self.runCmd("platform connect connect://localhost:%d" % + self.server.port) + self.assertTrue(self.dbg.GetSelectedPlatform().IsConnected()) + self.expect("platform process list -x", + startstr="1 matching process was found", endstr="process" + os.linesep) + self.expect("platform process list", + error="error: no processes were found on the \"remote-linux\" platform") + finally: + self.runCmd("platform disconnect") diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py index fad41f8a83a..73c698d1e3e 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/gdb_remote_client/gdbclientutils.py @@ -160,9 +160,34 @@ class MockGDBServerResponder: return self.QListThreadsInStopReply() if packet.startswith("qMemoryRegionInfo:"): return self.qMemoryRegionInfo() + if packet == "qQueryGDBServer": + return self.qQueryGDBServer() + if packet == "qHostInfo": + return self.qHostInfo() + if packet == "qGetWorkingDir": + return self.qGetWorkingDir() + if packet == "qsProcessInfo": + return self.qsProcessInfo() + if packet.startswith("qfProcessInfo"): + return self.qfProcessInfo(packet) return self.other(packet) + def qsProcessInfo(self): + return "E04" + + def qfProcessInfo(self, packet): + raise "E04" + + def qGetWorkingDir(self): + return "2f" + + def qHostInfo(self): + return "ptrsize:8;endian:little;" + + def qQueryGDBServer(self): + return "E04" + def interrupt(self): raise self.UnexpectedPacketException() @@ -171,7 +196,7 @@ class MockGDBServerResponder: def vCont(self, packet): raise self.UnexpectedPacketException() - + def readRegisters(self): return "00000000" * self.registerCount @@ -425,7 +450,6 @@ class MockGDBServer: class InvalidPacketException(Exception): pass - class GDBRemoteTestBase(TestBase): """ Base class for GDB client tests. |