forked from OSchip/llvm-project
60 lines
1.9 KiB
YAML
60 lines
1.9 KiB
YAML
## a) Show that llvm-dwarfdump dumps the .debug_str and
|
|
## .debug_str.dwo sections when --debug-str is specified.
|
|
|
|
## "some string\0foo\0\0"
|
|
# RUN: yaml2obj -DCONTENT="736f6d6520737472696e6700666f6f0000" %s -o %t.o
|
|
# RUN: llvm-dwarfdump %t.o --debug-str | FileCheck %s
|
|
|
|
# CHECK: .debug_str contents:
|
|
# CHECK-NEXT: 0x00000000: "some string"
|
|
# CHECK-NEXT: 0x0000000c: "foo"
|
|
# CHECK-NEXT: 0x00000010: ""
|
|
# CHECK: .debug_str.dwo contents:
|
|
# CHECK-NEXT: 0x00000000: "some string"
|
|
# CHECK-NEXT: 0x0000000c: "foo"
|
|
# CHECK-NEXT: 0x00000010: ""
|
|
# CHECK-EMPTY:
|
|
|
|
--- !ELF
|
|
FileHeader:
|
|
Class: ELFCLASS64
|
|
Data: ELFDATA2LSB
|
|
Type: ET_REL
|
|
Machine: EM_X86_64
|
|
Sections:
|
|
- Name: .debug_str
|
|
Type: SHT_PROGBITS
|
|
Content: [[CONTENT]]
|
|
- Name: .debug_str.dwo
|
|
Type: SHT_PROGBITS
|
|
Content: [[CONTENT]]
|
|
|
|
## b) Test how we dump unprintable chars.
|
|
|
|
## ['\t', '\0', '\001', '\0', '\\', '0', '0', '1', '\0']
|
|
# RUN: yaml2obj -DCONTENT="090001005C30303100" %s -o %t2.o
|
|
# RUN: llvm-dwarfdump --debug-str %t2.o | FileCheck %s --check-prefix=ESCAPED
|
|
|
|
# ESCAPED: .debug_str contents:
|
|
# ESCAPED-NEXT: 0x00000000: "\t"
|
|
# ESCAPED-NEXT: 0x00000002: "\001"
|
|
# ESCAPED-NEXT: 0x00000004: "\\001"
|
|
# ESCAPED: .debug_str.dwo contents:
|
|
# ESCAPED-NEXT: 0x00000000: "\t"
|
|
# ESCAPED-NEXT: 0x00000002: "\001"
|
|
# ESCAPED-NEXT: 0x00000004: "\\001"
|
|
# ESCAPED-EMPTY:
|
|
|
|
## c) Test that llvm-dwarfdump emits a warning when it encounters a string without a null terminator.
|
|
|
|
## "abc\0" "abc"
|
|
# RUN: yaml2obj -DCONTENT="61626300616263" %s -o %t3.o
|
|
# RUN: llvm-dwarfdump --debug-str %t3.o 2>&1 | FileCheck %s --check-prefix=WARN
|
|
|
|
# WARN: .debug_str contents:
|
|
# WARN-NEXT: 0x00000000: "abc"
|
|
# WARN-NEXT: warning: no null terminated string at offset 0x4
|
|
# WARN: .debug_str.dwo contents:
|
|
# WARN-NEXT: 0x00000000: "abc"
|
|
# WARN-NEXT: warning: no null terminated string at offset 0x4
|