[Lldb-commits] [PATCH] Add filepath to qModuleInfo packet

Tamas Berghammer tberghammer at google.com
Wed Mar 11 04:13:00 PDT 2015

In http://reviews.llvm.org/D8221#138492, @ovyalov wrote:

> http://stackoverflow.com/questions/5103443/how-to-check-what-shared-library-is-loaded-at-run-time
> Potentially, we may add optional pid request field to qModuleInfo and then try either to call remotely dlopen(NULL, RTLD_NOW) in a zygote process (it might be tricky since this requires dl library loaded into a process) or parse /proc/$pid/maps

The problem with this approach is that qModuleInfo is usually called before starting the inferior (at least for native applications) so we have ho process to use for this purpose.

Comment at: source/Host/android/HostInfoAndroid.cpp:47
@@ +46,3 @@
+HostInfoAndroid::ResolveLibraryPath(const std::string& module_path, const ArchSpec& arch)
ovyalov wrote:
> How we can handle application's native libraries loaded into zygote process?
> If application loads a library via System.loadLibrary a load path might have a following format:
> /data/app/com.google.ovyalov.ndktest-1/lib/x86/libprober.so 
> Depending on a target architecture x86 is replaced with arm64-v8a, armeabi, armeabi-v7a, mips, mips64 or x86_64.
> As far as I can see from /proc/${PID}/environ there is no LD_LIBRARY_PATH variable - just LD_PRELOAD=libsigchain.so
I think (hope) when a library is loaded by System.loadLibrary then the debugger will capture the full path of the library, but currently a few feature is missing to try it out with a zygote child. If it isn't the case then we have to improve this function to handle that case also.

I think LD_LIBRARY_PATH is generally not used in android, but the bionic linker supports it so if somebody want to use it, then it is possible to do so. I can imagine a few case when you want to do it, so I would like to support it in lldb to be consistent with the library loader.

Comment at: source/Host/android/HostInfoAndroid.cpp:88
@@ +87,3 @@
+    {
+        std::string path_candidate = path;
+        path_candidate += '/';
ovyalov wrote:
> Could you use FileSpec here instead of path concatenation?
> FileSpec file_candidate(path);
> file_candidate.AppendPathComponent(module_path);



More information about the lldb-commits mailing list