GDB说"无符号表,"但纳米节目文件中有调试符号 [英] GDB says "no symbol table," but nm shows file has debug symbols

查看:238
本文介绍了GDB说"无符号表,"但纳米节目文件中有调试符号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图调试使用GDB一个简单的C项目,但GDB似乎无法找到该程序的调试符号不管我怎么编译。

I'm trying to debug a simple C project using GDB, but GDB can't seem to find the debug symbols for the program no matter how I compile it.

当我加载该程序进入GDB,它声称已经成功地读取符号,因为它打印

When I load the program into GDB, it claims to have read the symbols successfully because it prints

Reading symbols from /home/edward/<executable>...done.

然而,当我运行该程序,打破分段错误,然后键入信息当地人,它说:

No symbol table info available.

此外, BT 显示,执行的功能我写了(不是一个系统或库调用)内停止,但没有行号信息,只是原始的内存地址。

Also, bt shows that execution stopped inside a function I wrote (not a system or library call), but there is no line number information, just raw memory addresses.

为什么不能GDB找到或使用较早成功读取的符号?我已经在我运行的二进制文件运行纳米 objdump的,他们都显示部分如 .debug_info .debug_line ,因此文件事实上确实包含调试符号。

Why can't GDB find or use the symbols it successfully read earlier? I've run nm and objdump on the binary file I'm running, and they both show sections like .debug_info, .debug_line, so the file does in fact contain debugging symbols.

我通常与设置以下标志一个Makefile编译

I usually compile with a Makefile that sets the following flags:

CFLAGS = -mno-red-zone -fno-omit-frame-pointer -ggdb -O0 -I. -Wdeclaration-after-statement -Wall

我可以看到正在使用时许调用gcc的。不过,我试图改变只是 -g ,并通过调用 gcc的-g -O0 在手动编译简单的测试文件,结果还是一样:二进制文件中包含调试符号,和GDB读取他们,但援引消息GDB的任何命令结果的调试信息不​​可用

which I can see are being used when make invokes gcc. However, I've tried changing to just -g, and compiling manually by invoking gcc -g -O0 on a simple test file, and the result is still the same: the binary file contains debug symbols, and GDB reads them, but invoking any GDB command results in a message that debug information is not available.

更新

我运行Ubuntu 12.04,我GDB的版本是7.4,我的版本的GCC 4.8.1是

I'm running Ubuntu 12.04, my GDB version is 7.4, and my GCC version is 4.8.1.

如果我设置投诉10000 在GDB,然后加载该文件,它打印以下投诉:

If I set complaints 10000 in GDB and then load the file, it prints the following complaints:

Reading symbols from /home/edward/<snip>/minithread...
DW_AT_low_pc 0x400690 is not < DW_AT_high_pc 0x33 for DIE at 0x205 [in module /home/edward/<snip>/minithread]
...DW_AT_low_pc 0x4006c3 is not < DW_AT_high_pc 0xa9 for DIE at 0x235 [in module /home/edward/<snip>/minithread]
...DW_AT_low_pc 0x40076c is not < DW_AT_high_pc 0xad for DIE at 0x287 [in module /home/edward/<snip>/minithread]
...DW_AT_low_pc 0x400819 is not < DW_AT_high_pc 0xe7 for DIE at 0x2d3 [in module /home/edward/<snip>/minithread]
...DW_AT_low_pc 0x400900 is not < DW_AT_high_pc 0x4f for DIE at 0x345 [in module /home/edward/<snip>/minithread]
...DW_AT_low_pc 0x40094f is not < DW_AT_high_pc 0x55 for DIE at 0x39d [in module /home/edward/<snip>/minithread]
...DW_AT_low_pc 0x4009a4 is not < DW_AT_high_pc 0x38 for DIE at 0x3e7 [in module /home/edward/<snip>/minithread]
...DW_AT_low_pc 0x4009dc is not < DW_AT_high_pc 0x43 for DIE at 0x433 [in module /home/edward/<snip>/minithread]
...DW_AT_low_pc 0x400a20 is not < DW_AT_high_pc 0x2e for DIE at 0x56c [in module /home/edward/<snip>/minithread]
...DW_AT_low_pc 0x400a4e is not < DW_AT_high_pc 0x2e for DIE at 0x5aa [in module /home/edward/<snip>/minithread]
...DW_AT_low_pc 0x400a7c is not < DW_AT_high_pc 0x29 for DIE at 0x5d4 [in module /home/edward/<snip>/minithread]
...DW_AT_low_pc 0x400aa5 is not < DW_AT_high_pc 0x49 for DIE at 0x620 [in module /home/edward/<snip>/minithread]
...DW_AT_low_pc 0x400aee is not < DW_AT_high_pc 0xca for DIE at 0x66c [in module /home/edward/<snip>/minithread]
...DW_AT_low_pc 0x400bb8 is not < DW_AT_high_pc 0x7bb for DIE at 0x6f0 [in module /home/edward/<snip>/minithread]...done.

这些错误问题的原因是什么?难道他们的意思是我的GDB是错误的版本?

Are these errors the cause of the problem? Do they mean my GDB is the "wrong" version?

推荐答案

GCC 4.8.1生成dwarf4调试信息这GDB 7.4无法理解。您需要安装GDB 7.6

gcc 4.8.1 generates dwarf4 debug info which gdb 7.4 can't understand. You need to install gdb 7.6

这篇关于GDB说&QUOT;无符号表,&QUOT;但纳米节目文件中有调试符号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆