gcc produces DWARF5, gdb requires DWARF4
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
linux (Ubuntu) |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
On Ubuntu 22.04.2 LTS using fully updated gcc and gdb, I find that by default gcc produces DWARF5 debug files which gdb cannot read, with the following error:
Dwarf Error: DW_FORM_line_strp used without required section
If I add the flags `-gdwarf-4 -gstrict-dwarf` to `gcc` then it produces output which gdb can read.
I would have expected the created and required versions of DWARF to match between these two programs when everything is up-to-date, within the same distro.
(I found the following two issues which appear to be people also suffering from gcc newly producing DWARF5, in different contexts: https:/
---
Package: gcc
Version: 4:11.2.0-1ubuntu1
$ gcc --version
gcc (Ubuntu 11.3.0-
Package: gdb
Version: 12.1-0ubuntu1~22.04
$ gdb --version
GNU gdb (Ubuntu 12.1-0ubuntu1~
Using default gcc output (i.e. with no flags specifying DWARF version):
(gdb) add-symbol-file {...}/shimx64.
add symbol table from file "{...}/
.text_addr = 0x561b000
.data_addr = 0x5681000
(y or n) y
Reading symbols from {...}/shimx64.
Dwarf Error: DW_FORM_line_strp used without required section
(No debugging symbols found in {...}/shimx64.
(gdb)
After adding `-gdwarf-4 -gstrict-dwarf` to gcc compile flags:
(gdb) add-symbol-file {...}/shimx64.
add symbol table from file "{...}/
.text_addr = 0x561b000
.data_addr = 0x5681000
(y or n) y
Reading symbols from {...}/shimx64.
(gdb)
This bug is missing log files that will aid in diagnosing the problem. While running an Ubuntu kernel (not a mainline or third-party kernel) please enter the following command in a terminal window:
apport-collect 2014231
and then change the status of the bug to 'Confirmed'.
If, due to the nature of the issue you have encountered, you are unable to run this command, please add a comment stating that fact and change the bug status to 'Confirmed'.
This change has been made by an automated script, maintained by the Ubuntu Kernel Team.