gcc produces DWARF5, gdb requires DWARF4

Bug #2014231 reported by Mike Beaton
12
This bug affects 2 people
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://github.com/golang/vscode-go/issues/1914 https://github.com/haikuports/haikuports/issues/4987 ; as mentioned however, the mismatch between what gcc produces and what gdb accepts seems to be a specific problem, which I suppose may be likely to break e.g. existing working debug instructions, etc.)

---

Package: gcc
Version: 4:11.2.0-1ubuntu1

$ gcc --version
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0

Package: gdb
Version: 12.1-0ubuntu1~22.04

$ gdb --version
GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1

Using default gcc output (i.e. with no flags specifying DWARF version):

(gdb) add-symbol-file {...}/shimx64.efi.debug 0x0561B000 -s .data 0x05681000
add symbol table from file "{...}/shimx64.efi.debug" at
 .text_addr = 0x561b000
 .data_addr = 0x5681000
(y or n) y
Reading symbols from {...}/shimx64.efi.debug...
Dwarf Error: DW_FORM_line_strp used without required section
(No debugging symbols found in {...}/shimx64.efi.debug)
(gdb)

After adding `-gdwarf-4 -gstrict-dwarf` to gcc compile flags:

(gdb) add-symbol-file {...}/shimx64.efi.debug 0x0561B000 -s .data 0x05681000
add symbol table from file "{...}/shimx64.efi.debug" at
 .text_addr = 0x561b000
 .data_addr = 0x5681000
(y or n) y
Reading symbols from {...}/shimx64.efi.debug...
(gdb)

Revision history for this message
Ubuntu Kernel Bot (ubuntu-kernel-bot) wrote : Missing required logs.

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.

Changed in linux (Ubuntu):
status: New → Incomplete
Revision history for this message
Mike Beaton (mjsbeaton) wrote :

Have moved status to 'Confirmed' without attaching kernel log files as I believe these are not relevant.

Changed in linux (Ubuntu):
status: Incomplete → Confirmed
description: updated
Revision history for this message
Silas (bear8642) wrote (last edit ):

Accidentally changed status whilst examining status list - currently unable to revert the change!

Changed in linux (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.