60 lines · yaml
1## a) Show that llvm-dwarfdump dumps the .debug_str and2## .debug_str.dwo sections when --debug-str is specified.3 4## "some string\0foo\0\0"5# RUN: yaml2obj -DCONTENT="736f6d6520737472696e6700666f6f0000" %s -o %t.o6# RUN: llvm-dwarfdump %t.o --debug-str | FileCheck %s7 8# CHECK: .debug_str contents:9# CHECK-NEXT: 0x00000000: "some string"10# CHECK-NEXT: 0x0000000c: "foo"11# CHECK-NEXT: 0x00000010: ""12# CHECK: .debug_str.dwo contents:13# CHECK-NEXT: 0x00000000: "some string"14# CHECK-NEXT: 0x0000000c: "foo"15# CHECK-NEXT: 0x00000010: ""16# CHECK-EMPTY:17 18--- !ELF19FileHeader:20 Class: ELFCLASS6421 Data: ELFDATA2LSB22 Type: ET_REL23 Machine: EM_X86_6424Sections:25 - Name: .debug_str26 Type: SHT_PROGBITS27 Content: [[CONTENT]]28 - Name: .debug_str.dwo29 Type: SHT_PROGBITS30 Content: [[CONTENT]]31 32## b) Test how we dump unprintable chars.33 34## ['\t', '\0', '\001', '\0', '\\', '0', '0', '1', '\0']35# RUN: yaml2obj -DCONTENT="090001005C30303100" %s -o %t2.o36# RUN: llvm-dwarfdump --debug-str %t2.o | FileCheck %s --check-prefix=ESCAPED37 38# ESCAPED: .debug_str contents:39# ESCAPED-NEXT: 0x00000000: "\t"40# ESCAPED-NEXT: 0x00000002: "\001"41# ESCAPED-NEXT: 0x00000004: "\\001"42# ESCAPED: .debug_str.dwo contents:43# ESCAPED-NEXT: 0x00000000: "\t"44# ESCAPED-NEXT: 0x00000002: "\001"45# ESCAPED-NEXT: 0x00000004: "\\001"46# ESCAPED-EMPTY:47 48## c) Test that llvm-dwarfdump emits a warning when it encounters a string without a null terminator.49 50## "abc\0" "abc"51# RUN: yaml2obj -DCONTENT="61626300616263" %s -o %t3.o52# RUN: llvm-dwarfdump --debug-str %t3.o 2>&1 | FileCheck %s --check-prefix=WARN53 54# WARN: .debug_str contents:55# WARN-NEXT: 0x00000000: "abc"56# WARN-NEXT: warning: no null terminated string at offset 0x457# WARN: .debug_str.dwo contents:58# WARN-NEXT: 0x00000000: "abc"59# WARN-NEXT: warning: no null terminated string at offset 0x460