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