我尝试在我的root用户上附加一个进程并使用GDB创建corefile但是它无法创建gcore文件,因为无法找到这些符号。
在我的手机上,我打开终端应用程序并输入
su
在终端中授予root访问权限。我输入
dumpsys meminfo
显示所有正在运行的进程。我输入
gdbserver :1234 --attach 5132
在我的电脑上,我打开gdb.exe(来自Android NDK)并输入
(gdb) target remote 192.168.1.13:1234
我得到了那些信息
(gdb) target remote 192.168.1.13:1234
Remote debugging using 192.168.1.13:1234
warning: Architecture rejected target-supplied description
Reading /system/bin/app_process32_original from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
warning: A handler for the OS ABI "Cygwin" is not built into this configuration
of GDB. Attempting to continue with the default arm settings.
Reading /system/bin/app_process32_original from remote target...
warning: A handler for the OS ABI "Cygwin" is not built into this configuration
of GDB. Attempting to continue with the default arm settings.
Reading symbols from target:/system/bin/app_process32_original...(no debugging symbols found)...done.
0xb6e8b0f8 in ?? ()
使用我自己编译的gdb.exe,我得到了另一个信息
(gdb) target remote 192.168.1.13:1234
Remote debugging using 192.168.1.13:1234
warning: Can not parse XML target description; XML support was disabled at compile time
Reading /system/bin/app_process32_original from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /system/bin/app_process32_original from remote target...
Reading symbols from target:/system/bin/app_process32_original...(no debugging symbols found)...done.
Remote 'g' packet reply is too long: fcffffff605fd9be10000000ffffffff0000000008000000000000005a010000a87687b414000000000000004010c032105fd9be005fd9be1352e6b6f8b0e8b610000f204a280000000000003d0000001100000000000000000000006000000004000000d002000068010000680100003702000052000010110000001600000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004a28000072002e0073006500720076006900630065002e0056006f006900700043006f006e006e006500630074006f0072005300e83bb770e83bb77088639b70e83bb770e83bb770e83bb770e83bb770e83bb770e83bb770e83bb770e83bb770e83bb770e83bb770e83bb770e83bb770e83bb77011000060
0xb6e8b0f8 in ?? ()
我输入
gcore
它说
Can't create a corefile
我在/ system / bin
中安装了与我的内核架构匹配的正确gdbserver二进制文件我在Android 4.4.4下尝试了不同的Android操作系统,它没有PIE保护功能,但我仍然遇到同样的问题。我尝试使用移植版本的gdb客户端,它运行得很好。
我只想用运行Android 5.1.1和2 GB RAM的强大设备保存核心文件,而不是在我的低端平板电脑上使用gdb客户端,该平板电脑具有512 MB RAM并运行Android 4.4.4,并且gdb无法使用由于内存不足而完全创建核心文件。
答案 0 :(得分:1)
编译GDB时,我必须给目标--target arm-linux-androideabi
而不是--target arm-eabi
并且它完美无缺
答案 1 :(得分:1)
只需下载gdb源代码并按以下步骤编译:
1)。使用以下命令编译gdb:
cd gdb-7.11/gdb
./configure --target=arm-linux-androideabi --with-python --prefix=$HOME/mybinaries/bin
make
make install
2)。使用以下命令编译gdbserver:
cd gdb-7.11/gdb/gdbserver
CC=arm-linux-androideabi-gcc LDFLAGS="-fPIC -pie" ./configure --target=arm-linux-androideabi --host=arm-linux-androideabi --prefix=$HOME/mybinaries/bin
make
make install