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.

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?



================
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



_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to