1 ## Test how we dump the .debug_str section.
3 ## a) Test dumping a .debug_str section with a default section header.
5 # RUN: yaml2obj --docnum=1 %s | obj2yaml | \
6 # RUN: FileCheck %s --check-prefix=BASIC --implicit-check-not='Name: .debug_str'
8 ## b) Test dumping a .debug_str section whose section header properties are overridden.
10 ## Override the sh_type field.
11 # RUN: yaml2obj --docnum=1 -DTYPE=STRTAB %s | obj2yaml | \
12 # RUN: FileCheck %s --check-prefixes=BASIC,COMMON \
13 # RUN: -DTYPE=STRTAB -DFLAGS="[ SHF_MERGE, SHF_STRINGS ]" -D#%x,ADDRALIGN=1
15 ## Override the sh_flags field.
16 # RUN: yaml2obj --docnum=1 -DFLAGS=[SHF_ALLOC] %s | obj2yaml | \
17 # RUN: FileCheck %s --check-prefixes=BASIC,COMMON \
18 # RUN: -DTYPE=PROGBITS -DFLAGS="[ SHF_ALLOC ]" -D#%x,ADDRALIGN=1
20 ## Override the sh_link field.
21 # RUN: yaml2obj --docnum=1 -DLINK=.sec %s | obj2yaml | \
22 # RUN: FileCheck %s --check-prefixes=BASIC,COMMON,LINK \
23 # RUN: -DTYPE=PROGBITS -DFLAGS="[ SHF_MERGE, SHF_STRINGS ]" -DLINK=.sec -D#%x,ADDRALIGN=1
25 ## Override the sh_addr field.
26 # RUN: yaml2obj --docnum=1 -DADDRESS=0x2020 %s | obj2yaml | \
27 # RUN: FileCheck %s --check-prefixes=BASIC,COMMON,ADDRESS \
28 # RUN: -DTYPE=PROGBITS -DFLAGS="[ SHF_MERGE, SHF_STRINGS ]" -D#%x,ADDRALIGN=1 -D#%x,ADDRESS=0x2020
30 ## Override the sh_addralign field.
31 # RUN: yaml2obj --docnum=1 -DADDRALIGN=3 %s | obj2yaml | \
32 # RUN: FileCheck %s --check-prefixes=BASIC,COMMON \
33 # RUN: -DTYPE=PROGBITS -DFLAGS="[ SHF_MERGE, SHF_STRINGS ]" -D#%x,ADDRALIGN=3
35 ## Override the sh_entsize field (sh_entsize=3).
36 # RUN: yaml2obj --docnum=1 -DENTSIZE=3 %s | obj2yaml | \
37 # RUN: FileCheck %s --check-prefixes=BASIC,COMMON,ENTSIZE \
38 # RUN: -DTYPE=PROGBITS -DFLAGS="[ SHF_MERGE, SHF_STRINGS ]" -D#%x,ADDRALIGN=1 -D#%x,ENTSIZE=3
40 ## Override the sh_entsize field (sh_entsize=0).
41 # RUN: yaml2obj --docnum=1 -DENTSIZE=0 %s | obj2yaml | \
42 # RUN: FileCheck %s --check-prefixes=BASIC,COMMON,ENTSIZE \
43 # RUN: -DTYPE=PROGBITS -DFLAGS="[ SHF_MERGE, SHF_STRINGS ]" -D#%x,ADDRALIGN=1 -D#%x,ENTSIZE=0
45 ## Override the sh_info field.
46 # RUN: yaml2obj --docnum=1 -DINFO=3 %s | obj2yaml | \
47 # RUN: FileCheck %s --check-prefixes=BASIC,COMMON,INFO \
48 # RUN: -DTYPE=PROGBITS -DFLAGS="[ SHF_MERGE, SHF_STRINGS ]" -D#%x,INFO=3 -D#%x,ADDRALIGN=1 -D#%x,ENTSIZE=1
57 Type: SHT_[[TYPE=PROGBITS]]
58 Flags: [[FLAGS=<none>]]
60 EntSize: [[ENTSIZE=1]]
62 AddressAlign: [[ADDRALIGN=1]]
63 Address: [[ADDRESS=<none>]]
72 # COMMON: - Name: .debug_str
73 # COMMON-NEXT: Type: SHT_[[TYPE]]
74 # COMMON-NEXT: Flags: [[FLAGS]]
75 # LINK-NEXT: Link: .sec
76 # ADDRESS-NEXT: Address: 0x[[#%x,ADDRESS]]
77 # COMMON-NEXT: AddressAlign: 0x[[#%x,ADDRALIGN]]
78 # ENTSIZE-NEXT: EntSize: 0x[[#%x,ENTSIZE]]
79 # INFO-NEXT: Info: 0x[[#%x,INFO]]
81 # BASIC-NEXT: debug_str:
87 ## c) Test dumping an empty .debug_str section.
89 # RUN: yaml2obj --docnum=2 %s | obj2yaml | FileCheck %s --check-prefix=EMPTY --implicit-check-not=Sections
92 # EMPTY-NEXT: debug_str: []
103 ## d) Test that yaml2obj stops parsing the .debug_str section if it encounters a
104 ## string without a null terminator. The output uses a raw content section instead of
105 ## the DWARF tag to represent the broken .debug_str section.
107 # RUN: yaml2obj --docnum=3 %s | obj2yaml | FileCheck %s --check-prefix=NO-TERMINATOR
109 # NO-TERMINATOR-NOT: DWARF:
110 # NO-TERMINATOR: Sections:
111 # NO-TERMINATOR-NEXT: - Name: .debug_str
112 # NO-TERMINATOR-NEXT: Type: SHT_PROGBITS
113 # NO-TERMINATOR-NEXT: Flags: [ SHF_MERGE, SHF_STRINGS ]
114 # NO-TERMINATOR-NEXT: Content: '61626300616263'
115 # NO-TERMINATOR-NEXT: ...
125 Content: "61626300616263" ## "abc\0abc"