心胸决定格局,眼界决定境界...

ndk gdb 若干问题

http://blog.csdn.net/lovexieyuan520/article/details/43212333

配置:

  • Add android.os.Debug.waitForDebugger(); before loading your native library. This might help.
  • Add APP_OPTIM := debug in Application.mk
  • Build with ndk-build NDK_DEBUG=1

首先要保证   ndk-gdb --verbose --port=5050,能成功进入gdb中。这样,eclipse才能统一进入gdb。

第二步:adb pull /system/bin/linker <your_project_base_dir>/obj/local/armeabi/linker

第三步:Run -> Debug As -> Android Native Application"

 

1.在主目录下:

ndk-gdb

问题1:默认5039端口被占用

    换端口,eg:  ndk-gdb  --port=5050

问题2:Add: Also during debug in console shows: "warning: Could not load shared library symbols for 95 libraries

After struggling a lot to debug on Eclipse this is my recipe:

Do the usual steps:

  • Add android.os.Debug.waitForDebugger(); before loading your native library. This might help.
  • Add APP_OPTIM := debug in Application.mk
  • Build with ndk-build NDK_DEBUG=1

Then, what I found different:

  • Open a console and run:

adb pull /system/bin/linker <your_project_base_dir>/obj/local/armeabi/linker

最后Run -> Debug As -> Android Native Application"

由于端口号已改,在debug configuration里面修改port即可

3.有时gdb.setup  gdbserver  没有生成,在cmd中,  ndk-build  NDK-DEBUG=1

 

4.could not extract pid of application on device/emulator

ndk-gdb --start --verbose --force

5.Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response

经过尝试,最后发现关闭AndroidServer.exe进程后,就能顺利的DEBUG了

6.
No symbol table is loaded.  Use the "file" command.  

使用ndk-gdb --start 启动程序第一个activity,但是此时so文件并没有被加载。
http://qiang106.iteye.com/blog/1830416
http://my.oschina.net/u/1429862/blog/226217

如果是在eclipse调试的过程中,则再console输入info sharedlibrary,查看依赖的所有动态库。 file obj/指定调试断点的so

7.我用NDK(android-ndk-r9c)的ndk-gdb —start 调试(sample的)hellojni。出现了“waiting for debugger”弹窗不消失问题

    public void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);

        //就是下面这一句代码可以让程序停下来等待JDB的连接 
        android.os.Debug.waitForDebugger();
 8.JDB  路径有空格(可改可不改,因为没有用到 Java的调试器)
如果改,如下:

 

I faced this problem too and I saw many posts but nothing really worked. There is a small trick that I did and things started working.

My JAVA_HOME was set to C:/Program Files/Java/jdk1.7.0_23. The problem was with Program Files directory and I was getting the same error.

In Windows there is a short name created for every directory with a space which is without a space. You can see it by running dir /X command on the command prompt. The Short name for Program Files was PROGRA~1.

In the Windows env variable through My Computer I changed the JAVA_HOME to C:/PROGR~1/Java/jdk1.7.0_23 and in hadoop-env.sh I changed JAVA_HOME to /cygdrv/c/PROGRA~1/Java/jdk1.7.0_23.

 
posted @ 2016-07-04 18:21  WELEN  阅读(774)  评论(0)    收藏  举报