1b: *std.Build,
2options: Options,
3root_step: *std.Build.Step,
4
5pub const Options = struct {
6 test_filters: []const []const u8,
7 test_target_filters: []const []const u8,
8 gdb: ?[]const u8,
9 lldb: ?[]const u8,
10 optimize_modes: []const std.builtin.Optimize,
11 skip_single_threaded: bool,
12 skip_libc: bool,
13};
14
15pub const Target = struct {
16 resolved: std.Build.ResolvedTarget,
17 optimize_mode: std.builtin.Optimize = .debug,
18 link_libc: ?bool = null,
19 single_threaded: ?bool = null,
20 pic: ?bool = null,
21 test_name_suffix: []const u8,
22};
23
24pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {
25 db.addLldbTest(
26 "basic",
27 target,
28 &.{
29 .{
30 .path = "basic.zig",
31 .source =
32 \\const Basic = struct {
33 \\ void: void = {},
34 \\ bool_false: bool = false,
35 \\ bool_true: bool = true,
36 \\ u0_0: u0 = 0,
37 \\ u1_0: u1 = 0,
38 \\ u1_1: u1 = 1,
39 \\ u2_0: u2 = 0,
40 \\ u2_3: u2 = 3,
41 \\ u3_0: u3 = 0,
42 \\ u3_7: u3 = 7,
43 \\ u4_0: u4 = 0,
44 \\ u4_15: u4 = 15,
45 \\ u5_0: u5 = 0,
46 \\ u5_31: u5 = 31,
47 \\ u6_0: u6 = 0,
48 \\ u6_63: u6 = 63,
49 \\ u7_0: u7 = 0,
50 \\ u7_127: u7 = 127,
51 \\ u8_0: u8 = 0,
52 \\ u8_255: u8 = 255,
53 \\ u16_0: u16 = 0,
54 \\ u16_65535: u16 = 65535,
55 \\ u24_0: u24 = 0,
56 \\ u24_16777215: u24 = 16777215,
57 \\ u32_0: u32 = 0,
58 \\ u32_4294967295: u32 = 4294967295,
59 \\ @"i1_-1": i1 = -1,
60 \\ i1_0: i1 = 0,
61 \\ @"i2_-2": i2 = -2,
62 \\ i2_0: i2 = 0,
63 \\ i2_1: i2 = 1,
64 \\ @"i3_-4": i3 = -4,
65 \\ i3_0: i3 = 0,
66 \\ i3_3: i3 = 3,
67 \\ @"i4_-8": i4 = -8,
68 \\ i4_0: i4 = 0,
69 \\ i4_7: i4 = 7,
70 \\ @"i5_-16": i5 = -16,
71 \\ i5_0: i5 = 0,
72 \\ i5_15: i5 = 15,
73 \\ @"i6_-32": i6 = -32,
74 \\ i6_0: i6 = 0,
75 \\ i6_31: i6 = 31,
76 \\ @"i7_-64": i7 = -64,
77 \\ i7_0: i7 = 0,
78 \\ i7_63: i7 = 63,
79 \\ @"i8_-128": i8 = -128,
80 \\ i8_0: i8 = 0,
81 \\ i8_127: i8 = 127,
82 \\ @"i16_-32768": i16 = -32768,
83 \\ i16_0: i16 = 0,
84 \\ i16_32767: i16 = 32767,
85 \\ @"i24_-8388608": i24 = -8388608,
86 \\ i24_0: i24 = 0,
87 \\ i24_8388607: i24 = 8388607,
88 \\ @"i32_-2147483648": i32 = -2147483648,
89 \\ i32_0: i32 = 0,
90 \\ i32_2147483647: i32 = 2147483647,
91 \\ @"f16_42.625": f16 = 42.625,
92 \\ @"f32_-2730.65625": f32 = -2730.65625,
93 \\ @"f64_357913941.33203125": f64 = 357913941.33203125,
94 \\ @"f80_-91625968981.3330078125": f80 = -91625968981.3330078125,
95 \\ @"f128_384307168202282325.333332061767578125": f128 = 384307168202282325.333332061767578125,
96 \\};
97 \\fn testBasic(basic: Basic) void {
98 \\ _ = basic;
99 \\}
100 \\pub fn main() void {
101 \\ testBasic(.{});
102 \\}
103 \\
104 ,
105 },
106 },
107 \\breakpoint set --file basic.zig --source-pattern-regexp '_ = basic;'
108 \\process launch
109 \\frame variable --show-all-children --show-types -- basic
110 \\breakpoint delete --force 1
111 ,
112 &.{
113 \\(lldb) frame variable --show-all-children --show-types -- basic
114 \\(root.basic.Basic) basic = {
115 \\ (void) .void = {}
116 \\ (bool) .bool_false = false
117 \\ (bool) .bool_true = true
118 \\ (u0) .u0_0 = 0
119 \\ (u1) .u1_0 = 0
120 \\ (u1) .u1_1 = 1
121 \\ (u2) .u2_0 = 0
122 \\ (u2) .u2_3 = 3
123 \\ (u3) .u3_0 = 0
124 \\ (u3) .u3_7 = 7
125 \\ (u4) .u4_0 = 0
126 \\ (u4) .u4_15 = 15
127 \\ (u5) .u5_0 = 0
128 \\ (u5) .u5_31 = 31
129 \\ (u6) .u6_0 = 0
130 \\ (u6) .u6_63 = 63
131 \\ (u7) .u7_0 = 0
132 \\ (u7) .u7_127 = 127
133 \\ (u8) .u8_0 = 0
134 \\ (u8) .u8_255 = 255
135 \\ (u16) .u16_0 = 0
136 \\ (u16) .u16_65535 = 65535
137 \\ (u24) .u24_0 = 0
138 \\ (u24) .u24_16777215 = 16777215
139 \\ (u32) .u32_0 = 0
140 \\ (u32) .u32_4294967295 = 4294967295
141 \\ (i1) .@"i1_-1" = -1
142 \\ (i1) .i1_0 = 0
143 \\ (i2) .@"i2_-2" = -2
144 \\ (i2) .i2_0 = 0
145 \\ (i2) .i2_1 = 1
146 \\ (i3) .@"i3_-4" = -4
147 \\ (i3) .i3_0 = 0
148 \\ (i3) .i3_3 = 3
149 \\ (i4) .@"i4_-8" = -8
150 \\ (i4) .i4_0 = 0
151 \\ (i4) .i4_7 = 7
152 \\ (i5) .@"i5_-16" = -16
153 \\ (i5) .i5_0 = 0
154 \\ (i5) .i5_15 = 15
155 \\ (i6) .@"i6_-32" = -32
156 \\ (i6) .i6_0 = 0
157 \\ (i6) .i6_31 = 31
158 \\ (i7) .@"i7_-64" = -64
159 \\ (i7) .i7_0 = 0
160 \\ (i7) .i7_63 = 63
161 \\ (i8) .@"i8_-128" = -128
162 \\ (i8) .i8_0 = 0
163 \\ (i8) .i8_127 = 127
164 \\ (i16) .@"i16_-32768" = -32768
165 \\ (i16) .i16_0 = 0
166 \\ (i16) .i16_32767 = 32767
167 \\ (i24) .@"i24_-8388608" = -8388608
168 \\ (i24) .i24_0 = 0
169 \\ (i24) .i24_8388607 = 8388607
170 \\ (i32) .@"i32_-2147483648" = -2147483648
171 \\ (i32) .i32_0 = 0
172 \\ (i32) .i32_2147483647 = 2147483647
173 \\ (f16) .@"f16_42.625" = 42.625
174 \\ (f32) .@"f32_-2730.65625" = -2730.65625
175 \\ (f64) .@"f64_357913941.33203125" = 357913941.33203125
176 \\ (f80) .@"f80_-91625968981.3330078125" = -91625968981.3330078125
177 \\ (f128) .@"f128_384307168202282325.333332061767578125" = 384307168202282325.333332061767578125
178 \\}
179 \\(lldb) breakpoint delete --force 1
180 \\1 breakpoints deleted; 0 breakpoint locations disabled.
181 },
182 );
183 db.addLldbTest(
184 "identifiers",
185 target,
186 &.{
187 .{
188 .path = "identifiers.zig",
189 .source =
190 \\const Struct = struct { @"zwölf": u32 };
191 \\fn testIdentifiers(@"fünf": u32, @"struct": Struct) void {
192 \\ _ = @"fünf";
193 \\ _ = @"struct";
194 \\}
195 \\pub fn main() void {
196 \\ testIdentifiers(5, .{ .@"zwölf" = 12 });
197 \\}
198 ,
199 },
200 },
201 \\breakpoint set --file identifiers.zig --source-pattern-regexp '_ = @"struct";'
202 \\process launch
203 \\frame variable --show-all-children --show-types -- @\"fünf'"' '@"f\xC3\xBCnf"' '@"f\u{FC}nf"' '@"struct".@"zwölf"' '@"struct".@"zw\xC3\xB6lf"' '@"struct".@"zw\u{F6}lf"'
204 \\breakpoint delete --force 1
205 ,
206 &.{
207 \\(lldb) frame variable --show-all-children --show-types -- @\"fünf'"' '@"f\xC3\xBCnf"' '@"f\u{FC}nf"' '@"struct".@"zwölf"' '@"struct".@"zw\xC3\xB6lf"' '@"struct".@"zw\u{F6}lf"'
208 \\(u32) @"fünf" = 5
209 \\(u32) @"f\xC3\xBCnf" = 5
210 \\(u32) @"f\u{FC}nf" = 5
211 \\(u32) @"struct".@"zwölf" = 12
212 \\(u32) @"struct".@"zw\xC3\xB6lf" = 12
213 \\(u32) @"struct".@"zw\u{F6}lf" = 12
214 \\(lldb) breakpoint delete --force 1
215 \\1 breakpoints deleted; 0 breakpoint locations disabled.
216 },
217 );
218 db.addLldbTest(
219 "types",
220 target,
221 &.{
222 .{
223 .path = "types.zig",
224 .source =
225 \\fn testTypes(
226 \\ Anyopaque: type,
227 \\ Bool: type,
228 \\ Void: type,
229 \\ Type: type,
230 \\ ComptimeInt: type,
231 \\ ComptimeFloat: type,
232 \\ Noreturn: type,
233 \\ Null: type,
234 \\ Undefined: type,
235 \\ EnumLiteral: type,
236 \\) void {
237 \\ _ = Anyopaque;
238 \\ _ = Bool;
239 \\ _ = Void;
240 \\ _ = Type;
241 \\ _ = ComptimeInt;
242 \\ _ = ComptimeFloat;
243 \\ _ = Noreturn;
244 \\ _ = Null;
245 \\ _ = Undefined;
246 \\ _ = EnumLiteral;
247 \\}
248 \\pub fn main() void {
249 \\ testTypes(
250 \\ anyopaque,
251 \\ bool,
252 \\ void,
253 \\ type,
254 \\ comptime_int,
255 \\ comptime_float,
256 \\ noreturn,
257 \\ @TypeOf(null),
258 \\ @TypeOf(undefined),
259 \\ @EnumLiteral(),
260 \\ );
261 \\}
262 ,
263 },
264 },
265 \\breakpoint set --file types.zig --source-pattern-regexp '_ = Undefined;'
266 \\process launch
267 \\frame variable --show-all-children --show-types -- Anyopaque Bool Void Type ComptimeInt ComptimeFloat Noreturn Null Undefined EnumLiteral
268 \\breakpoint delete --force 1
269 ,
270 &.{
271 \\(lldb) frame variable --show-all-children --show-types -- Anyopaque Bool Void Type ComptimeInt ComptimeFloat Noreturn Null Undefined EnumLiteral
272 \\(type) Anyopaque = anyopaque
273 \\(type) Bool = bool
274 \\(type) Void = void
275 \\(type) Type = type
276 \\(type) ComptimeInt = comptime_int
277 \\(type) ComptimeFloat = comptime_float
278 \\(type) Noreturn = noreturn
279 \\(type) Null = @TypeOf(null)
280 \\(type) Undefined = @TypeOf(undefined)
281 \\(type) EnumLiteral = @EnumLiteral()
282 \\(lldb) breakpoint delete --force 1
283 \\1 breakpoints deleted; 0 breakpoint locations disabled.
284 },
285 );
286 db.addLldbTest(
287 "pointers",
288 target,
289 &.{
290 .{
291 .path = "pointers.zig",
292 .source =
293 \\var array: [7]u32 = .{
294 \\ 3010,
295 \\ 3014,
296 \\ 3018,
297 \\ 3022,
298 \\ 3026,
299 \\ 3030,
300 \\ 3034,
301 \\};
302 \\const Pointers = struct {
303 \\ single: *u32 = @ptrFromInt(0x1010),
304 \\ single_const: *const u32 = @ptrFromInt(0x1014),
305 \\ single_volatile: *volatile u32 = @ptrFromInt(0x1018),
306 \\ single_const_volatile: *const volatile u32 = @ptrFromInt(0x101c),
307 \\ single_allowzero: *allowzero u32 = @ptrFromInt(0x1020),
308 \\ single_allowzero_const: *allowzero const u32 = @ptrFromInt(0x1024),
309 \\ single_allowzero_volatile: *allowzero volatile u32 = @ptrFromInt(0x1028),
310 \\ single_allowzero_const_volatile: *allowzero const volatile u32 = @ptrFromInt(0x102c),
311 \\
312 \\ many: [*]u32 = @ptrFromInt(0x2010),
313 \\ many_const: [*]const u32 = @ptrFromInt(0x2014),
314 \\ many_volatile: [*]volatile u32 = @ptrFromInt(0x2018),
315 \\ many_const_volatile: [*]const volatile u32 = @ptrFromInt(0x201c),
316 \\ many_allowzero: [*]allowzero u32 = @ptrFromInt(0x2020),
317 \\ many_allowzero_const: [*]allowzero const u32 = @ptrFromInt(0x2024),
318 \\ many_allowzero_volatile: [*]allowzero volatile u32 = @ptrFromInt(0x2028),
319 \\ many_allowzero_const_volatile: [*]allowzero const volatile u32 = @ptrFromInt(0x202c),
320 \\ slice: []u32 = array[0..1],
321 \\ slice_const: []const u32 = array[0..2],
322 \\ slice_volatile: []volatile u32 = array[0..3],
323 \\ slice_const_volatile: []const volatile u32 = array[0..4],
324 \\ slice_allowzero: []allowzero u32 = array[4..4],
325 \\ slice_allowzero_const: []allowzero const u32 = array[4..5],
326 \\ slice_allowzero_volatile: []allowzero volatile u32 = array[4..6],
327 \\ slice_allowzero_const_volatile: []allowzero const volatile u32 = array[4..7],
328 \\
329 \\ c: [*c]u32 = @ptrFromInt(0x4010),
330 \\ c_const: [*c]const u32 = @ptrFromInt(0x4014),
331 \\ c_volatile: [*c]volatile u32 = @ptrFromInt(0x4018),
332 \\ c_const_volatile: [*c]const volatile u32 = @ptrFromInt(0x401c),
333 \\};
334 \\const Access = struct {
335 \\ single: *u32 = &array[0],
336 \\ many: [*]u32 = array[1..3],
337 \\ slice: []u32 = array[3..5],
338 \\ c: [*c]u32 = array[5..7],
339 \\};
340 \\fn testPointers(pointers: Pointers, access: Access) void {
341 \\ _ = pointers;
342 \\ _ = access;
343 \\}
344 \\pub fn main() void {
345 \\ testPointers(.{}, .{});
346 \\}
347 \\
348 ,
349 },
350 },
351 \\breakpoint set --file pointers.zig --source-pattern-regexp '_ = access;'
352 \\process launch
353 \\frame variable --show-all-children --show-types -- pointers access.single.* access.many[0] access.many[1] access.slice[0] access.slice[1] access.c.* access.c[0] access.c[1]
354 \\breakpoint delete --force 1
355 ,
356 &.{
357 \\(lldb) frame variable --show-all-children --show-types -- pointers access.single.* access.many[0] access.many[1] access.slice[0] access.slice[1] access.c.* access.c[0] access.c[1]
358 \\(root.pointers.Pointers) pointers = {
359 \\ (*u32) .single = 0x0000000000001010
360 \\ (*const u32) .single_const = 0x0000000000001014
361 \\ (*volatile u32) .single_volatile = 0x0000000000001018
362 \\ (*const volatile u32) .single_const_volatile = 0x000000000000101c
363 \\ (*allowzero u32) .single_allowzero = 0x0000000000001020
364 \\ (*allowzero const u32) .single_allowzero_const = 0x0000000000001024
365 \\ (*allowzero volatile u32) .single_allowzero_volatile = 0x0000000000001028
366 \\ (*allowzero const volatile u32) .single_allowzero_const_volatile = 0x000000000000102c
367 \\ ([*]u32) .many = 0x0000000000002010
368 \\ ([*]const u32) .many_const = 0x0000000000002014
369 \\ ([*]volatile u32) .many_volatile = 0x0000000000002018
370 \\ ([*]const volatile u32) .many_const_volatile = 0x000000000000201c
371 \\ ([*]allowzero u32) .many_allowzero = 0x0000000000002020
372 \\ ([*]allowzero const u32) .many_allowzero_const = 0x0000000000002024
373 \\ ([*]allowzero volatile u32) .many_allowzero_volatile = 0x0000000000002028
374 \\ ([*]allowzero const volatile u32) .many_allowzero_const_volatile = 0x000000000000202c
375 \\ ([]u32) .slice = len=1 {
376 \\ (u32) [0] = 3010
377 \\ }
378 \\ ([]const u32) .slice_const = len=2 {
379 \\ (u32) [0] = 3010
380 \\ (u32) [1] = 3014
381 \\ }
382 \\ ([]volatile u32) .slice_volatile = len=3 {
383 \\ (u32) [0] = 3010
384 \\ (u32) [1] = 3014
385 \\ (u32) [2] = 3018
386 \\ }
387 \\ ([]const volatile u32) .slice_const_volatile = len=4 {
388 \\ (u32) [0] = 3010
389 \\ (u32) [1] = 3014
390 \\ (u32) [2] = 3018
391 \\ (u32) [3] = 3022
392 \\ }
393 \\ ([]allowzero u32) .slice_allowzero = len=0 {}
394 \\ ([]allowzero const u32) .slice_allowzero_const = len=1 {
395 \\ (u32) [0] = 3026
396 \\ }
397 \\ ([]allowzero volatile u32) .slice_allowzero_volatile = len=2 {
398 \\ (u32) [0] = 3026
399 \\ (u32) [1] = 3030
400 \\ }
401 \\ ([]allowzero const volatile u32) .slice_allowzero_const_volatile = len=3 {
402 \\ (u32) [0] = 3026
403 \\ (u32) [1] = 3030
404 \\ (u32) [2] = 3034
405 \\ }
406 \\ ([*c]u32) .c = 0x0000000000004010
407 \\ ([*c]const u32) .c_const = 0x0000000000004014
408 \\ ([*c]volatile u32) .c_volatile = 0x0000000000004018
409 \\ ([*c]const volatile u32) .c_const_volatile = 0x000000000000401c
410 \\}
411 \\(u32) access.single.* = 3010
412 \\(u32) access.many[0] = 3014
413 \\(u32) access.many[1] = 3018
414 \\(u32) access.slice[0] = 3022
415 \\(u32) access.slice[1] = 3026
416 \\(u32) access.c.* = 3030
417 \\(u32) access.c[0] = 3030
418 \\(u32) access.c[1] = 3034
419 \\(lldb) breakpoint delete --force 1
420 \\1 breakpoints deleted; 0 breakpoint locations disabled.
421 },
422 );
423 db.addLldbTest(
424 "strings",
425 target,
426 &.{
427 .{
428 .path = "strings.zig",
429 .source =
430 \\const Strings = struct {
431 \\ c_ptr: [*c]const u8 = "c_ptr\x07\x08\t",
432 \\ many_ptr: [*:0]const u8 = "many_ptr\n\x0b\x0c",
433 \\ ptr_array: *const [12:0]u8 = "ptr_array\x00\r\x1b",
434 \\ slice: [:0]const u8 = "slice\"\'\\\x00",
435 \\};
436 \\fn testStrings(strings: Strings) void {
437 \\ _ = strings;
438 \\}
439 \\pub fn main() void {
440 \\ testStrings(.{});
441 \\}
442 \\
443 ,
444 },
445 },
446 \\breakpoint set --file strings.zig --source-pattern-regexp '_ = strings;'
447 \\process launch
448 \\frame variable --show-all-children --show-types -- strings.slice
449 \\frame variable --show-all-children --show-types --format character -- strings.slice
450 \\frame variable --show-all-children --show-types --format c-string -- strings
451 \\breakpoint delete --force 1
452 ,
453 &.{
454 \\(lldb) frame variable --show-all-children --show-types -- strings.slice
455 \\([:0]const u8) strings.slice = len=9 {
456 \\ (u8) [0] = 115
457 \\ (u8) [1] = 108
458 \\ (u8) [2] = 105
459 \\ (u8) [3] = 99
460 \\ (u8) [4] = 101
461 \\ (u8) [5] = 34
462 \\ (u8) [6] = 39
463 \\ (u8) [7] = 92
464 \\ (u8) [8] = 0
465 \\}
466 \\(lldb) frame variable --show-all-children --show-types --format character -- strings.slice
467 \\([:0]const u8) strings.slice = len=9 {
468 \\ (u8) [0] = 's'
469 \\ (u8) [1] = 'l'
470 \\ (u8) [2] = 'i'
471 \\ (u8) [3] = 'c'
472 \\ (u8) [4] = 'e'
473 \\ (u8) [5] = '\"'
474 \\ (u8) [6] = '\''
475 \\ (u8) [7] = '\\'
476 \\ (u8) [8] = '\x00'
477 \\}
478 \\(lldb) frame variable --show-all-children --show-types --format c-string -- strings
479 \\(root.strings.Strings) strings = {
480 \\ ([*c]const u8) .c_ptr = "c_ptr\x07\x08\t"
481 \\ ([*:0]const u8) .many_ptr = "many_ptr\n\x0b\x0c"
482 \\ (*const [12:0]u8) .ptr_array = "ptr_array\x00\r\x1b"
483 \\ ([:0]const u8) .slice = "slice\"\'\\\x00" len=9 {
484 \\ (u8) [0] = "s"
485 \\ (u8) [1] = "l"
486 \\ (u8) [2] = "i"
487 \\ (u8) [3] = "c"
488 \\ (u8) [4] = "e"
489 \\ (u8) [5] = "\""
490 \\ (u8) [6] = "\'"
491 \\ (u8) [7] = "\\"
492 \\ (u8) [8] = "\x00"
493 \\ }
494 \\}
495 \\(lldb) breakpoint delete --force 1
496 \\1 breakpoints deleted; 0 breakpoint locations disabled.
497 },
498 );
499 db.addLldbTest(
500 "enums",
501 target,
502 &.{
503 .{
504 .path = "enums.zig",
505 .source =
506 \\const Enums = struct {
507 \\ const Zero = enum(u4) { _ };
508 \\ const One = enum { first };
509 \\ const Two = enum(i32) { first, second, _ };
510 \\ const Three = enum { first, second, third };
511 \\
512 \\ zero: Zero = @enumFromInt(13),
513 \\ one: One = .first,
514 \\ two: Two = @enumFromInt(-1234),
515 \\ three: Three = .second,
516 \\};
517 \\fn testEnums(enums: Enums) void {
518 \\ _ = enums;
519 \\}
520 \\pub fn main() void {
521 \\ testEnums(.{});
522 \\}
523 \\
524 ,
525 },
526 },
527 \\breakpoint set --file enums.zig --source-pattern-regexp '_ = enums;'
528 \\process launch
529 \\expression --show-types -- Enums
530 \\frame variable --show-all-children --show-types -- enums
531 \\breakpoint delete --force 1
532 ,
533 &.{
534 \\(lldb) expression --show-types -- Enums
535 \\(type) $0 = struct {
536 \\ (type) Zero = enum {}
537 \\ (type) One = enum {
538 \\ (root.enums.Enums.One) first = .first
539 \\ }
540 \\ (type) Two = enum {
541 \\ (root.enums.Enums.Two) first = .first
542 \\ (root.enums.Enums.Two) second = .second
543 \\ }
544 \\ (type) Three = enum {
545 \\ (root.enums.Enums.Three) first = .first
546 \\ (root.enums.Enums.Three) second = .second
547 \\ (root.enums.Enums.Three) third = .third
548 \\ }
549 \\}
550 \\(lldb) frame variable --show-all-children --show-types -- enums
551 \\(root.enums.Enums) enums = {
552 \\ (root.enums.Enums.Zero) .zero = @enumFromInt(13)
553 \\ (root.enums.Enums.One) .one = .first
554 \\ (root.enums.Enums.Two) .two = @enumFromInt(-1234)
555 \\ (root.enums.Enums.Three) .three = .second
556 \\}
557 \\(lldb) breakpoint delete --force 1
558 \\1 breakpoints deleted; 0 breakpoint locations disabled.
559 },
560 );
561 db.addLldbTest(
562 "errors",
563 target,
564 &.{
565 .{
566 .path = "errors.zig",
567 .source =
568 \\const Errors = struct {
569 \\ const Zero = error{};
570 \\ const One = Zero || error{One};
571 \\ const Two = One || error{Two};
572 \\ const Three = Two || error{Three};
573 \\
574 \\ one: One = error.One,
575 \\ two: Two = error.Two,
576 \\ three: Three = error.Three,
577 \\ any: anyerror = error.Any,
578 \\ any_void: anyerror!void = error.NotVoid,
579 \\ any_u32: One!u32 = 42,
580 \\};
581 \\fn testErrors(errors: Errors) void {
582 \\ _ = errors;
583 \\}
584 \\pub fn main() void {
585 \\ testErrors(.{});
586 \\}
587 \\
588 ,
589 },
590 },
591 \\breakpoint set --file errors.zig --source-pattern-regexp '_ = errors;'
592 \\process launch
593 \\expression --show-types -- Errors
594 \\frame variable --show-all-children --show-types -- errors
595 \\breakpoint delete --force 1
596 ,
597 &.{
598 \\(lldb) expression --show-types -- Errors
599 \\(type) $0 = struct {
600 \\ (type) Zero = error {}
601 \\ (type) One = error {
602 \\ (error{One}) One = error.One
603 \\ }
604 \\ (type) Two = error {
605 \\ (error{One,Two}) One = error.One
606 \\ (error{One,Two}) Two = error.Two
607 \\ }
608 \\ (type) Three = error {
609 \\ (error{One,Three,Two}) One = error.One
610 \\ (error{One,Three,Two}) Two = error.Two
611 \\ (error{One,Three,Two}) Three = error.Three
612 \\ }
613 \\}
614 \\(lldb) frame variable --show-all-children --show-types -- errors
615 \\(root.errors.Errors) errors = {
616 \\ (error{One}) .one = error.One
617 \\ (error{One,Two}) .two = error.Two
618 \\ (error{One,Three,Two}) .three = error.Three
619 \\ (anyerror) .any = error.Any
620 \\ (anyerror!void) .any_void = {
621 \\ (anyerror) .error = error.NotVoid
622 \\ }
623 \\ (error{One}!u32) .any_u32 = {
624 \\ (u32) .value = 42
625 \\ }
626 \\}
627 \\(lldb) breakpoint delete --force 1
628 \\1 breakpoints deleted; 0 breakpoint locations disabled.
629 },
630 );
631 db.addLldbTest(
632 "optionals",
633 target,
634 &.{
635 .{
636 .path = "optionals.zig",
637 .source =
638 \\pub fn main() void {
639 \\ {
640 \\ var null_u32: ?u32 = null;
641 \\ var maybe_u32: ?u32 = null;
642 \\ var nonnull_u32: ?u32 = 456;
643 \\ null_u32 = null_u32;
644 \\ maybe_u32 = 123;
645 \\ nonnull_u32 = nonnull_u32;
646 \\ }
647 \\}
648 \\
649 ,
650 },
651 },
652 \\breakpoint set --file optionals.zig --source-pattern-regexp 'maybe_u32 = 123;'
653 \\process launch
654 \\frame variable --show-all-children -- null_u32 maybe_u32 nonnull_u32 nonnull_u32.?
655 \\breakpoint delete --force 1
656 \\
657 \\breakpoint set --file optionals.zig --source-pattern-regexp 'nonnull_u32 = nonnull_u32;'
658 \\process continue
659 \\frame variable --show-all-children --show-types -- null_u32 maybe_u32 maybe_u32.? nonnull_u32 nonnull_u32.?
660 \\breakpoint delete --force 2
661 ,
662 &.{
663 \\(lldb) frame variable --show-all-children -- null_u32 maybe_u32 nonnull_u32 nonnull_u32.?
664 \\(?u32) null_u32 = null
665 \\(?u32) maybe_u32 = null
666 \\(?u32) nonnull_u32 = (nonnull_u32.? = 456)
667 \\(u32) nonnull_u32.? = 456
668 \\(lldb) breakpoint delete --force 1
669 \\1 breakpoints deleted; 0 breakpoint locations disabled.
670 ,
671 \\(lldb) frame variable --show-all-children --show-types -- null_u32 maybe_u32 maybe_u32.? nonnull_u32 nonnull_u32.?
672 \\(?u32) null_u32 = null
673 \\(?u32) maybe_u32 = {
674 \\ (u32) maybe_u32.? = 123
675 \\}
676 \\(u32) maybe_u32.? = 123
677 \\(?u32) nonnull_u32 = {
678 \\ (u32) nonnull_u32.? = 456
679 \\}
680 \\(u32) nonnull_u32.? = 456
681 \\(lldb) breakpoint delete --force 2
682 \\1 breakpoints deleted; 0 breakpoint locations disabled.
683 },
684 );
685 db.addLldbTest(
686 "unions",
687 target,
688 &.{
689 .{
690 .path = "unions.zig",
691 .source =
692 \\const Unions = struct {
693 \\ const Enum = enum { first, second, third };
694 \\ const Untagged = extern union {
695 \\ u32: u32,
696 \\ i32: i32,
697 \\ f32: f32,
698 \\ };
699 \\ const SafetyTagged = union {
700 \\ void: void,
701 \\ en: Enum,
702 \\ eu: error{Error}!Enum,
703 \\ };
704 \\ const Tagged = union(enum) {
705 \\ void: void,
706 \\ en: Enum,
707 \\ eu: error{Error}!Enum,
708 \\ };
709 \\
710 \\ untagged: Untagged = .{ .f32 = -1.5 },
711 \\ safety_tagged: SafetyTagged = .{ .en = .second },
712 \\ tagged: Tagged = .{ .eu = error.Error },
713 \\};
714 \\fn testUnions(unions: Unions) void {
715 \\ _ = unions;
716 \\}
717 \\pub fn main() void {
718 \\ testUnions(.{});
719 \\}
720 \\
721 ,
722 },
723 },
724 \\breakpoint set --file unions.zig --source-pattern-regexp '_ = unions;'
725 \\process launch
726 \\expression --show-types -- Unions
727 \\frame variable --show-all-children --show-types -- unions
728 \\breakpoint delete --force 1
729 ,
730 &.{
731 \\(lldb) expression --show-types -- Unions
732 \\(type) $0 = struct {
733 \\ (type) Untagged = union {}
734 \\ (type) SafetyTagged = union(enum) {
735 \\ (@typeInfo(unions.Unions.SafetyTagged).@"union".tag_type.?) void = .void
736 \\ (@typeInfo(unions.Unions.SafetyTagged).@"union".tag_type.?) en = .en
737 \\ (@typeInfo(unions.Unions.SafetyTagged).@"union".tag_type.?) eu = .eu
738 \\ }
739 \\ (type) Enum = enum {
740 \\ (root.unions.Unions.Enum) first = .first
741 \\ (root.unions.Unions.Enum) second = .second
742 \\ (root.unions.Unions.Enum) third = .third
743 \\ }
744 \\ (type) Tagged = union(enum) {
745 \\ (@typeInfo(unions.Unions.Tagged).@"union".tag_type.?) void = .void
746 \\ (@typeInfo(unions.Unions.Tagged).@"union".tag_type.?) en = .en
747 \\ (@typeInfo(unions.Unions.Tagged).@"union".tag_type.?) eu = .eu
748 \\ }
749 \\}
750 \\(lldb) frame variable --show-all-children --show-types -- unions
751 \\(root.unions.Unions) unions = {
752 \\ (root.unions.Unions.Untagged) .untagged = {
753 \\ (u32) .u32 = 3217031168
754 \\ (i32) .i32 = -1077936128
755 \\ (f32) .f32 = -1.5
756 \\ }
757 \\ (root.unions.Unions.SafetyTagged) .safety_tagged = {
758 \\ (root.unions.Unions.Enum) .en = .second
759 \\ }
760 \\ (root.unions.Unions.Tagged) .tagged = {
761 \\ (error{Error}!root.unions.Unions.Enum) .eu = {
762 \\ (error{Error}) .error = error.Error
763 \\ }
764 \\ }
765 \\}
766 \\(lldb) breakpoint delete --force 1
767 \\1 breakpoints deleted; 0 breakpoint locations disabled.
768 },
769 );
770 db.addLldbTest(
771 "storage",
772 target,
773 &.{
774 .{
775 .path = "storage.zig",
776 .source =
777 \\comptime {
778 \\ _ = @import("externs.zig");
779 \\}
780 \\const global_const: u64 = 0x19e50dc8d6002077;
781 \\var global_var: u64 = 0xcc423cec08622e32;
782 \\threadlocal var global_threadlocal1: u64 = 0xb4d643528c042121;
783 \\threadlocal var global_threadlocal2: u64 = 0x43faea1cf5ad7a22;
784 \\extern const extern_const: u64;
785 \\extern var extern_var: u64;
786 \\extern threadlocal var extern_threadlocal1: u64;
787 \\extern threadlocal var extern_threadlocal2: u64;
788 \\fn testStorage(
789 \\ param1: u64,
790 \\ param2: u64,
791 \\ param3: u64,
792 \\ param4: u64,
793 \\ param5: u64,
794 \\ param6: u64,
795 \\ param7: u64,
796 \\ param8: u64,
797 \\) callconv(.c) void {
798 \\ const local_comptime_val: u64 = global_const *% global_const;
799 \\ const local_comptime_ptr: struct { u64 } = .{ local_comptime_val *% local_comptime_val };
800 \\ const local_const: u64 = global_var ^ global_threadlocal1 ^ global_threadlocal2 ^
801 \\ extern_const ^ extern_var ^ extern_threadlocal1 ^ extern_threadlocal2 ^
802 \\ param1 ^ param2 ^ param3 ^ param4 ^ param5 ^ param6 ^ param7 ^ param8;
803 \\ var local_var: u64 = local_comptime_ptr[0] ^ local_const;
804 \\ local_var = local_var;
805 \\}
806 \\pub fn main() void {
807 \\ testStorage(
808 \\ 0x6a607e08125c7e00,
809 \\ 0x98944cb2a45a8b51,
810 \\ 0xa320cf10601ee6fb,
811 \\ 0x691ed3535bad3274,
812 \\ 0x63690e6867a5799f,
813 \\ 0x8e163f0ec76067f2,
814 \\ 0xf9a252c455fb4c06,
815 \\ 0xc88533722601e481,
816 \\ );
817 \\}
818 \\
819 ,
820 },
821 .{
822 .path = "externs.zig",
823 .source =
824 \\export const extern_const: u64 = 0x1b0c91ea0470b0b2;
825 \\export var extern_var: u64 = 0x19bc17b3f0b61ebc;
826 \\export threadlocal var extern_threadlocal1: u64 = 0x3034c4ce967ed64d;
827 \\export threadlocal var extern_threadlocal2: u64 = 0xfd330ab00b4bc5eb;
828 \\
829 ,
830 },
831 },
832 \\breakpoint set --file storage.zig --source-pattern-regexp 'local_var = local_var;'
833 \\process launch
834 \\target variable --show-types --format hex -- global_const global_var global_threadlocal1 global_threadlocal2 extern_const extern_var extern_threadlocal1 extern_threadlocal2
835 \\frame variable --show-all-children --show-types --format hex -- param1 param2 param3 param4 param5 param6 param7 param8 local_comptime_val 'local_comptime_ptr.@"0"' local_comptime_ptr[0] local_const local_var
836 \\breakpoint delete --force 1
837 ,
838 &.{
839 \\(lldb) target variable --show-types --format hex -- global_const global_var global_threadlocal1 global_threadlocal2 extern_const extern_var extern_threadlocal1 extern_threadlocal2
840 \\(u64) global_const = 0x19e50dc8d6002077
841 \\(u64) global_var = 0xcc423cec08622e32
842 \\(u64) global_threadlocal1 = 0xb4d643528c042121
843 \\(u64) global_threadlocal2 = 0x43faea1cf5ad7a22
844 \\(u64) extern_const = 0x1b0c91ea0470b0b2
845 \\(u64) extern_const = 0x1b0c91ea0470b0b2
846 \\(u64) extern_var = 0x19bc17b3f0b61ebc
847 \\(u64) extern_var = 0x19bc17b3f0b61ebc
848 \\(u64) extern_threadlocal1 = 0x3034c4ce967ed64d
849 \\(u64) extern_threadlocal1 = 0x3034c4ce967ed64d
850 \\(u64) extern_threadlocal2 = 0xfd330ab00b4bc5eb
851 \\(u64) extern_threadlocal2 = 0xfd330ab00b4bc5eb
852 \\(lldb) frame variable --show-all-children --show-types --format hex -- param1 param2 param3 param4 param5 param6 param7 param8 local_comptime_val 'local_comptime_ptr.@"0"' local_comptime_ptr[0] local_const local_var
853 \\(u64) param1 = 0x6a607e08125c7e00
854 \\(u64) param2 = 0x98944cb2a45a8b51
855 \\(u64) param3 = 0xa320cf10601ee6fb
856 \\(u64) param4 = 0x691ed3535bad3274
857 \\(u64) param5 = 0x63690e6867a5799f
858 \\(u64) param6 = 0x8e163f0ec76067f2
859 \\(u64) param7 = 0xf9a252c455fb4c06
860 \\(u64) param8 = 0xc88533722601e481
861 \\(u64) local_comptime_val = 0x69490636f81df751
862 \\(u64) local_comptime_ptr.@"0" = 0x82e834dae74767a1
863 \\(u64) local_comptime_ptr[0] = 0x82e834dae74767a1
864 \\(u64) local_const = 0x104ba3ac46b25fad
865 \\(u64) local_var = 0x92a39776a1f5380c
866 \\(lldb) breakpoint delete --force 1
867 \\1 breakpoints deleted; 0 breakpoint locations disabled.
868 },
869 );
870 db.addLldbTest(
871 "if_blocks",
872 target,
873 &.{
874 .{
875 .path = "if_blocks.zig",
876 .source =
877 \\pub fn main() void {
878 \\ for (0..2) |i| {
879 \\ if (i == 0) {
880 \\ var x: u32 = 123;
881 \\ _ = &x;
882 \\ } else {
883 \\ var x: f32 = 4.5;
884 \\ _ = &x;
885 \\ }
886 \\ }
887 \\}
888 \\
889 ,
890 },
891 },
892 \\breakpoint set --file if_blocks.zig --source-pattern-regexp '_ = &x;'
893 \\process launch
894 \\frame variable --show-all-children
895 \\process continue
896 \\frame variable --show-all-children
897 \\breakpoint delete --force 1
898 ,
899 &.{
900 \\(lldb) frame variable --show-all-children
901 \\(usize) i = 0
902 \\(u32) x = 123
903 \\(lldb) process continue
904 ,
905 \\(lldb) frame variable --show-all-children
906 \\(usize) i = 1
907 \\(f32) x = 4.5
908 \\(lldb) breakpoint delete --force 1
909 \\1 breakpoints deleted; 0 breakpoint locations disabled.
910 },
911 );
912 db.addLldbTest(
913 "switch_blocks",
914 target,
915 &.{
916 .{
917 .path = "switch_blocks.zig",
918 .source =
919 \\pub fn main() void {
920 \\ for (0..2) |i| {
921 \\ switch (i) {
922 \\ 0 => {
923 \\ var x: u32 = 123;
924 \\ _ = &x;
925 \\ },
926 \\ else => {
927 \\ var x: f32 = 4.5;
928 \\ _ = &x;
929 \\ },
930 \\ }
931 \\ }
932 \\}
933 \\
934 ,
935 },
936 },
937 \\breakpoint set --file switch_blocks.zig --source-pattern-regexp '_ = &x;'
938 \\process launch
939 \\frame variable --show-all-children
940 \\process continue
941 \\frame variable --show-all-children
942 \\breakpoint delete --force 1
943 ,
944 &.{
945 \\(lldb) frame variable --show-all-children
946 \\(usize) i = 0
947 \\(u32) x = 123
948 \\(lldb) process continue
949 ,
950 \\(lldb) frame variable --show-all-children
951 \\(usize) i = 1
952 \\(f32) x = 4.5
953 \\(lldb) breakpoint delete --force 1
954 \\1 breakpoints deleted; 0 breakpoint locations disabled.
955 },
956 );
957 db.addLldbTest(
958 "step_single_stmt_loops",
959 target,
960 &.{
961 .{
962 .path = "step_single_stmt_loops.zig",
963 .source =
964 \\pub fn main() void {
965 \\ var x: u32 = 0;
966 \\ for (0..3) |_| {
967 \\ x +%= 1;
968 \\ }
969 \\ {
970 \\ var i: u32 = 0;
971 \\ while (i < 3) : (i +%= 1) {
972 \\ x +%= 1;
973 \\ }
974 \\ }
975 \\ {
976 \\ var i: u32 = 0;
977 \\ while (i < 3) {
978 \\ i +%= 1;
979 \\ }
980 \\ }
981 \\ inline for (0..3) |_| {
982 \\ x +%= 1;
983 \\ }
984 \\ {
985 \\ comptime var i: u32 = 0;
986 \\ inline while (i < 3) : (i +%= 1) {
987 \\ x +%= 1;
988 \\ }
989 \\ }
990 \\ {
991 \\ comptime var i: u32 = 0;
992 \\ inline while (i < 3) {
993 \\ i +%= 1;
994 \\ }
995 \\ }
996 \\ x +%= 1;
997 \\}
998 \\
999 ,
1000 },
1001 },
1002 \\breakpoint set --name step_single_stmt_loops.main
1003 \\process launch
1004 \\thread step-in
1005 \\#00
1006 \\frame variable --show-all-children x
1007 \\thread step-in
1008 \\#01
1009 \\frame variable --show-all-children x
1010 \\thread step-in
1011 \\#02
1012 \\frame variable --show-all-children x
1013 \\thread step-in
1014 \\#03
1015 \\frame variable --show-all-children x
1016 \\thread step-in
1017 \\#04
1018 \\frame variable --show-all-children x
1019 \\thread step-in
1020 \\#05
1021 \\frame variable --show-all-children x
1022 \\thread step-in
1023 \\#06
1024 \\frame variable --show-all-children x
1025 \\thread step-in
1026 \\#07
1027 \\frame variable --show-all-children x
1028 \\thread step-in
1029 \\#08
1030 \\frame variable --show-all-children x
1031 \\thread step-in
1032 \\#09
1033 \\frame variable --show-all-children x
1034 \\thread step-in
1035 \\#10
1036 \\frame variable --show-all-children x
1037 \\thread step-in
1038 \\#11
1039 \\frame variable --show-all-children x
1040 \\thread step-in
1041 \\#12
1042 \\frame variable --show-all-children x
1043 \\thread step-in
1044 \\#13
1045 \\frame variable --show-all-children x
1046 \\thread step-in
1047 \\#14
1048 \\frame variable --show-all-children x
1049 \\thread step-in
1050 \\#15
1051 \\frame variable --show-all-children x
1052 \\thread step-in
1053 \\#16
1054 \\frame variable --show-all-children x
1055 \\thread step-in
1056 \\#17
1057 \\frame variable --show-all-children x
1058 \\thread step-in
1059 \\#18
1060 \\frame variable --show-all-children x
1061 \\thread step-in
1062 \\#19
1063 \\frame variable --show-all-children x
1064 \\thread step-in
1065 \\#20
1066 \\frame variable --show-all-children x
1067 \\thread step-in
1068 \\#21
1069 \\frame variable --show-all-children x
1070 \\thread step-in
1071 \\#22
1072 \\frame variable --show-all-children x
1073 \\thread step-in
1074 \\#23
1075 \\frame variable --show-all-children x
1076 \\thread step-in
1077 \\#24
1078 \\frame variable --show-all-children x
1079 \\thread step-in
1080 \\#25
1081 \\frame variable --show-all-children x
1082 \\thread step-in
1083 \\#26
1084 \\frame variable --show-all-children x
1085 \\thread step-in
1086 \\#27
1087 \\frame variable --show-all-children x
1088 \\thread step-in
1089 \\#28
1090 \\frame variable --show-all-children x
1091 \\thread step-in
1092 \\#29
1093 \\frame variable --show-all-children x
1094 \\thread step-in
1095 \\#30
1096 \\frame variable --show-all-children x
1097 \\thread step-in
1098 \\#31
1099 \\frame variable --show-all-children x
1100 \\thread step-in
1101 \\#32
1102 \\frame variable --show-all-children x
1103 \\thread step-in
1104 \\#33
1105 \\frame variable --show-all-children x
1106 \\thread step-in
1107 \\#34
1108 \\frame variable --show-all-children x
1109 \\thread step-in
1110 \\#35
1111 \\frame variable --show-all-children x
1112 \\thread step-in
1113 \\#36
1114 \\frame variable --show-all-children x
1115 \\thread step-in
1116 \\#37
1117 \\frame variable --show-all-children x
1118 \\thread step-in
1119 \\#38
1120 \\frame variable --show-all-children x
1121 \\thread step-in
1122 \\#39
1123 \\frame variable --show-all-children x
1124 \\thread step-in
1125 \\#40
1126 \\frame variable --show-all-children x
1127 \\thread step-in
1128 \\#41
1129 \\frame variable --show-all-children x
1130 \\thread step-in
1131 \\#42
1132 \\frame variable --show-all-children x
1133 \\thread step-in
1134 \\#43
1135 \\frame variable --show-all-children x
1136 \\thread step-in
1137 \\#44
1138 \\frame variable --show-all-children x
1139 \\thread step-in
1140 \\#45
1141 \\frame variable --show-all-children x
1142 \\
1143 ,
1144 &.{
1145 \\(lldb) #00
1146 \\(lldb) frame variable --show-all-children x
1147 \\(u32) x = 0
1148 \\(lldb) thread step-in
1149 ,
1150 \\(lldb) #01
1151 \\(lldb) frame variable --show-all-children x
1152 \\(u32) x = 0
1153 \\(lldb) thread step-in
1154 ,
1155 \\(lldb) #02
1156 \\(lldb) frame variable --show-all-children x
1157 \\(u32) x = 1
1158 \\(lldb) thread step-in
1159 ,
1160 \\(lldb) #03
1161 \\(lldb) frame variable --show-all-children x
1162 \\(u32) x = 1
1163 \\(lldb) thread step-in
1164 ,
1165 \\(lldb) #04
1166 \\(lldb) frame variable --show-all-children x
1167 \\(u32) x = 1
1168 \\(lldb) thread step-in
1169 ,
1170 \\(lldb) #05
1171 \\(lldb) frame variable --show-all-children x
1172 \\(u32) x = 2
1173 \\(lldb) thread step-in
1174 ,
1175 \\(lldb) #06
1176 \\(lldb) frame variable --show-all-children x
1177 \\(u32) x = 2
1178 \\(lldb) thread step-in
1179 ,
1180 \\(lldb) #07
1181 \\(lldb) frame variable --show-all-children x
1182 \\(u32) x = 2
1183 \\(lldb) thread step-in
1184 ,
1185 \\(lldb) #08
1186 \\(lldb) frame variable --show-all-children x
1187 \\(u32) x = 3
1188 \\(lldb) thread step-in
1189 ,
1190 \\(lldb) #09
1191 \\(lldb) frame variable --show-all-children x
1192 \\(u32) x = 3
1193 \\(lldb) thread step-in
1194 ,
1195 \\(lldb) #10
1196 \\(lldb) frame variable --show-all-children x
1197 \\(u32) x = 3
1198 \\(lldb) thread step-in
1199 ,
1200 \\(lldb) #11
1201 \\(lldb) frame variable --show-all-children x
1202 \\(u32) x = 3
1203 \\(lldb) thread step-in
1204 ,
1205 \\(lldb) #12
1206 \\(lldb) frame variable --show-all-children x
1207 \\(u32) x = 3
1208 \\(lldb) thread step-in
1209 ,
1210 \\(lldb) #13
1211 \\(lldb) frame variable --show-all-children x
1212 \\(u32) x = 4
1213 \\(lldb) thread step-in
1214 ,
1215 \\(lldb) #14
1216 \\(lldb) frame variable --show-all-children x
1217 \\(u32) x = 4
1218 \\(lldb) thread step-in
1219 ,
1220 \\(lldb) #15
1221 \\(lldb) frame variable --show-all-children x
1222 \\(u32) x = 4
1223 \\(lldb) thread step-in
1224 ,
1225 \\(lldb) #16
1226 \\(lldb) frame variable --show-all-children x
1227 \\(u32) x = 5
1228 \\(lldb) thread step-in
1229 ,
1230 \\(lldb) #17
1231 \\(lldb) frame variable --show-all-children x
1232 \\(u32) x = 5
1233 \\(lldb) thread step-in
1234 ,
1235 \\(lldb) #18
1236 \\(lldb) frame variable --show-all-children x
1237 \\(u32) x = 5
1238 \\(lldb) thread step-in
1239 ,
1240 \\(lldb) #19
1241 \\(lldb) frame variable --show-all-children x
1242 \\(u32) x = 6
1243 \\(lldb) thread step-in
1244 ,
1245 \\(lldb) #20
1246 \\(lldb) frame variable --show-all-children x
1247 \\(u32) x = 6
1248 \\(lldb) thread step-in
1249 ,
1250 \\(lldb) #21
1251 \\(lldb) frame variable --show-all-children x
1252 \\(u32) x = 6
1253 \\(lldb) thread step-in
1254 ,
1255 \\(lldb) #22
1256 \\(lldb) frame variable --show-all-children x
1257 \\(u32) x = 6
1258 \\(lldb) thread step-in
1259 ,
1260 \\(lldb) #23
1261 \\(lldb) frame variable --show-all-children x
1262 \\(u32) x = 6
1263 \\(lldb) thread step-in
1264 ,
1265 \\(lldb) #24
1266 \\(lldb) frame variable --show-all-children x
1267 \\(u32) x = 6
1268 \\(lldb) thread step-in
1269 ,
1270 \\(lldb) #25
1271 \\(lldb) frame variable --show-all-children x
1272 \\(u32) x = 6
1273 \\(lldb) thread step-in
1274 ,
1275 \\(lldb) #26
1276 \\(lldb) frame variable --show-all-children x
1277 \\(u32) x = 6
1278 \\(lldb) thread step-in
1279 ,
1280 \\(lldb) #27
1281 \\(lldb) frame variable --show-all-children x
1282 \\(u32) x = 6
1283 \\(lldb) thread step-in
1284 ,
1285 \\(lldb) #28
1286 \\(lldb) frame variable --show-all-children x
1287 \\(u32) x = 6
1288 \\(lldb) thread step-in
1289 ,
1290 \\(lldb) #29
1291 \\(lldb) frame variable --show-all-children x
1292 \\(u32) x = 6
1293 \\(lldb) thread step-in
1294 ,
1295 \\(lldb) #30
1296 \\(lldb) frame variable --show-all-children x
1297 \\(u32) x = 6
1298 \\(lldb) thread step-in
1299 ,
1300 \\(lldb) #31
1301 \\(lldb) frame variable --show-all-children x
1302 \\(u32) x = 6
1303 \\(lldb) thread step-in
1304 ,
1305 \\(lldb) #32
1306 \\(lldb) frame variable --show-all-children x
1307 \\(u32) x = 6
1308 \\(lldb) thread step-in
1309 ,
1310 \\(lldb) #33
1311 \\(lldb) frame variable --show-all-children x
1312 \\(u32) x = 7
1313 \\(lldb) thread step-in
1314 ,
1315 \\(lldb) #34
1316 \\(lldb) frame variable --show-all-children x
1317 \\(u32) x = 7
1318 \\(lldb) thread step-in
1319 ,
1320 \\(lldb) #35
1321 \\(lldb) frame variable --show-all-children x
1322 \\(u32) x = 8
1323 \\(lldb) thread step-in
1324 ,
1325 \\(lldb) #36
1326 \\(lldb) frame variable --show-all-children x
1327 \\(u32) x = 8
1328 \\(lldb) thread step-in
1329 ,
1330 \\(lldb) #37
1331 \\(lldb) frame variable --show-all-children x
1332 \\(u32) x = 9
1333 \\(lldb) thread step-in
1334 ,
1335 \\(lldb) #38
1336 \\(lldb) frame variable --show-all-children x
1337 \\(u32) x = 9
1338 \\(lldb) thread step-in
1339 ,
1340 \\(lldb) #39
1341 \\(lldb) frame variable --show-all-children x
1342 \\(u32) x = 10
1343 \\(lldb) thread step-in
1344 ,
1345 \\(lldb) #40
1346 \\(lldb) frame variable --show-all-children x
1347 \\(u32) x = 10
1348 \\(lldb) thread step-in
1349 ,
1350 \\(lldb) #41
1351 \\(lldb) frame variable --show-all-children x
1352 \\(u32) x = 11
1353 \\(lldb) thread step-in
1354 ,
1355 \\(lldb) #42
1356 \\(lldb) frame variable --show-all-children x
1357 \\(u32) x = 11
1358 \\(lldb) thread step-in
1359 ,
1360 \\(lldb) #43
1361 \\(lldb) frame variable --show-all-children x
1362 \\(u32) x = 12
1363 \\(lldb) thread step-in
1364 ,
1365 \\(lldb) #44
1366 \\(lldb) frame variable --show-all-children x
1367 \\(u32) x = 12
1368 \\(lldb) thread step-in
1369 ,
1370 \\(lldb) #45
1371 \\(lldb) frame variable --show-all-children x
1372 \\(u32) x = 12
1373 },
1374 );
1375 db.addLldbTest(
1376 "inline_call",
1377 target,
1378 &.{
1379 .{
1380 .path = "root0.zig",
1381 .source =
1382 \\const root0 = @This();
1383 \\pub const root1 = @import("root1.zig");
1384 \\const mod0 = @import("module");
1385 \\const mod1 = mod0.mod1;
1386 \\pub fn r0pf(r0pa: u32) void {
1387 \\ root0.r0cf(r0pa ^ 1);
1388 \\ root0.r0cfi(r0pa ^ 2);
1389 \\ root1.r1cf(r0pa ^ 3);
1390 \\ root1.r1cfi(r0pa ^ 4);
1391 \\ mod0.m0cf(r0pa ^ 5);
1392 \\ mod0.m0cfi(r0pa ^ 6);
1393 \\ mod1.m1cf(r0pa ^ 7);
1394 \\ mod1.m1cfi(r0pa ^ 8);
1395 \\}
1396 \\pub inline fn r0pfi(r0pai: u32) void {
1397 \\ root0.r0cf(r0pai ^ 1);
1398 \\ root0.r0cfi(r0pai ^ 2);
1399 \\ root1.r1cf(r0pai ^ 3);
1400 \\ root1.r1cfi(r0pai ^ 4);
1401 \\ mod0.m0cf(r0pai ^ 5);
1402 \\ mod0.m0cfi(r0pai ^ 6);
1403 \\ mod1.m1cf(r0pai ^ 7);
1404 \\ mod1.m1cfi(r0pai ^ 8);
1405 \\}
1406 \\pub fn r0cf(r0ca: u32) void {
1407 \\ var discard = r0ca;
1408 \\ _ = &discard;
1409 \\}
1410 \\pub inline fn r0cfi(r0cai: u32) void {
1411 \\ var discard = r0cai;
1412 \\ _ = &discard;
1413 \\}
1414 \\pub fn main() void {
1415 \\ root0.r0pf(12);
1416 \\ root0.r0pfi(23);
1417 \\ root1.r1pf(34);
1418 \\ root1.r1pfi(45);
1419 \\ mod0.m0pf(56);
1420 \\ mod0.m0pfi(67);
1421 \\ mod1.m1pf(78);
1422 \\ mod1.m1pfi(89);
1423 \\}
1424 \\
1425 ,
1426 },
1427 .{
1428 .path = "root1.zig",
1429 .source =
1430 \\const root0 = @import("root0.zig");
1431 \\const root1 = @This();
1432 \\const mod0 = @import("module");
1433 \\const mod1 = mod0.mod1;
1434 \\pub fn r1pf(r1pa: u32) void {
1435 \\ root0.r0cf(r1pa ^ 1);
1436 \\ root0.r0cfi(r1pa ^ 2);
1437 \\ root1.r1cf(r1pa ^ 3);
1438 \\ root1.r1cfi(r1pa ^ 4);
1439 \\ mod0.m0cf(r1pa ^ 5);
1440 \\ mod0.m0cfi(r1pa ^ 6);
1441 \\ mod1.m1cf(r1pa ^ 7);
1442 \\ mod1.m1cfi(r1pa ^ 8);
1443 \\}
1444 \\pub inline fn r1pfi(r1pai: u32) void {
1445 \\ root0.r0cf(r1pai ^ 1);
1446 \\ root0.r0cfi(r1pai ^ 2);
1447 \\ root1.r1cf(r1pai ^ 3);
1448 \\ root1.r1cfi(r1pai ^ 4);
1449 \\ mod0.m0cf(r1pai ^ 5);
1450 \\ mod0.m0cfi(r1pai ^ 6);
1451 \\ mod1.m1cf(r1pai ^ 7);
1452 \\ mod1.m1cfi(r1pai ^ 8);
1453 \\}
1454 \\pub fn r1cf(r1ca: u32) void {
1455 \\ var discard = r1ca;
1456 \\ _ = &discard;
1457 \\}
1458 \\pub inline fn r1cfi(r1cai: u32) void {
1459 \\ var discard = r1cai;
1460 \\ _ = &discard;
1461 \\}
1462 \\
1463 ,
1464 },
1465 .{
1466 .import = "module",
1467 .path = "mod0.zig",
1468 .source =
1469 \\const root0 = @import("root");
1470 \\const root1 = root0.root1;
1471 \\const mod0 = @This();
1472 \\pub const mod1 = @import("mod1.zig");
1473 \\pub fn m0pf(m0pa: u32) void {
1474 \\ root0.r0cf(m0pa ^ 1);
1475 \\ root0.r0cfi(m0pa ^ 2);
1476 \\ root1.r1cf(m0pa ^ 3);
1477 \\ root1.r1cfi(m0pa ^ 4);
1478 \\ mod0.m0cf(m0pa ^ 5);
1479 \\ mod0.m0cfi(m0pa ^ 6);
1480 \\ mod1.m1cf(m0pa ^ 7);
1481 \\ mod1.m1cfi(m0pa ^ 8);
1482 \\}
1483 \\pub inline fn m0pfi(m0pai: u32) void {
1484 \\ root0.r0cf(m0pai ^ 1);
1485 \\ root0.r0cfi(m0pai ^ 2);
1486 \\ root1.r1cf(m0pai ^ 3);
1487 \\ root1.r1cfi(m0pai ^ 4);
1488 \\ mod0.m0cf(m0pai ^ 5);
1489 \\ mod0.m0cfi(m0pai ^ 6);
1490 \\ mod1.m1cf(m0pai ^ 7);
1491 \\ mod1.m1cfi(m0pai ^ 8);
1492 \\}
1493 \\pub fn m0cf(m0ca: u32) void {
1494 \\ var discard = m0ca;
1495 \\ _ = &discard;
1496 \\}
1497 \\pub inline fn m0cfi(m0cai: u32) void {
1498 \\ var discard = m0cai;
1499 \\ _ = &discard;
1500 \\}
1501 \\
1502 ,
1503 },
1504 .{
1505 .path = "mod1.zig",
1506 .source =
1507 \\const root0 = @import("root");
1508 \\const root1 = root0.root1;
1509 \\const mod0 = @import("mod0.zig");
1510 \\const mod1 = @This();
1511 \\pub fn m1pf(m1pa: u32) void {
1512 \\ root0.r0cf(m1pa ^ 1);
1513 \\ root0.r0cfi(m1pa ^ 2);
1514 \\ root1.r1cf(m1pa ^ 3);
1515 \\ root1.r1cfi(m1pa ^ 4);
1516 \\ mod0.m0cf(m1pa ^ 5);
1517 \\ mod0.m0cfi(m1pa ^ 6);
1518 \\ mod1.m1cf(m1pa ^ 7);
1519 \\ mod1.m1cfi(m1pa ^ 8);
1520 \\}
1521 \\pub inline fn m1pfi(m1pai: u32) void {
1522 \\ root0.r0cf(m1pai ^ 1);
1523 \\ root0.r0cfi(m1pai ^ 2);
1524 \\ root1.r1cf(m1pai ^ 3);
1525 \\ root1.r1cfi(m1pai ^ 4);
1526 \\ mod0.m0cf(m1pai ^ 5);
1527 \\ mod0.m0cfi(m1pai ^ 6);
1528 \\ mod1.m1cf(m1pai ^ 7);
1529 \\ mod1.m1cfi(m1pai ^ 8);
1530 \\}
1531 \\pub fn m1cf(m1ca: u32) void {
1532 \\ var discard = m1ca;
1533 \\ _ = &discard;
1534 \\}
1535 \\pub inline fn m1cfi(m1cai: u32) void {
1536 \\ var discard = m1cai;
1537 \\ _ = &discard;
1538 \\}
1539 \\
1540 ,
1541 },
1542 },
1543 \\settings set frame-format 'frame #${frame.index}:{ ${module.file.basename}{\`${function.name-with-args}{${frame.no-debug}${function.pc-offset}}}}{ at ${line.file.basename}:${line.number}{:${line.column}}}{${function.is-optimized} [opt]}{${frame.is-artificial} [artificial]}\n'
1544 \\
1545 \\breakpoint set --file root0.zig --line 26
1546 \\breakpoint set --file root0.zig --line 30
1547 \\breakpoint set --file root1.zig --line 26
1548 \\breakpoint set --file root1.zig --line 30
1549 \\breakpoint set --file mod0.zig --line 26
1550 \\breakpoint set --file mod0.zig --line 30
1551 \\breakpoint set --file mod1.zig --line 26
1552 \\breakpoint set --file mod1.zig --line 30
1553 \\
1554 \\process launch
1555 \\thread backtrace --count 3
1556 \\process continue
1557 \\thread backtrace --count 3
1558 \\process continue
1559 \\thread backtrace --count 3
1560 \\process continue
1561 \\thread backtrace --count 3
1562 \\process continue
1563 \\thread backtrace --count 3
1564 \\process continue
1565 \\thread backtrace --count 3
1566 \\process continue
1567 \\thread backtrace --count 3
1568 \\process continue
1569 \\thread backtrace --count 3
1570 \\
1571 \\process continue
1572 \\thread backtrace --count 3
1573 \\process continue
1574 \\thread backtrace --count 3
1575 \\process continue
1576 \\thread backtrace --count 3
1577 \\process continue
1578 \\thread backtrace --count 3
1579 \\process continue
1580 \\thread backtrace --count 3
1581 \\process continue
1582 \\thread backtrace --count 3
1583 \\process continue
1584 \\thread backtrace --count 3
1585 \\process continue
1586 \\thread backtrace --count 3
1587 \\
1588 \\process continue
1589 \\thread backtrace --count 3
1590 \\process continue
1591 \\thread backtrace --count 3
1592 \\process continue
1593 \\thread backtrace --count 3
1594 \\process continue
1595 \\thread backtrace --count 3
1596 \\process continue
1597 \\thread backtrace --count 3
1598 \\process continue
1599 \\thread backtrace --count 3
1600 \\process continue
1601 \\thread backtrace --count 3
1602 \\process continue
1603 \\thread backtrace --count 3
1604 \\
1605 \\process continue
1606 \\thread backtrace --count 3
1607 \\process continue
1608 \\thread backtrace --count 3
1609 \\process continue
1610 \\thread backtrace --count 3
1611 \\process continue
1612 \\thread backtrace --count 3
1613 \\process continue
1614 \\thread backtrace --count 3
1615 \\process continue
1616 \\thread backtrace --count 3
1617 \\process continue
1618 \\thread backtrace --count 3
1619 \\process continue
1620 \\thread backtrace --count 3
1621 \\
1622 \\process continue
1623 \\thread backtrace --count 3
1624 \\process continue
1625 \\thread backtrace --count 3
1626 \\process continue
1627 \\thread backtrace --count 3
1628 \\process continue
1629 \\thread backtrace --count 3
1630 \\process continue
1631 \\thread backtrace --count 3
1632 \\process continue
1633 \\thread backtrace --count 3
1634 \\process continue
1635 \\thread backtrace --count 3
1636 \\process continue
1637 \\thread backtrace --count 3
1638 \\
1639 \\process continue
1640 \\thread backtrace --count 3
1641 \\process continue
1642 \\thread backtrace --count 3
1643 \\process continue
1644 \\thread backtrace --count 3
1645 \\process continue
1646 \\thread backtrace --count 3
1647 \\process continue
1648 \\thread backtrace --count 3
1649 \\process continue
1650 \\thread backtrace --count 3
1651 \\process continue
1652 \\thread backtrace --count 3
1653 \\process continue
1654 \\thread backtrace --count 3
1655 \\
1656 \\process continue
1657 \\thread backtrace --count 3
1658 \\process continue
1659 \\thread backtrace --count 3
1660 \\process continue
1661 \\thread backtrace --count 3
1662 \\process continue
1663 \\thread backtrace --count 3
1664 \\process continue
1665 \\thread backtrace --count 3
1666 \\process continue
1667 \\thread backtrace --count 3
1668 \\process continue
1669 \\thread backtrace --count 3
1670 \\process continue
1671 \\thread backtrace --count 3
1672 \\
1673 \\process continue
1674 \\thread backtrace --count 3
1675 \\process continue
1676 \\thread backtrace --count 3
1677 \\process continue
1678 \\thread backtrace --count 3
1679 \\process continue
1680 \\thread backtrace --count 3
1681 \\process continue
1682 \\thread backtrace --count 3
1683 \\process continue
1684 \\thread backtrace --count 3
1685 \\process continue
1686 \\thread backtrace --count 3
1687 \\process continue
1688 \\thread backtrace --count 3
1689 ,
1690 &.{
1691 \\ * frame #0: inline_call`root0.r0cf(r0ca=13) at root0.zig:26:5
1692 \\ frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:6:15
1693 \\ frame #2: inline_call`root0.main at root0.zig:34:15
1694 ,
1695 \\ * frame #0: inline_call`r0cfi(r0cai=14) at root0.zig:30:5
1696 \\ frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:7:16
1697 \\ frame #2: inline_call`root0.main at root0.zig:34:15
1698 ,
1699 \\ * frame #0: inline_call`root1.r1cf(r1ca=15) at root1.zig:26:5
1700 \\ frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:8:15
1701 \\ frame #2: inline_call`root0.main at root0.zig:34:15
1702 ,
1703 \\ * frame #0: inline_call`r1cfi(r1cai=8) at root1.zig:30:5
1704 \\ frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:9:16
1705 \\ frame #2: inline_call`root0.main at root0.zig:34:15
1706 ,
1707 \\ * frame #0: inline_call`mod0.m0cf(m0ca=9) at mod0.zig:26:5
1708 \\ frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:10:14
1709 \\ frame #2: inline_call`root0.main at root0.zig:34:15
1710 ,
1711 \\ * frame #0: inline_call`m0cfi(m0cai=10) at mod0.zig:30:5
1712 \\ frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:11:15
1713 \\ frame #2: inline_call`root0.main at root0.zig:34:15
1714 ,
1715 \\ * frame #0: inline_call`mod1.m1cf(m1ca=11) at mod1.zig:26:5
1716 \\ frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:12:14
1717 \\ frame #2: inline_call`root0.main at root0.zig:34:15
1718 ,
1719 \\ * frame #0: inline_call`m1cfi(m1cai=4) at mod1.zig:30:5
1720 \\ frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:13:15
1721 \\ frame #2: inline_call`root0.main at root0.zig:34:15
1722 ,
1723 \\ * frame #0: inline_call`root0.r0cf(r0ca=22) at root0.zig:26:5
1724 \\ frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:16:15
1725 \\ frame #2: inline_call`root0.main at root0.zig:35:16
1726 ,
1727 \\ * frame #0: inline_call`r0cfi(r0cai=21) at root0.zig:30:5
1728 \\ frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:17:16
1729 \\ frame #2: inline_call`root0.main at root0.zig:35:16
1730 ,
1731 \\ * frame #0: inline_call`root1.r1cf(r1ca=20) at root1.zig:26:5
1732 \\ frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:18:15
1733 \\ frame #2: inline_call`root0.main at root0.zig:35:16
1734 ,
1735 \\ * frame #0: inline_call`r1cfi(r1cai=19) at root1.zig:30:5
1736 \\ frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:19:16
1737 \\ frame #2: inline_call`root0.main at root0.zig:35:16
1738 ,
1739 \\ * frame #0: inline_call`mod0.m0cf(m0ca=18) at mod0.zig:26:5
1740 \\ frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:20:14
1741 \\ frame #2: inline_call`root0.main at root0.zig:35:16
1742 ,
1743 \\ * frame #0: inline_call`m0cfi(m0cai=17) at mod0.zig:30:5
1744 \\ frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:21:15
1745 \\ frame #2: inline_call`root0.main at root0.zig:35:16
1746 ,
1747 \\ * frame #0: inline_call`mod1.m1cf(m1ca=16) at mod1.zig:26:5
1748 \\ frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:22:14
1749 \\ frame #2: inline_call`root0.main at root0.zig:35:16
1750 ,
1751 \\ * frame #0: inline_call`m1cfi(m1cai=31) at mod1.zig:30:5
1752 \\ frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:23:15
1753 \\ frame #2: inline_call`root0.main at root0.zig:35:16
1754 ,
1755 \\ * frame #0: inline_call`root0.r0cf(r0ca=35) at root0.zig:26:5
1756 \\ frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:6:15
1757 \\ frame #2: inline_call`root0.main at root0.zig:36:15
1758 ,
1759 \\ * frame #0: inline_call`r0cfi(r0cai=32) at root0.zig:30:5
1760 \\ frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:7:16
1761 \\ frame #2: inline_call`root0.main at root0.zig:36:15
1762 ,
1763 \\ * frame #0: inline_call`root1.r1cf(r1ca=33) at root1.zig:26:5
1764 \\ frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:8:15
1765 \\ frame #2: inline_call`root0.main at root0.zig:36:15
1766 ,
1767 \\ * frame #0: inline_call`r1cfi(r1cai=38) at root1.zig:30:5
1768 \\ frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:9:16
1769 \\ frame #2: inline_call`root0.main at root0.zig:36:15
1770 ,
1771 \\ * frame #0: inline_call`mod0.m0cf(m0ca=39) at mod0.zig:26:5
1772 \\ frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:10:14
1773 \\ frame #2: inline_call`root0.main at root0.zig:36:15
1774 ,
1775 \\ * frame #0: inline_call`m0cfi(m0cai=36) at mod0.zig:30:5
1776 \\ frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:11:15
1777 \\ frame #2: inline_call`root0.main at root0.zig:36:15
1778 ,
1779 \\ * frame #0: inline_call`mod1.m1cf(m1ca=37) at mod1.zig:26:5
1780 \\ frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:12:14
1781 \\ frame #2: inline_call`root0.main at root0.zig:36:15
1782 ,
1783 \\ * frame #0: inline_call`m1cfi(m1cai=42) at mod1.zig:30:5
1784 \\ frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:13:15
1785 \\ frame #2: inline_call`root0.main at root0.zig:36:15
1786 ,
1787 \\ * frame #0: inline_call`root0.r0cf(r0ca=44) at root0.zig:26:5
1788 \\ frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:16:15
1789 \\ frame #2: inline_call`root0.main at root0.zig:37:16
1790 ,
1791 \\ * frame #0: inline_call`r0cfi(r0cai=47) at root0.zig:30:5
1792 \\ frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:17:16
1793 \\ frame #2: inline_call`root0.main at root0.zig:37:16
1794 ,
1795 \\ * frame #0: inline_call`root1.r1cf(r1ca=46) at root1.zig:26:5
1796 \\ frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:18:15
1797 \\ frame #2: inline_call`root0.main at root0.zig:37:16
1798 ,
1799 \\ * frame #0: inline_call`r1cfi(r1cai=41) at root1.zig:30:5
1800 \\ frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:19:16
1801 \\ frame #2: inline_call`root0.main at root0.zig:37:16
1802 ,
1803 \\ * frame #0: inline_call`mod0.m0cf(m0ca=40) at mod0.zig:26:5
1804 \\ frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:20:14
1805 \\ frame #2: inline_call`root0.main at root0.zig:37:16
1806 ,
1807 \\ * frame #0: inline_call`m0cfi(m0cai=43) at mod0.zig:30:5
1808 \\ frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:21:15
1809 \\ frame #2: inline_call`root0.main at root0.zig:37:16
1810 ,
1811 \\ * frame #0: inline_call`mod1.m1cf(m1ca=42) at mod1.zig:26:5
1812 \\ frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:22:14
1813 \\ frame #2: inline_call`root0.main at root0.zig:37:16
1814 ,
1815 \\ * frame #0: inline_call`m1cfi(m1cai=37) at mod1.zig:30:5
1816 \\ frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:23:15
1817 \\ frame #2: inline_call`root0.main at root0.zig:37:16
1818 ,
1819 \\ * frame #0: inline_call`root0.r0cf(r0ca=57) at root0.zig:26:5
1820 \\ frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:6:15
1821 \\ frame #2: inline_call`root0.main at root0.zig:38:14
1822 ,
1823 \\ * frame #0: inline_call`r0cfi(r0cai=58) at root0.zig:30:5
1824 \\ frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:7:16
1825 \\ frame #2: inline_call`root0.main at root0.zig:38:14
1826 ,
1827 \\ * frame #0: inline_call`root1.r1cf(r1ca=59) at root1.zig:26:5
1828 \\ frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:8:15
1829 \\ frame #2: inline_call`root0.main at root0.zig:38:14
1830 ,
1831 \\ * frame #0: inline_call`r1cfi(r1cai=60) at root1.zig:30:5
1832 \\ frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:9:16
1833 \\ frame #2: inline_call`root0.main at root0.zig:38:14
1834 ,
1835 \\ * frame #0: inline_call`mod0.m0cf(m0ca=61) at mod0.zig:26:5
1836 \\ frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:10:14
1837 \\ frame #2: inline_call`root0.main at root0.zig:38:14
1838 ,
1839 \\ * frame #0: inline_call`m0cfi(m0cai=62) at mod0.zig:30:5
1840 \\ frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:11:15
1841 \\ frame #2: inline_call`root0.main at root0.zig:38:14
1842 ,
1843 \\ * frame #0: inline_call`mod1.m1cf(m1ca=63) at mod1.zig:26:5
1844 \\ frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:12:14
1845 \\ frame #2: inline_call`root0.main at root0.zig:38:14
1846 ,
1847 \\ * frame #0: inline_call`m1cfi(m1cai=48) at mod1.zig:30:5
1848 \\ frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:13:15
1849 \\ frame #2: inline_call`root0.main at root0.zig:38:14
1850 ,
1851 \\ * frame #0: inline_call`root0.r0cf(r0ca=66) at root0.zig:26:5
1852 \\ frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:16:15
1853 \\ frame #2: inline_call`root0.main at root0.zig:39:15
1854 ,
1855 \\ * frame #0: inline_call`r0cfi(r0cai=65) at root0.zig:30:5
1856 \\ frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:17:16
1857 \\ frame #2: inline_call`root0.main at root0.zig:39:15
1858 ,
1859 \\ * frame #0: inline_call`root1.r1cf(r1ca=64) at root1.zig:26:5
1860 \\ frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:18:15
1861 \\ frame #2: inline_call`root0.main at root0.zig:39:15
1862 ,
1863 \\ * frame #0: inline_call`r1cfi(r1cai=71) at root1.zig:30:5
1864 \\ frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:19:16
1865 \\ frame #2: inline_call`root0.main at root0.zig:39:15
1866 ,
1867 \\ * frame #0: inline_call`mod0.m0cf(m0ca=70) at mod0.zig:26:5
1868 \\ frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:20:14
1869 \\ frame #2: inline_call`root0.main at root0.zig:39:15
1870 ,
1871 \\ * frame #0: inline_call`m0cfi(m0cai=69) at mod0.zig:30:5
1872 \\ frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:21:15
1873 \\ frame #2: inline_call`root0.main at root0.zig:39:15
1874 ,
1875 \\ * frame #0: inline_call`mod1.m1cf(m1ca=68) at mod1.zig:26:5
1876 \\ frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:22:14
1877 \\ frame #2: inline_call`root0.main at root0.zig:39:15
1878 ,
1879 \\ * frame #0: inline_call`m1cfi(m1cai=75) at mod1.zig:30:5
1880 \\ frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:23:15
1881 \\ frame #2: inline_call`root0.main at root0.zig:39:15
1882 ,
1883 \\ * frame #0: inline_call`root0.r0cf(r0ca=79) at root0.zig:26:5
1884 \\ frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:6:15
1885 \\ frame #2: inline_call`root0.main at root0.zig:40:14
1886 ,
1887 \\ * frame #0: inline_call`r0cfi(r0cai=76) at root0.zig:30:5
1888 \\ frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:7:16
1889 \\ frame #2: inline_call`root0.main at root0.zig:40:14
1890 ,
1891 \\ * frame #0: inline_call`root1.r1cf(r1ca=77) at root1.zig:26:5
1892 \\ frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:8:15
1893 \\ frame #2: inline_call`root0.main at root0.zig:40:14
1894 ,
1895 \\ * frame #0: inline_call`r1cfi(r1cai=74) at root1.zig:30:5
1896 \\ frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:9:16
1897 \\ frame #2: inline_call`root0.main at root0.zig:40:14
1898 ,
1899 \\ * frame #0: inline_call`mod0.m0cf(m0ca=75) at mod0.zig:26:5
1900 \\ frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:10:14
1901 \\ frame #2: inline_call`root0.main at root0.zig:40:14
1902 ,
1903 \\ * frame #0: inline_call`m0cfi(m0cai=72) at mod0.zig:30:5
1904 \\ frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:11:15
1905 \\ frame #2: inline_call`root0.main at root0.zig:40:14
1906 ,
1907 \\ * frame #0: inline_call`mod1.m1cf(m1ca=73) at mod1.zig:26:5
1908 \\ frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:12:14
1909 \\ frame #2: inline_call`root0.main at root0.zig:40:14
1910 ,
1911 \\ * frame #0: inline_call`m1cfi(m1cai=70) at mod1.zig:30:5
1912 \\ frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:13:15
1913 \\ frame #2: inline_call`root0.main at root0.zig:40:14
1914 ,
1915 \\ * frame #0: inline_call`root0.r0cf(r0ca=88) at root0.zig:26:5
1916 \\ frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:16:15
1917 \\ frame #2: inline_call`root0.main at root0.zig:41:15
1918 ,
1919 \\ * frame #0: inline_call`r0cfi(r0cai=91) at root0.zig:30:5
1920 \\ frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:17:16
1921 \\ frame #2: inline_call`root0.main at root0.zig:41:15
1922 ,
1923 \\ * frame #0: inline_call`root1.r1cf(r1ca=90) at root1.zig:26:5
1924 \\ frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:18:15
1925 \\ frame #2: inline_call`root0.main at root0.zig:41:15
1926 ,
1927 \\ * frame #0: inline_call`r1cfi(r1cai=93) at root1.zig:30:5
1928 \\ frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:19:16
1929 \\ frame #2: inline_call`root0.main at root0.zig:41:15
1930 ,
1931 \\ * frame #0: inline_call`mod0.m0cf(m0ca=92) at mod0.zig:26:5
1932 \\ frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:20:14
1933 \\ frame #2: inline_call`root0.main at root0.zig:41:15
1934 ,
1935 \\ * frame #0: inline_call`m0cfi(m0cai=95) at mod0.zig:30:5
1936 \\ frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:21:15
1937 \\ frame #2: inline_call`root0.main at root0.zig:41:15
1938 ,
1939 \\ * frame #0: inline_call`mod1.m1cf(m1ca=94) at mod1.zig:26:5
1940 \\ frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:22:14
1941 \\ frame #2: inline_call`root0.main at root0.zig:41:15
1942 ,
1943 \\ * frame #0: inline_call`m1cfi(m1cai=81) at mod1.zig:30:5
1944 \\ frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:23:15
1945 \\ frame #2: inline_call`root0.main at root0.zig:41:15
1946 },
1947 );
1948 db.addLldbTest(
1949 "link_object",
1950 target,
1951 &.{
1952 .{
1953 .path = "main.zig",
1954 .source =
1955 \\extern fn fabsf(f32) f32;
1956 \\pub fn main() void {
1957 \\ var x: f32 = -1234.5;
1958 \\ x = fabsf(x);
1959 \\ _ = &x;
1960 \\}
1961 \\
1962 ,
1963 },
1964 },
1965 \\breakpoint set --file main.zig --source-pattern-regexp 'x = fabsf\(x\);'
1966 \\process launch
1967 \\frame variable --show-all-children -- x
1968 \\breakpoint delete --force 1
1969 \\
1970 \\breakpoint set --file main.zig --source-pattern-regexp '_ = &x;'
1971 \\process continue
1972 \\frame variable --show-all-children -- x
1973 \\breakpoint delete --force 2
1974 ,
1975 &.{
1976 \\(lldb) frame variable --show-all-children -- x
1977 \\(f32) x = -1234.5
1978 \\(lldb) breakpoint delete --force 1
1979 \\1 breakpoints deleted; 0 breakpoint locations disabled.
1980 ,
1981 \\(lldb) frame variable --show-all-children -- x
1982 \\(f32) x = 1234.5
1983 \\(lldb) breakpoint delete --force 2
1984 \\1 breakpoints deleted; 0 breakpoint locations disabled.
1985 },
1986 );
1987 db.addLldbTest(
1988 "hash_map",
1989 target,
1990 &.{
1991 .{
1992 .path = "main.zig",
1993 .source =
1994 \\const std = @import("std");
1995 \\const Context = struct {
1996 \\ pub fn hash(_: Context, key: u32) Map.Hash {
1997 \\ return key;
1998 \\ }
1999 \\ pub fn eql(_: Context, lhs: u32, rhs: u32) bool {
2000 \\ return lhs == rhs;
2001 \\ }
2002 \\};
2003 \\const Map = std.HashMapUnmanaged(u32, u32, Context, 63);
2004 \\fn testHashMap(map: Map) void {
2005 \\ _ = map;
2006 \\}
2007 \\pub fn main() !void {
2008 \\ var map: Map = .empty;
2009 \\ defer map.deinit(std.heap.page_allocator);
2010 \\ try map.ensureTotalCapacity(std.heap.page_allocator, 10);
2011 \\ map.putAssumeCapacity(0, 1);
2012 \\ map.putAssumeCapacity(2, 3);
2013 \\ map.putAssumeCapacity(4, 5);
2014 \\ map.putAssumeCapacity(6, 7);
2015 \\ map.putAssumeCapacity(8, 9);
2016 \\
2017 \\ testHashMap(map);
2018 \\}
2019 \\
2020 ,
2021 },
2022 },
2023 \\breakpoint set --file main.zig --source-pattern-regexp '_ = map;'
2024 \\process launch
2025 \\frame variable --show-all-children --show-types -- map
2026 \\breakpoint delete --force 1
2027 ,
2028 &.{
2029 \\(lldb) frame variable --show-all-children --show-types -- map
2030 \\(std.hash_map.Custom(u32,u32,main.Context,63)) map = len=5 capacity=16 {
2031 \\ (std.hash_map.Custom(u32,u32,main.Context,63).KV) [0] = {
2032 \\ (u32) .key = 0
2033 \\ (u32) .value = 1
2034 \\ }
2035 \\ (std.hash_map.Custom(u32,u32,main.Context,63).KV) [1] = {
2036 \\ (u32) .key = 2
2037 \\ (u32) .value = 3
2038 \\ }
2039 \\ (std.hash_map.Custom(u32,u32,main.Context,63).KV) [2] = {
2040 \\ (u32) .key = 4
2041 \\ (u32) .value = 5
2042 \\ }
2043 \\ (std.hash_map.Custom(u32,u32,main.Context,63).KV) [3] = {
2044 \\ (u32) .key = 6
2045 \\ (u32) .value = 7
2046 \\ }
2047 \\ (std.hash_map.Custom(u32,u32,main.Context,63).KV) [4] = {
2048 \\ (u32) .key = 8
2049 \\ (u32) .value = 9
2050 \\ }
2051 \\}
2052 \\(lldb) breakpoint delete --force 1
2053 \\1 breakpoints deleted; 0 breakpoint locations disabled.
2054 },
2055 );
2056 db.addLldbTest(
2057 "multi_array_list",
2058 target,
2059 &.{
2060 .{
2061 .path = "main.zig",
2062 .source =
2063 \\const std = @import("std");
2064 \\const Elem0 = struct { u32, u8, u16 };
2065 \\const Elem1 = struct { a: u32, b: u8, c: u16 };
2066 \\fn testMultiArrayList(
2067 \\ list0: std.MultiArrayList(Elem0),
2068 \\ slice0: std.MultiArrayList(Elem0).Slice,
2069 \\ list1: std.MultiArrayList(Elem1),
2070 \\ slice1: std.MultiArrayList(Elem1).Slice,
2071 \\) void {
2072 \\ _ = .{ list0, slice0, list1, slice1 };
2073 \\}
2074 \\pub fn main() !void {
2075 \\ var list0: std.MultiArrayList(Elem0) = .{};
2076 \\ defer list0.deinit(std.heap.page_allocator);
2077 \\ try list0.setCapacity(std.heap.page_allocator, 8);
2078 \\ list0.appendAssumeCapacity(.{ 1, 2, 3 });
2079 \\ list0.appendAssumeCapacity(.{ 4, 5, 6 });
2080 \\ list0.appendAssumeCapacity(.{ 7, 8, 9 });
2081 \\ const slice0 = list0.slice();
2082 \\
2083 \\ var list1: std.MultiArrayList(Elem1) = .{};
2084 \\ defer list1.deinit(std.heap.page_allocator);
2085 \\ try list1.setCapacity(std.heap.page_allocator, 12);
2086 \\ list1.appendAssumeCapacity(.{ .a = 1, .b = 2, .c = 3 });
2087 \\ list1.appendAssumeCapacity(.{ .a = 4, .b = 5, .c = 6 });
2088 \\ list1.appendAssumeCapacity(.{ .a = 7, .b = 8, .c = 9 });
2089 \\ const slice1 = list1.slice();
2090 \\
2091 \\ testMultiArrayList(list0, slice0, list1, slice1);
2092 \\}
2093 \\
2094 ,
2095 },
2096 },
2097 \\breakpoint set --file main.zig --source-pattern-regexp '_ = \.{ list0, slice0, list1, slice1 };'
2098 \\process launch
2099 \\frame variable --show-all-children --show-types -- list0 list0.len list0.capacity list0[0] list0[1] list0[2] 'list0.@"0"' 'list0.@"1"' 'list0.@"2"'
2100 \\frame variable --show-all-children --show-types -- slice0 slice0.len slice0.capacity slice0[0] slice0[1] slice0[2] 'slice0.@"0"' 'slice0.@"1"' 'slice0.@"2"'
2101 \\frame variable --show-all-children --show-types -- list1 list1.len list1.capacity list1[0] list1[1] list1[2] list1.a list1.b list1.c
2102 \\frame variable --show-all-children --show-types -- slice1 slice1.len slice1.capacity slice1[0] slice1[1] slice1[2] slice1.a slice1.b slice1.c
2103 \\breakpoint delete --force 1
2104 ,
2105 &.{
2106 \\(lldb) frame variable --show-all-children --show-types -- list0 list0.len list0.capacity list0[0] list0[1] list0[2] 'list0.@"0"' 'list0.@"1"' 'list0.@"2"'
2107 \\(std.multi_array_list.MultiArrayList(struct { u32, u8, u16 })) list0 = len=3 capacity=8 {
2108 \\ (struct { u32, u8, u16 }) [0] = {
2109 \\ (u32) .@"0" = 1
2110 \\ (u8) .@"1" = 2
2111 \\ (u16) .@"2" = 3
2112 \\ }
2113 \\ (struct { u32, u8, u16 }) [1] = {
2114 \\ (u32) .@"0" = 4
2115 \\ (u8) .@"1" = 5
2116 \\ (u16) .@"2" = 6
2117 \\ }
2118 \\ (struct { u32, u8, u16 }) [2] = {
2119 \\ (u32) .@"0" = 7
2120 \\ (u8) .@"1" = 8
2121 \\ (u16) .@"2" = 9
2122 \\ }
2123 \\}
2124 \\(usize) list0.len = 3
2125 \\(usize) list0.capacity = 8
2126 \\(struct { u32, u8, u16 }) list0[0] = {
2127 \\ (u32) .@"0" = 1
2128 \\ (u8) .@"1" = 2
2129 \\ (u16) .@"2" = 3
2130 \\}
2131 \\(struct { u32, u8, u16 }) list0[1] = {
2132 \\ (u32) .@"0" = 4
2133 \\ (u8) .@"1" = 5
2134 \\ (u16) .@"2" = 6
2135 \\}
2136 \\(struct { u32, u8, u16 }) list0[2] = {
2137 \\ (u32) .@"0" = 7
2138 \\ (u8) .@"1" = 8
2139 \\ (u16) .@"2" = 9
2140 \\}
2141 \\([3]u32) list0.@"0" = {
2142 \\ (u32) [0] = 1
2143 \\ (u32) [1] = 4
2144 \\ (u32) [2] = 7
2145 \\}
2146 \\([3]u8) list0.@"1" = {
2147 \\ (u8) [0] = 2
2148 \\ (u8) [1] = 5
2149 \\ (u8) [2] = 8
2150 \\}
2151 \\([3]u16) list0.@"2" = {
2152 \\ (u16) [0] = 3
2153 \\ (u16) [1] = 6
2154 \\ (u16) [2] = 9
2155 \\}
2156 \\(lldb) frame variable --show-all-children --show-types -- slice0 slice0.len slice0.capacity slice0[0] slice0[1] slice0[2] 'slice0.@"0"' 'slice0.@"1"' 'slice0.@"2"'
2157 \\(std.multi_array_list.MultiArrayList(struct { u32, u8, u16 }).Slice) slice0 = len=3 capacity=8 {
2158 \\ (struct { u32, u8, u16 }) [0] = {
2159 \\ (u32) .@"0" = 1
2160 \\ (u8) .@"1" = 2
2161 \\ (u16) .@"2" = 3
2162 \\ }
2163 \\ (struct { u32, u8, u16 }) [1] = {
2164 \\ (u32) .@"0" = 4
2165 \\ (u8) .@"1" = 5
2166 \\ (u16) .@"2" = 6
2167 \\ }
2168 \\ (struct { u32, u8, u16 }) [2] = {
2169 \\ (u32) .@"0" = 7
2170 \\ (u8) .@"1" = 8
2171 \\ (u16) .@"2" = 9
2172 \\ }
2173 \\}
2174 \\(usize) slice0.len = 3
2175 \\(usize) slice0.capacity = 8
2176 \\(struct { u32, u8, u16 }) slice0[0] = {
2177 \\ (u32) .@"0" = 1
2178 \\ (u8) .@"1" = 2
2179 \\ (u16) .@"2" = 3
2180 \\}
2181 \\(struct { u32, u8, u16 }) slice0[1] = {
2182 \\ (u32) .@"0" = 4
2183 \\ (u8) .@"1" = 5
2184 \\ (u16) .@"2" = 6
2185 \\}
2186 \\(struct { u32, u8, u16 }) slice0[2] = {
2187 \\ (u32) .@"0" = 7
2188 \\ (u8) .@"1" = 8
2189 \\ (u16) .@"2" = 9
2190 \\}
2191 \\([3]u32) slice0.@"0" = {
2192 \\ (u32) [0] = 1
2193 \\ (u32) [1] = 4
2194 \\ (u32) [2] = 7
2195 \\}
2196 \\([3]u8) slice0.@"1" = {
2197 \\ (u8) [0] = 2
2198 \\ (u8) [1] = 5
2199 \\ (u8) [2] = 8
2200 \\}
2201 \\([3]u16) slice0.@"2" = {
2202 \\ (u16) [0] = 3
2203 \\ (u16) [1] = 6
2204 \\ (u16) [2] = 9
2205 \\}
2206 \\(lldb) frame variable --show-all-children --show-types -- list1 list1.len list1.capacity list1[0] list1[1] list1[2] list1.a list1.b list1.c
2207 \\(std.multi_array_list.MultiArrayList(main.Elem1)) list1 = len=3 capacity=12 {
2208 \\ (root.main.Elem1) [0] = {
2209 \\ (u32) .a = 1
2210 \\ (u8) .b = 2
2211 \\ (u16) .c = 3
2212 \\ }
2213 \\ (root.main.Elem1) [1] = {
2214 \\ (u32) .a = 4
2215 \\ (u8) .b = 5
2216 \\ (u16) .c = 6
2217 \\ }
2218 \\ (root.main.Elem1) [2] = {
2219 \\ (u32) .a = 7
2220 \\ (u8) .b = 8
2221 \\ (u16) .c = 9
2222 \\ }
2223 \\}
2224 \\(usize) list1.len = 3
2225 \\(usize) list1.capacity = 12
2226 \\(root.main.Elem1) list1[0] = {
2227 \\ (u32) .a = 1
2228 \\ (u8) .b = 2
2229 \\ (u16) .c = 3
2230 \\}
2231 \\(root.main.Elem1) list1[1] = {
2232 \\ (u32) .a = 4
2233 \\ (u8) .b = 5
2234 \\ (u16) .c = 6
2235 \\}
2236 \\(root.main.Elem1) list1[2] = {
2237 \\ (u32) .a = 7
2238 \\ (u8) .b = 8
2239 \\ (u16) .c = 9
2240 \\}
2241 \\([3]u32) list1.a = {
2242 \\ (u32) [0] = 1
2243 \\ (u32) [1] = 4
2244 \\ (u32) [2] = 7
2245 \\}
2246 \\([3]u8) list1.b = {
2247 \\ (u8) [0] = 2
2248 \\ (u8) [1] = 5
2249 \\ (u8) [2] = 8
2250 \\}
2251 \\([3]u16) list1.c = {
2252 \\ (u16) [0] = 3
2253 \\ (u16) [1] = 6
2254 \\ (u16) [2] = 9
2255 \\}
2256 \\(lldb) frame variable --show-all-children --show-types -- slice1 slice1.len slice1.capacity slice1[0] slice1[1] slice1[2] slice1.a slice1.b slice1.c
2257 \\(std.multi_array_list.MultiArrayList(main.Elem1).Slice) slice1 = len=3 capacity=12 {
2258 \\ (root.main.Elem1) [0] = {
2259 \\ (u32) .a = 1
2260 \\ (u8) .b = 2
2261 \\ (u16) .c = 3
2262 \\ }
2263 \\ (root.main.Elem1) [1] = {
2264 \\ (u32) .a = 4
2265 \\ (u8) .b = 5
2266 \\ (u16) .c = 6
2267 \\ }
2268 \\ (root.main.Elem1) [2] = {
2269 \\ (u32) .a = 7
2270 \\ (u8) .b = 8
2271 \\ (u16) .c = 9
2272 \\ }
2273 \\}
2274 \\(usize) slice1.len = 3
2275 \\(usize) slice1.capacity = 12
2276 \\(root.main.Elem1) slice1[0] = {
2277 \\ (u32) .a = 1
2278 \\ (u8) .b = 2
2279 \\ (u16) .c = 3
2280 \\}
2281 \\(root.main.Elem1) slice1[1] = {
2282 \\ (u32) .a = 4
2283 \\ (u8) .b = 5
2284 \\ (u16) .c = 6
2285 \\}
2286 \\(root.main.Elem1) slice1[2] = {
2287 \\ (u32) .a = 7
2288 \\ (u8) .b = 8
2289 \\ (u16) .c = 9
2290 \\}
2291 \\([3]u32) slice1.a = {
2292 \\ (u32) [0] = 1
2293 \\ (u32) [1] = 4
2294 \\ (u32) [2] = 7
2295 \\}
2296 \\([3]u8) slice1.b = {
2297 \\ (u8) [0] = 2
2298 \\ (u8) [1] = 5
2299 \\ (u8) [2] = 8
2300 \\}
2301 \\([3]u16) slice1.c = {
2302 \\ (u16) [0] = 3
2303 \\ (u16) [1] = 6
2304 \\ (u16) [2] = 9
2305 \\}
2306 \\(lldb) breakpoint delete --force 1
2307 \\1 breakpoints deleted; 0 breakpoint locations disabled.
2308 },
2309 );
2310}
2311
2312const File = struct { import: ?[]const u8 = null, path: []const u8, source: []const u8 };
2313
2314fn addGdbTest(
2315 db: *Debugger,
2316 name: []const u8,
2317 target: *const Target,
2318 files: []const File,
2319 commands: []const u8,
2320 expected_output: []const []const u8,
2321) void {
2322 db.addTest(
2323 name,
2324 target,
2325 files,
2326 &.{},
2327 &.{
2328 db.options.gdb orelse return,
2329 "--batch",
2330 "--command",
2331 },
2332 "set remotetimeout 0",
2333 commands,
2334 &.{
2335 "--args",
2336 },
2337 expected_output,
2338 );
2339}
2340
2341fn addLldbTest(
2342 db: *Debugger,
2343 name: []const u8,
2344 target: *const Target,
2345 files: []const File,
2346 commands: []const u8,
2347 expected_output: []const []const u8,
2348) void {
2349 db.addTest(
2350 name,
2351 target,
2352 files,
2353 &.{.{ "LANG", "C.UTF-8" }}, // affects output formatting
2354 &.{
2355 db.options.lldb orelse return,
2356 "--batch",
2357 "--source",
2358 },
2359 "settings set plugin.process.gdb-remote.packet-timeout 0",
2360 commands,
2361 &.{
2362 "--",
2363 },
2364 expected_output,
2365 );
2366}
2367
2368/// After a failure while running a script, the debugger starts accepting commands from stdin, and
2369/// because it is empty, the debugger exits normally with status 0. Choose a non-zero status to
2370/// return from the debugger script instead to detect it running to completion and indicate success.
2371const success = 99;
2372
2373fn addTest(
2374 db: *Debugger,
2375 name: []const u8,
2376 target: *const Target,
2377 files: []const File,
2378 env: []const struct { []const u8, []const u8 },
2379 db_argv1: []const []const u8,
2380 db_commands: []const u8,
2381 commands: []const u8,
2382 db_argv2: []const []const u8,
2383 expected_output: []const []const u8,
2384) void {
2385 if (db.options.test_filters.len > 0) {
2386 for (db.options.test_filters) |test_filter| {
2387 if (std.mem.find(u8, name, test_filter) != null) break;
2388 } else return;
2389 }
2390 if (db.options.test_target_filters.len > 0) {
2391 const triple_txt = target.resolved.query.zigTriple(db.b.allocator) catch @panic("OOM");
2392 for (db.options.test_target_filters) |filter| {
2393 if (std.mem.find(u8, triple_txt, filter) != null) break;
2394 } else return;
2395 }
2396 const files_wf = db.b.addWriteFiles();
2397
2398 const mod = db.b.createModule(.{
2399 .target = target.resolved,
2400 .root_source_file = files_wf.add(files[0].path, files[0].source),
2401 .optimize = target.optimize_mode,
2402 .link_libc = target.link_libc,
2403 .single_threaded = target.single_threaded,
2404 .pic = target.pic,
2405 .strip = false,
2406 });
2407 for (files[1..]) |file| {
2408 const path = files_wf.add(file.path, file.source);
2409 if (file.import) |import| mod.addImport(import, db.b.createModule(.{
2410 .root_source_file = path,
2411 }));
2412 }
2413
2414 const exe = db.b.addExecutable(.{
2415 .name = name,
2416 .root_module = mod,
2417 .use_llvm = false,
2418 .use_lld = false,
2419 });
2420
2421 const commands_wf = db.b.addWriteFiles();
2422 const run = std.Build.Step.Run.create(db.b, db.b.fmt("run {s} {s}", .{ name, target.test_name_suffix }));
2423 for (env) |env_var| run.setEnvironmentVariable(env_var[0], env_var[1]);
2424 run.addArgs(db_argv1);
2425 run.addFileArg(commands_wf.add(
2426 db.b.fmt("{s}.cmd", .{name}),
2427 db.b.fmt("{s}\n\n{s}\n\nquit {d}\n", .{ db_commands, commands, success }),
2428 ));
2429 run.addArgs(db_argv2);
2430 run.addArtifactArg(exe);
2431 for (expected_output) |expected| run.addCheck(.{ .expect_stdout_match = db.b.fmt("{s}\n", .{expected}) });
2432 run.addCheck(.{ .expect_term = .{ .exited = success } });
2433 run.setStdIn(.{ .bytes = "" });
2434 db.root_step.dependOn(&run.step);
2435}
2436
2437const Debugger = @This();
2438const std = @import("std");