我有一个 pintool 可以调用PIN_Backtrace()
. 似乎libunwind
不支持某些寄存器x86_64
,这会导致以下错误消息和异常退出:
libunwind: uint64_t libunwind::Registers_x86_64::getRegister(int) const Source/bionic/libunwind/src/Registers.hpp:342 - unsupported x86_64 register
Aborted
即使出现这些错误,我也希望程序继续运行。处理这种情况的最有效方法是什么?
我调试了我的pintool
使用gdb
。abort()
这是调试器接收到的回溯:
(gdb) bt
#0 0x00007ffff726c22b in ?? ()
#1 0x00007fffeca88730 in ?? ()
#2 0x00007ffff726c363 in ?? ()
#3 0x0000000000005386 in ?? ()
#4 0x0000000000000001 in ?? ()
#5 0x0000000000000000 in ?? ()
info proc mapping
显示地址范围如下:
...
0x7fffeea3a000 0x7ffff71fb000 0x87c1000 0x0
0x7ffff71fb000 0x7ffff7283000 0x88000 0x0 /home/ahmad/Programs/pin-3.7-97619-g0d0c92f4f-gcc-linux/intel64/runtime/pincrt/libc-dynamic.so
0x7ffff7283000 0x7ffff7284000 0x1000 0x0
0x7ffff7284000 0x7ffff7286000 0x2000 0x88000 /home/ahmad/Programs/pin-3.7-97619-g0d0c92f4f-gcc-linux/intel64/runtime/pincrt/libc-dynamic.so
...
和
...
0x7fffe1687000 0x7fffec287000 0xac00000 0x0
0x7fffec287000 0x7fffed28e000 0x1007000 0x0
0x7fffed28e000 0x7fffedb6a000 0x8dc000 0x0
...
似乎使用的libunwind
库Pin
是PinCRT
. 这可以在以下info /proc/<PID>/maps
输出中看到pintool
:
...
7ffff7e33000-7ffff7e45000 r-xp 00000000 08:13 466277 /home/ahmad/Programs/pin-3.7-97619-g0d0c92f4f-gcc-linux/intel64/runtime/pincrt/libunwind-dynamic.so
7ffff7e45000-7ffff7e46000 r--p 00011000 08:13 466277 /home/ahmad/Programs/pin-3.7-97619-g0d0c92f4f-gcc-linux/intel64/runtime/pincrt/libunwind-dynamic.so
7ffff7e46000-7ffff7e47000 rw-p 00012000 08:13 466277 /home/ahmad/Programs/pin-3.7-97619-g0d0c92f4f-gcc-linux/intel64/runtime/pincrt/libunwind-dynamic.so
...