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

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 17 10:16:49 PDT 2019



> On Oct 17, 2019, at 1:35 AM, Pavel Labath via Phabricator <reviews at reviews.llvm.org> wrote:
> 
> labath added a comment.
> 
> In D68968#1712018 <https://reviews.llvm.org/D68968#1712018>, @jingham wrote:
> 
>> I don't think it would be good to make it hard to see the actual path (if you have it) as well as the bundle ID.  If you are working on system components, you want to know that you are running some hand-built copy of a binary and not the pre-installed one.  So we want to make it easy to see "which thing with this bundleID am I actually running".  Other than that this seems fine to me.
> 
> 
> Thanks, Jim. This part is interesting. On android the application "path" is mostly uninteresting, because it will always be "/system/bin/app_proces" (as the "app" is really just a shared library loaded into that process), and AFAIK it is not even possible to run an application (an least on an unrooted phone) from a different location.

On iOS you can run an app from anywhere.  There's a registration process so the app launcher knows how to respond to "tell app-bundle foo to do something".   But other than that I don't think there are any significant restrictions on where it can be.

> 
> What would you say is the right way to display this in the "platform process list" output? Would it be ok if in non-verbose mode we displayed only one of these things (bundle id, path base name, argv[0], probably in that order), and then for the non-verbose mode listed each thing separately?
> 

If the second "non-verbose" in the sentence above was supposed to be "verbose" then this seems good to me.  Even though the location is not so restricted, Xcode installs binaries for you and the there's no way to control where they go, so for the vast majority of users seeing the bundle id would be fine.

Jim


> 
> 
> ================
> Comment at: lldb/source/Host/linux/Host.cpp:220-222
> +  if (process_info.GetNameAsStringRef().empty() &&
> +      !process_info.GetArg0().empty()) {
> +    process_info.SetBundleID(process_info.GetArg0());
> ----------------
> wallace wrote:
>> labath wrote:
>>> How sure are we that the app processes are the only ones which have the exe link unreadable? Will that be true on all phones or just the recent ones with all the selinux stuff?
>>> 
>>> I was hoping that there is some more reliable way of fetching this information, but there doesn't seem to be anything except [[ https://developer.android.com/reference/android/app/ActivityManager.RunningAppProcessInfo.html | ActivityManager.RunningAppProcessInfo ]], which I don't know if it can be accessed from lldb, either host- or device-side.
>>> 
>>> @danalbert, any ideas here?
>> Another option I've just discovered is to invoke `pm list packages` to get the list of all apks and if an Arg0 is in that list, then it's a package.
>> That seems good enough
> That should prevent us accidentally setting an incorrect bundle id, but it does not prevent a process from deliberately changing its argv[0] to the name of some other installed package. That seems suboptimal, particularly if we're later going to use start using the bundle id for other than just display purposes (e.g. for issuing "am kill" commands). So, I am still wondering if we shouldn't go back to using argv[0] for the purpose of "process list", and leave the "bundle id" field for cases where we can get this information from a more reliable source (e.g. reading it from the apk, or fetching it from the android package manager, etc). What do you think?
> 
> 
> 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