Android:建立静态的aarch64 gdb

时间:2018-12-10 02:56:18

标签: android gdb

在Android上使用gdbserver和gdbserver64以及在主机上使用配套的aarch64 gdb时遇到很多麻烦。例如,我遇到了这样的问题,其中gdb输出的似乎是胡说八道:

(gdb) target remote :5039
Remote debugging using :5039
warning: Could not load vsyscall page because no executable was specified
try using the "file" command first.
0x0000007fa7921d2c in ?? ()
(gdb) bt
Python Exception <type 'exceptions.ImportError'> No module named gdb.frames: 
#0  0x0000007fa7921d2c in ?? ()
#1  0x0000000040000600 in ?? ()
Backtrace stopped: Cannot access memory at address 0x22eee199476794f4
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x0000007f87c249b4 in ?? ()
(gdb) x/4i $pc
=> 0x7f87c249b4:    ldrb    w8, [x0,#432]
   0x7f87c249b8:    cbz w8, 0x7f87c249ec
   0x7f87c249bc:    ldr x8, [x19,#3632]
   0x7f87c249c0:    ldr x9, [x8,#24]
(gdb) bt
Python Exception <type 'exceptions.ImportError'> No module named gdb.frames: 
#0  0x0000007f87c249b4 in ?? ()
#1  0x0000007fa4b4fb25 in ?? ()
#2  0x0000000000000001 in ?? ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) c
Continuing.
[New Thread 22374]
[New Thread 22375]

Program received signal SIGSEGV, Segmentation fault.
0x0000007f87c249b4 in ?? ()
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x0000007f87c249b4 in ?? ()

这几乎是不可能使用的,因为一切都完全无济于事。没有符号被加载,没有回溯线甚至是遥不可及的。在使用静态gdb追踪或跟踪该应用程序时,该应用程序还会在没有被信号通知的地方反复发出信号(仅举一个特定的问题)。

但是,我能够使用预构建的armv7a 静态链接 gdb二进制文件相对轻松地调试Android模拟器中的某些32位应用程序。我在设备外壳中运行了静态gdb,没有任何问题。我可以轻松加载符号,也没有奇怪的信号传输问题。

我在任何地方都找不到静态链接的aarch64 gdb二进制文件,因此我尝试在aarch64 chroot中构建一个二进制文件。我确实设法为aarch64构建了gdb,并且我使用了these configure flags

LDFLAGS="-static" ../configure --prefix=/noprefix --enable-static --disable-shared --disable-interprocess-agent --disable-libcc1

但是它是动态链接的,这不是我想要的。

root@gram:/opt/gdb-aarch64/noprefix/bin# file gdb
gdb: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, for GNU/Linux 3.7.0, BuildID[sha1]=f1a630e569467794c45b4389f510720c4342704b, not stripped

如何构建静态链接的Linux aarch64 gdb?

0 个答案:

没有答案
相关问题