Bug 1956475 - gdb can't read the debuginfo written by gcc 11: Dwarf Error: wrong unit_type in compilation unit header (is DW_UT_split_compile (0x05), should be DW_UT_type (0x02))
Summary: gdb can't read the debuginfo written by gcc 11: Dwarf Error: wrong unit_type ...
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: 34
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Kevin Buettner
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-05-03 18:32 UTC by Michael Stahl
Modified: 2021-05-03 18:32 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: ---
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)

Description Michael Stahl 2021-05-03 18:32:19 UTC
Description of problem:

found this when building LibreOffice on Fedora 34 with --enable-dbgutil; it will use these debug-related flags:

-ggdb2 -gsplit-dwarf -ggnu-pubnames

apparently GCC 11 will use -gdwarf-5 by default but GDB doesn't support it.


Version-Release number of selected component (if applicable):
gcc-11.1.1-1.fc34.x86_64
gdb-10.1-14.fc34.x86_64

How reproducible:
always

Steps to Reproduce:
1. trivial test2.c file with main function
2. see below 

Actual results:

 > g++ -ggdb2 -gsplit-dwarf -ggnu-pubnames test2.c
 > gdb a.out 
GNU gdb (GDB) Fedora 10.1-14.fc34
...
Reading symbols from a.out...
Dwarf Error: wrong unit_type in compilation unit header (is DW_UT_split_compile (0x05), should be DW_UT_type (0x02)) [in module /tmp/a-test2.dwo]
(No debugging symbols found in a.out)
(gdb) b main
Breakpoint 1 at 0x40110a
(gdb) r
Starting program: /tmp/a.out 
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.33-5.fc34.x86_64
Breakpoint 1, 0x000000000040110a in main ()
Missing separate debuginfos, use: dnf debuginfo-install libgcc-11.1.1-1.fc34.x86_64 libstdc++-11.1.1-1.fc34.x86_64
(gdb) list
No symbol table is loaded.  Use the "file" command.
(gdb) s
Single stepping until exit from function main,
which has no line number information.
0x00007ffff7a7bb75 in __libc_start_main () from /lib64/libc.so.6


Expected results:

 > g++ -ggdb2 -gsplit-dwarf -ggnu-pubnames -gdwarf-4 test2.c
 > gdb a.out 
GNU gdb (GDB) Fedora 10.1-14.fc34
...
Reading symbols from a.out...
(gdb) b main
Breakpoint 1 at 0x40110a: file test2.c, line 4.
(gdb) r
Starting program: /tmp/a.out 
Missing separate debuginfos, use: dnf debuginfo-install glibc-2.33-5.fc34.x86_64

Breakpoint 1, main () at test2.c:4
4	    int x = 1;
Missing separate debuginfos, use: dnf debuginfo-install libgcc-11.1.1-1.fc34.x86_64 libstdc++-11.1.1-1.fc34.x86_64
(gdb) list
1	
2	int main()
3	{
4	    int x = 1;
5	    ++x;
6	    ++x;
7	    ++x;
8	}
(gdb) 


Additional info:

this bug could be related: https://sourceware.org/bugzilla/show_bug.cgi?id=27354


Note You need to log in before you can comment on or make changes to this bug.