[Lldb-commits] [PATCH] D68968: [android/process info] Introduce bundle id

walter erquinigo via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 17 15:34:26 PDT 2019


wallace added a comment.

Thanks for your feedback and to @clayborg  for an offline discussion we had.

I'm going to add three new attributes to the ProcessInfo class, with corresponding parameters in the gdb-remote packet

- display_name: This is a custom display name that the server can set for a given process. This will supersede any other other attribute in the GetProcessName call. There are interesting cases that are worth mentioning for Android:
  - Kernel threads and system processes are displayed like [kworker/u:0] [khubd] by ps on Android. At least on modern devices ps.c identify those processes as the ones with unreadable /proc/<pid>/cmdline and unreadable /proc/<pid>/exe. The name is gotten from /proc/<pid>/stat. There's some generic information about this here https://unix.stackexchange.com/questions/22121/what-do-the-brackets-around-processes-mean. In this case both the actual executable and args are not known, so it's better to leave those fields empty and store the display name in this new field.
  - Custom apk process names: apks can launch processes and subprocesses with custom names. The custom name has the form com.example.app:custom_name. It's always that way and it's documented here https://developer.android.com/guide/topics/manifest/application-element#proc (go to the android:process section). A given apk can have several subprocesses, each one with a different custom name, e.g. com.samsung.services:Core, com.samsung.services:Monitor, etc. In this case, the package name is known and a display_name field would be useful to store the entire custom name.

- bundle_id: This will be exactly the apk package name or the iOS bundle name inferred by the server. I plan to make a best effort guess for modern android devices, leaving old devices as cases to implement as needed. I plan to use `pm list packages` for this, given that this is the only reliable way to get all the apk names. Besides, I'll check /proc<pid>/stat for the process name and not arg0. It seems that /stat is not modifiable the same way arg0 is.

- bundle_path: On android this is the path the apk path. This will also be useful for iOS, because app bundles are also stored somewhere. Fortunately, the command `pm list packages -f`, shows the list of apks along with their corresponding paths on disk. This command doesn't work on old devices, but still, I wouldn't prioritize them now.

For the `platform process list` command, I'll make the GetProcessName function look for the actual name from these sources in the given order: display_name -> bundle_id -> exe path
In the case of the --verbose mode, I'll show all bundle information and display name fields


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68968/new/

https://reviews.llvm.org/D68968





More information about the lldb-commits mailing list