[Lldb-commits] [PATCH] D68289: [lldb-server/android] Show more processes and package name when necessary

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Oct 1 12:18:37 PDT 2019


wallace created this revision.
wallace added reviewers: clayborg, aadsm, labath, xiaobai.
Herald added subscribers: lldb-commits, kristof.beyls, krytarowski, srhines.
Herald added a project: LLDB.

By default `platform process list` only shows the processes of the current user that lldb-server can parse.
There are several problems:

- apk programs don't have an executable file. They instead use a package name as identifier.
- each apk also runs under a different user. That's how android works
- because of the user permission, some files like /proc/<pid>/{environ,exe} can't be read.

This results in a very small process list.

This is a local run on my machine

  (lldb) platform process list
  2 matching processes were found on "remote-android"
  PID    PARENT USER       TRIPLE                   NAME
  ====== ====== ========== ======================== ============================
  23291  3177              aarch64-unknown-linux-android sh
  23301  23291            aarch64-unknown-linux-android lldb-server

However, I have 700 processes running at this time.

By implementing a few fallbacks for android, I've expanded this list to 202, filtering out kernel processes, which would presumably appear in this list if the device was rooted.

  (lldb) platform process list
  202 matching processes were found on "remote-android"
  PID    PARENT USER       TRIPLE                   NAME
  ====== ====== ========== ======================== ============================
  ...
  12647  3208              aarch64-unknown-linux-android sh
  12649  12647             aarch64-unknown-linux-android lldb-server
  12653  982                                        com.samsung.faceservice
  13185  982                                        com.samsung.vvm
  15899  982                                        com.samsung.android.spay
  16220  982                                        com.sec.spp.push
  17126  982                                        com.sec.spp.push:RemoteDlcProcess
  19772  983                                        com.android.chrome
  20209  982                                        com.samsung.cmh:CMH
  20380  982                                        com.google.android.inputmethod.latin
  20879  982                                        com.samsung.android.oneconnect:Receiver
  21212  983                                        com.tencent.mm
  24459  1                 aarch64-unknown-linux-android wpa_supplicant
  25974  982                                        com.samsung.android.contacts
  26293  982                                        com.samsung.android.messaging
  28714  982                                        com.samsung.android.dialer
  31605  982                                        com.samsung.android.MtpApplication
  32256  982                                        com.bezobidny

Something to notice is that the architecture is unkonwn for all apks. And that's fine, because run-as would be required to gather this information and that would make this entire functionality massively slow.

There are still several improvements to make here, like displaying actual user names, which I'll try to do in a following diff.

Note: Regarding overall apk debugging support from lldb. I'm planning on having lldb spawn lldb-server by itself with the correct user, so that everything works well. The initial lldb-server used for connecting to the remote platform can be reused for such purpose. Furthermore, eventually lldb could also launch that initial lldb-server on its own.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D68289

Files:
  lldb/source/Host/linux/Host.cpp
  lldb/source/Utility/FileSpec.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D68289.222670.patch
Type: text/x-patch
Size: 10056 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20191001/20e6c332/attachment.bin>


More information about the lldb-commits mailing list