w/o -gsplit-dwarf, gdb can load debug info from the program compiled w/ -g3 w/ -gsplit-dwarf, gdb can __NOT__ load debug info from the .dwo file compiled w/ -g3, such as macro definitions Is this a known issue? Bliss, --gys
gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0 It can be a bug in gcc...
I see this too, here's a small reproducer: --- #define NUM_STUFF 18 int main() { return NUM_STUFF; } --- $ gcc test.c -g3 -O0 -gsplit-dwarf -c && gcc test.o -o test $ gdb ./test (gdb) start Temporary breakpoint 1 at 0x111d: file test.c, line 4. Starting program: /home/simark/src/babeltrace/src/lib/graph/test Temporary breakpoint 1, main () at test.c:4 4 return NUM_STUFF; (gdb) p NUM_STUFF No symbol "NUM_STUFF" in current context. Without -gsplit-dwarf, NUM_STUFF is printed correctly.
looks gcc does not produce .dwo file properly for .debug_macro.dwo section; gcc uses DW_FORM_GNU_str_index, but use DW_MACRO_define_strp as opcode; the actual operands for DW_MACRO_define_strp are unsigned LEB128, which can't be read by fixed offset.