summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2018-03-29 13:47:57 +0000
committerPavel Labath <labath@google.com>2018-03-29 13:47:57 +0000
commit2d1fc4375f3885f0ee0ffcb58fc554530cd74ef2 (patch)
tree635ba95793254f745abd8cd5ca0280c2a6eb5e97
parent4f8f1e5115efd6c0bafbde0f1993b1298e85c3dd (diff)
downloadbcm5719-llvm-2d1fc4375f3885f0ee0ffcb58fc554530cd74ef2.tar.gz
bcm5719-llvm-2d1fc4375f3885f0ee0ffcb58fc554530cd74ef2.zip
.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. llvm-svn: 328773
-rw-r--r--llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp2
-rw-r--r--llvm/test/DebugInfo/X86/dwarfdump-debug-names.s16
-rw-r--r--llvm/test/tools/llvm-dwarfdump/X86/debug-names-find.s4
-rw-r--r--llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-duplicate.s4
-rw-r--r--llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-forms.s2
-rw-r--r--llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-buckets.s2
-rw-r--r--llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-unhashed-names.s2
-rw-r--r--llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-wrong-hash.s2
8 files changed, 17 insertions, 17 deletions
diff --git a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
index 3b9662067c3..40174119b0a 100644
--- a/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
+++ b/llvm/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp
@@ -535,7 +535,7 @@ DWARFDebugNames::Entry::lookup(dwarf::Index Index) const {
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;
}
diff --git a/llvm/test/DebugInfo/X86/dwarfdump-debug-names.s b/llvm/test/DebugInfo/X86/dwarfdump-debug-names.s
index 0291591f4ab..2b28c07533d 100644
--- a/llvm/test/DebugInfo/X86/dwarfdump-debug-names.s
+++ b/llvm/test/DebugInfo/X86/dwarfdump-debug-names.s
@@ -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: ]
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug-names-find.s b/llvm/test/tools/llvm-dwarfdump/X86/debug-names-find.s
index e65ede13c3b..d21ba6df254 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug-names-find.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug-names-find.s
@@ -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
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-duplicate.s b/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-duplicate.s
index 5c5075ca25f..03b1af982de 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-duplicate.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-duplicate.s
@@ -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
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-forms.s b/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-forms.s
index 9aaa4c4dd2c..910431c6206 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-forms.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-abbrev-forms.s
@@ -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
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-buckets.s b/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-buckets.s
index 5934d6d820a..551e51c59ed 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-buckets.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-buckets.s
@@ -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
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-unhashed-names.s b/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-unhashed-names.s
index cd9bbcdffe3..72ee6d7ef37 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-unhashed-names.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-unhashed-names.s
@@ -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
diff --git a/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-wrong-hash.s b/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-wrong-hash.s
index baffaece842..b0e01813ca1 100644
--- a/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-wrong-hash.s
+++ b/llvm/test/tools/llvm-dwarfdump/X86/debug-names-verify-wrong-hash.s
@@ -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
OpenPOWER on IntegriCloud