【问题标题】:Remote Debugging with GDB: Program dies after SIGILL, Illegal instruction使用 GDB 进行远程调试:程序在 SIGILL 后终止,非法指令
【发布时间】:2016-03-31 02:38:01
【问题描述】:

我正在尝试在兼容 ARMv6 的处理器 rev 4 上调试代码。

我用--host=arm-openwrt-linux-gnueabi 标志编译了GDBserver。 gdb 本身是用

编译的
   --host=x86_64-unknon-linux-gnu --target=arm-openwrt-linux-gnueabi --with-expat

如果我现在连接到 gdbserver 中,我的程序正在运行,我收到以下错误消息:

(gdb) target remote 192.168.x.x:2345
Remote debugging using 192.168.x.x:2345
Cannot access memory at address 0x0
0xb6fdaec0 in ?? ()
(gdb) set sysroot /home/xxxxxx/Dokumente/lgn-sdk-v0.2/staging_dir/toolchain-arm_v6k_gcc-4.6-linaro_eglibc-2.15_eabi/
Reading symbols from /home/xxxxxx/Dokumente/lgn-sdk-v0.2/staging_dir/toolchain-arm_v6k_gcc-4.6-linaro_eglibc-2.15_eabi/lib/ld-linux.so.3...done.
Loaded symbols for /home/xxxxxxx/Dokumente/lgn-sdk-v0.2/staging_dir/toolchain-arm_v6k_gcc-4.6-linaro_eglibc-2.15_eabi/lib/ld-linux.so.3
(gdb) n
Single stepping until exit from function _start,
which has no line number information.

Program received signal SIGILL, Illegal instruction.
0xb6fe8d20 in _dl_debug_initialize () from /home/xxxxx/Dokumente/lgn-sdk-v0.2/staging_dir/toolchain-arm_v6k_gcc-4.6-linaro_eglibc-2.15_eabi/lib/ld-linux.so.3
(gdb)  
Single stepping until exit from function _dl_debug_initialize,
which has no line number information.

Program terminated with signal SIGILL, Illegal instruction.

【问题讨论】:

  • 您是否使用正确的-march 编译了您自己的程序?以非法指令退出的是你的程序,而不是 gdb。
  • 是的,我是这么认为的。我在我的 makefile 中使用了-march=armv6k 标志。
  • 如果你在没有 gdbserver 的情况下运行你的程序是否也会被杀死?
  • 不,程序在没有 gdbserver 的情况下运行良好。它只是一个测试 gdb 的小 Hello World 示例。 #include <stdio.h> #include <string.h> int main(int arc, char* argv[]){ printf("anfang \n"); printf("ende \n"); }
  • 那么,您是否将 gdbserver 链接到您的二进制文件中?还是以gdbserver yourbinary 开头?

标签: c gdb


【解决方案1】:

我没有完整的答案,但我有一个类似的问题并通过以下方式解决它:

  • 通过目标远程连接
  • 打破主线
  • 继续
  • 然后,设置 sysroot

这让我能够度过崩溃。不过,我当然会对更好的解决方案感兴趣。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-12-05
    • 2014-07-19
    • 2011-10-18
    • 1970-01-01
    • 2013-08-26
    • 1970-01-01
    • 1970-01-01
    • 2017-06-27
    相关资源
    最近更新 更多