1 # UNSUPPORTED: system-windows
2 # This test is unsupported on windows because it creates paths
5 # Recreate the folder structure in a temp directory we can remove later.
7 RUN: mkdir -p %t/Inputs %t/tempdir
8 RUN: cp %p/../Inputs/basic.macho.x86_64 %t/Inputs
9 RUN: cp %p/../Inputs/basic1.macho.x86_64.o %t/Inputs
10 RUN: cp %p/../Inputs/basic2.macho.x86_64.o %t/Inputs
11 RUN: cp %p/../Inputs/basic3.macho.x86_64.o %t/Inputs
13 # Verify all the files are present.
14 RUN: dsymutil -f -o - -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s
16 # Make sure we don't crash with an empty TMPDIR.
17 RUN: env TMPDIR="" dsymutil -o -f -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1
19 # Make sure we don't leave around a temporary directory.
20 RUN: env TMPDIR="%t/tempdir" dsymutil -o - -f %t/Inputs/basic.macho.x86_64
21 RUN: not ls %t/tempdir/dsymutil-*
23 # Create a reproducer.
25 RUN: env DSYMUTIL_REPRODUCER_PATH=%t.repro dsymutil -gen-reproducer -f -o %t.generate -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefixes=REPRODUCER
26 RUN: llvm-dwarfdump -a %t.generate | FileCheck %s
29 RUN: env LLVM_DIAGNOSTIC_DIR=%t.diags dsymutil -gen-reproducer -f -o %t.generate -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefixes=REPRODUCER
30 RUN: ls %t.diags | grep 'dsymutil-' | count 1
32 # Remove the input files and verify that was successful.
34 RUN: not dsymutil -f -o %t.error -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefix=ERROR
36 RUN: not dsymutil --linker parallel -f -o %t.error -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefix=ERROR
39 RUN: dsymutil -use-reproducer %t.repro -f -o - -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s
40 RUN: dsymutil --linker parallel -use-reproducer %t.repro -f -o - -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s
42 # Using a reproducer takes precedence.
43 RUN: dsymutil -gen-reproducer -use-reproducer %t.repro -f -o - -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s
45 RUN: dsymutil --linker parallel -gen-reproducer -use-reproducer %t.repro -f -o - -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s
48 CHECK: DW_TAG_compile_unit
49 CHECK-NEXT: DW_AT_producer ("Apple LLVM version 6.0 (clang-600.0.39) (based on LLVM 3.5svn)")
50 CHECK-NEXT: DW_AT_language (DW_LANG_C99)
51 CHECK-NEXT: DW_AT_name ("basic1.c")
52 CHECK-NEXT: DW_AT_stmt_list (0x00000000)
53 CHECK-NEXT: DW_AT_comp_dir ("/Inputs")
54 CHECK-NEXT: DW_AT_low_pc (0x0000000100000ea0)
55 CHECK: DW_TAG_subprogram
56 CHECK-NEXT: DW_AT_name ("main")
57 CHECK-NEXT: DW_AT_decl_file ("/Inputs{{[/\\]}}basic1.c")
58 CHECK-NEXT: DW_AT_decl_line (23)
59 CHECK-NEXT: DW_AT_prototyped (0x01)
60 CHECK-NEXT: DW_AT_type (0x00000063
61 CHECK-NEXT: DW_AT_external (0x01)
62 CHECK-NEXT: DW_AT_accessibility (DW_ACCESS_public)
63 CHECK-NEXT: DW_AT_low_pc (0x0000000100000ea0)
64 CHECK-NEXT: DW_AT_high_pc (0x0000000100000ec4)
65 CHECK-NEXT: DW_AT_frame_base (DW_OP_reg6 RBP)
66 CHECK: DW_TAG_formal_parameter
67 CHECK-NEXT: DW_AT_name ("argc")
68 CHECK-NEXT: DW_AT_decl_file ("/Inputs{{[/\\]}}basic1.c")
69 CHECK-NEXT: DW_AT_decl_line (23)
70 CHECK-NEXT: DW_AT_type (0x00000063
71 CHECK-NEXT: DW_AT_location (DW_OP_fbreg -8)
72 CHECK: DW_TAG_formal_parameter
73 CHECK-NEXT: DW_AT_name ("argv")
74 CHECK-NEXT: DW_AT_decl_file ("/Inputs{{[/\\]}}basic1.c")
75 CHECK-NEXT: DW_AT_decl_line (23)
76 CHECK-NEXT: DW_AT_type (0x0000006a
77 CHECK-NEXT: DW_AT_location (DW_OP_fbreg -16)
79 CHECK: DW_TAG_base_type
80 CHECK-NEXT: DW_AT_name ("int")
81 CHECK-NEXT: DW_AT_encoding (DW_ATE_signed)
82 CHECK-NEXT: DW_AT_byte_size (0x04)
83 CHECK: DW_TAG_pointer_type
84 CHECK-NEXT: DW_AT_type (0x0000006f
85 CHECK: DW_TAG_pointer_type
86 CHECK-NEXT: DW_AT_type (0x00000074
87 CHECK: DW_TAG_const_type
88 CHECK-NEXT: DW_AT_type (0x00000079
89 CHECK: DW_TAG_base_type
90 CHECK-NEXT: DW_AT_name ("char")
91 CHECK-NEXT: DW_AT_encoding (DW_ATE_signed_char)
92 CHECK-NEXT: DW_AT_byte_size (0x01)
95 REPRODUCER: Reproducer written
96 ERROR: error: cannot parse the debug map