4 # RUN: llvm-mc -triple=x86_64-windows-msvc --filetype=obj %p/Inputs/inline_sites.s > %t.obj
5 # RUN: lld-link -debug:full -nodefaultlib -entry:main -base:0x140000000 %t.obj -out:%t.exe
6 # RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \
7 # RUN: %p/Inputs/inline_sites.lldbinit 2>&1 | FileCheck %s
9 # CHECK: (lldb) image dump line-table a.cpp -v
10 # CHECK-NEXT: Line table
11 # CHECK-NEXT: 0x0000000140001000: /tmp/a.cpp:2
12 # CHECK-NEXT: 0x0000000140001004: /tmp/a.h:5, is_start_of_statement = TRUE, is_prologue_end = TRUE
13 # CHECK-NEXT: 0x000000014000100c: /tmp/a.h:6
14 # CHECK-NEXT: 0x0000000140001010: /tmp/a.h:7
15 # CHECK-NEXT: 0x0000000140001018: /tmp/a.h:9
16 # CHECK-NEXT: 0x000000014000101c: /tmp/b.h:5, is_start_of_statement = TRUE, is_prologue_end = TRUE
17 # CHECK-NEXT: 0x0000000140001022: /tmp/b.h:6
18 # CHECK-NEXT: 0x0000000140001026: /tmp/b.h:7
19 # CHECK-NEXT: 0x000000014000102a: /tmp/c.h:5, is_start_of_statement = TRUE, is_prologue_end = TRUE
20 # CHECK-NEXT: 0x0000000140001031: /tmp/c.h:6
21 # CHECK-NEXT: 0x0000000140001035: /tmp/c.h:7
22 # CHECK-NEXT: 0x0000000140001039: /tmp/a.cpp:3
23 # CHECK-NEXT: 0x000000014000103d: /tmp/a.cpp:4
24 # CHECK-NEXT: 0x000000014000103f: /tmp/a.h:20
25 # CHECK-NEXT: 0x0000000140001044: /tmp/a.h:8
26 # CHECK-NEXT: 0x0000000140001046: /tmp/a.cpp:3, is_terminal_entry = TRUE
28 #CHECK: (lldb) b a.h:5
29 #CHECK: Breakpoint 1: where = {{.*}}`main + 4 [inlined] Namespace1::foo at a.h:5, address = 0x0000000140001004
30 #CHECK: (lldb) b a.h:6
31 #CHECK: Breakpoint 2: where = {{.*}}`main + 12 [inlined] Namespace1::foo + 8 at a.h:6, address = 0x000000014000100c
32 #CHECK: (lldb) b a.h:7
33 #CHECK: Breakpoint 3: where = {{.*}}`main + 16 [inlined] Namespace1::foo + 12 at a.h:7, address = 0x0000000140001010
34 #CHECK: (lldb) b a.h:8
35 #CHECK: Breakpoint 4: where = {{.*}}`main + 68 [inlined] Namespace1::foo + 5 at a.h:8, address = 0x0000000140001044
36 #CHECK: (lldb) b a.h:9
37 #CHECK: Breakpoint 5: where = {{.*}}`main + 24 [inlined] Namespace1::foo + 20 at a.h:9, address = 0x0000000140001018
38 #CHECK: (lldb) b b.h:5
39 #CHECK: Breakpoint 6: where = {{.*}}`main + 28 [inlined] Class1::bar at b.h:5, address = 0x000000014000101c
40 #CHECK: (lldb) b b.h:6
41 #CHECK: Breakpoint 7: where = {{.*}}`main + 34 [inlined] Class1::bar + 6 at b.h:6, address = 0x0000000140001022
42 #CHECK: (lldb) b b.h:7
43 #CHECK: Breakpoint 8: where = {{.*}}`main + 38 [inlined] Class1::bar + 10 at b.h:7, address = 0x0000000140001026
44 #CHECK: (lldb) b c.h:5
45 #CHECK: Breakpoint 9: where = {{.*}}`main + 42 [inlined] Namespace2::Class2::func at c.h:5, address = 0x000000014000102a
46 #CHECK: (lldb) b c.h:6
47 #CHECK: Breakpoint 10: where = {{.*}}`main + 49 [inlined] Namespace2::Class2::func + 7 at c.h:6, address = 0x0000000140001031
48 #CHECK: (lldb) b c.h:7
49 #CHECK: Breakpoint 11: where = {{.*}}`main + 53 [inlined] Namespace2::Class2::func + 11 at c.h:7, address = 0x0000000140001035
50 #CHECK: (lldb) b a.cpp:3
51 #CHECK: Breakpoint 12: where = {{.*}}`main + 57 at a.cpp:3, address = 0x0000000140001039
52 #CHECK: (lldb) b a.cpp:4
53 #CHECK: Breakpoint 13: where = {{.*}}`main + 61 at a.cpp:4, address = 0x000000014000103d
55 # FIXME: The following variable location have wrong register numbers due to
56 # https://github.com/llvm/llvm-project/issues/53575. Fix them after resolving
59 # CHECK-LABEL: (lldb) image lookup -a 0x140001003 -v
60 # CHECK: Summary: {{.*}}`main + 3 at a.cpp:2
61 # CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001046)
62 # CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046)
63 # CHECK: LineEntry: [0x0000000140001000-0x0000000140001004): /tmp/a.cpp:2
64 # CHECK-NEXT: Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = <block>, location = [0x0000000140001000, 0x000000014000102d) -> DW_OP_reg26 XMM9
65 # CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001045) -> DW_OP_reg3 RBX
67 # CHECK-LABEL: (lldb) image lookup -a 0x140001004 -v
68 # CHECK: Summary: {{.*}}`main + 4 [inlined] Namespace1::foo at a.h:5
69 # CHECK-NEXT: {{.*}}`main + 4 at a.cpp:3
70 # CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001046)
71 # CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046)
72 # CHECK-NEXT: id = {{.*}}, ranges = [0x140001004-0x140001039)[0x14000103f-0x140001046), name = "Namespace1::foo", decl = a.h:4
73 # CHECK: LineEntry: [0x0000000140001004-0x000000014000100c): /tmp/a.h:5
74 # CHECK-NEXT: Variable: id = {{.*}}, name = "x", type = "int", valid ranges = <block>, location = <empty>, decl =
75 # CHECK-NEXT: Variable: id = {{.*}}, name = "foo_local", type = "int", valid ranges = <block>, location = [0x0000000140001004, 0x0000000140001039) -> DW_OP_breg7 RSP+44
76 # CHECK-NEXT: Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = <block>, location = [0x0000000140001000, 0x000000014000102d) -> DW_OP_reg26 XMM9
77 # CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001045) -> DW_OP_reg3 RBX
78 # CHECK-NEXT: Variable: id = {{.*}}, name = "main_local", type = "int", valid ranges = <block>, location = [0x0000000140001004, 0x0000000140001046) -> DW_OP_breg7 RSP+48
80 # CHECK-LABEL: (lldb) image lookup -a 0x140001010 -v
81 # CHECK: Summary: {{.*}}`main + 16 [inlined] Namespace1::foo + 12 at a.h:7
82 # CHECK-NEXT: {{.*}}`main + 4 at a.cpp:3
83 # CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001046)
84 # CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046)
85 # CHECK-NEXT: id = {{.*}}, ranges = [0x140001004-0x140001039)[0x14000103f-0x140001046), name = "Namespace1::foo", decl = a.h:4
86 # CHECK: LineEntry: [0x0000000140001010-0x0000000140001018): /tmp/a.h:7
87 # CHECK-NEXT: Variable: id = {{.*}}, name = "x", type = "int", valid ranges = <block>, location = <empty>, decl =
88 # CHECK-NEXT: Variable: id = {{.*}}, name = "foo_local", type = "int", valid ranges = <block>, location = [0x0000000140001004, 0x0000000140001039) -> DW_OP_breg7 RSP+44
89 # CHECK-NEXT: Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = <block>, location = [0x0000000140001000, 0x000000014000102d) -> DW_OP_reg26 XMM9
90 # CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001045) -> DW_OP_reg3 RBX
91 # CHECK-NEXT: Variable: id = {{.*}}, name = "main_local", type = "int", valid ranges = <block>, location = [0x0000000140001004, 0x0000000140001046) -> DW_OP_breg7 RSP+48
93 # CHECK-LABEL: (lldb) image lookup -a 0x14000101c -v
94 # CHECK: Summary: {{.*}}`main + 28 [inlined] Class1::bar at b.h:5
95 # CHECK-NEXT: {{.*}}`main + 28 [inlined] Namespace1::foo + 24 at a.h:9
96 # CHECK-NEXT: {{.*}}`main + 4 at a.cpp:3
97 # CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001046)
98 # CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046)
99 # CHECK-NEXT: id = {{.*}}, ranges = [0x140001004-0x140001039)[0x14000103f-0x140001046), name = "Namespace1::foo", decl = a.h:4
100 # CHECK-NEXT: id = {{.*}}, range = [0x14000101c-0x140001039), name = "Class1::bar", decl = b.h:4
101 # CHECK: LineEntry: [0x000000014000101c-0x0000000140001022): /tmp/b.h:5
102 # CHECK-NEXT: Variable: id = {{.*}}, name = "x", type = "int", valid ranges = <block>, location = [0x000000014000101c, 0x000000014000101e) -> DW_OP_reg24 XMM7
103 # CHECK-NEXT: Variable: id = {{.*}}, name = "bar_local", type = "int", valid ranges = <block>, location = [0x000000014000101c, 0x0000000140001039) -> DW_OP_breg7 RSP+52
104 # CHECK-NEXT: Variable: id = {{.*}}, name = "x", type = "int", valid ranges = <block>, location = <empty>, decl =
105 # CHECK-NEXT: Variable: id = {{.*}}, name = "foo_local", type = "int", valid ranges = <block>, location = [0x0000000140001004, 0x0000000140001039) -> DW_OP_breg7 RSP+44
106 # CHECK-NEXT: Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = <block>, location = [0x0000000140001000, 0x000000014000102d) -> DW_OP_reg26 XMM9
107 # CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001045) -> DW_OP_reg3 RBX
108 # CHECK-NEXT: Variable: id = {{.*}}, name = "main_local", type = "int", valid ranges = <block>, location = [0x0000000140001004, 0x0000000140001046) -> DW_OP_breg7 RSP+48
110 # CHECK-LABEL: (lldb) image lookup -a 0x14000102a -v
111 # CHECK: Summary: {{.*}}`main + 42 [inlined] Namespace2::Class2::func at c.h:5
112 # CHECK-NEXT: {{.*}}`main + 42 [inlined] Class1::bar + 14 at b.h:7
113 # CHECK-NEXT: {{.*}}`main + 28 [inlined] Namespace1::foo + 24 at a.h:9
114 # CHECK-NEXT: {{.*}}`main + 4 at a.cpp:3
115 # CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001046)
116 # CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046)
117 # CHECK-NEXT: id = {{.*}}, ranges = [0x140001004-0x140001039)[0x14000103f-0x140001046), name = "Namespace1::foo", decl = a.h:4
118 # CHECK-NEXT: id = {{.*}}, range = [0x14000101c-0x140001039), name = "Class1::bar", decl = b.h:4
119 # CHECK-NEXT: id = {{.*}}, range = [0x14000102a-0x140001039), name = "Namespace2::Class2::func", decl = c.h:4
120 # CHECK: LineEntry: [0x000000014000102a-0x0000000140001031): /tmp/c.h:5
121 # CHECK-NEXT: Variable: id = {{.*}}, name = "x", type = "int", valid ranges = <block>, location = [0x000000014000102a, 0x0000000140001039) -> DW_OP_reg24 XMM7
122 # CHECK-NEXT: Variable: id = {{.*}}, name = "func_local", type = "int", valid ranges = <block>, location = [0x000000014000102a, 0x0000000140001039) -> DW_OP_breg7 RSP+48
123 # CHECK-NEXT: Variable: id = {{.*}}, name = "bar_local", type = "int", valid ranges = <block>, location = [0x000000014000101c, 0x0000000140001039) -> DW_OP_breg7 RSP+52
124 # CHECK-NEXT: Variable: id = {{.*}}, name = "x", type = "int", valid ranges = <block>, location = <empty>, decl =
125 # CHECK-NEXT: Variable: id = {{.*}}, name = "foo_local", type = "int", valid ranges = <block>, location = [0x0000000140001004, 0x0000000140001039) -> DW_OP_breg7 RSP+44
126 # CHECK-NEXT: Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = <block>, location = [0x0000000140001000, 0x000000014000102d) -> DW_OP_reg26 XMM9
127 # CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001045) -> DW_OP_reg3 RBX
128 # CHECK-NEXT: Variable: id = {{.*}}, name = "main_local", type = "int", valid ranges = <block>, location = [0x0000000140001004, 0x0000000140001046) -> DW_OP_breg7 RSP+48
130 # CHECK-LABEL: (lldb) image lookup -a 0x140001039 -v
131 # CHECK: Summary: {{.*}}`main + 57 at a.cpp:3
132 # CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001046)
133 # CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046)
134 # CHECK: LineEntry: [0x0000000140001039-0x000000014000103d): /tmp/a.cpp:3
135 # CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001045) -> DW_OP_reg3 RBX
136 # CHECK-NEXT: Variable: id = {{.*}}, name = "main_local", type = "int", valid ranges = <block>, location = [0x0000000140001004, 0x0000000140001046) -> DW_OP_breg7 RSP+48
138 # CHECK-LABEL: (lldb) image lookup -a 0x140001044 -v
139 # CHECK: Summary: {{.*}}`main + 68 [inlined] Namespace1::foo + 5 at a.h:8
140 # CHECK-NEXT: {{.*}}`main + 63 at a.cpp:3
141 # CHECK: Function: id = {{.*}}, name = "main", range = [0x0000000140001000-0x0000000140001046)
142 # CHECK: Blocks: id = {{.*}}, range = [0x140001000-0x140001046)
143 # CHECK-NEXT: id = {{.*}}, ranges = [0x140001004-0x140001039)[0x14000103f-0x140001046), name = "Namespace1::foo", decl = a.h:4
144 # CHECK: LineEntry: [0x0000000140001044-0x0000000140001046): /tmp/a.h:8
145 # CHECK-NEXT: Variable: id = {{.*}}, name = "x", type = "int", valid ranges = <block>, location = <empty>, decl =
146 # CHECK-NEXT: Variable: id = {{.*}}, name = "foo_local", type = "int", valid ranges = <block>, location = [0x0000000140001044, 0x0000000140001046) -> DW_OP_breg7 RSP+44
147 # CHECK-NEXT: Variable: id = {{.*}}, name = "argc", type = "int", valid ranges = <block>, location = [0x0000000140001044, 0x0000000140001045) -> DW_OP_reg26 XMM9
148 # CHECK-NEXT: Variable: id = {{.*}}, name = "argv", type = "char **", valid ranges = <block>, location = [0x0000000140001000, 0x0000000140001045) -> DW_OP_reg3 RBX
149 # CHECK-NEXT: Variable: id = {{.*}}, name = "main_local", type = "int", valid ranges = <block>, location = [0x0000000140001004, 0x0000000140001046) -> DW_OP_breg7 RSP+48
151 # CHECK-LABEL: (lldb) target modules dump ast
152 # CHECK-NEXT: Dumping clang ast for 1 modules.
153 # CHECK-NEXT: TranslationUnitDecl {{.*}} <undeserialized declarations>
154 # CHECK-NEXT: |-FunctionDecl {{.*}} main 'int (int, char **)'
155 # CHECK-NEXT: | |-ParmVarDecl {{.*}} argc 'int'
156 # CHECK-NEXT: | `-ParmVarDecl {{.*}} argv 'char **'
157 # CHECK-NEXT: |-NamespaceDecl {{.*}} Namespace1
158 # CHECK-NEXT: | `-FunctionDecl {{.*}} foo 'int (int)' inline
159 # CHECK-NEXT: | `-ParmVarDecl {{.*}} x 'int'
160 # CHECK-NEXT: |-CXXRecordDecl {{.*}} <undeserialized declarations> class Class1
161 # CHECK-NEXT: | |-AccessSpecDecl {{.*}} public
162 # CHECK-NEXT: | `-CXXMethodDecl {{.*}} bar 'int (int)' static
163 # CHECK-NEXT: | `-ParmVarDecl {{.*}} 'int'
164 # CHECK-NEXT: `-NamespaceDecl {{.*}} Namespace2
165 # CHECK-NEXT: `-CXXRecordDecl {{.*}} <undeserialized declarations> class Class2
166 # CHECK-NEXT: |-AccessSpecDecl {{.*}} public
167 # CHECK-NEXT: `-CXXMethodDecl {{.*}} func 'int (int)' static
168 # CHECK-NEXT: `-ParmVarDecl {{.*}} 'int'