[dsymutil] Implement the BinaryHolder object and gain archive support.
[oota-llvm.git] / test / tools / dsymutil / debug-map-parsing.test
1 RUN: llvm-dsymutil -v -parse-only -oso-prepend-path=%p %p/Inputs/basic.macho.x86_64 | FileCheck %s
2 RUN: llvm-dsymutil -v -parse-only -oso-prepend-path=%p %p/Inputs/basic-lto.macho.x86_64 | FileCheck %s --check-prefix=CHECK-LTO
3 RUN: llvm-dsymutil -v -parse-only -oso-prepend-path=%p %p/Inputs/basic-archive.macho.x86_64 | FileCheck %s --check-prefix=CHECK-ARCHIVE
4 RUN: llvm-dsymutil -v -parse-only %p/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefix=NOT-FOUND
5 RUN: not llvm-dsymutil -v -parse-only %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: DEBUG MAP:
12 CHECK: /Inputs/basic1.macho.x86_64.o:
13 CHECK:  0000000000000000 => 0000000100000ea0    _main
14 CHECK: /Inputs/basic2.macho.x86_64.o:
15 CHECK:  0000000000000310 => 0000000100001000    _baz
16 CHECK:  0000000000000020 => 0000000100000ed0    _foo
17 CHECK:  0000000000000070 => 0000000100000f20    _inc
18 CHECK:  0000000000000560 => 0000000100001008    _private_int
19 CHECK: /Inputs/basic3.macho.x86_64.o:
20 CHECK:  0000000000000020 => 0000000100000f40    _bar
21 CHECK:  0000000000000070 => 0000000100000f90    _inc
22 CHECK:  0000000000000004 => 0000000100001004    _val
23 CHECK: END DEBUG MAP
24
25
26 Check that we can parse the debug-map of the basic-lto executable
27
28 CHECK-LTO-NOT: error
29 CHECK-LTO: DEBUG MAP:
30 CHECK-LTO: /Inputs/basic-lto.macho.x86_64.o:
31 CHECK-LTO:      0000000000000050 => 0000000100000f90    _bar
32 CHECK-LTO:      0000000000000658 => 0000000100001000    _baz
33 CHECK-LTO:      0000000000000010 => 0000000100000f50    _foo
34 CHECK-LTO:      0000000000000000 => 0000000100000f40    _main
35 CHECK-LTO:      00000000000008e8 => 0000000100001008    _private_int
36 CHECK-LTO:      00000000000008ec => 0000000100001004    _val
37 CHECK-LTO: END DEBUG MAP
38
39 Check thet we correctly handle debug maps with archive members (including only
40 opening the archive once if mulitple of its members are used).
41
42 CHECK-ARCHIVE:      trying to open {{.*}}basic-archive.macho.x86_64'
43 CHECK-ARCHIVE-NEXT:     loaded file.
44 CHECK-ARCHIVE-NEXT: trying to open {{.*}}/Inputs/basic1.macho.x86_64.o'
45 CHECK-ARCHIVE-NEXT:     loaded file.
46 CHECK-ARCHIVE-NEXT: trying to open {{.*}}/libbasic.a(basic2.macho.x86_64.o)'
47 CHECK-ARCHIVE-NEXT:     opened new archive {{.*}}/libbasic.a'
48 CHECK-ARCHIVE-NEXT:     found member in current archive.
49 CHECK-ARCHIVE-NEXT: trying to open {{.*}}/libbasic.a(basic3.macho.x86_64.o)'
50 CHECK-ARCHIVE-NEXT:     found member in current archive.
51 CHECK-ARCHIVE: DEBUG MAP:   object addr =>  executable addr     symbol name
52 CHECK-ARCHIVE: /Inputs/basic1.macho.x86_64.o:
53 CHECK-ARCHIVE:  0000000000000000 => 0000000100000ea0    _main
54 CHECK-ARCHIVE: /Inputs/./libbasic.a(basic2.macho.x86_64.o):
55 CHECK-ARCHIVE:  0000000000000310 => 0000000100001000    _baz
56 CHECK-ARCHIVE:  0000000000000020 => 0000000100000ed0    _foo
57 CHECK-ARCHIVE:  0000000000000070 => 0000000100000f20    _inc
58 CHECK-ARCHIVE:  0000000000000560 => 0000000100001004    _private_int
59 CHECK-ARCHIVE: /Inputs/./libbasic.a(basic3.macho.x86_64.o):
60 CHECK-ARCHIVE:  0000000000000020 => 0000000100000f40    _bar
61 CHECK-ARCHIVE:  0000000000000070 => 0000000100000f90    _inc
62 CHECK-ARCHIVE:  0000000000000004 => 0000000100001008    _val
63 CHECK-ARCHIVE: END DEBUG MAP
64
65 Check that we warn about missing object files (this presumes that the files aren't
66 present in the machine's /Inputs/ folder, which should be a pretty safe bet).
67
68 NOT-FOUND: cannot open{{.*}}"/Inputs/basic1.macho.x86_64.o": {{[Nn]o}} such file
69 NOT-FOUND: cannot open{{.*}}"/Inputs/basic2.macho.x86_64.o": {{[Nn]o}} such file
70 NOT-FOUND: cannot open{{.*}}"/Inputs/basic3.macho.x86_64.o": {{[Nn]o}} such file
71 NOT-FOUND: DEBUG MAP:
72 NOT-FOUND-NEXT: END DEBUG MAP
73
74 Check that we correctly error out on invalid executatble.
75
76 NO-EXECUTABLE: cannot parse{{.*}}/inexistant": {{[Nn]o}} such file
77 NO-EXECUTABLE-NOT: DEBUG MAP