Bug 24675 - gdb not loading debug info from .dwo file
Summary: gdb not loading debug info from .dwo file
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: 8.2.1
: P1 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-06-13 02:00 UTC by garyu.shi
Modified: 2019-06-29 23:53 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2019-06-29 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description garyu.shi 2019-06-13 02:00:28 UTC
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
Comment 1 garyu.shi 2019-06-13 03:04:03 UTC
gcc (Ubuntu 7.4.0-1ubuntu1~18.04) 7.4.0

It can be a bug in gcc...
Comment 2 Simon Marchi 2019-06-29 02:26:03 UTC
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.
Comment 3 garyu.shi 2019-06-29 23:53:58 UTC
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.