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