[Lldb-commits] [PATCH] D68048: [WIP][RFC] Improve fetching the process list on the android platform

Greg Clayton via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Wed Sep 25 14:50:33 PDT 2019


clayborg added a comment.

> There are some things still left.
> 
> architecture:
>  I don't know if we can simply reuse an existing variable and set it for all processes, or if we should really find the architecture of each process.

The only time we might run into an issue is when we have arm32 running on arm64. Not sure if that can be detected. For now we can deduce the devices architecture and apply to all?

> user id:
>  ps returns a user name, but ProcessInfo expects a numeric user ID. Examples of user names are u0_a306, u0_a84, root, bluetooth, etc. Generally there's a new user name when an apk runs IIRC. Should we include a user name field in ProcessInfo for these cases?

No, we should try and figure out the user ID for the user name if possible. The platform code has code to get the username for a user ID.

> process name:
>  ProcessInfo stores its process name as a FileSpec, which does path splitting by / or \. For some problematic system processes, ps shows a process name between brackets like [irq/159-arm-smm]. The FileSpec file will try to parse it as an actual path and the output of the process list command will just include 159-arm-smm].
>  I imagine that it's reasonable to discard all the processes that have names between brackets.

Not sure. Maybe we can get some info from the /proc/<pid>/maps to find the file for the process? We do want to get the process' main binary in the process info. Anything that we don't want to attach to and debug can be left off this list. Not sure if that means any process those name starts with a '[' character or not?

> long process list:
>  Should we discard system and root processes? These are a lot (hundreds on my devices) and can't be debugged.

Probably best to only show things we can attach to. Not sure how to weed this out. If the lldb-server in platform mode _is_ running as root, we probably want to show the root processes maybe? Normally we show processes that the lldb-server user ID has access to, but this falls down real quick with Android since each app has its own user ID. Not sure what the best option is here.

> c++:
>  I haven't written c++ in years, and i have forgotten almost everything. Please make as many advices as possible :)

Will do!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D68048





More information about the lldb-commits mailing list