1 RUN: dsymutil -dump-debug-map -oso-prepend-path=%p %p/Inputs/basic.macho.x86_64 | FileCheck %s
2 RUN: dsymutil -dump-debug-map -oso-prepend-path=%p %p/Inputs/basic-lto.macho.x86_64 | FileCheck %s --check-prefix=CHECK-LTO
3 RUN: dsymutil -verbose -dump-debug-map -oso-prepend-path=%p %p/Inputs/basic-archive.macho.x86_64 2>&1 | FileCheck %s --check-prefix=CHECK-ARCHIVE
4 RUN: dsymutil -dump-debug-map %p/Inputs/basic.macho.x86_64 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=NOT-FOUND
5 RUN: not dsymutil -dump-debug-map %p/Inputs/inexistant 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=NO-EXECUTABLE
7 RUN: dsymutil --linker parallel -dump-debug-map -oso-prepend-path=%p %p/Inputs/basic.macho.x86_64 | FileCheck %s
8 RUN: dsymutil --linker parallel -dump-debug-map -oso-prepend-path=%p %p/Inputs/basic-lto.macho.x86_64 | FileCheck %s --check-prefix=CHECK-LTO
9 RUN: dsymutil --linker parallel -verbose -dump-debug-map -oso-prepend-path=%p %p/Inputs/basic-archive.macho.x86_64 2>&1 | FileCheck %s --check-prefix=CHECK-ARCHIVE
10 RUN: dsymutil --linker parallel -dump-debug-map %p/Inputs/basic.macho.x86_64 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=NOT-FOUND
11 RUN: not dsymutil --linker parallel -dump-debug-map %p/Inputs/inexistant 2>&1 | FileCheck -DMSG=%errc_ENOENT %s --check-prefix=NO-EXECUTABLE
15 Check that We can parse the debug map of the basic executable.
19 CHECK: triple: 'x86_64-apple-darwin'
20 CHECK: binary-path:{{.*}}/Inputs/basic.macho.x86_64
21 CHECK: filename:{{.*}}/Inputs/basic1.macho.x86_64.o
22 CHECK-DAG: sym: _main, objAddr: 0x0, binAddr: 0x100000EA0, size: 0x24
23 CHECK: filename{{.*}}/Inputs/basic2.macho.x86_64.o
24 CHECK-DAG: sym: _baz, objAddr: 0x310, binAddr: 0x100001000, size: 0x0
25 CHECK-DAG: sym: _foo, objAddr: 0x20, binAddr: 0x100000ED0, size: 0x50
26 CHECK-DAG: sym: _inc, objAddr: 0x70, binAddr: 0x100000F20, size: 0x17
27 CHECK-DAG: sym: _private_int, objAddr: 0x560, binAddr: 0x100001008, size: 0x0
28 CHECK: filename{{.*}}/Inputs/basic3.macho.x86_64.o
29 CHECK-DAG: sym: _bar, objAddr: 0x20, binAddr: 0x100000F40, size: 0x50
30 CHECK-DAG: sym: _inc, objAddr: 0x70, binAddr: 0x100000F90, size: 0x19
31 CHECK-DAG: sym: _val, binAddr: 0x100001004, size: 0x0
35 Check that we can parse the debug-map of the basic-lto executable
39 CHECK-LTO: triple: 'x86_64-apple-darwin'
40 CHECK-LTO: binary-path:{{.*}}/Inputs/basic-lto.macho.x86_64
41 CHECK-LTO: /Inputs/basic-lto.macho.x86_64.o
42 CHECK-LTO-DAG: sym: _bar, objAddr: 0x50, binAddr: 0x100000F90, size: 0x24
43 CHECK-LTO-DAG: sym: _baz, objAddr: 0x658, binAddr: 0x100001000, size: 0x0
44 CHECK-LTO-DAG: sym: _foo, objAddr: 0x10, binAddr: 0x100000F50, size: 0x40
45 CHECK-LTO-DAG: sym: _main, objAddr: 0x0, binAddr: 0x100000F40, size: 0x10
46 CHECK-LTO-DAG: sym: _private_int, objAddr: 0x8E8, binAddr: 0x100001008, size: 0x0
47 CHECK-LTO-DAG: sym: _val, objAddr: 0x8EC, binAddr: 0x100001004, size: 0x0
50 Check thet we correctly handle debug maps with archive members (including only
51 opening the archive once if mulitple of its members are used).
53 CHECK-ARCHIVE: trying to open {{.*}}basic-archive.macho.x86_64'
54 CHECK-ARCHIVE-NEXT: loaded object.
55 CHECK-ARCHIVE-NEXT: trying to open {{.*}}/Inputs/basic1.macho.x86_64.o'
56 CHECK-ARCHIVE: loaded object.
57 CHECK-ARCHIVE-NEXT: trying to open {{.*}}/libbasic.a(basic2.macho.x86_64.o)'
58 CHECK-ARCHIVE-NEXT: loaded archive {{.*}}/libbasic.a'
59 CHECK-ARCHIVE-NEXT: found member in archive.
60 CHECK-ARCHIVE-NEXT: trying to open {{.*}}/libbasic.a(basic3.macho.x86_64.o)'
61 CHECK-ARCHIVE-NEXT: found member in archive.
63 CHECK-ARCHIVE: triple: 'x86_64-apple-darwin'
64 CHECK-ARCHIVE: binary-path:{{.*}}/Inputs/basic-archive.macho.x86_64
65 CHECK-ARCHIVE: /Inputs/basic1.macho.x86_64.o
66 CHECK-ARCHIVE-DAG: sym: _main, objAddr: 0x0, binAddr: 0x100000EA0, size: 0x24
67 CHECK-ARCHIVE: /Inputs/./libbasic.a(basic2.macho.x86_64.o)
68 CHECK-ARCHIVE-DAG: sym: _baz, objAddr: 0x310, binAddr: 0x100001000, size: 0x0
69 CHECK-ARCHIVE-DAG: sym: _foo, objAddr: 0x20, binAddr: 0x100000ED0, size: 0x50
70 CHECK-ARCHIVE-DAG: sym: _inc, objAddr: 0x70, binAddr: 0x100000F20, size: 0x17
71 CHECK-ARCHIVE-DAG: sym: _private_int, objAddr: 0x560, binAddr: 0x100001004, size: 0x0
72 CHECK-ARCHIVE: /Inputs/./libbasic.a(basic3.macho.x86_64.o)
73 CHECK-ARCHIVE-DAG: sym: _bar, objAddr: 0x20, binAddr: 0x100000F40, size: 0x50
74 CHECK-ARCHIVE-DAG: sym: _inc, objAddr: 0x70, binAddr: 0x100000F90, size: 0x19
75 CHECK-ARCHIVE-DAG: sym: _val, binAddr: 0x100001008, size: 0x0
78 Check that we warn about missing object files (this presumes that the files aren't
79 present in the machine's /Inputs/ folder, which should be a pretty safe bet).
81 warning: (x86_64) /Inputs/basic1.macho.x86_64.o unable to open object file:
82 NOT-FOUND: warning: (x86_64) {{.*}}/Inputs/basic1.macho.x86_64.o unable to open object file: [[MSG]]
83 NOT-FOUND: warning: (x86_64) {{.*}}/Inputs/basic2.macho.x86_64.o unable to open object file: [[MSG]]
84 NOT-FOUND: warning: (x86_64) {{.*}}/Inputs/basic3.macho.x86_64.o unable to open object file: [[MSG]]
86 NOT-FOUND-NEXT: triple: 'x86_64-apple-darwin'
87 NOT-FOUND-NEXT: binary-path:{{.*}}/Inputs/basic.macho.x86_64
90 Check that we correctly error out on invalid executable.
92 NO-EXECUTABLE: cannot parse{{.*}}/inexistant': [[MSG]]
93 NO-EXECUTABLE-NOT: ---