[llvm] 38907b6 - [DWARFYAML][debug_abbrev] Emit 0 byte for terminating abbreviations.
Xing GUO via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 1 09:05:21 PDT 2020
Author: Xing GUO
Date: 2020-07-02T00:09:29+08:00
New Revision: 38907b696c0e31d2269ec4b8966bf603c36b579c
URL: https://github.com/llvm/llvm-project/commit/38907b696c0e31d2269ec4b8966bf603c36b579c
DIFF: https://github.com/llvm/llvm-project/commit/38907b696c0e31d2269ec4b8966bf603c36b579c.diff
LOG: [DWARFYAML][debug_abbrev] Emit 0 byte for terminating abbreviations.
The abbreviations for a given compilation unit end with an entry
consisting of a 0 byte for the abbreviation code.
Reviewed By: jhenderson
Differential Revision: https://reviews.llvm.org/D82933
Added:
Modified:
llvm/lib/ObjectYAML/DWARFEmitter.cpp
llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml
llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
Removed:
################################################################################
diff --git a/llvm/lib/ObjectYAML/DWARFEmitter.cpp b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
index 67509ba52cf4..7a86143b260b 100644
--- a/llvm/lib/ObjectYAML/DWARFEmitter.cpp
+++ b/llvm/lib/ObjectYAML/DWARFEmitter.cpp
@@ -111,6 +111,10 @@ Error DWARFYAML::emitDebugAbbrev(raw_ostream &OS, const DWARFYAML::Data &DI) {
encodeULEB128(0, OS);
}
+ // The abbreviations for a given compilation unit end with an entry consisting
+ // of a 0 byte for the abbreviation code.
+ OS.write_zeros(1);
+
return Error::success();
}
diff --git a/llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml b/llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml
index 73a1092d36ac..142ed0ac02ea 100644
--- a/llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml
+++ b/llvm/test/ObjectYAML/MachO/DWARF2-AddrSize8-FormValues.yaml
@@ -204,7 +204,7 @@ LoadCommands:
- sectname: __debug_abbrev
segname: __DWARF
addr: 0x000000010000312C
- size: 84
+ size: 86
offset: 0x00002167
align: 0
reloff: 0x00000000
@@ -217,7 +217,7 @@ LoadCommands:
segname: __DWARF
addr: 0x0000000100003178
size: 83
- offset: 0x000021BB
+ offset: 0x000021BC
align: 0
reloff: 0x00000000
nreloc: 0
diff --git a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-abbrev.yaml
index 11b8162d7615..03583ac87324 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=38 -DADDRALIGN=1 %s --check-prefixes=SHDR,CONTENT
+# RUN: FileCheck -DSIZE=39 -DADDRALIGN=1 %s --check-prefixes=SHDR,CONTENT
# SHDR: Index: 1
# SHDR-NEXT: Name: .debug_abbrev (1)
@@ -27,14 +27,14 @@
##
## CONTENT: 1A000002 2E011101 |...%............|
## ^- DW_AT_strx ULEB128 ^- DW_TAG_subprogram ULEB128
-## ^--- terminating entry ^- DW_CHILDREN_yes 1-byte
+## ^--- attr terminator ^- DW_CHILDREN_yes 1-byte
## ^- abbreviation code ULEB128 ^- DW_AT_low_pc ULEB128
## ^- DW_FORM_addr ULEB128
##
# CONTENT-NEXT: 0010: 121B0000 03060081
## ^- DW_AT_high_pc ULEB128 ^- abbreviation code ULEB128
## ^- DW_FORM_addrx ULEB128 ^- Tag: value UELB128
-## ^--- terminating entry ^- DW_CHILDREN_no 1-byte
+## ^--- attr terminator ^- DW_CHILDREN_no 1-byte
## ^- DW_AT_call_pc ULEB128 (0x81)
##
# CONTENT: 01810104 02A04021 |..............@!|
@@ -42,8 +42,9 @@
## ^--- Form: invalid ULEB128 (0x81) ^--- Attribute: reserved ULEB128 (0x2020)
## ^- Attribute: reserved ULEB128 ^- DW_FORM_implicit_const ULEB128
##
-# CONTENT-NEXT: 0020: CEC2F105 0000 |......|
-## ^------- Value SLEB128 (12345678) ^--- terminating entry
+# CONTENT-NEXT: 0020: CEC2F105 000000 |.......|
+## ^------- Value SLEB128 (12345678) ^--- attr terminator
+## ^- abbrev terminator
# CONTENT-NEXT: )
--- !ELF
@@ -186,8 +187,8 @@ DWARF:
# RUN: llvm-readelf --sections %t6.o | FileCheck %s --check-prefix=OVERRIDDEN
# OVERRIDDEN: [Nr] Name Type Address Off Size ES Flg Lk Inf Al
-# OVERRIDDEN: [ 1] .debug_abbrev STRTAB 0000000000002020 000050 000005 01 A 2 1 2
-# OVERRIDDEN-NEXT: [ 2] .sec STRTAB 0000000000000000 000055 000000 00 0 0 0
+# OVERRIDDEN: [ 1] .debug_abbrev STRTAB 0000000000002020 000050 000006 01 A 2 1 2
+# OVERRIDDEN-NEXT: [ 2] .sec STRTAB 0000000000000000 000056 000000 00 0 0 0
--- !ELF
FileHeader:
@@ -205,7 +206,7 @@ Sections:
AddressAlign: 2 ## 0 by default.
Address: 0x2020 ## 0x00 by default.
Offset: 0x50 ## 0x40 for the first section.
- Size: 0x05 ## Set the "Size" so that we can reuse the check tag "OVERRIDDEN".
+ Size: 0x06 ## Set the "Size" so that we can reuse the check tag "OVERRIDDEN".
- Name: .sec ## Linked by .debug_abbrev.
Type: SHT_STRTAB
diff --git a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
index 00fd224bf648..896a9b472887 100644
--- a/llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
+++ b/llvm/test/tools/yaml2obj/ELF/DWARF/debug-info.yaml
@@ -6,7 +6,7 @@
# RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2LSB %s -o %t1.le.o
# RUN: llvm-readobj --sections --section-data %t1.le.o | \
-# RUN: FileCheck -DINDEX=2 -DNAME=15 -DOFFSET=0x9A -DSIZE=171 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF32-LE-CONTENT
+# RUN: FileCheck -DINDEX=2 -DNAME=15 -DOFFSET=0x9B -DSIZE=171 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF32-LE-CONTENT
# SHDR: Index: [[INDEX]]
# SHDR-NEXT: Name: .debug_info ([[NAME]])
@@ -287,7 +287,7 @@ DWARF:
# RUN: yaml2obj --docnum=1 -DENDIAN=ELFDATA2MSB %s -o %t1.be.o
# RUN: llvm-readobj --sections --section-data %t1.be.o | \
-# RUN: FileCheck -DINDEX=2 -DNAME=15 -DOFFSET=0x9A -DSIZE=171 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF32-BE-CONTENT
+# RUN: FileCheck -DINDEX=2 -DNAME=15 -DOFFSET=0x9B -DSIZE=171 -DADDRALIGN=1 %s --check-prefixes=SHDR,DWARF32-BE-CONTENT
# DWARF32-BE-CONTENT-NEXT: SectionData (
# DWARF32-BE-CONTENT-NEXT: 0000: 00001234 00050204 00001234 01123456
More information about the llvm-commits
mailing list