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