调试android原生二进制文件

时间:2014-12-15 13:37:05

标签: android debugging reverse-engineering reverse

我想调试一个Android原生二进制文件,我从https://sites.google.com/site/ortegaalfredo/android here

下载了gdb

但我有这个输出:

root@android:/data/local/tmp # ./gdb /system/bin/ls                            


dlopen failed on 'libthread_db.so.1' - libthread_db.so.1: cannot open shared object file: No such file or directory
GDB will not be able to debug pthreads.

GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "arm-none-linux-gnueabi"...
(no debugging symbols found)
(gdb) r
Starting program: /system/bin/ls 
(no debugging symbols found)

Program received signal SIGILL, Illegal instruction.
0x40005a52 in rtld_db_dlactivity () from /system/bin/linker

所有二进制文件中的错误

感谢您的帮助

1 个答案:

答案 0 :(得分:1)

据我了解你必须:

  1. 将gdb-server上传到设备(设置的简单方法是显示为debuggable true)。如果你使用android stiudio也将jniDebuggable设置为true:

    android{ buildTypes { debug { jniDebuggable true debuggable true } } }

  2. 使用如下的调试符号构建您的本机库:

    ndk-build NDK_DEBUG=1 APP_OPTIM=debug

  3. 在设备或模拟器上运行您的应用,并从&gt;项目文件夹&lt;:ndk-gdb --verbose

  4. 调用