开发者

C program debugging in gdb problem

I'm trying to run my app on gdb. Therefore I compiled it with the 'g' option. But when I'm running gdb ./app I get:

DW_FORM_strp pointing outside of .debug_str section [in module /home/w/app]

And I cannot do any break:

(gdb) break main
No symbol table is loaded.  Use the "file" command. 
(gdb) . 
开发者_C百科


Most likely you've compiled your program with a newer version of GCC, but are debugging it with an old GDB.

Else, you have a buggy GCC version, which puts incorrect debug info into your executable.


Use objdump -W to look at the Elf file's Dwarf debug information to see the .debug_str table.

Each DW_FORM_strp is an offset into this table.

Compiling with -g (or -g-dwarf2) puts the Dwarf information in each object file with its own portion of .debug_str section strings.

Linking those object files with -g tries to make unique strings and doesn't update all the DW_FORM_strp offsets properly. Seen with gcc 4.3.4's ld.

We were pasing CC_FLAGS to a makefile link step by accident.

Workaround : don't link with -g flag.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜