aboutsummaryrefslogtreecommitdiffstats
path: root/test/tools/dsymutil/debug-map-parsing.test
blob: b64ad9ff2e4d122814fa8638761a12e6eb3fba82 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
RUN: llvm-dsymutil -v -parse-only -oso-prepend-path=%p %p/Inputs/basic.macho.x86_64 | FileCheck %s
RUN: llvm-dsymutil -v -parse-only -oso-prepend-path=%p %p/Inputs/basic-lto.macho.x86_64 | FileCheck %s --check-prefix=CHECK-LTO
RUN: llvm-dsymutil -v -parse-only -oso-prepend-path=%p %p/Inputs/basic-archive.macho.x86_64 | FileCheck %s --check-prefix=CHECK-ARCHIVE
RUN: llvm-dsymutil -v -parse-only %p/Inputs/basic.macho.x86_64 2>&1 | FileCheck %s --check-prefix=NOT-FOUND
RUN: not llvm-dsymutil -v -parse-only %p/Inputs/inexistant 2>&1 | FileCheck %s --check-prefix=NO-EXECUTABLE


Check that We can parse the debug map of the basic executable.

CHECK-NOT: error
CHECK: DEBUG MAP: x86_64-unknown-unknown-macho
CHECK: /Inputs/basic1.macho.x86_64.o:
CHECK: 	0000000000000000 => 0000000100000ea0	_main
CHECK: /Inputs/basic2.macho.x86_64.o:
CHECK: 	0000000000000310 => 0000000100001000	_baz
CHECK: 	0000000000000020 => 0000000100000ed0	_foo
CHECK: 	0000000000000070 => 0000000100000f20	_inc
CHECK: 	0000000000000560 => 0000000100001008	_private_int
CHECK: /Inputs/basic3.macho.x86_64.o:
CHECK: 	0000000000000020 => 0000000100000f40	_bar
CHECK: 	0000000000000070 => 0000000100000f90	_inc
CHECK: 	0000000000000004 => 0000000100001004	_val
CHECK: END DEBUG MAP


Check that we can parse the debug-map of the basic-lto executable

CHECK-LTO-NOT: error
CHECK-LTO: DEBUG MAP: x86_64-unknown-unknown-macho
CHECK-LTO: /Inputs/basic-lto.macho.x86_64.o:
CHECK-LTO: 	0000000000000050 => 0000000100000f90	_bar
CHECK-LTO: 	0000000000000658 => 0000000100001000	_baz
CHECK-LTO: 	0000000000000010 => 0000000100000f50	_foo
CHECK-LTO: 	0000000000000000 => 0000000100000f40	_main
CHECK-LTO: 	00000000000008e8 => 0000000100001008	_private_int
CHECK-LTO: 	00000000000008ec => 0000000100001004	_val
CHECK-LTO: END DEBUG MAP

Check thet we correctly handle debug maps with archive members (including only
opening the archive once if mulitple of its members are used).

CHECK-ARCHIVE:      trying to open {{.*}}basic-archive.macho.x86_64'
CHECK-ARCHIVE-NEXT: 	loaded file.
CHECK-ARCHIVE-NEXT: trying to open {{.*}}/Inputs/basic1.macho.x86_64.o'
CHECK-ARCHIVE-NEXT: 	loaded file.
CHECK-ARCHIVE-NEXT: trying to open {{.*}}/libbasic.a(basic2.macho.x86_64.o)'
CHECK-ARCHIVE-NEXT: 	opened new archive {{.*}}/libbasic.a'
CHECK-ARCHIVE-NEXT: 	found member in current archive.
CHECK-ARCHIVE-NEXT: trying to open {{.*}}/libbasic.a(basic3.macho.x86_64.o)'
CHECK-ARCHIVE-NEXT: 	found member in current archive.
CHECK-ARCHIVE: DEBUG MAP: x86_64-unknown-unknown-macho
CHECK-ARCHIVE:       object addr =>  executable addr	symbol name
CHECK-ARCHIVE: /Inputs/basic1.macho.x86_64.o:
CHECK-ARCHIVE: 	0000000000000000 => 0000000100000ea0	_main
CHECK-ARCHIVE: /Inputs/./libbasic.a(basic2.macho.x86_64.o):
CHECK-ARCHIVE: 	0000000000000310 => 0000000100001000	_baz
CHECK-ARCHIVE: 	0000000000000020 => 0000000100000ed0	_foo
CHECK-ARCHIVE: 	0000000000000070 => 0000000100000f20	_inc
CHECK-ARCHIVE: 	0000000000000560 => 0000000100001004	_private_int
CHECK-ARCHIVE: /Inputs/./libbasic.a(basic3.macho.x86_64.o):
CHECK-ARCHIVE: 	0000000000000020 => 0000000100000f40	_bar
CHECK-ARCHIVE: 	0000000000000070 => 0000000100000f90	_inc
CHECK-ARCHIVE: 	0000000000000004 => 0000000100001008	_val
CHECK-ARCHIVE: END DEBUG MAP

Check that we warn about missing object files (this presumes that the files aren't
present in the machine's /Inputs/ folder, which should be a pretty safe bet).

NOT-FOUND: cannot open{{.*}}"/Inputs/basic1.macho.x86_64.o": {{[Nn]o}} such file
NOT-FOUND: cannot open{{.*}}"/Inputs/basic2.macho.x86_64.o": {{[Nn]o}} such file
NOT-FOUND: cannot open{{.*}}"/Inputs/basic3.macho.x86_64.o": {{[Nn]o}} such file
NOT-FOUND: DEBUG MAP:
NOT-FOUND-NEXT:  object addr =>  executable addr	symbol name
NOT-FOUND-NEXT: END DEBUG MAP

Check that we correctly error out on invalid executatble.

NO-EXECUTABLE: cannot parse{{.*}}/inexistant": {{[Nn]o}} such file
NO-EXECUTABLE-NOT: DEBUG MAP