1 RUN: llvm-dsymutil -v -dump-debug-map -oso-prepend-path=%p %p/Inputs/basic.macho.x86_64 | FileCheck %s
2 RUN: llvm-dsymutil -v -dump-debug-map -oso-prepend-path=%p %p/Inputs/basic-lto.macho.x86_64 | FileCheck %s --check-prefix=CHECK-LTO
3 RUN: llvm-dsymutil -v -dump-debug-map -oso-prepend-path=%p %p/Inputs/basic-archive.macho.x86_64 | FileCheck %s --check-prefix=CHECK-ARCHIVE
4 RUN: llvm-dsymutil -v -dump-debug-map %p/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefix=NOT-FOUND
5 RUN: not llvm-dsymutil -v -dump-debug-map %p/Inputs/inexistant 2>&1 | FileCheck %s --check-prefix=NO-EXECUTABLE
8 Check that We can parse the debug map of the basic executable.
12 CHECK: triple: 'x86_64-unknown-unknown-macho'
13 CHECK: filename:{{.*}}/Inputs/basic1.macho.x86_64.o
14 CHECK-DAG: sym: _main, objAddr: 0x0000000000000000, binAddr: 0x0000000100000EA0, size: 0x00000024
15 CHECK: filename{{.*}}/Inputs/basic2.macho.x86_64.o
16 CHECK-DAG: sym: _baz, objAddr: 0x0000000000000310, binAddr: 0x0000000100001000, size: 0x00000000
17 CHECK-DAG: sym: _foo, objAddr: 0x0000000000000020, binAddr: 0x0000000100000ED0, size: 0x00000050
18 CHECK-DAG: sym: _inc, objAddr: 0x0000000000000070, binAddr: 0x0000000100000F20, size: 0x00000017
19 CHECK-DAG: sym: _private_int, objAddr: 0x0000000000000560, binAddr: 0x0000000100001008, size: 0x00000000
20 CHECK: filename{{.*}}/Inputs/basic3.macho.x86_64.o
21 CHECK-DAG: sym: _bar, objAddr: 0x0000000000000020, binAddr: 0x0000000100000F40, size: 0x00000050
22 CHECK-DAG: sym: _inc, objAddr: 0x0000000000000070, binAddr: 0x0000000100000F90, size: 0x00000019
23 CHECK-DAG: sym: _val, objAddr: 0x0000000000000004, binAddr: 0x0000000100001004, size: 0x00000000
27 Check that we can parse the debug-map of the basic-lto executable
31 CHECK-LTO: triple: 'x86_64-unknown-unknown-macho'
32 CHECK-LTO: /Inputs/basic-lto.macho.x86_64.o
33 CHECK-LTO-DAG: sym: _bar, objAddr: 0x0000000000000050, binAddr: 0x0000000100000F90, size: 0x00000024
34 CHECK-LTO-DAG: sym: _baz, objAddr: 0x0000000000000658, binAddr: 0x0000000100001000, size: 0x00000000
35 CHECK-LTO-DAG: sym: _foo, objAddr: 0x0000000000000010, binAddr: 0x0000000100000F50, size: 0x00000040
36 CHECK-LTO-DAG: sym: _main, objAddr: 0x0000000000000000, binAddr: 0x0000000100000F40, size: 0x00000010
37 CHECK-LTO-DAG: sym: _private_int, objAddr: 0x00000000000008E8, binAddr: 0x0000000100001008, size: 0x00000000
38 CHECK-LTO-DAG: sym: _val, objAddr: 0x00000000000008EC, binAddr: 0x0000000100001004, size: 0x00000000
41 Check thet we correctly handle debug maps with archive members (including only
42 opening the archive once if mulitple of its members are used).
44 CHECK-ARCHIVE: trying to open {{.*}}basic-archive.macho.x86_64'
45 CHECK-ARCHIVE-NEXT: loaded file.
46 CHECK-ARCHIVE-NEXT: trying to open {{.*}}/Inputs/basic1.macho.x86_64.o'
47 CHECK-ARCHIVE-NEXT: loaded file.
48 CHECK-ARCHIVE-NEXT: trying to open {{.*}}/libbasic.a(basic2.macho.x86_64.o)'
49 CHECK-ARCHIVE-NEXT: opened new archive {{.*}}/libbasic.a'
50 CHECK-ARCHIVE-NEXT: found member in current archive.
51 CHECK-ARCHIVE-NEXT: trying to open {{.*}}/libbasic.a(basic3.macho.x86_64.o)'
52 CHECK-ARCHIVE-NEXT: found member in current archive.
54 CHECK-ARCHIVE: triple: 'x86_64-unknown-unknown-macho'
55 CHECK-ARCHIVE: /Inputs/basic1.macho.x86_64.o
56 CHECK-ARCHIVE-DAG: sym: _main, objAddr: 0x0000000000000000, binAddr: 0x0000000100000EA0, size: 0x00000024
57 CHECK-ARCHIVE: /Inputs/./libbasic.a(basic2.macho.x86_64.o)
58 CHECK-ARCHIVE-DAG: sym: _baz, objAddr: 0x0000000000000310, binAddr: 0x0000000100001000, size: 0x00000000
59 CHECK-ARCHIVE-DAG: sym: _foo, objAddr: 0x0000000000000020, binAddr: 0x0000000100000ED0, size: 0x00000050
60 CHECK-ARCHIVE-DAG: sym: _inc, objAddr: 0x0000000000000070, binAddr: 0x0000000100000F20, size: 0x00000017
61 CHECK-ARCHIVE-DAG: sym: _private_int, objAddr: 0x0000000000000560, binAddr: 0x0000000100001004, size: 0x00000000
62 CHECK-ARCHIVE: /Inputs/./libbasic.a(basic3.macho.x86_64.o)
63 CHECK-ARCHIVE-DAG: sym: _bar, objAddr: 0x0000000000000020, binAddr: 0x0000000100000F40, size: 0x00000050
64 CHECK-ARCHIVE-DAG: sym: _inc, objAddr: 0x0000000000000070, binAddr: 0x0000000100000F90, size: 0x00000019
65 CHECK-ARCHIVE-DAG: sym: _val, objAddr: 0x0000000000000004, binAddr: 0x0000000100001008, size: 0x00000000
68 Check that we warn about missing object files (this presumes that the files aren't
69 present in the machine's /Inputs/ folder, which should be a pretty safe bet).
71 NOT-FOUND: cannot open{{.*}}"/Inputs/basic1.macho.x86_64.o": {{[Nn]o}} such file
72 NOT-FOUND: cannot open{{.*}}"/Inputs/basic2.macho.x86_64.o": {{[Nn]o}} such file
73 NOT-FOUND: cannot open{{.*}}"/Inputs/basic3.macho.x86_64.o": {{[Nn]o}} such file
75 NOT-FOUND-NEXT: triple: 'x86_64-unknown-unknown-macho'
78 Check that we correctly error out on invalid executatble.
80 NO-EXECUTABLE: cannot parse{{.*}}/inexistant": {{[Nn]o}} such file
81 NO-EXECUTABLE-NOT: ---