我遇到了 ndk-gdb 非常奇怪的问题。
当我尝试使用以下命令时:break < fun_name >, break < file_name:line >, info functions 我得到错误和 gdb 退出:
(gdb) b Java_com_rtsoft_shared_AppRenderer_nativeResize
readchar: Got EOF
Remote side has terminated connection. GDBserver will reopen the connection.
Listening on Unix socket debug-socket
/cygdrive/c/Programs/android-ndk-r8b/ndk-gdb: line 699: 2876 Segmentation fault $GDBCLIENT -x `native_path $GDBSETUP`
Tha poroblem 我看到这个 gdb 没有看到我的 src 文件,但是为什么呢?
“info sharedlib”显示我加载的库以及它们所有的调试符号。
No libwmlscriptcore.so
No libwebcore.so
0x81186590 0x813909a8 Yes C:/Workspace/Irrlicht/ElementDefence/project/android/obj/local/armeabi/libirrlicht.so
0x80cbb5d8 0x80dcbdcc Yes C:/Workspace/Irrlicht/ElementDefence/project/android/obj/local/armeabi/libBullet.so
0x81939240 0x81a49be8 Yes C:/Workspace/Irrlicht/ElementDefence/project/android/obj/local/armeabi/libelementaldefence.so
No gralloc.msm7k.so
No libGLES_android.so
No libgsl.so
"show dir" 显示所有包含 src 文件 (.c, .cpp) 的有效目录。
show dir
Source directories searched: C:/Programs/android-ndk-r8b/platforms/android-8/arch-arm/usr/include;C:/Workspace/Irrlicht/ElementDefence/project/android/jni;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/Entity;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/GUI;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/Manager;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/Math;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/Renderer;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/Network;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/Audio;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/Renderer/linearparticle/sources;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/Irrlicht;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../project/source;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../project/source/Component;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../project/source/GameObjects;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../project/source/GameObjects/CreepStates;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../project/source/GameObjects/TowerStates;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../project/source/gs;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../project/source/mgr;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../project/source/mgr/CursorActions;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../project/source/mgr/MagicEffects;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../project/source/mgr/MagicEffects/Affectors;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../project/source/utils;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/android;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/util;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/Irrlicht/include;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/Irrlicht/source/Irrlicht;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/Irrlicht/source/Irrlicht/libpng;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/Irrlicht/source/Irrlicht/jpeglib;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/ClanLib-2.0/Sources;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/util/boost;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/memory;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/Bullet;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/pugixml;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/util/unzip;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/util/zlib;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/util/bzip2;C:/Workspace/Irrlicht/ElementDefence/project/android/jni/../../../shared/Irrlicht/irrBullet;C:/Programs/android-ndk-r8b/sources/cxx-stl/gnu-libstdc++/4.6/include;C:/Programs/android-ndk-r8b/sources/cxx-stl/gnu-libstdc++/4.6/libs/armeabi/include;$cdir;$cwd
当应用程序崩溃 gdb 停止时,显示堆栈跟踪并对“c”命令做出反应,但不显示任何 src 文件。
当程序在 Java 制动点(在 Eclipce 中)停止时,我在 cygwin shell 中运行以下命令(具有管理员权限):
$NDK/ndk-gdb --verbose --force --adb=/cygdrive/c/Programs/android-sdk/platform-tools/adb.exe
我在设备上调试。尝试使用 android-ndk-r7-crystax-5.beta2 和 android-ndk-r8b。都是一样的错误。有人有这个问题吗?
谢谢。