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 changed:

  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.
+ 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
+  .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) 
- 
+ (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
+  .text_addr = 0x561b000
+  .data_addr = 0x5681000
  (y or n) y
  Reading symbols from {...}/shimx64.efi.debug...
  (gdb)

-- 
You received this bug notification because you are a member of Kernel
Packages, which is subscribed to linux in Ubuntu.
https://bugs.launchpad.net/bugs/2014231

Title:
  gcc produces DWARF5, gdb requires DWARF4

Status in linux package in Ubuntu:
  Confirmed

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)

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/2014231/+subscriptions


-- 
Mailing list: https://launchpad.net/~kernel-packages
Post to     : kernel-packages@lists.launchpad.net
Unsubscribe : https://launchpad.net/~kernel-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to