[llvm] r328773 - .debug_names: Parse DW_IDX_die_offset as a reference

Pavel Labath via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 29 06:47:58 PDT 2018


Author: labath
Date: Thu Mar 29 06:47:57 2018
New Revision: 328773

URL: http://llvm.org/viewvc/llvm-project?rev=328773&view=rev
Log:
.debug_names: Parse DW_IDX_die_offset as a reference

Before this patch we were parsing the attributes as section offsets, as
that is what apple_names is doing. However, this is not correct as DWARF
v5 specifies that this attribute should use the Reference form class.

This also updates all the testcases (except the ones that deliberately
pass a different form) to use the correct form class.

Modified:
    llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
    llvm/trunk/test/DebugInfo/X86/dwarfdump-debug-names.s
    llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-find.s
    llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-duplicate.s
    llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-forms.s
    llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-buckets.s
    llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-unhashed-names.s
    llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-wrong-hash.s

Modified: llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp?rev=328773&r1=328772&r2=328773&view=diff
==============================================================================
--- llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp (original)
+++ llvm/trunk/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp Thu Mar 29 06:47:57 2018
@@ -535,7 +535,7 @@ DWARFDebugNames::Entry::lookup(dwarf::In
 
 Optional<uint64_t> DWARFDebugNames::Entry::getDIEUnitOffset() const {
   if (Optional<DWARFFormValue> Off = lookup(dwarf::DW_IDX_die_offset))
-    return Off->getAsSectionOffset();
+    return Off->getAsReferenceUVal();
   return None;
 }
 

Modified: llvm/trunk/test/DebugInfo/X86/dwarfdump-debug-names.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/X86/dwarfdump-debug-names.s?rev=328773&r1=328772&r2=328773&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/X86/dwarfdump-debug-names.s (original)
+++ llvm/trunk/test/DebugInfo/X86/dwarfdump-debug-names.s Thu Mar 29 06:47:57 2018
@@ -44,7 +44,7 @@
 	.byte	46                      # Abbrev code
 	.byte	46                      # DW_TAG_subprogram
 	.byte	3                       # DW_IDX_die_offset
-	.byte	6                       # DW_FORM_data4
+	.byte	19                      # DW_FORM_ref4
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev list
@@ -52,11 +52,11 @@
 .Lnames_entries0:
 .Lnames0:
 	.byte	46                      # Abbrev code
-	.long	.Ldie0                  # DW_IDX_die_offset
+	.long	.Ldie0-.Lcu_begin0      # DW_IDX_die_offset
 	.long	0                       # End of list: foo
 .Lnames1:
 	.byte	46                      # Abbrev code
-	.long	.Ldie0                  # DW_IDX_die_offset
+	.long	.Ldie0-.Lcu_begin0      # DW_IDX_die_offset
 	.long	0                       # End of list: _Z3foov
 	.p2align	2
 .Lnames_end0:
@@ -81,7 +81,7 @@
 	.byte	52                      # Abbrev code
 	.byte	52                      # DW_TAG_variable
 	.byte	3                       # DW_IDX_die_offset
-	.byte	6                       # DW_FORM_data4
+	.byte	19                      # DW_FORM_ref4
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev list
@@ -89,7 +89,7 @@
 .Lnames_entries1:
 .Lnames2:
 	.byte	52                      # Abbrev code
-	.long	.Ldie1                  # DW_IDX_die_offset
+	.long	.Ldie1-.Lcu_begin1      # DW_IDX_die_offset
 	.long	0                       # End of list: bar
 	.p2align	2
 .Lnames_end1:
@@ -113,7 +113,7 @@
 # CHECK-NEXT:   Abbreviations [
 # CHECK-NEXT:     Abbreviation 0x2e {
 # CHECK-NEXT:       Tag: DW_TAG_subprogram
-# CHECK-NEXT:       DW_IDX_die_offset: DW_FORM_data4
+# CHECK-NEXT:       DW_IDX_die_offset: DW_FORM_ref4
 # CHECK-NEXT:     }
 # CHECK-NEXT:   ]
 # CHECK-NEXT:   Bucket 0 [
@@ -159,7 +159,7 @@
 # CHECK-NEXT:   Abbreviations [
 # CHECK-NEXT:     Abbreviation 0x34 {
 # CHECK-NEXT:       Tag: DW_TAG_variable
-# CHECK-NEXT:       DW_IDX_die_offset: DW_FORM_data4
+# CHECK-NEXT:       DW_IDX_die_offset: DW_FORM_ref4
 # CHECK-NEXT:     }
 # CHECK-NEXT:   ]
 # CHECK-NEXT:   Bucket 0 [
@@ -169,7 +169,7 @@
 # CHECK-NEXT:       Entry @ 0xa3 {
 # CHECK-NEXT:         Abbrev: 0x34
 # CHECK-NEXT:         Tag: DW_TAG_variable
-# CHECK-NEXT:         DW_IDX_die_offset: 0x00000003
+# CHECK-NEXT:         DW_IDX_die_offset: 0x00000001
 # CHECK-NEXT:       }
 # CHECK-NEXT:     }
 # CHECK-NEXT:   ]

Modified: llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-find.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-find.s?rev=328773&r1=328772&r2=328773&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-find.s (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-find.s Thu Mar 29 06:47:57 2018
@@ -121,7 +121,7 @@
 	.byte	46                      # Abbrev code
 	.byte	46                      # DW_TAG_subprogram
 	.byte	3                       # DW_IDX_die_offset
-	.byte	6                       # DW_FORM_data4
+	.byte	19                      # DW_FORM_ref4
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev list
@@ -163,7 +163,7 @@
 	.byte	46                      # Abbrev code
 	.byte	46                      # DW_TAG_subprogram
 	.byte	3                       # DW_IDX_die_offset
-	.byte	6                       # DW_FORM_data4
+	.byte	19                      # DW_FORM_ref4
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev list

Modified: llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-duplicate.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-duplicate.s?rev=328773&r1=328772&r2=328773&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-duplicate.s (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-duplicate.s Thu Mar 29 06:47:57 2018
@@ -50,13 +50,13 @@
 	.byte	46                      # Abbrev code
 	.byte	46                      # DW_TAG_subprogram
 	.byte	3                       # DW_IDX_die_offset
-	.byte	6                       # DW_FORM_data4
+	.byte	19                      # DW_FORM_ref4
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev
 	.byte	46                      # Abbrev code
 	.byte	46                      # DW_TAG_subprogram
 	.byte	3                       # DW_IDX_die_offset
-	.byte	6                       # DW_FORM_data4
+	.byte	19                      # DW_FORM_ref4
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev list

Modified: llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-forms.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-forms.s?rev=328773&r1=328772&r2=328773&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-forms.s (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-forms.s Thu Mar 29 06:47:57 2018
@@ -65,7 +65,7 @@
 	.byte   17                      # DW_FORM_ref1
 	.byte	2                       # DW_IDX_type_unit
 	.byte   17                      # DW_FORM_ref1
-	.byte	2                       # DW_IDX_die_offset
+	.byte	2                       # DW_IDX_type_unit
 	.byte   5                       # DW_FORM_data2
 	.byte	5                       # DW_IDX_type_hash
 	.byte   6                       # DW_FORM_data4

Modified: llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-buckets.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-buckets.s?rev=328773&r1=328772&r2=328773&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-buckets.s (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-buckets.s Thu Mar 29 06:47:57 2018
@@ -69,7 +69,7 @@
 	.byte	46                      # Abbrev code
 	.byte	46                      # DW_TAG_subprogram
 	.byte	3                       # DW_IDX_die_offset
-	.byte	6                       # DW_FORM_data4
+	.byte	19                      # DW_FORM_ref4
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev list

Modified: llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-unhashed-names.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-unhashed-names.s?rev=328773&r1=328772&r2=328773&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-unhashed-names.s (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-unhashed-names.s Thu Mar 29 06:47:57 2018
@@ -97,7 +97,7 @@
 	.byte	46                      # Abbrev code
 	.byte	46                      # DW_TAG_subprogram
 	.byte	3                       # DW_IDX_die_offset
-	.byte	6                       # DW_FORM_data4
+	.byte	19                      # DW_FORM_ref4
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev list

Modified: llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-wrong-hash.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-wrong-hash.s?rev=328773&r1=328772&r2=328773&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-wrong-hash.s (original)
+++ llvm/trunk/test/tools/llvm-dwarfdump/X86/debug-names-verify-wrong-hash.s Thu Mar 29 06:47:57 2018
@@ -79,7 +79,7 @@
 	.byte	46                      # Abbrev code
 	.byte	46                      # DW_TAG_subprogram
 	.byte	3                       # DW_IDX_die_offset
-	.byte	6                       # DW_FORM_data4
+	.byte	19                      # DW_FORM_ref4
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev
 	.byte	0                       # End of abbrev list




More information about the llvm-commits mailing list