• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1## a) Show that llvm-dwarfdump dumps the .debug_str and
2## .debug_str.dwo sections when --debug-str is specified.
3
4##                        "some string\0foo\0\0"
5# RUN: yaml2obj -DCONTENT="736f6d6520737472696e6700666f6f0000" %s -o %t.o
6# RUN: llvm-dwarfdump %t.o --debug-str | FileCheck %s
7
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--- !ELF
19FileHeader:
20  Class:   ELFCLASS64
21  Data:    ELFDATA2LSB
22  Type:    ET_REL
23  Machine: EM_X86_64
24Sections:
25  - Name:    .debug_str
26    Type:    SHT_PROGBITS
27    Content: [[CONTENT]]
28  - Name:    .debug_str.dwo
29    Type:    SHT_PROGBITS
30    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.o
36# RUN: llvm-dwarfdump --debug-str %t2.o | FileCheck %s --check-prefix=ESCAPED
37
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.o
52# RUN: llvm-dwarfdump --debug-str %t3.o 2>&1 | FileCheck %s --check-prefix=WARN
53
54#      WARN: .debug_str contents:
55# WARN-NEXT: 0x00000000: "abc"
56# WARN-NEXT: warning: no null terminated string at offset 0x4
57#      WARN: .debug_str.dwo contents:
58# WARN-NEXT: 0x00000000: "abc"
59# WARN-NEXT: warning: no null terminated string at offset 0x4
60