clayborg added a comment. It would be nice to auto detect the names correctly?
================ Comment at: lldb/trunk/source/Plugins/Platform/Android/PlatformAndroid.cpp:389 + struct __lldb_dlopen_result { void *image_ptr; const char *error_str; } the_result; + the_result.image_ptr = __dl_dlopen ("%s", 2); + if (the_result.image_ptr == (void*)0x0) ---------------- labath wrote: > nitesh.jain wrote: > > Hi Tamas, > > > > When I run "process load libloadunload_a.so --install" its fail with error > > Couldn't lookup symbols: __dl_dlerror, __dl_dlopen. > > > > Symbol table contains 13 entries: > > Num: Value Size Type Bind Vis Ndx Name > > 0: 00000000 0 NOTYPE LOCAL DEFAULT UND > > 1: 00000304 5 FUNC GLOBAL DEFAULT 5 android_dlopen_ext > > 2: 00000309 5 FUNC GLOBAL DEFAULT 5 android_get_LD_LIBRARY_PA > > 3: 0000030e 5 FUNC GLOBAL DEFAULT 5 android_update_LD_LIBRARY > > 4: 00000313 5 FUNC GLOBAL DEFAULT 5 dl_iterate_phdr > > 5: 00000318 5 FUNC GLOBAL DEFAULT 5 **dladdr** > > 6: 0000031d 5 FUNC GLOBAL DEFAULT 5 **dlclose** > > 7: 00000322 5 FUNC GLOBAL DEFAULT 5 **dlerror** > > 8: 00000327 5 FUNC GLOBAL DEFAULT 5 **dlopen** > > 9: 0000032c 5 FUNC GLOBAL DEFAULT 5 dlsym > > 10: 00002000 0 NOTYPE GLOBAL DEFAULT ABS _edata > > 11: 00002000 0 NOTYPE GLOBAL DEFAULT ABS __bss_start > > 12: 00002000 0 NOTYPE GLOBAL DEFAULT ABS _end > > > > The symbols are not prefix with "__dl_" . We are using SDK version 25 for > > MIP64r6 target. > > > > generic_mips64:/ # getprop ro.build.version.sdk > > 25 > > > > Even we are not seeing prefix "__dl_" added to X86-64 dynamic symbol > > Symbol table '.dynsym' contains 12 entries: > > Num: Value Size Type Bind Vis Ndx Name > > 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND > > 1: 0000000000000442 6 FUNC GLOBAL DEFAULT 7 > > dl_iterate_phdr@@LIBC > > 2: 000000000000043c 6 FUNC GLOBAL DEFAULT 7 > > android_dlopen_ext@@LIBC > > 3: 000000000000044e 6 FUNC GLOBAL DEFAULT 7 dlclose@@LIBC > > 4: 0000000000000448 6 FUNC GLOBAL DEFAULT 7 dladdr@@LIBC > > 5: 000000000000045a 6 FUNC GLOBAL DEFAULT 7 dlopen@@LIBC > > 6: 0000000000000454 6 FUNC GLOBAL DEFAULT 7 dlerror@@LIBC > > 7: 0000000000000460 6 FUNC GLOBAL DEFAULT 7 dlsym@@LIBC > > 8: 0000000000002000 0 NOTYPE GLOBAL DEFAULT ABS _edata > > 9: 0000000000002000 0 NOTYPE GLOBAL DEFAULT ABS __bss_start > > 10: 0000000000002000 0 NOTYPE GLOBAL DEFAULT ABS _end > > 11: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS LIBC > > > > Symbol table '.symtab' contains 14 entries: > > Num: Value Size Type Bind Vis Ndx Name > > 0: 0000000000000000 0 NOTYPE LOCAL DEFAULT UND > > 1: 0000000000000000 0 FILE LOCAL DEFAULT ABS tmp-platform.c > > 2: 0000000000001ee0 288 OBJECT LOCAL HIDDEN 10 _DYNAMIC > > 3: 0000000000000000 0 OBJECT GLOBAL DEFAULT ABS LIBC > > 4: 0000000000000442 6 FUNC GLOBAL DEFAULT 7 dl_iterate_phdr > > 5: 000000000000043c 6 FUNC GLOBAL DEFAULT 7 > > android_dlopen_ext > > 6: 000000000000044e 6 FUNC GLOBAL DEFAULT 7 dlclose > > 7: 0000000000000448 6 FUNC GLOBAL DEFAULT 7 dladdr > > 8: 000000000000045a 6 FUNC GLOBAL DEFAULT 7 dlopen > > > Is it possible you are using a **preview** version of android sdk? These had > the new dlopen symbols even though the official android sdk's still used the > __dl_dlopen symbols? Maybe search for a symbol named "__dl_open" first, then fall back to "dl_open" if that symbol is available, and supply as an argument for "expr.Printf(" by adding a "%s" in place of the "__dl_dlopen? call? Then it can work for both? ``` const char *dl_open_func_name = nullptr; SymbolContextList matching_symbols; std::vector<const char *> dl_open_names = { "__dl_open", "dl_open" }; const char *dl_open_name = nullptr; for (auto name: dl_open_names) { if (process->GetTarget().GetImages().FindFunctionSymbols(ConstString(name), eFunctionNameTypeFull, matching_symbols)) dl_open_name = name; break; } } ``` Repository: rL LLVM https://reviews.llvm.org/D11465 _______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits