-
Notifications
You must be signed in to change notification settings - Fork 258
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GDB 7.10 from NDK r11b is not working on OS X/Windows #53
Comments
@jmgao: is this one of the issues you've already fixed for r11c? |
No, because they're not using ndk-gdb.py, but it might be related:
Do you see warning messages similar to the following?
If so, the problem is probably that gdbserver isn't sending the GNU/Linux osabi to gdb. Try using |
Marking as r12 for the gdb fix (assuming that that's the problem) |
Oh, I read that as the opposite of what it said. Never mind :) |
@jmgao Thanks a lot,
|
Hi all, I follow the official NDK link [ e.g. for MacOs http://dl.google.com/android/repository/android-ndk-r11b-darwin-x86_64.zip ]. Unzip the package. In toolchains sub-folders arm-linux-androideabi-4.9 (the same thing for the other toolchains), the file arm-linux-androideabi-gdb does not exist. The complete path of this tool should be something like: [ NDK_DIR/android-ndk-r11b/toolchains/arm-linux-androideabi-4.9/prebuilt/darwin-x86_64/bin/arm-linux-androideabi-gdb ] Obviously this raises the big issue that is impossible to debug native apps for example via QtCreator that by default tries to load arm-linux-androideabi-gdb when debugging started. I verify this issue on MacOs, Win8 and Linux. |
Did you run it before connecting?
|
Also #35 |
Sure, I've launched the main activity from |
Sorry, I meant did you use On Wed, Mar 30, 2016, 12:10 PM Mikhail notifications@github.com wrote:
|
I did that, and after connecting to remote target GDB works like it should. |
Fixed in r11c |
I've tried to use the GDB 7.10 directly without ndk-gdb.py helper script, but it's not working as expected.
My test device is Nexus 5 running API 23 with latest OTA updates.
Here's the reproduction steps:
android-ndk-r11b/ndk-build V=1 NDK_DEBUG=1 -B
android:debuggable
attribute in AndroidManifest.xml<application android:debuggable="true" android:label="@string/app_name" android:hasCode="false">
adb pull /system/bin local_sysroot && adb pull /system/lib local_sysroot
android-ndk-r11b/prebuilt/android-arm/gdbserver/
to/data/data/com.example.native_activity/gdbserver
chmod 750 /data/data/com.example.native_activity/gdbserver
adb forward tcp:5678 tcp:5678
$ANDROID_NDK_ROOT/prebuilt/darwin-x86_64/bin/gdb
OR
$ANDROID_NDK_ROOT/prebuilt/windows/bin/gdb
Here's GDB 7.10 output:
OS X 10.11
(gdb) set sysroot /Users/mike/wrk/ub1404/nexus5/
(gdb) show sysroot
The current system root is "/Users/mike/wrk/ub1404/nexus5/".
(gdb) target remote :5678
Remote debugging using :5678
0xb6c93894 in ?? ()
(gdb) bt
#0 0xb6c93894 in ?? ()
#1 0xb6c6ce72 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) info thread
Id Target Id Frame
19 Thread 32420 0xb6c939bc in ?? ()
18 Thread 32076 0xb6c939bc in ?? ()
17 Thread 32044 0xb6c939bc in ?? ()
16 Thread 31805 0xb6c939bc in ?? ()
15 Thread 31784 0xb6c939bc in ?? ()
14 Thread 31525 0xb6c939bc in ?? ()
13 Thread 29778 0xb6c939bc in ?? ()
12 Thread 29770 0xb6c939bc in ?? ()
11 Thread 28441 0xb6c939bc in ?? ()
10 Thread 28440 0xb6c939bc in ?? ()
9 Thread 28433 0xb6c939bc in ?? ()
8 Thread 28432 0xb6c939bc in ?? ()
7 Thread 28431 0xb6c6a5e4 in ?? ()
6 Thread 28429 0xb6c6a5e4 in ?? ()
5 Thread 28428 0xb6c6a5e4 in ?? ()
4 Thread 28427 0xb6c6a5e4 in ?? ()
3 Thread 28426 0xb6c94948 in ?? ()
2 Thread 28417 0xb6c93b68 in ?? ()
** 1 Thread 28412 0xb6c93894 in ?? ()
(gdb) c
Continuing.
^C[New Thread 353]
Program received signal SIGINT, Interrupt.
0xb6c93894 in ?? ()
(gdb) info dll
No shared libraries loaded at this time.
Windows 7
(gdb) set sysroot /z/wrk/ub1404/nexus5/
(gdb) target remote :5678
Remote debugging using :5678
0xb6c93894 in ?? ()
(gdb) info thread
Id Target Id Frame
22 Thread 1202 0xb6c939bc in ?? ()
21 Thread 459 0xb6c939bc in ?? ()
20 Thread 353 0xb6c939bc in ?? ()
19 Thread 32420 0xb6c939bc in ?? ()
18 Thread 32076 0xb6c939bc in ?? ()
17 Thread 32044 0xb6c939bc in ?? ()
16 Thread 31805 0xb6c939bc in ?? ()
15 Thread 31784 0xb6c939bc in ?? ()
14 Thread 31525 0xb6c939bc in ?? ()
13 Thread 29778 0xb6c6a5e4 in ?? ()
12 Thread 29770 0xb6c939bc in ?? ()
11 Thread 28441 0xb6c6a5e4 in ?? ()
10 Thread 28440 0xb6c939bc in ?? ()
9 Thread 28433 0xb6c939bc in ?? ()
8 Thread 28432 0xb6c939bc in ?? ()
7 Thread 28431 0xb6c6a5e4 in ?? ()
6 Thread 28429 0xb6c6a5e4 in ?? ()
5 Thread 28428 0xb6c6a5e4 in ?? ()
4 Thread 28427 0xb6c6a5e4 in ?? ()
3 Thread 28426 0xb6c94948 in ?? ()
2 Thread 28417 0xb6c93b68 in ?? ()
** 1 Thread 28412 0xb6c93894 in ?? ()
(gdb) info dll
No shared libraries loaded at this time.
(gdb) info target
Symbols from "Z:\wrk\ub1404\nexus5\system\bin\app_process32".
Remote serial target in gdb-specific protocol:
Debugging a target over a serial line.
While running this, GDB does not access memory from...
Local exec file:
`Z:\wrk\ub1404\nexus5\system\bin\app_process32',
file type elf32-littlearm.
Entry point: 0x1808
0x00000154 - 0x00000167 is .interp
0x00000168 - 0x00000180 is .note.android.ident
0x00000180 - 0x000001a0 is .note.gnu.build-id
0x000001a0 - 0x00000670 is .dynsym
0x00000670 - 0x00000ce8 is .dynstr
0x00000ce8 - 0x00000d44 is .gnu.hash
0x00000d44 - 0x00000dde is .gnu.version
0x00000de0 - 0x00000e30 is .gnu.version_r
0x00000e30 - 0x00000f80 is .rel.dyn
0x00000f80 - 0x00001170 is .rel.plt
0x00001170 - 0x0000146c is .plt
0x0000146c - 0x0000388c is .text
0x0000388c - 0x00003a64 is .ARM.exidx
0x00003a64 - 0x00003aac is .ARM.extab
0x00003ab0 - 0x00004590 is .rodata
0x00005cd8 - 0x00005d40 is .data.rel.ro.local
0x00005d40 - 0x00005d48 is .preinit_array
0x00005d48 - 0x00005d54 is .init_array
0x00005d54 - 0x00005d5c is .fini_array
0x00005d60 - 0x00005d88 is .data.rel.ro
0x00005d88 - 0x00005ed0 is .dynamic
0x00005ed0 - 0x00006000 is .got
0x00006000 - 0x00006629 is .bss
(gdb) c
Continuing.
[New Thread 1578]
Program received signal SIGINT, Interrupt.
0xb6c93894 in ?? ()
(gdb) bt
#0 0xb6c93894 in ?? ()
#1 0xb6c6ce72 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
On Linux GDB 7.10 is able to load the symbols for the shared libraries and display the correct thread stacks:
(gdb) bt
#0 0xb6c93894 in epoll_pwait () from /vagrant/nexus5/system/lib/libc.so
#1 0xb6c6ce72 in epoll_pwait () from /vagrant/nexus5/system/lib/libc.so
#2 0xb6c6ce80 in epoll_wait () from /vagrant/nexus5/system/lib/libc.so
#3 0xb6ebfc5a in android::Looper::pollInner(int) () from /vagrant/nexus5/system/lib/libutils.so
#4 0xb6ebfed6 in android::Looper::pollOnce(int, int, int, void**) () from /vagrant/nexus5/system/lib/libutils.so
#5 0xb6e04ce4 in android::NativeMessageQueue::pollOnce(JNIEnv, jobject, int) ()
from /vagrant/nexus5/system/lib/libandroid_runtime.so
#6 0x7389656e in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) c
Continuing.
[New Thread 32044]
^C
Program received signal SIGINT, Interrupt.
0xb6c93894 in __epoll_pwait () from /vagrant/nexus5/system/lib/libc.so
The text was updated successfully, but these errors were encountered: