xref: /llvm-project/llvm/test/tools/llvm-dwarfutil/ELF/X86/separate-debug-file.test (revision 4539b44148918c332ff966a2a955aca0ab93dde4)
1## This test checks the --[no-]separate-debug-file option.
2
3# RUN: yaml2obj %p/Inputs/common.yaml -o %t.o
4
5## Check --garbage-collection --no-separate-debug-file.
6# RUN: llvm-dwarfutil --garbage-collection --no-separate-debug-file %t.o %t2
7# RUN: llvm-dwarfdump -a %t2 | FileCheck --check-prefix=CHECK-DEBUG %s
8
9## Check --garbage-collection --separate-debug-file.
10# RUN: llvm-dwarfutil --garbage-collection --separate-debug-file %t.o %t2
11# RUN: llvm-objdump --headers %t2 | FileCheck --check-prefix=CHECK-NON-DEBUG %s
12# RUN: llvm-dwarfdump -a %t2.debug | FileCheck --check-prefix=CHECK-DEBUG %s
13
14## Check --no-garbage-collection --no-separate-debug-file.
15# RUN: llvm-dwarfutil --no-garbage-collection --no-separate-debug-file %t.o %t1
16# RUN: llvm-dwarfdump -a %t1 | FileCheck --check-prefix=CHECK-DEBUG %s
17
18## Check --no-garbage-collection --separate-debug-file.
19# RUN: llvm-dwarfutil --no-garbage-collection %t.o --separate-debug-file %t3
20# RUN: llvm-objdump --headers %t3 | FileCheck --check-prefix=CHECK-NON-DEBUG %s
21# RUN: llvm-dwarfdump -a %t3.debug | FileCheck --check-prefix=CHECK-DEBUG %s
22## Copy result to compare it later.
23# RUN: cp %t3 %t4
24# RUN: cp %t3.debug %t4.debug
25
26## Check that --separate-debug-file wins if last.
27# RUN: llvm-dwarfutil --no-garbage-collection --no-separate-debug-file --separate-debug-file %t.o %t3
28# RUN: cmp %t4 %t3
29# RUN: cmp %t4.debug %t3.debug
30
31## Check that --no-separate-debug-file wins if last.
32# RUN: llvm-dwarfutil --no-garbage-collection --separate-debug-file --no-separate-debug-file %t.o %t5
33# RUN: cmp %t1 %t5
34
35# CHECK-NON-DEBUG-NOT: .debug_abbrev
36# CHECK-NON-DEBUG-NOT: .debug_info
37# CHECK-NON-DEBUG: .gnu_debuglink
38# CHECK-NON-DEBUG-NOT: .debug_abbrev
39# CHECK-NON-DEBUG-NOT: .debug_info
40
41# CHECK-DEBUG: .debug_abbrev
42# CHECK-DEBUG: DW_TAG_compile_unit
43# CHECK-DEBUG: .debug_info
44# CHECK-DEBUG: DW_TAG_compile_unit
45# CHECK-DEBUG: DW_AT_producer{{.*}}"by_hand"
46# CHECK-DEBUG: DW_AT_language{{.*}}DW_LANG_C_plus_plus
47# CHECK-DEBUG: DW_AT_name{{.*}}"CU1"
48# CHECK-DEBUG: DW_TAG_class_type
49# CHECK-DEBUG: DW_AT_name{{.*}}"class1"
50# CHECK-DEBUG: DW_TAG_base_type
51# CHECK-DEBUG: DW_AT_name{{.*}}"int"
52# CHECK-DEBUG: DW_AT_name{{.*}}"char"
53# CHECK-DEBUG: DW_AT_name{{.*}}"float"
54# CHECK-DEBUG: DW_TAG_pointer_type
55# CHECK-DEBUG: DW_TAG_variable
56# CHECK-DEBUG: DW_AT_name{{.*}}"var1"
57