我尝试在我的根 Android 上附加一个进程并使用 GDB 创建核心文件,但它无法创建 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 无法完全创建corefile 由于内存不足。