Bug 1956475

Summary: 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))
Product: [Fedora] Fedora Reporter: Michael Stahl <mst.misc>
Component: gdbAssignee: Kevin Buettner <kevinb>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 34CC: blarsen, jan, jan.kratochvil, keiths, kevinb, pmuldoon, sergiodj
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-11-26 19:54:15 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

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

Comment 1 Guinevere Larsen 2021-11-26 19:54:15 UTC
This problem has been fixed in the new GDB release.