1# UNSUPPORTED: system-windows
2# This test is unsupported on windows because it creates paths
3# longer than MAX_PATH
4
5# Recreate the folder structure in a temp directory we can remove later.
6RUN: rm -rf %t
7RUN: mkdir -p %t/Inputs
8RUN: cp %p/../Inputs/basic.macho.x86_64 %t/Inputs
9RUN: cp %p/../Inputs/basic1.macho.x86_64.o %t/Inputs
10RUN: cp %p/../Inputs/basic2.macho.x86_64.o %t/Inputs
11RUN: cp %p/../Inputs/basic3.macho.x86_64.o %t/Inputs
12
13# Sanity check all the files are present.
14RUN: dsymutil -f -o - -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s
15
16# Create a reproducer.
17RUN: env DSYMUTIL_REPRODUCER_PATH=%t.repro dsymutil -gen-reproducer -f -o %t.generate -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 | FileCheck %s --check-prefixes=REPRODUCER
18RUN: llvm-dwarfdump -a %t.generate | FileCheck %s
19
20# Remove the input files and sanity check that was successful.
21RUN: rm -rf %t
22RUN: not dsymutil -f -o %t.error -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefix=ERROR
23
24# Use the reproducer.
25RUN: dsymutil -use-reproducer %t.repro -f -o - -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 | llvm-dwarfdump -a - | FileCheck %s
26
27# Conflicting options.
28RUN: not dsymutil -gen-reproducer -use-reproducer %t.repro -f -o %t.error -oso-prepend-path=%t %t/Inputs/basic.macho.x86_64 2>&1 |  FileCheck %s --check-prefix=CONFLICT
29
30CHECK: .debug_info
31CHECK:  DW_TAG_compile_unit
32CHECK-NEXT:    DW_AT_producer ("Apple LLVM version 6.0 (clang-600.0.39) (based on LLVM 3.5svn)")
33CHECK-NEXT:    DW_AT_language (DW_LANG_C99)
34CHECK-NEXT:    DW_AT_name ("basic1.c")
35CHECK-NEXT:    DW_AT_stmt_list (0x00000000)
36CHECK-NEXT:    DW_AT_comp_dir ("/Inputs")
37CHECK-NEXT:    DW_AT_low_pc (0x0000000100000ea0)
38CHECK:    DW_TAG_subprogram
39CHECK-NEXT:    DW_AT_name ("main")
40CHECK-NEXT:      DW_AT_decl_file ("/Inputs{{[/\\]}}basic1.c")
41CHECK-NEXT:      DW_AT_decl_line (23)
42CHECK-NEXT:      DW_AT_prototyped (0x01)
43CHECK-NEXT:      DW_AT_type (0x00000063
44CHECK-NEXT:      DW_AT_external (0x01)
45CHECK-NEXT:      DW_AT_accessibility (DW_ACCESS_public)
46CHECK-NEXT:      DW_AT_low_pc (0x0000000100000ea0)
47CHECK-NEXT:      DW_AT_high_pc (0x0000000100000ec4)
48CHECK-NEXT:      DW_AT_frame_base (DW_OP_reg6 RBP)
49CHECK:      DW_TAG_formal_parameter
50CHECK-NEXT:        DW_AT_name ("argc")
51CHECK-NEXT:        DW_AT_decl_file ("/Inputs{{[/\\]}}basic1.c")
52CHECK-NEXT:        DW_AT_decl_line (23)
53CHECK-NEXT:        DW_AT_type (0x00000063
54CHECK-NEXT:        DW_AT_location (DW_OP_fbreg -8)
55CHECK:      DW_TAG_formal_parameter
56CHECK-NEXT:        DW_AT_name ("argv")
57CHECK-NEXT:        DW_AT_decl_file ("/Inputs{{[/\\]}}basic1.c")
58CHECK-NEXT:        DW_AT_decl_line (23)
59CHECK-NEXT:        DW_AT_type (0x0000006a
60CHECK-NEXT:        DW_AT_location (DW_OP_fbreg -16)
61CHECK:      NULL
62CHECK:    DW_TAG_base_type
63CHECK-NEXT:      DW_AT_name ("int")
64CHECK-NEXT:      DW_AT_encoding (DW_ATE_signed)
65CHECK-NEXT:      DW_AT_byte_size (0x04)
66CHECK:    DW_TAG_pointer_type
67CHECK-NEXT:      DW_AT_type (0x0000006f
68CHECK:    DW_TAG_pointer_type
69CHECK-NEXT:      DW_AT_type (0x00000074
70CHECK:    DW_TAG_const_type
71CHECK-NEXT:      DW_AT_type (0x00000079
72CHECK:    DW_TAG_base_type
73CHECK-NEXT:      DW_AT_name ("char")
74CHECK-NEXT:      DW_AT_encoding (DW_ATE_signed_char)
75CHECK-NEXT:      DW_AT_byte_size (0x01)
76CHECK:      NULL
77
78REPRODUCER: reproducer written
79ERROR: error: cannot parse the debug map
80CONFLICT: cannot combine --gen-reproducer and --use-reproducer
81