[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#968670: dwz: Fails with "Unknown DWARF DW_OP_1"



Control: tag + upstream patch
X-Debbugs-Cc: d.filder@web.de

dwz source code comes with outdated (August 2019) copies of
dwarf2.def, dwarf2.h and dwarfnames.c from gcc/libiberty.
The patch updates them and proposes a long-term solution.
Hopefully this will fix any dh_dwz issues.

Regards,
Dennis.

Description: Update DWARF definition files to latest gcc master
 Upstream devs haven't updated some files copied from gcc/libiberty in
 a while.  This patch for dwz/0.13-2 updates them to the ones in gcc
 master@b2d84e9f9cccbe4ee662f7002b83105629d09939 allowing it to
 recognize newly introduced DWARF tags produced by current
 gcc/binutils/etc.
 .
 A better approach would build-depend on libiberty-dev (20210106-1 has
 them), include/copy them and update COPYRIGHT_YEARS with
 contrib/release/gen-copyright-years.sh.
Author: Dennis Filder <d.filder@web.de>
Bug-Debian: https://bugs.debian.org/968670
Last-Update: 2021-02-05
---
diff -u -r dwz-0.13+20210126/COPYRIGHT_YEARS dwz-0.13+20210126/COPYRIGHT_YEARS
--- dwz-0.13+20210126/COPYRIGHT_YEARS	2021-01-19 08:36:09.000000000 +0100
+++ dwz-0.13+20210126/COPYRIGHT_YEARS	2021-02-05 20:31:33.000000000 +0100
@@ -1,3 +1,3 @@
--DFSF_YEARS='"1992-2019"'
+-DFSF_YEARS='"1992-2021"'
 -DRH_YEARS='"2001-2021"'
 -DSUSE_YEARS='"2019"'
diff -u -r dwz-0.13+20210126/dwarf2.def dwz-0.13+20210126/dwarf2.def
--- dwz-0.13+20210126/dwarf2.def	2019-08-11 17:16:07.000000000 +0200
+++ dwz-0.13+20210126/dwarf2.def	2021-02-05 20:31:09.000000000 +0100
@@ -1,7 +1,7 @@
 /* -*- c -*-
    Declarations and definitions of codes relating to the DWARF2 and
    DWARF3 symbolic debugging information formats.
-   Copyright (C) 1992-2019 Free Software Foundation, Inc.
+   Copyright (C) 1992-2021 Free Software Foundation, Inc.

    Written by Gary Funck (gary@intrepid.com) The Ada Joint Program
    Office (AJPO), Florida State University and Silicon Graphics Inc.
@@ -805,3 +805,14 @@
 DW_IDX (DW_IDX_GNU_internal, 0x2000)
 DW_IDX (DW_IDX_GNU_external, 0x2001)
 DW_END_IDX
+
+/* DWARF5 Unit type header encodings  */
+DW_FIRST_UT (DW_UT_compile, 0x01)
+DW_UT (DW_UT_type, 0x02)
+DW_UT (DW_UT_partial, 0x03)
+DW_UT (DW_UT_skeleton, 0x04)
+DW_UT (DW_UT_split_compile, 0x05)
+DW_UT (DW_UT_split_type, 0x06)
+DW_UT (DW_UT_lo_user, 0x80)
+DW_UT (DW_UT_hi_user, 0xff)
+DW_END_UT
diff -u -r dwz-0.13+20210126/dwarf2.h dwz-0.13+20210126/dwarf2.h
--- dwz-0.13+20210126/dwarf2.h	2019-08-11 17:16:07.000000000 +0200
+++ dwz-0.13+20210126/dwarf2.h	2021-02-05 20:31:17.000000000 +0100
@@ -1,6 +1,6 @@
 /* Declarations and definitions of codes relating to the DWARF2 and
    DWARF3 symbolic debugging information formats.
-   Copyright (C) 1992-2019 Free Software Foundation, Inc.
+   Copyright (C) 1992-2021 Free Software Foundation, Inc.

    Written by Gary Funck (gary@intrepid.com) The Ada Joint Program
    Office (AJPO), Florida State University and Silicon Graphics Inc.
@@ -55,6 +55,7 @@
 #define DW_CFA_DUP(name, value) , name = value
 #define DW_IDX(name, value) , name = value
 #define DW_IDX_DUP(name, value) , name = value
+#define DW_UT(name, value) , name = value

 #define DW_FIRST_TAG(name, value) enum dwarf_tag { \
   name = value
@@ -77,6 +78,9 @@
 #define DW_FIRST_IDX(name, value) enum dwarf_name_index_attribute { \
   name = value
 #define DW_END_IDX };
+#define DW_FIRST_UT(name, value) enum dwarf_unit_type { \
+  name = value
+#define DW_END_UT };

 #include "dwarf2.def"

@@ -94,6 +98,8 @@
 #undef DW_END_CFA
 #undef DW_FIRST_IDX
 #undef DW_END_IDX
+#undef DW_FIRST_UT
+#undef DW_END_UT

 #undef DW_TAG
 #undef DW_TAG_DUP
@@ -108,6 +114,7 @@
 #undef DW_CFA_DUP
 #undef DW_IDX
 #undef DW_IDX_DUP
+#undef DW_UT

 /* Flag that tells whether entry has a child or not.  */
 #define DW_children_no   0
@@ -316,7 +323,6 @@

 #define DW_CIE_ID	  0xffffffff
 #define DW64_CIE_ID	  0xffffffffffffffffULL
-#define DW_CIE_VERSION	  1

 #define DW_CFA_extended   0

@@ -451,19 +457,6 @@
     DW_RLE_start_end = 0x06,
     DW_RLE_start_length = 0x07
   };
-
-/* Unit types in unit_type unit header field.  */
-enum dwarf_unit_type
-  {
-    DW_UT_compile = 0x01,
-    DW_UT_type = 0x02,
-    DW_UT_partial = 0x03,
-    DW_UT_skeleton = 0x04,
-    DW_UT_split_compile = 0x05,
-    DW_UT_split_type = 0x06,
-    DW_UT_lo_user = 0x80,
-    DW_UT_hi_user = 0xff
-  };
 
 /* @@@ For use with GNU frame unwind information.  */

@@ -489,19 +482,36 @@
 #define DW_EH_PE_indirect	0x80

 /* Codes for the debug sections in a dwarf package (.dwp) file.
-   Extensions for Fission.  See http://gcc.gnu.org/wiki/DebugFissionDWP.  */
+   (From the pre-standard formats Extensions for Fission.
+   See http://gcc.gnu.org/wiki/DebugFissionDWP).  */
 enum dwarf_sect
-  {
-    DW_SECT_INFO = 1,
-    DW_SECT_TYPES = 2,
-    DW_SECT_ABBREV = 3,
-    DW_SECT_LINE = 4,
-    DW_SECT_LOC = 5,
-    DW_SECT_STR_OFFSETS = 6,
-    DW_SECT_MACINFO = 7,
-    DW_SECT_MACRO = 8,
-    DW_SECT_MAX = 8
-  };
+{
+  DW_SECT_INFO = 1,
+  DW_SECT_TYPES = 2,
+  DW_SECT_ABBREV = 3,
+  DW_SECT_LINE = 4,
+  DW_SECT_LOC = 5,
+  DW_SECT_STR_OFFSETS = 6,
+  DW_SECT_MACINFO = 7,
+  DW_SECT_MACRO = 8,
+  DW_SECT_MAX = 8
+};
+
+/* Codes for the debug sections in a dwarf package (.dwp) file.
+   (From the official DWARF v5 spec.
+   See http://dwarfstd.org/doc/DWARF5.pdf, section 7.3.5).  */
+enum dwarf_sect_v5
+{
+  DW_SECT_INFO_V5 = 1,
+  DW_SECT_RESERVED_V5 = 2,
+  DW_SECT_ABBREV_V5 = 3,
+  DW_SECT_LINE_V5 = 4,
+  DW_SECT_LOCLISTS_V5 = 5,
+  DW_SECT_STR_OFFSETS_V5 = 6,
+  DW_SECT_MACRO_V5 = 7,
+  DW_SECT_RNGLISTS_V5 = 8,
+  DW_SECT_MAX_V5 = 8
+};

 #ifdef __cplusplus
 extern "C" {
@@ -535,6 +545,10 @@
    recognized.  */
 extern const char *get_DW_IDX_name (unsigned int idx);

+/* Return the name of a DW_UT_ constant, or NULL if the value is not
+   recognized.  */
+extern const char *get_DW_UT_name (unsigned int ut);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
diff -u -r dwz-0.13+20210126/dwarfnames.c dwz-0.13+20210126/dwarfnames.c
--- dwz-0.13+20210126/dwarfnames.c	2019-08-11 17:16:07.000000000 +0200
+++ dwz-0.13+20210126/dwarfnames.c	2021-02-05 20:30:40.000000000 +0100
@@ -1,5 +1,5 @@
 /* Names of various DWARF tags.
-   Copyright (C) 2012-2019 Free Software Foundation, Inc.
+   Copyright (C) 2012-2021 Free Software Foundation, Inc.

 This file is part of GNU CC.

@@ -64,6 +64,11 @@
   switch (idx) {					\
   DW_IDX (name, value)
 #define DW_END_IDX } return 0; }
+#define DW_FIRST_UT(name, value) \
+  const char *get_DW_UT_name (unsigned int ut) {	\
+  switch (ut) {					\
+  DW_UT (name, value)
+#define DW_END_UT } return 0; }

 #define DW_TAG(name, value) case name: return # name ;
 #define DW_TAG_DUP(name, value)
@@ -78,6 +83,7 @@
 #define DW_CFA_DUP(name, value)
 #define DW_IDX(name, value) case name: return # name ;
 #define DW_IDX_DUP(name, value)
+#define DW_UT(name, value) case name: return # name ;

 #include "dwarf2.def"

@@ -95,6 +101,7 @@
 #undef DW_END_CFA
 #undef DW_FIRST_IDX
 #undef DW_END_IDX
+#undef DW_END_UT

 #undef DW_TAG
 #undef DW_TAG_DUP

Reply to: