aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/ObjectYAML
diff options
context:
space:
mode:
authorXing GUO <higuoxing@gmail.com>2020-09-01 09:57:03 +0800
committerXing GUO <higuoxing@gmail.com>2020-09-01 10:02:09 +0800
commit428b2ffad4a346a967a4a105356fbc0fa518e2cc (patch)
treee5f0122e2fceeacefde3a95dad480a1fd16c0530 /llvm/test/ObjectYAML
parent1d3d9b9cd808ef37f3dacd3ada81bff1353cd24b (diff)
downloadllvm-428b2ffad4a346a967a4a105356fbc0fa518e2cc.zip
llvm-428b2ffad4a346a967a4a105356fbc0fa518e2cc.tar.gz
llvm-428b2ffad4a346a967a4a105356fbc0fa518e2cc.tar.bz2
[DWARFYAML] Make the debug_str section optional.
This patch makes the debug_str section optional. When the debug_str section exists but doesn't contain anything, yaml2obj will emit a section header for it. Reviewed By: grimar Differential Revision: https://reviews.llvm.org/D86860
Diffstat (limited to 'llvm/test/ObjectYAML')
-rw-r--r--llvm/test/ObjectYAML/MachO/DWARF-debug_str.yaml71
1 files changed, 70 insertions, 1 deletions
diff --git a/llvm/test/ObjectYAML/MachO/DWARF-debug_str.yaml b/llvm/test/ObjectYAML/MachO/DWARF-debug_str.yaml
index 4089034..29247b3 100644
--- a/llvm/test/ObjectYAML/MachO/DWARF-debug_str.yaml
+++ b/llvm/test/ObjectYAML/MachO/DWARF-debug_str.yaml
@@ -1,4 +1,6 @@
-# RUN: yaml2obj %s | obj2yaml | FileCheck %s
+## a) Test that obj2yaml is able to dump the __debug_str section.
+
+# RUN: yaml2obj --docnum=1 %s | obj2yaml | FileCheck %s
--- !mach-o
FileHeader:
@@ -252,3 +254,70 @@ DWARF:
#CHECK: - int
#CHECK: - char
+## b) Test dumping an empty __debug_str section.
+
+# RUN: yaml2obj --docnum=2 -DCONTENT='[]' %s | obj2yaml | FileCheck %s --check-prefix=EMPTY-CONTENT
+
+# EMPTY-CONTENT: Sections:
+# EMPTY-CONTENT-NEXT: - sectname: __debug_str
+# EMPTY-CONTENT-NEXT: segname: __DWARF
+# EMPTY-CONTENT-NEXT: addr: 0x0000000000000000
+# EMPTY-CONTENT-NEXT: size: 0
+# EMPTY-CONTENT-NEXT: offset: 0x00000210
+# EMPTY-CONTENT-NEXT: align: 0
+# EMPTY-CONTENT-NEXT: reloff: 0x00000000
+# EMPTY-CONTENT-NEXT: nreloc: 0
+# EMPTY-CONTENT-NEXT: flags: 0x00000000
+# EMPTY-CONTENT-NEXT: reserved1: 0x00000000
+# EMPTY-CONTENT-NEXT: reserved2: 0x00000000
+# EMPTY-CONTENT-NEXT: reserved3: 0x00000000
+# EMPTY-CONTENT-NEXT: DWARF:
+# EMPTY-CONTENT-NEXT: debug_str: []
+
+--- !mach-o
+FileHeader:
+ magic: 0xFEEDFACF
+ cputype: 0x01000007
+ cpusubtype: 0x00000003
+ filetype: 0x0000000A
+ ncmds: 1
+ sizeofcmds: 232
+ flags: 0x00000000
+ reserved: 0x00000000
+LoadCommands:
+ - cmd: LC_SEGMENT_64
+ cmdsize: 152
+ segname: __DWARF
+ vmaddr: 0x00
+ vmsize: 0x00
+ fileoff: 0x00
+ filesize: 0x00
+ maxprot: 0
+ initprot: 0
+ nsects: 1
+ flags: 0
+ Sections:
+ - sectname: __debug_str
+ segname: __DWARF
+ addr: 0x00
+ size: [[SIZE=0]]
+ offset: 0x210
+ align: 0
+ reloff: 0x00000000
+ nreloc: 0
+ flags: 0x00000000
+ reserved1: 0x00000000
+ reserved2: 0x00000000
+ reserved3: 0x00000000
+DWARF:
+ debug_str:
+ [[CONTENT]]
+
+## c) Test generating and dumping a __debug_str section who only has an empty string.
+
+# RUN: yaml2obj --docnum=2 -DCONTENT='[ "" ]' -DSIZE=1 %s | obj2yaml | FileCheck %s --check-prefix=EMPTY-STRING
+
+# EMPTY-STRING: DWARF:
+# EMPTY-STRING-NEXT: debug_str:
+# EMPTY-STRING-NEXT: - ''
+# EMPTY-STRING-NEXT: ...