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