This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug gdb/19746] New: auto-solib-add is active, yet no symbols are loaded despite correct solib-search-path


https://sourceware.org/bugzilla/show_bug.cgi?id=19746

            Bug ID: 19746
           Summary: auto-solib-add is active, yet no symbols are loaded
                    despite correct solib-search-path
           Product: gdb
           Version: 7.7
            Status: NEW
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: h4xx0rz at hotmail dot de
  Target Milestone: ---

Steps to reproduce

1) Download
https://raw.githubusercontent.com/secure-software-engineering/DroidBench/develop/apk/Native/NativeIDFunction.apk
1.1) Extract the downloaded NativeIDFunction.apk to a folder. It is actually
zip file.
The apk file contains a folder lib/armeabi/. Remember this path, because it
will be later supplied to gdb via set solib-search-path
1.2) You will also need the Android SDK and (possibly the Android NDK as well,
because it contains the used GDB and GDBServer version)
2) (Download and) Start an Android Emulator. I have used Android 4.4.2, API
level 19, armeabi-v7a.
3) Use adb install NativeIDFunction.apk; you can find adb in the platform-tools
directory.
4) Launch NDK test from the Android launcher within the emulator.
5) Goto adb shell
6) Type
ps | grep mod.ndk 
within the shell of adb shell
This should give sth like
u0_a55    1170  56    242152 23756 ffffffff b6f4e5cc S mod.ndk
In this case, 1170 is the process id.

7) Copy the gdbserver to the device:
In my case, I wanted to use the gdbserver from the Android NDK, which can be
found in
android-ndk-r10e/prebuilt/android-arm/gdbserver/gdbserver
Therefore, run in a new shell:
adb push android-ndk-r10e/prebuilt/android-arm/gdbserver/gdbserver
/data/local/tmp/gdbserver
8) Back in adb shell's shell:
chmod 777 /data/local/tmp/gdbserver
run-as mod.ndk /data/local/tmp/gdbserver +pipe --attach 1170
(replace with whatever process id you get)
9) In a new shell:
adb forward tcp:9996 localfilesystem:/data/data/mod.ndk/pipe
Select an appropriate gdb. I have used
android-ndk-r10e/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gdb
In gdb's console:
> show auto-solib-add
Autoloading of shared library symbols is on.

> set solib-search-path PATHOFEXTRACTEDAPK/lib/armeabi
> target remote tcp:127.0.0.1:9996
At this point in time, the ndk module has already been loaded by the APK file.
> info sharedlibrary
shows:
0xa8c7ecf0  0xa8c80218  No          PATHOFEXTRACTEDAPK/lib/armeabi/libndkmod.so
Why are the symbols not loaded?

One can load the symbols manually:
> sharedlibrary
Error reading attached process's symbol file.
mod.ndk: Datei oder Verzeichnis nicht gefunden.
Reading symbols from PATHOFEXTRACTEDAPK/libndkmod.so...(no debugging symbols
found)...done.
Loaded symbols for PATHOFEXTRACTEDAPK/libndkmod.so

Now, info shared library shows
0xa8c7ecf0  0xa8c80218  Yes (*)     PATHOFEXTRACTEDAPK/libndkmod.so

So, why does GDB not load the symbols in the first place? I would expect it to
catch all load-library calls and run the sharedlibrary command by itself.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]