Среда разработки:
NDK: r7
SDK и инструменты: r15
AVD: GB2.3.3, уровень API 10
Я написал тестовое приложение, в котором поток будет запущен вродной.Я сохранил точку разрыва в потоке.(По сути, когда я пытался на Galaxy S2, я получал сообщение об ошибке «Отладка потоков не поддерживается в этой платформе». Поэтому я создал AVD 2.3.3 Level 10).
После этого я получил такую ошибку
#0 0xafd0c51c in epoll_wait () from /Volumes/SecureCode/webos/rta/android/obj/local/armeabi/libc.so
#1 0xa81216a6 in ?? ()
Я гуглил и нашел это Решение (ссылка здесь).
Я следовал заНаправляющие линии есть
$ adb pull /system/lib lib
$ ndk-gdb
...
(gdb) set solib-search-path lib
Но после этого я также не могу достичь точки останова.Я все еще застреваю в этом poll_wait () и не двигаюсь вперед.
D:\EclipseTestWorkspace\CallbackJava>sh
sh-4.1$ ndk-gdb --force --start --verbose
Android NDK installation path: /cygdrive/c/Android/android-ndk
Using default adb command: /cygdrive/c/Android/android-sdk-windows/platform-tools/adb
ADB version found: Android Debug Bridge version 1.0.29
Using final ADB command: '/cygdrive/c/Android/android-sdk-windows/platform-tools/adb'
Using auto-detected project path: .
Found package name: com.callback
ABIs targetted by application: armeabi
Device API Level: 10
Device CPU ABI: armeabi
Compatible device ABI: armeabi
Found debuggable flag: true
Found device gdbserver: /data/data/com.callback/lib/gdbserver
Using gdb setup init: ./libs/armeabi/gdb.setup
Using toolchain prefix: /cygdrive/c/Android/android-ndk/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-
Using app out directory: ./obj/local/armeabi
Found data directory: '/data/data/com.callback'
Found first launchable activity: .CallbackJavaActivity
Launching activity: com.callback/.CallbackJavaActivity
## COMMAND: /cygdrive/c/Android/android-sdk-windows/platform-tools/adb shell am start -n com.callback/.CallbackJavaActivity
Starting: Intent { cmp=com.callback/.CallbackJavaActivity }
## COMMAND: /cygdrive/c/Android/android-sdk-windows/platform-tools/adb shell sleep 2
Found running PID: 352
Launched gdbserver succesfully.
## COMMAND: /cygdrive/c/Android/android-sdk-windows/platform-tools/adb shell run-as com.callback lib/gdbserver +debug-socket --attach 352
Setup network redirection
## COMMAND: /cygdrive/c/Android/android-sdk-windows/platform-tools/adb forward tcp:5039 localfilesystem:/data/data/com.callback/debug-socket
## COMMAND: /cygdrive/c/Android/android-sdk-windows/platform-tools/adb pull /system/bin/app_process obj/local/armeabi/app_process
Attached; pid = 352
Listening on sockaddr socket debug-socket
19 KB/s (5660 bytes in 0.281s)
Pulled app_process from device/emulator.
## COMMAND: /cygdrive/c/Android/android-sdk-windows/platform-tools/adb pull /system/lib/libc.so obj/local/armeabi/libc.so
80 KB/s (273868 bytes in 3.325s)
Pulled libc.so from device/emulator.
GNU gdb 6.6
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=i586-mingw32msvc --target=arm-elf-linux".
(no debugging symbols found)
Error while mapping shared library sections:
/system/bin/linker: No such file or directory.
----- So many similar errors -----
Error while mapping shared library sections:
gralloc.default.so: No such file or directory.
(no debugging symbols found)
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
warning: shared library handler failed to enable breakpoint
0xafd0c51c in epoll_wait () from D:/EclipseTestWorkspace/CallbackJava/obj/local/armeabi/libc.so
(gdb) set solib-search-path lib
Error while mapping shared library sections:
/system/bin/linker: No such file or directory.
Error while mapping shared library sections:
gralloc.default.so: No such file or directory.
Symbol file not found for /system/bin/linker
Reading symbols from D:\EclipseTestWorkspace\CallbackJava/lib/libc.so...(no debugging symbols found)...done.
Loaded symbols for D:\EclipseTestWorkspace\CallbackJava/lib/libc.so
----- So many similar errors -----
Loaded symbols for D:\EclipseTestWorkspace\CallbackJava/lib/libwebcore.so
Symbol file not found for gralloc.default.so
(gdb) file ./libs/armeabi/libcallbacks.so
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from D:\EclipseTestWorkspace\CallbackJava/./libs/armeabi/libcallbacks.so...(no debugging symbols found)...done.
(gdb) file ./obj/local/armeabi/libcallbacks.so
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from D:\EclipseTestWorkspace\CallbackJava/./obj/local/armeabi/libcallbacks.so...done.
(gdb) break callbacks_java.cpp:appcallback_register
Breakpoint 1 at 0x1a64: file D:/EclipseTestWorkspace/CallbackJava/jni/callbacks_java.cpp, line 419.
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x00001a64 in appcallback_register at D:/EclipseTestWorkspace/CallbackJava/jni/callbacks_java.cpp:419
(gdb) where
#0 0xafd0c51c in epoll_wait () from D:\EclipseTestWorkspace\CallbackJava/lib/libc.so
#1 0xa81211b4 in android::Looper::pollInner () from D:\EclipseTestWorkspace\CallbackJava/lib/libutils.so
#2 0x00000000 in ?? ()
(gdb) where
#0 0xafd0c51c in epoll_wait () from D:\EclipseTestWorkspace\CallbackJava/lib/libc.so
#1 0xa81211b4 in android::Looper::pollInner () from D:\EclipseTestWorkspace\CallbackJava/lib/libutils.so
#2 0x00000000 in ?? ()
(gdb) c
Continuing.
Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0x1a64: Input/output error.
(gdb)
Что я хотел бы сосредоточить на основной части как
(gdb) file ./libs/armeabi/libcallbacks.so
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from D:\EclipseTestWorkspace\CallbackJava/./libs/armeabi/libcallbacks.so...(no debugging symbols found)...done.
(gdb) file ./obj/local/armeabi/libcallbacks.so
A program is being debugged already.
Are you sure you want to change the file? (y or n) y
Reading symbols from D:\EclipseTestWorkspace\CallbackJava/./obj/local/armeabi/libcallbacks.so...done.
(gdb) break callbacks_java.cpp:appcallback_register
Breakpoint 1 at 0x1a64: file D:/EclipseTestWorkspace/CallbackJava/jni/callbacks_java.cpp, line 419.
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x00001a64 in appcallback_register at D:/EclipseTestWorkspace/CallbackJava/jni/callbacks_java.cpp:419
(gdb) where
#0 0xafd0c51c in epoll_wait () from D:\EclipseTestWorkspace\CallbackJava/lib/libc.so
#1 0xa81211b4 in android::Looper::pollInner () from D:\EclipseTestWorkspace\CallbackJava/lib/libutils.so
#2 0x00000000 in ?? ()
(gdb) where
#0 0xafd0c51c in epoll_wait () from D:\EclipseTestWorkspace\CallbackJava/lib/libc.so
#1 0xa81211b4 in android::Looper::pollInner () from D:\EclipseTestWorkspace\CallbackJava/lib/libutils.so
#2 0x00000000 in ?? ()
(gdb) c
Continuing.
Warning:
Cannot insert breakpoint 1.
Error accessing memory address 0x1a64: Input/output error.
(gdb)
Так что из последней ошибки, что японять это с учетом абсолютного адреса 0x1a64.Он не учитывает относительный адрес (адрес времени выполнения), поэтому не может достичь точки останова.а также застрять в epoll_wait (), не двигаясь дальше.
Может ли кто-нибудь помочь мне, как мне продолжить?
Спасибо и С уважением,
SSuman185