1 | // clang-format off |
2 | |
3 | // REQUIRES: system-windows |
4 | // RUN: %build -o %t.exe -- %s |
5 | // RUN: env LLDB_USE_NATIVE_PDB_READER=1 %lldb -f %t.exe -s \ |
6 | // RUN: %p/Inputs/local-variables.lldbinit 2>&1 | FileCheck %s |
7 | |
8 | int Function(int Param1, char Param2) { |
9 | unsigned Local1 = Param1 + 1; |
10 | char Local2 = Param2 + 1; |
11 | ++Local1; |
12 | ++Local2; |
13 | return Local1; |
14 | } |
15 | |
16 | int main(int argc, char **argv) { |
17 | int SomeLocal = argc * 2; |
18 | return Function(Param1: SomeLocal, Param2: 'a'); |
19 | } |
20 | |
21 | // CHECK: (lldb) target create "{{.*}}local-variables.cpp.tmp.exe" |
22 | // CHECK-NEXT: Current executable set to '{{.*}}local-variables.cpp.tmp.exe' |
23 | // CHECK-NEXT: (lldb) command source -s 0 '{{.*}}local-variables.lldbinit' |
24 | // CHECK-NEXT: Executing commands in '{{.*}}local-variables.lldbinit'. |
25 | // CHECK-NEXT: (lldb) break set -f local-variables.cpp -l 17 |
26 | // CHECK-NEXT: Breakpoint 1: where = local-variables.cpp.tmp.exe`main + {{.*}} at local-variables.cpp:{{.*}}, address = {{.*}} |
27 | // CHECK-NEXT: (lldb) run a b c d e f g |
28 | // CHECK-NEXT: Process {{.*}} launched: '{{.*}}local-variables.cpp.tmp.exe' |
29 | // CHECK-NEXT: Process {{.*}} stopped |
30 | // CHECK-NEXT: * thread #1, stop reason = breakpoint 1.1 |
31 | // CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`main(argc=8, argv={{.*}}) at local-variables.cpp:{{.*}} |
32 | // CHECK-NEXT: 14 } |
33 | // CHECK-NEXT: 15 |
34 | // CHECK-NEXT: 16 int main(int argc, char **argv) { |
35 | // CHECK-NEXT: -> 17 int SomeLocal = argc * 2; |
36 | // CHECK-NEXT: 18 return Function(SomeLocal, 'a'); |
37 | // CHECK-NEXT: 19 } |
38 | // CHECK-NEXT: 20 |
39 | |
40 | // CHECK: (lldb) expression argc |
41 | // CHECK-NEXT: (int) $0 = 8 |
42 | // CHECK-NEXT: (lldb) step |
43 | // CHECK-NEXT: Process {{.*}} stopped |
44 | // CHECK-NEXT: * thread #1, stop reason = step in |
45 | // CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`main(argc=8, argv={{.*}}) at local-variables.cpp:{{.*}} |
46 | // CHECK-NEXT: 15 |
47 | // CHECK-NEXT: 16 int main(int argc, char **argv) { |
48 | // CHECK-NEXT: 17 int SomeLocal = argc * 2; |
49 | // CHECK-NEXT: -> 18 return Function(SomeLocal, 'a'); |
50 | // CHECK-NEXT: 19 } |
51 | // CHECK-NEXT: 20 |
52 | |
53 | // CHECK: (lldb) expression SomeLocal |
54 | // CHECK-NEXT: (int) $1 = 16 |
55 | // CHECK-NEXT: (lldb) step |
56 | // CHECK-NEXT: Process {{.*}} stopped |
57 | // CHECK-NEXT: * thread #1, stop reason = step in |
58 | // CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`Function(Param1=16, Param2='a') at local-variables.cpp:{{.*}} |
59 | // CHECK-NEXT: 6 |
60 | // CHECK-NEXT: 7 |
61 | // CHECK-NEXT: 8 int Function(int Param1, char Param2) { |
62 | // CHECK-NEXT: -> 9 unsigned Local1 = Param1 + 1; |
63 | // CHECK-NEXT: 10 char Local2 = Param2 + 1; |
64 | // CHECK-NEXT: 11 ++Local1; |
65 | // CHECK-NEXT: 12 ++Local2; |
66 | |
67 | // CHECK: (lldb) expression Param1 |
68 | // CHECK-NEXT: (int) $2 = 16 |
69 | // CHECK-NEXT: (lldb) expression Param2 |
70 | // CHECK-NEXT: (char) $3 = 'a' |
71 | // CHECK-NEXT: (lldb) step |
72 | // CHECK-NEXT: Process {{.*}} stopped |
73 | // CHECK-NEXT: * thread #1, stop reason = step in |
74 | // CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`Function(Param1=16, Param2='a') at local-variables.cpp:{{.*}} |
75 | // CHECK-NEXT: 7 |
76 | // CHECK-NEXT: 8 int Function(int Param1, char Param2) { |
77 | // CHECK-NEXT: 9 unsigned Local1 = Param1 + 1; |
78 | // CHECK-NEXT: -> 10 char Local2 = Param2 + 1; |
79 | // CHECK-NEXT: 11 ++Local1; |
80 | // CHECK-NEXT: 12 ++Local2; |
81 | // CHECK-NEXT: 13 return Local1; |
82 | |
83 | // CHECK: (lldb) expression Param1 |
84 | // CHECK-NEXT: (int) $4 = 16 |
85 | // CHECK-NEXT: (lldb) expression Param2 |
86 | // CHECK-NEXT: (char) $5 = 'a' |
87 | // CHECK-NEXT: (lldb) expression Local1 |
88 | // CHECK-NEXT: (unsigned int) $6 = 17 |
89 | // CHECK-NEXT: (lldb) step |
90 | // CHECK-NEXT: Process {{.*}} stopped |
91 | // CHECK-NEXT: * thread #1, stop reason = step in |
92 | // CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`Function(Param1=16, Param2='a') at local-variables.cpp:{{.*}} |
93 | // CHECK-NEXT: 8 int Function(int Param1, char Param2) { |
94 | // CHECK-NEXT: 9 unsigned Local1 = Param1 + 1; |
95 | // CHECK-NEXT: 10 char Local2 = Param2 + 1; |
96 | // CHECK-NEXT: -> 11 ++Local1; |
97 | // CHECK-NEXT: 12 ++Local2; |
98 | // CHECK-NEXT: 13 return Local1; |
99 | // CHECK-NEXT: 14 } |
100 | |
101 | // CHECK: (lldb) expression Param1 |
102 | // CHECK-NEXT: (int) $7 = 16 |
103 | // CHECK-NEXT: (lldb) expression Param2 |
104 | // CHECK-NEXT: (char) $8 = 'a' |
105 | // CHECK-NEXT: (lldb) expression Local1 |
106 | // CHECK-NEXT: (unsigned int) $9 = 17 |
107 | // CHECK-NEXT: (lldb) expression Local2 |
108 | // CHECK-NEXT: (char) $10 = 'b' |
109 | // CHECK-NEXT: (lldb) step |
110 | // CHECK-NEXT: Process {{.*}} stopped |
111 | // CHECK-NEXT: * thread #1, stop reason = step in |
112 | // CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`Function(Param1=16, Param2='a') at local-variables.cpp:{{.*}} |
113 | // CHECK-NEXT: 9 unsigned Local1 = Param1 + 1; |
114 | // CHECK-NEXT: 10 char Local2 = Param2 + 1; |
115 | // CHECK-NEXT: 11 ++Local1; |
116 | // CHECK-NEXT: -> 12 ++Local2; |
117 | // CHECK-NEXT: 13 return Local1; |
118 | // CHECK-NEXT: 14 } |
119 | // CHECK-NEXT: 15 |
120 | |
121 | // CHECK: (lldb) expression Param1 |
122 | // CHECK-NEXT: (int) $11 = 16 |
123 | // CHECK-NEXT: (lldb) expression Param2 |
124 | // CHECK-NEXT: (char) $12 = 'a' |
125 | // CHECK-NEXT: (lldb) expression Local1 |
126 | // CHECK-NEXT: (unsigned int) $13 = 18 |
127 | // CHECK-NEXT: (lldb) expression Local2 |
128 | // CHECK-NEXT: (char) $14 = 'b' |
129 | // CHECK-NEXT: (lldb) step |
130 | // CHECK-NEXT: Process {{.*}} stopped |
131 | // CHECK-NEXT: * thread #1, stop reason = step in |
132 | // CHECK-NEXT: frame #0: {{.*}} local-variables.cpp.tmp.exe`Function(Param1=16, Param2='a') at local-variables.cpp:{{.*}} |
133 | // CHECK-NEXT: 10 char Local2 = Param2 + 1; |
134 | // CHECK-NEXT: 11 ++Local1; |
135 | // CHECK-NEXT: 12 ++Local2; |
136 | // CHECK-NEXT: -> 13 return Local1; |
137 | // CHECK-NEXT: 14 } |
138 | // CHECK-NEXT: 15 |
139 | // CHECK-NEXT: 16 int main(int argc, char **argv) { |
140 | |
141 | // CHECK: (lldb) expression Param1 |
142 | // CHECK-NEXT: (int) $15 = 16 |
143 | // CHECK-NEXT: (lldb) expression Param2 |
144 | // CHECK-NEXT: (char) $16 = 'a' |
145 | // CHECK-NEXT: (lldb) expression Local1 |
146 | // CHECK-NEXT: (unsigned int) $17 = 18 |
147 | // CHECK-NEXT: (lldb) expression Local2 |
148 | // CHECK-NEXT: (char) $18 = 'c' |
149 | // CHECK-NEXT: (lldb) continue |
150 | // CHECK-NEXT: Process {{.*}} resuming |
151 | // CHECK-NEXT: Process {{.*}} exited with status = 18 (0x00000012) |
152 | |
153 | // CHECK: (lldb) target modules dump ast |
154 | // CHECK-NEXT: Dumping clang ast for {{.*}} modules. |
155 | // CHECK-NEXT: TranslationUnitDecl |
156 | // CHECK-NEXT: |-FunctionDecl {{.*}} main 'int (int, char **)' |
157 | // CHECK-NEXT: | |-ParmVarDecl {{.*}} argc 'int' |
158 | // CHECK-NEXT: | `-ParmVarDecl {{.*}} argv 'char **' |
159 | // CHECK-NEXT: |-FunctionDecl {{.*}} __scrt_common_main_seh 'int ()' static |
160 | // CHECK-NEXT: |-FunctionDecl {{.*}} invoke_main 'int ()' inline |
161 | // CHECK: `-FunctionDecl {{.*}} Function 'int (int, char)' |
162 | // CHECK-NEXT: |-ParmVarDecl {{.*}} Param1 'int' |
163 | // CHECK-NEXT: `-ParmVarDecl {{.*}} Param2 'char' |
164 | |