[llvm] 1dc57ad - [DWARFYAML] Make the 'Attributes' field optional.
Xing GUO via llvm-commits
llvm-commits at lists.llvm.org
Tue Aug 25 07:38:21 PDT 2020
Author: Xing GUO
Date: 2020-08-25T22:37:43+08:00
New Revision: 1dc57ada0c79a57fbf7c87d5816e680cfd3bc077
URL: https://github.com/llvm/llvm-project/commit/1dc57ada0c79a57fbf7c87d5816e680cfd3bc077
DIFF: https://github.com/llvm/llvm-project/commit/1dc57ada0c79a57fbf7c87d5816e680cfd3bc077.diff
LOG: [DWARFYAML] Make the 'Attributes' field optional.
This patch makes the 'Attributes' field optional. We don't need to
explicitly specify the 'Attributes' field in the future.
Reviewed By: jhenderson, grimar
Differential Revision: https://reviews.llvm.org/D86537
Added:
Modified:
llvm/lib/ObjectYAML/DWARFYAML.cpp
llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
Removed:
################################################################################
diff --git a/llvm/lib/ObjectYAML/DWARFYAML.cpp b/llvm/lib/ObjectYAML/DWARFYAML.cpp
index c55ae9e1e477..0e453596c9d7 100644
--- a/llvm/lib/ObjectYAML/DWARFYAML.cpp
+++ b/llvm/lib/ObjectYAML/DWARFYAML.cpp
@@ -116,7 +116,7 @@ void MappingTraits<DWARFYAML::Abbrev>::mapping(IO &IO,
IO.mapOptional("Code", Abbrev.Code);
IO.mapRequired("Tag", Abbrev.Tag);
IO.mapRequired("Children", Abbrev.Children);
- IO.mapRequired("Attributes", Abbrev.Attributes);
+ IO.mapOptional("Attributes", Abbrev.Attributes);
}
void MappingTraits<DWARFYAML::AttributeAbbrev>::mapping(
diff --git a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
index d199ac260c17..f1d14847699c 100644
--- a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
+++ b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
@@ -4,7 +4,7 @@
# RUN: yaml2obj --docnum=1 %s -o %t1.o
# RUN: llvm-readobj --sections --section-data %t1.o | \
-# RUN: FileCheck -DSIZE=54 -DADDRALIGN=1 %s --check-prefixes=SHDR,CONTENT
+# RUN: FileCheck -DSIZE=59 -DADDRALIGN=1 %s --check-prefixes=SHDR,CONTENT
# SHDR: Index: 1
# SHDR-NEXT: Name: .debug_abbrev (1)
@@ -51,12 +51,14 @@
## ^- DW_CHILDREN_yes 1-byte ^- abbreviation code ULEB128
## ^- DW_AT_producer ULEB128 ^- DW_TAG_subprogram ULEB128
## ^- DW_FORM_strp ULEB128
-# CONTENT-NEXT: 0030: 01110100 0000 |......|
-## ^- DW_CHILDREN_yes 1-byte
-## ^- DW_AT_low_pc ULEB128
-## ^- DW_FORM_addr UELB128
-## ^---- attr terminator
-## ^- abbrev table terminator
+# CONTENT-NEXT: 0030: 01110100 00031100 000000 |...........|
+## ^- DW_CHILDREN_yes 1-byte ^--- attr terminator
+## ^- DW_AT_low_pc ULEB128 ^- abbrev table terminator
+## ^- DW_FORM_addr UELB128
+## ^---- attr terminator
+## ^- abbrev code ULEB128 (0x03)
+## ^- DW_TAG_compile_unit
+## ^- DW_CHILDREN_no
# CONTENT-NEXT: )
--- !ELF
@@ -116,6 +118,10 @@ DWARF:
Attributes:
- Attribute: DW_AT_low_pc
Form: DW_FORM_addr
+ ## Test that if the 'Attributes' field is not specified, yaml2obj emits
+ ## a terminating entry, 0 for the attribute, 0 for the form.
+ - Tag: DW_TAG_compile_unit
+ Children: DW_CHILDREN_no
## b) Generate the .debug_abbrev section from raw section content.
@@ -179,7 +185,6 @@ DWARF:
- Code: 1
Tag: DW_TAG_compile_unit
Children: DW_CHILDREN_no
- Attributes: []
## e) Test that yaml2obj emits an error message when both the "Content" and the
## "debug_abbrev" entry are specified at the same time.
@@ -201,7 +206,6 @@ DWARF:
- Code: 1
Tag: DW_TAG_compile_unit
Children: DW_CHILDREN_no
- Attributes: []
## f) Test that all the properties can be overridden by the section header when
## the "debug_abbrev" entry doesn't exist.
@@ -261,7 +265,6 @@ DWARF:
- Code: 1
Tag: DW_TAG_compile_unit
Children: DW_CHILDREN_no
- Attributes: []
## h) Test that yaml2obj automatically generates abbreviation codes for us.
@@ -288,24 +291,18 @@ DWARF:
- Table:
- Tag: DW_TAG_compile_unit
Children: DW_CHILDREN_no
- Attributes: []
- Tag: DW_TAG_subprogram
Children: DW_CHILDREN_no
- Attributes: []
- Code: 4
Tag: DW_TAG_subprogram
Children: DW_CHILDREN_no
- Attributes: []
- Code: 4
Tag: DW_TAG_subprogram
Children: DW_CHILDREN_no
- Attributes: []
- Tag: DW_TAG_subprogram
Children: DW_CHILDREN_no
- Attributes: []
- Tag: DW_TAG_subprogram
Children: DW_CHILDREN_no
- Attributes: []
## i) Test that yaml2obj emits an error message when there are non-empty compilation units
## and multiple abbrev tables are assigned the same ID.
diff --git a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
index 434487d182e2..ed3f5b212244 100644
--- a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
+++ b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
@@ -446,7 +446,6 @@ DWARF:
- Code: 1
Tag: DW_TAG_compile_unit
Children: DW_CHILDREN_no
- Attributes: []
debug_info:
- Length: 0x1234
Version: 5
@@ -474,7 +473,6 @@ DWARF:
- Code: 1
Tag: DW_TAG_compile_unit
Children: DW_CHILDREN_no
- Attributes: []
debug_info:
- Length: 0x1234
Version: 5
@@ -540,7 +538,6 @@ DWARF:
- Code: 1
Tag: DW_TAG_compile_unit
Children: DW_CHILDREN_no
- Attributes: []
debug_info:
- Length: 0x1234
Version: 5
diff --git a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
index c08a0e15a337..c38d61146a41 100644
--- a/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
+++ b/llvm/unittests/DebugInfo/DWARF/DWARFDebugInfoTest.cpp
@@ -1367,7 +1367,6 @@ TEST(DWARFDebugInfo, TestEmptyChildren) {
" - Code: 0x00000001\n"
" Tag: DW_TAG_compile_unit\n"
" Children: DW_CHILDREN_yes\n"
- " Attributes:\n"
"debug_info:\n"
" - Version: 4\n"
" AbbrOffset: 0\n"
More information about the llvm-commits
mailing list