| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 
 | ## 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
 |