Package: gdb
Version: 10.1-2
Tags: patch
Forwarded: https://sourceware.org/bugzilla/show_bug.cgi?id=27354

Dear Maintainer,

GDB 10.1 is unable to debug binaries produced by GCC 11.2.0 with the
-gsplit-dwarf switch. GCC 11, which is now in Debian sid, uses DWARFv5
debugging format by default. With -gdwarf-4 the error does not appear.


builder@barberry:/tmp/tmp.qHMJOXsPej$ cat hello.c 
#include <stdio.h>

int main()
{
  puts("Hello everybody!");
  return 0;
}
builder@barberry:/tmp/tmp.qHMJOXsPej$ gcc -g -gsplit-dwarf -c hello.c
builder@barberry:/tmp/tmp.qHMJOXsPej$ gcc hello.o -o hello
builder@barberry:/tmp/tmp.qHMJOXsPej$ gdb -silent hello
Reading symbols from hello...
Dwarf Error: wrong unit_type in compilation unit header (is DW_UT_split_compile 
(0x05), should be DW_UT_type (0x02)) [in module /tmp/tmp.qHMJOXsPej/hello.dwo]
(No debugging symbols found in hello)
(gdb) q


The attached patch against GDB in unstable seems to be fixing the issue.

diffstat for gdb-10.1 gdb-10.1

 changelog                                     |    6 ++++++
 patches/Fix-wrong-unit_type-Dwarf-Error.patch |   11 +++++++++++
 patches/series                                |    1 +
 3 files changed, 18 insertions(+)

diff -Nru gdb-10.1/debian/changelog gdb-10.1/debian/changelog
--- gdb-10.1/debian/changelog   2021-03-04 21:37:19.000000000 +0300
+++ gdb-10.1/debian/changelog   2021-12-25 10:45:33.000000000 +0300
@@ -1,3 +1,9 @@
+gdb (10.1-2local1) unstable; urgency=medium
+
+  * Build for internal use.
+
+ -- Nicholas Guriev <[email protected]>  Sat, 25 Dec 2021 10:45:33 +0300
+
 gdb (10.1-2) unstable; urgency=high
 
   * Acknowledge past contributions from Matthias and Samuel.
diff -Nru gdb-10.1/debian/patches/Fix-wrong-unit_type-Dwarf-Error.patch 
gdb-10.1/debian/patches/Fix-wrong-unit_type-Dwarf-Error.patch
--- gdb-10.1/debian/patches/Fix-wrong-unit_type-Dwarf-Error.patch       
1970-01-01 03:00:00.000000000 +0300
+++ gdb-10.1/debian/patches/Fix-wrong-unit_type-Dwarf-Error.patch       
2021-12-25 10:42:54.000000000 +0300
@@ -0,0 +1,11 @@
+--- a/gdb/dwarf2/read.c
++++ b/gdb/dwarf2/read.c
+@@ -12943,7 +12943,7 @@ open_and_init_dwo_file (dwarf2_cu *cu, c
+     {
+       create_debug_type_hash_table (per_objfile, dwo_file.get (),
+                                   &dwo_file->sections.info, dwo_file->tus,
+-                                  rcuh_kind::TYPE);
++                                  rcuh_kind::COMPILE);
+     }
+ 
+   if (dwarf_read_debug)
diff -Nru gdb-10.1/debian/patches/series gdb-10.1/debian/patches/series
--- gdb-10.1/debian/patches/series      2021-03-04 21:21:03.000000000 +0300
+++ gdb-10.1/debian/patches/series      2021-12-25 10:40:05.000000000 +0300
@@ -11,3 +11,4 @@
 2bf3b79d05bf85e41cbdcb020bd1cc424f59dd9a.diff
 fork-inferior-fix
 vm_min_max_address
+Fix-wrong-unit_type-Dwarf-Error.patch

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to