authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-10-02 08:58:00-04:00
committergravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-10-02 09:10:10-04:00
log655bee8c75c19b82b8f2c730feec857e85e4991b
tree64a468fe171f83aaa52781104c3b4556b2ecd759
parentfaa537cf9c732b19baa285df9915384bd55dbd2f

test: convert debugger tests to new runner


36 files changed, 2986 insertions(+), 2655 deletions(-)

build.zig+16-11
......@@ -700,15 +700,6 @@ pub fn build(b: *std.Build) !void {
700700 .skip_libc = skip_libc,
701701 }));
702702 test_step.dependOn(tests.addCliTests(b));
703 if (tests.addDebuggerTests(b, .{
704 .test_filters = test_filters,
705 .test_target_filters = test_target_filters,
706 .gdb = b.option([]const u8, "gdb", "path to gdb binary"),
707 .lldb = b.option([]const u8, "lldb", "path to lldb binary"),
708 .optimize_modes = optimize_modes,
709 .skip_single_threaded = skip_single_threaded,
710 .skip_libc = skip_libc,
711 })) |test_debugger_step| test_step.dependOn(test_debugger_step);
712703 if (tests.addLlvmIrTests(b, .{
713704 .enable_llvm = enable_llvm,
714705 .test_filters = test_filters,
......@@ -795,7 +786,7 @@ pub fn build(b: *std.Build) !void {
795786 .target = b.graph.host,
796787 }),
797788 });
798 test_step.dependOn(try tests.addIncrementalTests(b, runner, .{
789 const runner_opts: tests.RunnerOptions = .{
799790 .test_filters = test_filters,
800791 .test_target_filters = test_target_filters,
801792 .skip_non_native = skip_non_native,
......@@ -807,7 +798,21 @@ pub fn build(b: *std.Build) !void {
807798 .skip_darwin = skip_darwin,
808799 .skip_linux = skip_linux,
809800 .skip_llvm = skip_llvm,
810 }));
801 .gdb = b.option([]const u8, "gdb", "path to gdb binary"),
802 .lldb = b.option([]const u8, "lldb", "path to lldb binary"),
803 };
804
805 const test_incremental_step = b.step("test-incremental", "Run the incremental compilation tests");
806 try tests.addRunnerTests(b, runner, test_incremental_step, "test/incremental", tests.incremental_matrix, runner_opts);
807 test_step.dependOn(test_incremental_step);
808
809 const test_debugger_step = b.step("test-debugger", "Run the debugger tests");
810 if (runner_opts.gdb == null and runner_opts.lldb == null) {
811 test_debugger_step.dependOn(&b.addFail("test-debugger requires -Dgdb and/or -Dlldb").step);
812 } else {
813 try tests.addRunnerTests(b, runner, test_debugger_step, "test/debugger", tests.debugger_matrix, runner_opts);
814 test_step.dependOn(test_debugger_step);
815 }
811816}
812817
813818fn addWasiUpdateStep(b: *std.Build, version: [:0]const u8) !void {
ci/x86_64-linux-debug-llvm.sh+1-1
......@@ -67,7 +67,7 @@ stage3-debug/bin/zig build install test docs \
6767 -Dskip-windows \
6868 -Dskip-darwin \
6969 -Denable-superhtml \
70 -Dlldb="$HOME/deps/lldb-zig/Debug-aad646607a/bin/lldb" \
70 -Dlldb="$HOME/deps/lldb-zig/Debug-86a744cac9/bin/lldb" \
7171 -Dlibc-test-path="$HOME/deps/libc-test-b95fe84"
7272
7373stage4-debug/bin/zig test ../test/behavior.zig
ci/x86_64-linux-debug.sh+1-1
......@@ -61,7 +61,7 @@ stage3-debug/bin/zig build install test docs \
6161 -Denable-llvm \
6262 -Dno-lib \
6363 -Denable-superhtml \
64 -Dlldb="$HOME/deps/lldb-zig/Debug-aad646607a/bin/lldb" \
64 -Dlldb="$HOME/deps/lldb-zig/Debug-86a744cac9/bin/lldb" \
6565 -Dskip-freebsd \
6666 -Dskip-netbsd \
6767 -Dskip-openbsd \
ci/x86_64-linux-release.sh+1-1
......@@ -67,7 +67,7 @@ stage3-release/bin/zig build install test docs \
6767 -Denable-llvm \
6868 -Dno-lib \
6969 -Denable-superhtml \
70 -Dlldb="$HOME/deps/lldb-zig/Release-aad646607a/bin/lldb" \
70 -Dlldb="$HOME/deps/lldb-zig/Release-86a744cac9/bin/lldb" \
7171 -Dlibc-test-path="$HOME/deps/libc-test-b95fe84"
7272
7373# Ensure that the fuzzer at least compiles.
lib/lldb/pretty_printers.py+5-5
......@@ -899,16 +899,16 @@ def add(debugger, *, category, regex=False, type, identifier=None, synth=False,
899899 if synth: debugger.HandleCommand('type synthetic add --category %s%s --python-class %s_SynthProvider "%s"' % (category, ' --regex' if regex else '', prefix, type))
900900
901901def __lldb_init_module(debugger, _=None):
902 # Initialize Zig Categories
903 debugger.HandleCommand('type category define --language c99 zig.lang zig.std')
902 # Initialize Zig Categories (for programs compiled with the llvm backend)
903 debugger.HandleCommand('type category define --language c99 zig.lang zig.std zig.compiler')
904904
905 # Initialize Zig Language
905 # Initialize Zig Language (for programs compiled with the llvm backend)
906906 add(debugger, category='zig.lang', regex=True, type='^\\[\\]', identifier='zig_Slice', synth=True, expand=True, summary='len=${svar%#}')
907907 add(debugger, category='zig.lang', type='[]u8', identifier='zig_String', summary=True)
908908 add(debugger, category='zig.lang', regex=True, type='^\\?', identifier='zig_Optional', synth=True, summary=True)
909909 add(debugger, category='zig.lang', regex=True, type='^(error{.*}|anyerror)!', identifier='zig_ErrorUnion', synth=True, inline_children=True, summary=True)
910910
911 # Initialize Zig Standard Library
911 # Initialize Zig Standard Library (for programs compiled with the llvm backend)
912912 add(debugger, category='zig.std', type='mem.Allocator', summary='${var.ptr}')
913913 add(debugger, category='zig.std', regex=True, type='^multi_array_list\\.MultiArrayList\\(.*\\)$', identifier='std_MultiArrayList', synth=True, expand=True, summary='len=${var.len} capacity=${var.capacity}')
914914 add(debugger, category='zig.std', regex=True, type='^multi_array_list\\.MultiArrayList\\(.*\\)\\.Slice$', identifier='std_MultiArrayList_Slice', synth=True, expand=True, summary='len=${var.len} capacity=${var.capacity}')
......@@ -916,7 +916,7 @@ def __lldb_init_module(debugger, _=None):
916916 add(debugger, category='zig.std', regex=True, type='^hash_map\\.HashMapUnmanaged\\(.*\\)$', identifier='std_HashMapUnmanaged', synth=True, expand=True, summary=True)
917917 add(debugger, category='zig.std', regex=True, type='^hash_map\\.HashMapUnmanaged\\(.*\\)\\.Entry$', identifier = 'std_Entry', synth=True, inline_children=True, summary=True)
918918
919 # Initialize Zig Compiler
919 # Initialize Zig Compiler (compiled with the llvm backend)
920920 add(debugger, category='zig.compiler', type='Zir.Inst', identifier='TagAndPayload', synth=True, inline_children=True, summary=True)
921921 add(debugger, category='zig.compiler', regex=True, type=MultiArrayList_Entry('Zir\\.Inst'), identifier='TagAndPayload', synth=True, inline_children=True, summary=True)
922922 add(debugger, category='zig.compiler', regex=True, type='^Zir\\.Inst\\.Data\\.Data__struct_[1-9][0-9]*$', inline_children=True, summary=True)
test/debugger/basic/basic.zig created+71
......@@ -0,0 +1,71 @@
1const Basic = struct {
2 void: void = {},
3 bool_false: bool = false,
4 bool_true: bool = true,
5 u0_0: u0 = 0,
6 u1_0: u1 = 0,
7 u1_1: u1 = 1,
8 u2_0: u2 = 0,
9 u2_3: u2 = 3,
10 u3_0: u3 = 0,
11 u3_7: u3 = 7,
12 u4_0: u4 = 0,
13 u4_15: u4 = 15,
14 u5_0: u5 = 0,
15 u5_31: u5 = 31,
16 u6_0: u6 = 0,
17 u6_63: u6 = 63,
18 u7_0: u7 = 0,
19 u7_127: u7 = 127,
20 u8_0: u8 = 0,
21 u8_255: u8 = 255,
22 u16_0: u16 = 0,
23 u16_65535: u16 = 65535,
24 u24_0: u24 = 0,
25 u24_16777215: u24 = 16777215,
26 u32_0: u32 = 0,
27 u32_4294967295: u32 = 4294967295,
28 @"i1_-1": i1 = -1,
29 i1_0: i1 = 0,
30 @"i2_-2": i2 = -2,
31 i2_0: i2 = 0,
32 i2_1: i2 = 1,
33 @"i3_-4": i3 = -4,
34 i3_0: i3 = 0,
35 i3_3: i3 = 3,
36 @"i4_-8": i4 = -8,
37 i4_0: i4 = 0,
38 i4_7: i4 = 7,
39 @"i5_-16": i5 = -16,
40 i5_0: i5 = 0,
41 i5_15: i5 = 15,
42 @"i6_-32": i6 = -32,
43 i6_0: i6 = 0,
44 i6_31: i6 = 31,
45 @"i7_-64": i7 = -64,
46 i7_0: i7 = 0,
47 i7_63: i7 = 63,
48 @"i8_-128": i8 = -128,
49 i8_0: i8 = 0,
50 i8_127: i8 = 127,
51 @"i16_-32768": i16 = -32768,
52 i16_0: i16 = 0,
53 i16_32767: i16 = 32767,
54 @"i24_-8388608": i24 = -8388608,
55 i24_0: i24 = 0,
56 i24_8388607: i24 = 8388607,
57 @"i32_-2147483648": i32 = -2147483648,
58 i32_0: i32 = 0,
59 i32_2147483647: i32 = 2147483647,
60 @"f16_42.625": f16 = 42.625,
61 @"f32_-2730.65625": f32 = -2730.65625,
62 @"f64_357913941.33203125": f64 = 357913941.33203125,
63 @"f80_-91625968981.3330078125": f80 = -91625968981.3330078125,
64 @"f128_384307168202282325.333332061767578125": f128 = 384307168202282325.333332061767578125,
65};
66fn testBasic(basic: Basic) void {
67 _ = basic;
68}
69pub fn main() void {
70 testBasic(.{});
71}
test/debugger/basic/lldb created+75
......@@ -0,0 +1,75 @@
1(lldb) breakpoint set --file basic.zig --source-pattern-regexp '_ = basic;'
2Breakpoint 1: where = basic`basic.testBasic + #... at basic.zig:68:1, address = 0x#...
3(lldb) process launch
4Process #... launched: '#.../basic' (#...)
5Process #... stopped
6* thread #1, name = 'basic', stop reason = breakpoint 1.1
7 frame #0: basic`basic.testBasic(basic=Basic @ 0x#...) at basic.zig:68:1
8(lldb) frame variable --show-all-children --show-types -- basic
9(root.basic.Basic) basic = {
10 (void) .void = {}
11 (bool) .bool_false = false
12 (bool) .bool_true = true
13 (u0) .u0_0 = 0
14 (u1) .u1_0 = 0
15 (u1) .u1_1 = 1
16 (u2) .u2_0 = 0
17 (u2) .u2_3 = 3
18 (u3) .u3_0 = 0
19 (u3) .u3_7 = 7
20 (u4) .u4_0 = 0
21 (u4) .u4_15 = 15
22 (u5) .u5_0 = 0
23 (u5) .u5_31 = 31
24 (u6) .u6_0 = 0
25 (u6) .u6_63 = 63
26 (u7) .u7_0 = 0
27 (u7) .u7_127 = 127
28 (u8) .u8_0 = 0
29 (u8) .u8_255 = 255
30 (u16) .u16_0 = 0
31 (u16) .u16_65535 = 65535
32 (u24) .u24_0 = 0
33 (u24) .u24_16777215 = 16777215
34 (u32) .u32_0 = 0
35 (u32) .u32_4294967295 = 4294967295
36 (i1) .@"i1_-1" = -1
37 (i1) .i1_0 = 0
38 (i2) .@"i2_-2" = -2
39 (i2) .i2_0 = 0
40 (i2) .i2_1 = 1
41 (i3) .@"i3_-4" = -4
42 (i3) .i3_0 = 0
43 (i3) .i3_3 = 3
44 (i4) .@"i4_-8" = -8
45 (i4) .i4_0 = 0
46 (i4) .i4_7 = 7
47 (i5) .@"i5_-16" = -16
48 (i5) .i5_0 = 0
49 (i5) .i5_15 = 15
50 (i6) .@"i6_-32" = -32
51 (i6) .i6_0 = 0
52 (i6) .i6_31 = 31
53 (i7) .@"i7_-64" = -64
54 (i7) .i7_0 = 0
55 (i7) .i7_63 = 63
56 (i8) .@"i8_-128" = -128
57 (i8) .i8_0 = 0
58 (i8) .i8_127 = 127
59 (i16) .@"i16_-32768" = -32768
60 (i16) .i16_0 = 0
61 (i16) .i16_32767 = 32767
62 (i24) .@"i24_-8388608" = -8388608
63 (i24) .i24_0 = 0
64 (i24) .i24_8388607 = 8388607
65 (i32) .@"i32_-2147483648" = -2147483648
66 (i32) .i32_0 = 0
67 (i32) .i32_2147483647 = 2147483647
68 (f16) .@"f16_42.625" = 42.625
69 (f32) .@"f32_-2730.65625" = -2730.65625
70 (f64) .@"f64_357913941.33203125" = 357913941.33203125
71 (f80) .@"f80_-91625968981.3330078125" = -91625968981.3330078125
72 (f128) .@"f128_384307168202282325.333332061767578125" = 384307168202282325.333332061767578125
73}
74(lldb) breakpoint delete --force 1
751 breakpoints deleted; 0 breakpoint locations disabled.
test/debugger/basic/manifest created+8
......@@ -0,0 +1,8 @@
1#exe {
2--name basic
3-Mroot=basic.zig
4#}
5
6#write basic.zig basic.zig
7#update
8#check lldb lldb
test/debugger/enums created+67
......@@ -0,0 +1,67 @@
1#todo {
2passes, but prints errors
3#}
4#skip x86_64-linux-none-whole-selfhosted-new-nopic
5#skip x86_64-linux-none-whole-selfhosted-new-pic
6#skip x86_64-linux-none-incremental-selfhosted-new-nopic
7#skip x86_64-linux-none-incremental-selfhosted-new-pic
8
9#exe {
10--name enums
11-Mroot=enums.zig
12#}
13
14#write enums.zig {
15const Enums = struct {
16 const Zero = enum(u4) { _ };
17 const One = enum { first };
18 const Two = enum(i32) { first, second, _ };
19 const Three = enum { first, second, third };
20
21 zero: Zero = @fromBackingInt(13),
22 one: One = .first,
23 two: Two = @fromBackingInt(-1234),
24 three: Three = .second,
25};
26fn testEnums(enums: Enums) void {
27 _ = enums;
28}
29pub fn main() void {
30 testEnums(.{});
31}
32#}
33#update
34#check lldb {
35(lldb) breakpoint set --file enums.zig --source-pattern-regexp '_ = enums;'
36Breakpoint 1: where = enums`enums.testEnums + #... at enums.zig:14:1, address = 0x#...
37(lldb) process launch
38Process #... launched: '#.../enums' (#...)
39Process #... stopped
40* thread #1, name = 'enums', stop reason = breakpoint 1.1
41 frame #0: enums`enums.testEnums(enums=(.zero = @fromBackingInt(13), .one = .first, .two = @fromBackingInt(-1234), .three = .second)) at enums.zig:14:1
42(lldb) expression --show-types -- Enums
43(type) $0 = struct {
44 (type) Zero = enum {}
45 (type) One = enum {
46 (root.enums.Enums.One) first = .first
47 }
48 (type) Two = enum {
49 (root.enums.Enums.Two) first = .first
50 (root.enums.Enums.Two) second = .second
51 }
52 (type) Three = enum {
53 (root.enums.Enums.Three) first = .first
54 (root.enums.Enums.Three) second = .second
55 (root.enums.Enums.Three) third = .third
56 }
57}
58(lldb) frame variable --show-all-children --show-types -- enums
59(root.enums.Enums) enums = {
60 (root.enums.Enums.Zero) .zero = @fromBackingInt(13)
61 (root.enums.Enums.One) .one = .first
62 (root.enums.Enums.Two) .two = @fromBackingInt(-1234)
63 (root.enums.Enums.Three) .three = .second
64}
65(lldb) breakpoint delete --force 1
661 breakpoints deleted; 0 breakpoint locations disabled.
67#}
test/debugger/errors created+75
......@@ -0,0 +1,75 @@
1#todo {
2passes, but prints errors
3#}
4#skip x86_64-linux-none-whole-selfhosted-new-nopic
5#skip x86_64-linux-none-whole-selfhosted-new-pic
6#skip x86_64-linux-none-incremental-selfhosted-new-nopic
7#skip x86_64-linux-none-incremental-selfhosted-new-pic
8
9#exe {
10--name errors
11-Mroot=errors.zig
12#}
13
14#write errors.zig {
15const Errors = struct {
16 const Zero = error{};
17 const One = Zero || error{One};
18 const Two = One || error{Two};
19 const Three = Two || error{Three};
20
21 one: One = error.One,
22 two: Two = error.Two,
23 three: Three = error.Three,
24 any: anyerror = error.Any,
25 any_void: anyerror!void = error.NotVoid,
26 any_u32: One!u32 = 42,
27};
28fn testErrors(errors: Errors) void {
29 _ = errors;
30}
31pub fn main() void {
32 testErrors(.{});
33}
34#}
35#update
36#check lldb {
37(lldb) breakpoint set --file errors.zig --source-pattern-regexp '_ = errors;'
38Breakpoint 1: where = errors`errors.testErrors + #... at errors.zig:16:1, address = 0x#...
39(lldb) process launch
40Process #... launched: '#.../errors' (#...)
41Process #... stopped
42* thread #1, name = 'errors', stop reason = breakpoint 1.1
43 frame #0: errors`errors.testErrors(errors=Errors @ 0x#...) at errors.zig:16:1
44(lldb) expression --show-types -- Errors
45(type) $0 = struct {
46 (type) Zero = error {}
47 (type) One = error {
48 (error{One}) One = error.One
49 }
50 (type) Two = error {
51 (error{One,Two}) One = error.One
52 (error{One,Two}) Two = error.Two
53 }
54 (type) Three = error {
55 (error{One,Three,Two}) One = error.One
56 (error{One,Three,Two}) Two = error.Two
57 (error{One,Three,Two}) Three = error.Three
58 }
59}
60(lldb) frame variable --show-all-children --show-types -- errors
61(root.errors.Errors) errors = {
62 (error{One}) .one = error.One
63 (error{One,Two}) .two = error.Two
64 (error{One,Three,Two}) .three = error.Three
65 (anyerror) .any = error.Any
66 (anyerror!void) .any_void = {
67 (anyerror) .error = error.NotVoid
68 }
69 (error{One}!u32) .any_u32 = {
70 (u32) .value = 42
71 }
72}
73(lldb) breakpoint delete --force 1
741 breakpoints deleted; 0 breakpoint locations disabled.
75#}
test/debugger/hash_map created+67
......@@ -0,0 +1,67 @@
1#exe {
2--name hash_map
3-Mroot=main.zig
4#}
5
6#write main.zig {
7const std = @import("std");
8const Context = struct {
9 pub fn hash(_: Context, key: u32) Map.Hash {
10 return key;
11 }
12 pub fn eql(_: Context, lhs: u32, rhs: u32) bool {
13 return lhs == rhs;
14 }
15};
16const Map = std.HashMapUnmanaged(u32, u32, Context, 63);
17fn testHashMap(map: Map) void {
18 _ = map;
19}
20pub fn main() !void {
21 var map: Map = .empty;
22 defer map.deinit(std.heap.page_allocator);
23 try map.ensureTotalCapacity(std.heap.page_allocator, 10);
24 map.putAssumeCapacity(0, 1);
25 map.putAssumeCapacity(2, 3);
26 map.putAssumeCapacity(4, 5);
27 map.putAssumeCapacity(6, 7);
28 map.putAssumeCapacity(8, 9);
29
30 testHashMap(map);
31}
32#}
33#update
34#check lldb {
35(lldb) breakpoint set --file main.zig --source-pattern-regexp '_ = map;'
36Breakpoint 1: where = hash_map`main.testHashMap + #... at main.zig:13:1, address = 0x#...
37(lldb) process launch
38Process #... launched: '#.../hash_map' (#...)
39Process #... stopped
40* thread #1, name = 'hash_map', stop reason = breakpoint 1.1
41 frame #0: hash_map`main.testHashMap(map=len=5 capacity=16) at main.zig:13:1
42(lldb) frame variable --show-all-children --show-types -- map
43(std.hash_map.Custom(u32,u32,main.Context,63)) map = len=5 capacity=16 {
44 (std.hash_map.Custom(u32,u32,main.Context,63).KV) [0] = {
45 (u32) .key = 0
46 (u32) .value = 1
47 }
48 (std.hash_map.Custom(u32,u32,main.Context,63).KV) [1] = {
49 (u32) .key = 2
50 (u32) .value = 3
51 }
52 (std.hash_map.Custom(u32,u32,main.Context,63).KV) [2] = {
53 (u32) .key = 4
54 (u32) .value = 5
55 }
56 (std.hash_map.Custom(u32,u32,main.Context,63).KV) [3] = {
57 (u32) .key = 6
58 (u32) .value = 7
59 }
60 (std.hash_map.Custom(u32,u32,main.Context,63).KV) [4] = {
61 (u32) .key = 8
62 (u32) .value = 9
63 }
64}
65(lldb) breakpoint delete --force 1
661 breakpoints deleted; 0 breakpoint locations disabled.
67#}
test/debugger/identifiers created+34
......@@ -0,0 +1,34 @@
1#exe {
2--name identifiers
3-Mroot=identifiers.zig
4#}
5
6#write identifiers.zig {
7const Struct = struct { @"zwölf": u32 };
8fn testIdentifiers(@"fünf": u32, @"struct": Struct) void {
9 _ = @"fünf";
10 _ = @"struct";
11}
12pub fn main() void {
13 testIdentifiers(5, .{ .@"zwölf" = 12 });
14}
15#}
16#update
17#check lldb {
18(lldb) breakpoint set --file identifiers.zig --source-pattern-regexp '_ = @"struct";'
19Breakpoint 1: where = identifiers`identifiers.testIdentifiers + #... at identifiers.zig:5:1, address = 0x#...
20(lldb) process launch
21Process #... launched: '#.../identifiers' (#...)
22Process #... stopped
23* thread #1, name = 'identifiers', stop reason = breakpoint 1.1
24 frame #0: identifiers`identifiers.testIdentifiers(fünf=5, struct=(.@"zw\xc3\xb6lf" = 12)) at identifiers.zig:5:1
25(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"'
26(u32) @"fünf" = 5
27(u32) @"f\xC3\xBCnf" = 5
28(u32) @"f\u{FC}nf" = 5
29(u32) @"struct".@"zwölf" = 12
30(u32) @"struct".@"zw\xC3\xB6lf" = 12
31(u32) @"struct".@"zw\u{F6}lf" = 12
32(lldb) breakpoint delete --force 1
331 breakpoints deleted; 0 breakpoint locations disabled.
34#}
test/debugger/if_blocks created+41
......@@ -0,0 +1,41 @@
1#exe {
2--name if_blocks
3-Mroot=if_blocks.zig
4#}
5
6#write if_blocks.zig {
7pub fn main() void {
8 for (0..2) |i| {
9 if (i == 0) {
10 var x: u32 = 123;
11 _ = &x;
12 } else {
13 var x: f32 = 4.5;
14 _ = &x;
15 }
16 }
17}
18#}
19#update
20#check lldb {
21(lldb) breakpoint set --file if_blocks.zig --source-pattern-regexp '_ = &x;'
22Breakpoint 1: 2 locations.
23(lldb) process launch
24Process #... launched: '#.../if_blocks' (#...)
25Process #... stopped
26* thread #1, name = 'if_blocks', stop reason = breakpoint 1.1
27 frame #0: if_blocks`if_blocks.main at if_blocks.zig:5:13
28(lldb) frame variable --show-all-children
29(usize) i = 0
30(u32) x = 123
31(lldb) process continue
32Process #... resuming
33Process #... stopped
34* thread #1, name = 'if_blocks', stop reason = breakpoint 1.2
35 frame #0: if_blocks`if_blocks.main at if_blocks.zig:8:13
36(lldb) frame variable --show-all-children
37(usize) i = 1
38(f32) x = 4.5
39(lldb) breakpoint delete --force 1
401 breakpoints deleted; 0 breakpoint locations disabled.
41#}
test/debugger/inline_call/lldb created+664
......@@ -0,0 +1,664 @@
1(lldb) breakpoint set --file root0.zig --line 26
2Breakpoint 1: where = inline_call`root0.r0cf + #... at root0.zig:26:5, address = 0x#...
3(lldb) breakpoint set --file root0.zig --line 30
4Breakpoint 2: 8 locations.
5(lldb) breakpoint set --file root1.zig --line 26
6Breakpoint 3: where = inline_call`root1.r1cf + #... at root1.zig:26:5, address = 0x#...
7(lldb) breakpoint set --file root1.zig --line 30
8Breakpoint 4: 8 locations.
9(lldb) breakpoint set --file mod0.zig --line 26
10Breakpoint 5: where = inline_call`mod0.m0cf + #... at mod0.zig:26:5, address = 0x#...
11(lldb) breakpoint set --file mod0.zig --line 30
12Breakpoint 6: 8 locations.
13(lldb) breakpoint set --file mod1.zig --line 26
14Breakpoint 7: where = inline_call`mod1.m1cf + #... at mod1.zig:26:5, address = 0x#...
15(lldb) breakpoint set --file mod1.zig --line 30
16Breakpoint 8: 8 locations.
17(lldb) #---
18(lldb) process launch
19Process #... launched: '#.../inline_call' (#...)
20Process #... stopped
21* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
22 frame #0: inline_call`root0.r0cf(r0ca=13) at root0.zig:26:5
23(lldb) thread backtrace --count 3
24* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
25 * frame #0: inline_call`root0.r0cf(r0ca=13) at root0.zig:26:5
26 frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:6:15
27 frame #2: inline_call`root0.main at root0.zig:34:15
28(lldb) process continue
29Process #... resuming
30Process #... stopped
31* thread #1, name = 'inline_call', stop reason = breakpoint 2.8
32 frame #0: inline_call`r0cfi(r0cai=14) at root0.zig:30:5
33(lldb) thread backtrace --count 3
34* thread #1, name = 'inline_call', stop reason = breakpoint 2.8
35 * frame #0: inline_call`r0cfi(r0cai=14) at root0.zig:30:5
36 frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:7:16
37 frame #2: inline_call`root0.main at root0.zig:34:15
38(lldb) process continue
39Process #... resuming
40Process #... stopped
41* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
42 frame #0: inline_call`root1.r1cf(r1ca=15) at root1.zig:26:5
43(lldb) thread backtrace --count 3
44* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
45 * frame #0: inline_call`root1.r1cf(r1ca=15) at root1.zig:26:5
46 frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:8:15
47 frame #2: inline_call`root0.main at root0.zig:34:15
48(lldb) process continue
49Process #... resuming
50Process #... stopped
51* thread #1, name = 'inline_call', stop reason = breakpoint 4.8
52 frame #0: inline_call`r1cfi(r1cai=8) at root1.zig:30:5
53(lldb) thread backtrace --count 3
54* thread #1, name = 'inline_call', stop reason = breakpoint 4.8
55 * frame #0: inline_call`r1cfi(r1cai=8) at root1.zig:30:5
56 frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:9:16
57 frame #2: inline_call`root0.main at root0.zig:34:15
58(lldb) process continue
59Process #... resuming
60Process #... stopped
61* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
62 frame #0: inline_call`mod0.m0cf(m0ca=9) at mod0.zig:26:5
63(lldb) thread backtrace --count 3
64* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
65 * frame #0: inline_call`mod0.m0cf(m0ca=9) at mod0.zig:26:5
66 frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:10:14
67 frame #2: inline_call`root0.main at root0.zig:34:15
68(lldb) process continue
69Process #... resuming
70Process #... stopped
71* thread #1, name = 'inline_call', stop reason = breakpoint 6.8
72 frame #0: inline_call`m0cfi(m0cai=10) at mod0.zig:30:5
73(lldb) thread backtrace --count 3
74* thread #1, name = 'inline_call', stop reason = breakpoint 6.8
75 * frame #0: inline_call`m0cfi(m0cai=10) at mod0.zig:30:5
76 frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:11:15
77 frame #2: inline_call`root0.main at root0.zig:34:15
78(lldb) process continue
79Process #... resuming
80Process #... stopped
81* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
82 frame #0: inline_call`mod1.m1cf(m1ca=11) at mod1.zig:26:5
83(lldb) thread backtrace --count 3
84* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
85 * frame #0: inline_call`mod1.m1cf(m1ca=11) at mod1.zig:26:5
86 frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:12:14
87 frame #2: inline_call`root0.main at root0.zig:34:15
88(lldb) process continue
89Process #... resuming
90Process #... stopped
91* thread #1, name = 'inline_call', stop reason = breakpoint 8.8
92 frame #0: inline_call`m1cfi(m1cai=4) at mod1.zig:30:5
93(lldb) thread backtrace --count 3
94* thread #1, name = 'inline_call', stop reason = breakpoint 8.8
95 * frame #0: inline_call`m1cfi(m1cai=4) at mod1.zig:30:5
96 frame #1: inline_call`root0.r0pf(r0pa=12) at root0.zig:13:15
97 frame #2: inline_call`root0.main at root0.zig:34:15
98(lldb) #---
99(lldb) process continue
100Process #... resuming
101Process #... stopped
102* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
103 frame #0: inline_call`root0.r0cf(r0ca=22) at root0.zig:26:5
104(lldb) thread backtrace --count 3
105* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
106 * frame #0: inline_call`root0.r0cf(r0ca=22) at root0.zig:26:5
107 frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:16:15
108 frame #2: inline_call`root0.main at root0.zig:35:16
109(lldb) process continue
110Process #... resuming
111Process #... stopped
112* thread #1, name = 'inline_call', stop reason = breakpoint 2.1
113 frame #0: inline_call`r0cfi(r0cai=21) at root0.zig:30:5
114(lldb) thread backtrace --count 3
115* thread #1, name = 'inline_call', stop reason = breakpoint 2.1
116 * frame #0: inline_call`r0cfi(r0cai=21) at root0.zig:30:5
117 frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:17:16
118 frame #2: inline_call`root0.main at root0.zig:35:16
119(lldb) process continue
120Process #... resuming
121Process #... stopped
122* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
123 frame #0: inline_call`root1.r1cf(r1ca=20) at root1.zig:26:5
124(lldb) thread backtrace --count 3
125* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
126 * frame #0: inline_call`root1.r1cf(r1ca=20) at root1.zig:26:5
127 frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:18:15
128 frame #2: inline_call`root0.main at root0.zig:35:16
129(lldb) process continue
130Process #... resuming
131Process #... stopped
132* thread #1, name = 'inline_call', stop reason = breakpoint 4.1
133 frame #0: inline_call`r1cfi(r1cai=19) at root1.zig:30:5
134(lldb) thread backtrace --count 3
135* thread #1, name = 'inline_call', stop reason = breakpoint 4.1
136 * frame #0: inline_call`r1cfi(r1cai=19) at root1.zig:30:5
137 frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:19:16
138 frame #2: inline_call`root0.main at root0.zig:35:16
139(lldb) process continue
140Process #... resuming
141Process #... stopped
142* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
143 frame #0: inline_call`mod0.m0cf(m0ca=18) at mod0.zig:26:5
144(lldb) thread backtrace --count 3
145* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
146 * frame #0: inline_call`mod0.m0cf(m0ca=18) at mod0.zig:26:5
147 frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:20:14
148 frame #2: inline_call`root0.main at root0.zig:35:16
149(lldb) process continue
150Process #... resuming
151Process #... stopped
152* thread #1, name = 'inline_call', stop reason = breakpoint 6.1
153 frame #0: inline_call`m0cfi(m0cai=17) at mod0.zig:30:5
154(lldb) thread backtrace --count 3
155* thread #1, name = 'inline_call', stop reason = breakpoint 6.1
156 * frame #0: inline_call`m0cfi(m0cai=17) at mod0.zig:30:5
157 frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:21:15
158 frame #2: inline_call`root0.main at root0.zig:35:16
159(lldb) process continue
160Process #... resuming
161Process #... stopped
162* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
163 frame #0: inline_call`mod1.m1cf(m1ca=16) at mod1.zig:26:5
164(lldb) thread backtrace --count 3
165* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
166 * frame #0: inline_call`mod1.m1cf(m1ca=16) at mod1.zig:26:5
167 frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:22:14
168 frame #2: inline_call`root0.main at root0.zig:35:16
169(lldb) process continue
170Process #... resuming
171Process #... stopped
172* thread #1, name = 'inline_call', stop reason = breakpoint 8.1
173 frame #0: inline_call`m1cfi(m1cai=31) at mod1.zig:30:5
174(lldb) thread backtrace --count 3
175* thread #1, name = 'inline_call', stop reason = breakpoint 8.1
176 * frame #0: inline_call`m1cfi(m1cai=31) at mod1.zig:30:5
177 frame #1: inline_call`r0pfi(r0pai=23) at root0.zig:23:15
178 frame #2: inline_call`root0.main at root0.zig:35:16
179(lldb) #---
180(lldb) process continue
181Process #... resuming
182Process #... stopped
183* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
184 frame #0: inline_call`root0.r0cf(r0ca=35) at root0.zig:26:5
185(lldb) thread backtrace --count 3
186* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
187 * frame #0: inline_call`root0.r0cf(r0ca=35) at root0.zig:26:5
188 frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:6:15
189 frame #2: inline_call`root0.main at root0.zig:36:15
190(lldb) process continue
191Process #... resuming
192Process #... stopped
193* thread #1, name = 'inline_call', stop reason = breakpoint 2.7
194 frame #0: inline_call`r0cfi(r0cai=32) at root0.zig:30:5
195(lldb) thread backtrace --count 3
196* thread #1, name = 'inline_call', stop reason = breakpoint 2.7
197 * frame #0: inline_call`r0cfi(r0cai=32) at root0.zig:30:5
198 frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:7:16
199 frame #2: inline_call`root0.main at root0.zig:36:15
200(lldb) process continue
201Process #... resuming
202Process #... stopped
203* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
204 frame #0: inline_call`root1.r1cf(r1ca=33) at root1.zig:26:5
205(lldb) thread backtrace --count 3
206* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
207 * frame #0: inline_call`root1.r1cf(r1ca=33) at root1.zig:26:5
208 frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:8:15
209 frame #2: inline_call`root0.main at root0.zig:36:15
210(lldb) process continue
211Process #... resuming
212Process #... stopped
213* thread #1, name = 'inline_call', stop reason = breakpoint 4.7
214 frame #0: inline_call`r1cfi(r1cai=38) at root1.zig:30:5
215(lldb) thread backtrace --count 3
216* thread #1, name = 'inline_call', stop reason = breakpoint 4.7
217 * frame #0: inline_call`r1cfi(r1cai=38) at root1.zig:30:5
218 frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:9:16
219 frame #2: inline_call`root0.main at root0.zig:36:15
220(lldb) process continue
221Process #... resuming
222Process #... stopped
223* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
224 frame #0: inline_call`mod0.m0cf(m0ca=39) at mod0.zig:26:5
225(lldb) thread backtrace --count 3
226* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
227 * frame #0: inline_call`mod0.m0cf(m0ca=39) at mod0.zig:26:5
228 frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:10:14
229 frame #2: inline_call`root0.main at root0.zig:36:15
230(lldb) process continue
231Process #... resuming
232Process #... stopped
233* thread #1, name = 'inline_call', stop reason = breakpoint 6.7
234 frame #0: inline_call`m0cfi(m0cai=36) at mod0.zig:30:5
235(lldb) thread backtrace --count 3
236* thread #1, name = 'inline_call', stop reason = breakpoint 6.7
237 * frame #0: inline_call`m0cfi(m0cai=36) at mod0.zig:30:5
238 frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:11:15
239 frame #2: inline_call`root0.main at root0.zig:36:15
240(lldb) process continue
241Process #... resuming
242Process #... stopped
243* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
244 frame #0: inline_call`mod1.m1cf(m1ca=37) at mod1.zig:26:5
245(lldb) thread backtrace --count 3
246* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
247 * frame #0: inline_call`mod1.m1cf(m1ca=37) at mod1.zig:26:5
248 frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:12:14
249 frame #2: inline_call`root0.main at root0.zig:36:15
250(lldb) process continue
251Process #... resuming
252Process #... stopped
253* thread #1, name = 'inline_call', stop reason = breakpoint 8.7
254 frame #0: inline_call`m1cfi(m1cai=42) at mod1.zig:30:5
255(lldb) thread backtrace --count 3
256* thread #1, name = 'inline_call', stop reason = breakpoint 8.7
257 * frame #0: inline_call`m1cfi(m1cai=42) at mod1.zig:30:5
258 frame #1: inline_call`root1.r1pf(r1pa=34) at root1.zig:13:15
259 frame #2: inline_call`root0.main at root0.zig:36:15
260(lldb) #---
261(lldb) process continue
262Process #... resuming
263Process #... stopped
264* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
265 frame #0: inline_call`root0.r0cf(r0ca=44) at root0.zig:26:5
266(lldb) thread backtrace --count 3
267* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
268 * frame #0: inline_call`root0.r0cf(r0ca=44) at root0.zig:26:5
269 frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:16:15
270 frame #2: inline_call`root0.main at root0.zig:37:16
271(lldb) process continue
272Process #... resuming
273Process #... stopped
274* thread #1, name = 'inline_call', stop reason = breakpoint 2.2
275 frame #0: inline_call`r0cfi(r0cai=47) at root0.zig:30:5
276(lldb) thread backtrace --count 3
277* thread #1, name = 'inline_call', stop reason = breakpoint 2.2
278 * frame #0: inline_call`r0cfi(r0cai=47) at root0.zig:30:5
279 frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:17:16
280 frame #2: inline_call`root0.main at root0.zig:37:16
281(lldb) process continue
282Process #... resuming
283Process #... stopped
284* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
285 frame #0: inline_call`root1.r1cf(r1ca=46) at root1.zig:26:5
286(lldb) thread backtrace --count 3
287* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
288 * frame #0: inline_call`root1.r1cf(r1ca=46) at root1.zig:26:5
289 frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:18:15
290 frame #2: inline_call`root0.main at root0.zig:37:16
291(lldb) process continue
292Process #... resuming
293Process #... stopped
294* thread #1, name = 'inline_call', stop reason = breakpoint 4.2
295 frame #0: inline_call`r1cfi(r1cai=41) at root1.zig:30:5
296(lldb) thread backtrace --count 3
297* thread #1, name = 'inline_call', stop reason = breakpoint 4.2
298 * frame #0: inline_call`r1cfi(r1cai=41) at root1.zig:30:5
299 frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:19:16
300 frame #2: inline_call`root0.main at root0.zig:37:16
301(lldb) process continue
302Process #... resuming
303Process #... stopped
304* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
305 frame #0: inline_call`mod0.m0cf(m0ca=40) at mod0.zig:26:5
306(lldb) thread backtrace --count 3
307* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
308 * frame #0: inline_call`mod0.m0cf(m0ca=40) at mod0.zig:26:5
309 frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:20:14
310 frame #2: inline_call`root0.main at root0.zig:37:16
311(lldb) process continue
312Process #... resuming
313Process #... stopped
314* thread #1, name = 'inline_call', stop reason = breakpoint 6.2
315 frame #0: inline_call`m0cfi(m0cai=43) at mod0.zig:30:5
316(lldb) thread backtrace --count 3
317* thread #1, name = 'inline_call', stop reason = breakpoint 6.2
318 * frame #0: inline_call`m0cfi(m0cai=43) at mod0.zig:30:5
319 frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:21:15
320 frame #2: inline_call`root0.main at root0.zig:37:16
321(lldb) process continue
322Process #... resuming
323Process #... stopped
324* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
325 frame #0: inline_call`mod1.m1cf(m1ca=42) at mod1.zig:26:5
326(lldb) thread backtrace --count 3
327* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
328 * frame #0: inline_call`mod1.m1cf(m1ca=42) at mod1.zig:26:5
329 frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:22:14
330 frame #2: inline_call`root0.main at root0.zig:37:16
331(lldb) process continue
332Process #... resuming
333Process #... stopped
334* thread #1, name = 'inline_call', stop reason = breakpoint 8.2
335 frame #0: inline_call`m1cfi(m1cai=37) at mod1.zig:30:5
336(lldb) thread backtrace --count 3
337* thread #1, name = 'inline_call', stop reason = breakpoint 8.2
338 * frame #0: inline_call`m1cfi(m1cai=37) at mod1.zig:30:5
339 frame #1: inline_call`r1pfi(r1pai=45) at root1.zig:23:15
340 frame #2: inline_call`root0.main at root0.zig:37:16
341(lldb) #---
342(lldb) process continue
343Process #... resuming
344Process #... stopped
345* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
346 frame #0: inline_call`root0.r0cf(r0ca=57) at root0.zig:26:5
347(lldb) thread backtrace --count 3
348* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
349 * frame #0: inline_call`root0.r0cf(r0ca=57) at root0.zig:26:5
350 frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:6:15
351 frame #2: inline_call`root0.main at root0.zig:38:14
352(lldb) process continue
353Process #... resuming
354Process #... stopped
355* thread #1, name = 'inline_call', stop reason = breakpoint 2.6
356 frame #0: inline_call`r0cfi(r0cai=58) at root0.zig:30:5
357(lldb) thread backtrace --count 3
358* thread #1, name = 'inline_call', stop reason = breakpoint 2.6
359 * frame #0: inline_call`r0cfi(r0cai=58) at root0.zig:30:5
360 frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:7:16
361 frame #2: inline_call`root0.main at root0.zig:38:14
362(lldb) process continue
363Process #... resuming
364Process #... stopped
365* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
366 frame #0: inline_call`root1.r1cf(r1ca=59) at root1.zig:26:5
367(lldb) thread backtrace --count 3
368* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
369 * frame #0: inline_call`root1.r1cf(r1ca=59) at root1.zig:26:5
370 frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:8:15
371 frame #2: inline_call`root0.main at root0.zig:38:14
372(lldb) process continue
373Process #... resuming
374Process #... stopped
375* thread #1, name = 'inline_call', stop reason = breakpoint 4.6
376 frame #0: inline_call`r1cfi(r1cai=60) at root1.zig:30:5
377(lldb) thread backtrace --count 3
378* thread #1, name = 'inline_call', stop reason = breakpoint 4.6
379 * frame #0: inline_call`r1cfi(r1cai=60) at root1.zig:30:5
380 frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:9:16
381 frame #2: inline_call`root0.main at root0.zig:38:14
382(lldb) process continue
383Process #... resuming
384Process #... stopped
385* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
386 frame #0: inline_call`mod0.m0cf(m0ca=61) at mod0.zig:26:5
387(lldb) thread backtrace --count 3
388* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
389 * frame #0: inline_call`mod0.m0cf(m0ca=61) at mod0.zig:26:5
390 frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:10:14
391 frame #2: inline_call`root0.main at root0.zig:38:14
392(lldb) process continue
393Process #... resuming
394Process #... stopped
395* thread #1, name = 'inline_call', stop reason = breakpoint 6.6
396 frame #0: inline_call`m0cfi(m0cai=62) at mod0.zig:30:5
397(lldb) thread backtrace --count 3
398* thread #1, name = 'inline_call', stop reason = breakpoint 6.6
399 * frame #0: inline_call`m0cfi(m0cai=62) at mod0.zig:30:5
400 frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:11:15
401 frame #2: inline_call`root0.main at root0.zig:38:14
402(lldb) process continue
403Process #... resuming
404Process #... stopped
405* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
406 frame #0: inline_call`mod1.m1cf(m1ca=63) at mod1.zig:26:5
407(lldb) thread backtrace --count 3
408* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
409 * frame #0: inline_call`mod1.m1cf(m1ca=63) at mod1.zig:26:5
410 frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:12:14
411 frame #2: inline_call`root0.main at root0.zig:38:14
412(lldb) process continue
413Process #... resuming
414Process #... stopped
415* thread #1, name = 'inline_call', stop reason = breakpoint 8.6
416 frame #0: inline_call`m1cfi(m1cai=48) at mod1.zig:30:5
417(lldb) thread backtrace --count 3
418* thread #1, name = 'inline_call', stop reason = breakpoint 8.6
419 * frame #0: inline_call`m1cfi(m1cai=48) at mod1.zig:30:5
420 frame #1: inline_call`mod0.m0pf(m0pa=56) at mod0.zig:13:15
421 frame #2: inline_call`root0.main at root0.zig:38:14
422(lldb) #---
423(lldb) process continue
424Process #... resuming
425Process #... stopped
426* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
427 frame #0: inline_call`root0.r0cf(r0ca=66) at root0.zig:26:5
428(lldb) thread backtrace --count 3
429* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
430 * frame #0: inline_call`root0.r0cf(r0ca=66) at root0.zig:26:5
431 frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:16:15
432 frame #2: inline_call`root0.main at root0.zig:39:15
433(lldb) process continue
434Process #... resuming
435Process #... stopped
436* thread #1, name = 'inline_call', stop reason = breakpoint 2.3
437 frame #0: inline_call`r0cfi(r0cai=65) at root0.zig:30:5
438(lldb) thread backtrace --count 3
439* thread #1, name = 'inline_call', stop reason = breakpoint 2.3
440 * frame #0: inline_call`r0cfi(r0cai=65) at root0.zig:30:5
441 frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:17:16
442 frame #2: inline_call`root0.main at root0.zig:39:15
443(lldb) process continue
444Process #... resuming
445Process #... stopped
446* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
447 frame #0: inline_call`root1.r1cf(r1ca=64) at root1.zig:26:5
448(lldb) thread backtrace --count 3
449* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
450 * frame #0: inline_call`root1.r1cf(r1ca=64) at root1.zig:26:5
451 frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:18:15
452 frame #2: inline_call`root0.main at root0.zig:39:15
453(lldb) process continue
454Process #... resuming
455Process #... stopped
456* thread #1, name = 'inline_call', stop reason = breakpoint 4.3
457 frame #0: inline_call`r1cfi(r1cai=71) at root1.zig:30:5
458(lldb) thread backtrace --count 3
459* thread #1, name = 'inline_call', stop reason = breakpoint 4.3
460 * frame #0: inline_call`r1cfi(r1cai=71) at root1.zig:30:5
461 frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:19:16
462 frame #2: inline_call`root0.main at root0.zig:39:15
463(lldb) process continue
464Process #... resuming
465Process #... stopped
466* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
467 frame #0: inline_call`mod0.m0cf(m0ca=70) at mod0.zig:26:5
468(lldb) thread backtrace --count 3
469* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
470 * frame #0: inline_call`mod0.m0cf(m0ca=70) at mod0.zig:26:5
471 frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:20:14
472 frame #2: inline_call`root0.main at root0.zig:39:15
473(lldb) process continue
474Process #... resuming
475Process #... stopped
476* thread #1, name = 'inline_call', stop reason = breakpoint 6.3
477 frame #0: inline_call`m0cfi(m0cai=69) at mod0.zig:30:5
478(lldb) thread backtrace --count 3
479* thread #1, name = 'inline_call', stop reason = breakpoint 6.3
480 * frame #0: inline_call`m0cfi(m0cai=69) at mod0.zig:30:5
481 frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:21:15
482 frame #2: inline_call`root0.main at root0.zig:39:15
483(lldb) process continue
484Process #... resuming
485Process #... stopped
486* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
487 frame #0: inline_call`mod1.m1cf(m1ca=68) at mod1.zig:26:5
488(lldb) thread backtrace --count 3
489* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
490 * frame #0: inline_call`mod1.m1cf(m1ca=68) at mod1.zig:26:5
491 frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:22:14
492 frame #2: inline_call`root0.main at root0.zig:39:15
493(lldb) process continue
494Process #... resuming
495Process #... stopped
496* thread #1, name = 'inline_call', stop reason = breakpoint 8.3
497 frame #0: inline_call`m1cfi(m1cai=75) at mod1.zig:30:5
498(lldb) thread backtrace --count 3
499* thread #1, name = 'inline_call', stop reason = breakpoint 8.3
500 * frame #0: inline_call`m1cfi(m1cai=75) at mod1.zig:30:5
501 frame #1: inline_call`m0pfi(m0pai=67) at mod0.zig:23:15
502 frame #2: inline_call`root0.main at root0.zig:39:15
503(lldb) #---
504(lldb) process continue
505Process #... resuming
506Process #... stopped
507* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
508 frame #0: inline_call`root0.r0cf(r0ca=79) at root0.zig:26:5
509(lldb) thread backtrace --count 3
510* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
511 * frame #0: inline_call`root0.r0cf(r0ca=79) at root0.zig:26:5
512 frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:6:15
513 frame #2: inline_call`root0.main at root0.zig:40:14
514(lldb) process continue
515Process #... resuming
516Process #... stopped
517* thread #1, name = 'inline_call', stop reason = breakpoint 2.5
518 frame #0: inline_call`r0cfi(r0cai=76) at root0.zig:30:5
519(lldb) thread backtrace --count 3
520* thread #1, name = 'inline_call', stop reason = breakpoint 2.5
521 * frame #0: inline_call`r0cfi(r0cai=76) at root0.zig:30:5
522 frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:7:16
523 frame #2: inline_call`root0.main at root0.zig:40:14
524(lldb) process continue
525Process #... resuming
526Process #... stopped
527* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
528 frame #0: inline_call`root1.r1cf(r1ca=77) at root1.zig:26:5
529(lldb) thread backtrace --count 3
530* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
531 * frame #0: inline_call`root1.r1cf(r1ca=77) at root1.zig:26:5
532 frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:8:15
533 frame #2: inline_call`root0.main at root0.zig:40:14
534(lldb) process continue
535Process #... resuming
536Process #... stopped
537* thread #1, name = 'inline_call', stop reason = breakpoint 4.5
538 frame #0: inline_call`r1cfi(r1cai=74) at root1.zig:30:5
539(lldb) thread backtrace --count 3
540* thread #1, name = 'inline_call', stop reason = breakpoint 4.5
541 * frame #0: inline_call`r1cfi(r1cai=74) at root1.zig:30:5
542 frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:9:16
543 frame #2: inline_call`root0.main at root0.zig:40:14
544(lldb) process continue
545Process #... resuming
546Process #... stopped
547* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
548 frame #0: inline_call`mod0.m0cf(m0ca=75) at mod0.zig:26:5
549(lldb) thread backtrace --count 3
550* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
551 * frame #0: inline_call`mod0.m0cf(m0ca=75) at mod0.zig:26:5
552 frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:10:14
553 frame #2: inline_call`root0.main at root0.zig:40:14
554(lldb) process continue
555Process #... resuming
556Process #... stopped
557* thread #1, name = 'inline_call', stop reason = breakpoint 6.5
558 frame #0: inline_call`m0cfi(m0cai=72) at mod0.zig:30:5
559(lldb) thread backtrace --count 3
560* thread #1, name = 'inline_call', stop reason = breakpoint 6.5
561 * frame #0: inline_call`m0cfi(m0cai=72) at mod0.zig:30:5
562 frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:11:15
563 frame #2: inline_call`root0.main at root0.zig:40:14
564(lldb) process continue
565Process #... resuming
566Process #... stopped
567* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
568 frame #0: inline_call`mod1.m1cf(m1ca=73) at mod1.zig:26:5
569(lldb) thread backtrace --count 3
570* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
571 * frame #0: inline_call`mod1.m1cf(m1ca=73) at mod1.zig:26:5
572 frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:12:14
573 frame #2: inline_call`root0.main at root0.zig:40:14
574(lldb) process continue
575Process #... resuming
576Process #... stopped
577* thread #1, name = 'inline_call', stop reason = breakpoint 8.5
578 frame #0: inline_call`m1cfi(m1cai=70) at mod1.zig:30:5
579(lldb) thread backtrace --count 3
580* thread #1, name = 'inline_call', stop reason = breakpoint 8.5
581 * frame #0: inline_call`m1cfi(m1cai=70) at mod1.zig:30:5
582 frame #1: inline_call`mod1.m1pf(m1pa=78) at mod1.zig:13:15
583 frame #2: inline_call`root0.main at root0.zig:40:14
584(lldb) #---
585(lldb) process continue
586Process #... resuming
587Process #... stopped
588* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
589 frame #0: inline_call`root0.r0cf(r0ca=88) at root0.zig:26:5
590(lldb) thread backtrace --count 3
591* thread #1, name = 'inline_call', stop reason = breakpoint 1.1
592 * frame #0: inline_call`root0.r0cf(r0ca=88) at root0.zig:26:5
593 frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:16:15
594 frame #2: inline_call`root0.main at root0.zig:41:15
595(lldb) process continue
596Process #... resuming
597Process #... stopped
598* thread #1, name = 'inline_call', stop reason = breakpoint 2.4
599 frame #0: inline_call`r0cfi(r0cai=91) at root0.zig:30:5
600(lldb) thread backtrace --count 3
601* thread #1, name = 'inline_call', stop reason = breakpoint 2.4
602 * frame #0: inline_call`r0cfi(r0cai=91) at root0.zig:30:5
603 frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:17:16
604 frame #2: inline_call`root0.main at root0.zig:41:15
605(lldb) process continue
606Process #... resuming
607Process #... stopped
608* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
609 frame #0: inline_call`root1.r1cf(r1ca=90) at root1.zig:26:5
610(lldb) thread backtrace --count 3
611* thread #1, name = 'inline_call', stop reason = breakpoint 3.1
612 * frame #0: inline_call`root1.r1cf(r1ca=90) at root1.zig:26:5
613 frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:18:15
614 frame #2: inline_call`root0.main at root0.zig:41:15
615(lldb) process continue
616Process #... resuming
617Process #... stopped
618* thread #1, name = 'inline_call', stop reason = breakpoint 4.4
619 frame #0: inline_call`r1cfi(r1cai=93) at root1.zig:30:5
620(lldb) thread backtrace --count 3
621* thread #1, name = 'inline_call', stop reason = breakpoint 4.4
622 * frame #0: inline_call`r1cfi(r1cai=93) at root1.zig:30:5
623 frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:19:16
624 frame #2: inline_call`root0.main at root0.zig:41:15
625(lldb) process continue
626Process #... resuming
627Process #... stopped
628* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
629 frame #0: inline_call`mod0.m0cf(m0ca=92) at mod0.zig:26:5
630(lldb) thread backtrace --count 3
631* thread #1, name = 'inline_call', stop reason = breakpoint 5.1
632 * frame #0: inline_call`mod0.m0cf(m0ca=92) at mod0.zig:26:5
633 frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:20:14
634 frame #2: inline_call`root0.main at root0.zig:41:15
635(lldb) process continue
636Process #... resuming
637Process #... stopped
638* thread #1, name = 'inline_call', stop reason = breakpoint 6.4
639 frame #0: inline_call`m0cfi(m0cai=95) at mod0.zig:30:5
640(lldb) thread backtrace --count 3
641* thread #1, name = 'inline_call', stop reason = breakpoint 6.4
642 * frame #0: inline_call`m0cfi(m0cai=95) at mod0.zig:30:5
643 frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:21:15
644 frame #2: inline_call`root0.main at root0.zig:41:15
645(lldb) process continue
646Process #... resuming
647Process #... stopped
648* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
649 frame #0: inline_call`mod1.m1cf(m1ca=94) at mod1.zig:26:5
650(lldb) thread backtrace --count 3'
651* thread #1, name = 'inline_call', stop reason = breakpoint 7.1
652 * frame #0: inline_call`mod1.m1cf(m1ca=94) at mod1.zig:26:5
653 frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:22:14
654 frame #2: inline_call`root0.main at root0.zig:41:15
655(lldb) process continue
656Process #... resuming
657Process #... stopped
658* thread #1, name = 'inline_call', stop reason = breakpoint 8.4
659 frame #0: inline_call`m1cfi(m1cai=81) at mod1.zig:30:5
660(lldb) thread backtrace --count 3
661* thread #1, name = 'inline_call', stop reason = breakpoint 8.4
662 * frame #0: inline_call`m1cfi(m1cai=81) at mod1.zig:30:5
663 frame #1: inline_call`m1pfi(m1pai=89) at mod1.zig:23:15
664 frame #2: inline_call`root0.main at root0.zig:41:15
test/debugger/inline_call/manifest created+18
......@@ -0,0 +1,18 @@
1#todo {
2implement inline line info in lldb
3#}
4#skip x86_64-linux-none-incremental-selfhosted-new-nopic
5#skip x86_64-linux-none-incremental-selfhosted-new-pic
6
7#exe {
8--name inline_call
9--dep module -Mroot=root0.zig
10-Mmodule=mod0.zig
11#}
12
13#write root0.zig root0.zig
14#write root1.zig root1.zig
15#write mod0.zig mod0.zig
16#write mod1.zig mod1.zig
17#update
18#check lldb lldb
test/debugger/inline_call/mod0.zig created+32
......@@ -0,0 +1,32 @@
1const root0 = @import("root");
2const root1 = root0.root1;
3const mod0 = @This();
4pub const mod1 = @import("mod1.zig");
5pub fn m0pf(m0pa: u32) void {
6 root0.r0cf(m0pa ^ 1);
7 root0.r0cfi(m0pa ^ 2);
8 root1.r1cf(m0pa ^ 3);
9 root1.r1cfi(m0pa ^ 4);
10 mod0.m0cf(m0pa ^ 5);
11 mod0.m0cfi(m0pa ^ 6);
12 mod1.m1cf(m0pa ^ 7);
13 mod1.m1cfi(m0pa ^ 8);
14}
15pub inline fn m0pfi(m0pai: u32) void {
16 root0.r0cf(m0pai ^ 1);
17 root0.r0cfi(m0pai ^ 2);
18 root1.r1cf(m0pai ^ 3);
19 root1.r1cfi(m0pai ^ 4);
20 mod0.m0cf(m0pai ^ 5);
21 mod0.m0cfi(m0pai ^ 6);
22 mod1.m1cf(m0pai ^ 7);
23 mod1.m1cfi(m0pai ^ 8);
24}
25pub fn m0cf(m0ca: u32) void {
26 var discard = m0ca;
27 _ = &discard;
28}
29pub inline fn m0cfi(m0cai: u32) void {
30 var discard = m0cai;
31 _ = &discard;
32}
test/debugger/inline_call/mod1.zig created+32
......@@ -0,0 +1,32 @@
1const root0 = @import("root");
2const root1 = root0.root1;
3const mod0 = @import("mod0.zig");
4const mod1 = @This();
5pub fn m1pf(m1pa: u32) void {
6 root0.r0cf(m1pa ^ 1);
7 root0.r0cfi(m1pa ^ 2);
8 root1.r1cf(m1pa ^ 3);
9 root1.r1cfi(m1pa ^ 4);
10 mod0.m0cf(m1pa ^ 5);
11 mod0.m0cfi(m1pa ^ 6);
12 mod1.m1cf(m1pa ^ 7);
13 mod1.m1cfi(m1pa ^ 8);
14}
15pub inline fn m1pfi(m1pai: u32) void {
16 root0.r0cf(m1pai ^ 1);
17 root0.r0cfi(m1pai ^ 2);
18 root1.r1cf(m1pai ^ 3);
19 root1.r1cfi(m1pai ^ 4);
20 mod0.m0cf(m1pai ^ 5);
21 mod0.m0cfi(m1pai ^ 6);
22 mod1.m1cf(m1pai ^ 7);
23 mod1.m1cfi(m1pai ^ 8);
24}
25pub fn m1cf(m1ca: u32) void {
26 var discard = m1ca;
27 _ = &discard;
28}
29pub inline fn m1cfi(m1cai: u32) void {
30 var discard = m1cai;
31 _ = &discard;
32}
test/debugger/inline_call/root0.zig created+42
......@@ -0,0 +1,42 @@
1const root0 = @This();
2pub const root1 = @import("root1.zig");
3const mod0 = @import("module");
4const mod1 = mod0.mod1;
5pub fn r0pf(r0pa: u32) void {
6 root0.r0cf(r0pa ^ 1);
7 root0.r0cfi(r0pa ^ 2);
8 root1.r1cf(r0pa ^ 3);
9 root1.r1cfi(r0pa ^ 4);
10 mod0.m0cf(r0pa ^ 5);
11 mod0.m0cfi(r0pa ^ 6);
12 mod1.m1cf(r0pa ^ 7);
13 mod1.m1cfi(r0pa ^ 8);
14}
15pub inline fn r0pfi(r0pai: u32) void {
16 root0.r0cf(r0pai ^ 1);
17 root0.r0cfi(r0pai ^ 2);
18 root1.r1cf(r0pai ^ 3);
19 root1.r1cfi(r0pai ^ 4);
20 mod0.m0cf(r0pai ^ 5);
21 mod0.m0cfi(r0pai ^ 6);
22 mod1.m1cf(r0pai ^ 7);
23 mod1.m1cfi(r0pai ^ 8);
24}
25pub fn r0cf(r0ca: u32) void {
26 var discard = r0ca;
27 _ = &discard;
28}
29pub inline fn r0cfi(r0cai: u32) void {
30 var discard = r0cai;
31 _ = &discard;
32}
33pub fn main() void {
34 root0.r0pf(12);
35 root0.r0pfi(23);
36 root1.r1pf(34);
37 root1.r1pfi(45);
38 mod0.m0pf(56);
39 mod0.m0pfi(67);
40 mod1.m1pf(78);
41 mod1.m1pfi(89);
42}
test/debugger/inline_call/root1.zig created+32
......@@ -0,0 +1,32 @@
1const root0 = @import("root0.zig");
2const root1 = @This();
3const mod0 = @import("module");
4const mod1 = mod0.mod1;
5pub fn r1pf(r1pa: u32) void {
6 root0.r0cf(r1pa ^ 1);
7 root0.r0cfi(r1pa ^ 2);
8 root1.r1cf(r1pa ^ 3);
9 root1.r1cfi(r1pa ^ 4);
10 mod0.m0cf(r1pa ^ 5);
11 mod0.m0cfi(r1pa ^ 6);
12 mod1.m1cf(r1pa ^ 7);
13 mod1.m1cfi(r1pa ^ 8);
14}
15pub inline fn r1pfi(r1pai: u32) void {
16 root0.r0cf(r1pai ^ 1);
17 root0.r0cfi(r1pai ^ 2);
18 root1.r1cf(r1pai ^ 3);
19 root1.r1cfi(r1pai ^ 4);
20 mod0.m0cf(r1pai ^ 5);
21 mod0.m0cfi(r1pai ^ 6);
22 mod1.m1cf(r1pai ^ 7);
23 mod1.m1cfi(r1pai ^ 8);
24}
25pub fn r1cf(r1ca: u32) void {
26 var discard = r1ca;
27 _ = &discard;
28}
29pub inline fn r1cfi(r1cai: u32) void {
30 var discard = r1cai;
31 _ = &discard;
32}
test/debugger/link_object created+39
......@@ -0,0 +1,39 @@
1#exe {
2--name link_object
3-Mroot=main.zig
4#}
5
6#write main.zig {
7extern fn fabsf(f32) f32;
8pub fn main() void {
9 var x: f32 = -1234.5;
10 x = fabsf(x);
11 _ = &x;
12}
13#}
14#update
15#check lldb {
16(lldb) breakpoint set --file main.zig --source-pattern-regexp 'x = fabsf\(x\);'
17Breakpoint 1: where = link_object`main.main + #... at main.zig:4:14, address = 0x#...
18(lldb) process launch
19Process #... launched: '#.../link_object' (#...)
20Process #... stopped
21* thread #1, name = 'link_object', stop reason = breakpoint 1.1
22 frame #0: link_object`main.main at main.zig:4:14
23(lldb) frame variable --show-all-children -- x
24(f32) x = -1234.5
25(lldb) breakpoint delete --force 1
261 breakpoints deleted; 0 breakpoint locations disabled.
27(lldb) #---
28(lldb) breakpoint set --file main.zig --source-pattern-regexp '_ = &x;'
29Breakpoint 2: where = link_object`main.main + #... at main.zig:5:5, address = 0x#...
30(lldb) process continue
31Process #... resuming
32Process #... stopped
33* thread #1, name = 'link_object', stop reason = breakpoint 2.1
34 frame #0: link_object`main.main at main.zig:5:5
35(lldb) frame variable --show-all-children -- x
36(f32) x = 1234.5
37(lldb) breakpoint delete --force 2
381 breakpoints deleted; 0 breakpoint locations disabled.
39#}
test/debugger/multi_array_list/lldb created+209
......@@ -0,0 +1,209 @@
1(lldb) breakpoint set --file main.zig --source-pattern-regexp '_ = \.{ list0, slice0, list1, slice1 };'
2Breakpoint 1: where = mal`main.testMultiArrayList + #... at main.zig:11:1, address = 0x#...
3(lldb) process launch
4Process #... launched: '#.../mal' (#...)
5Process #... stopped
6* thread #1, name = 'mal', stop reason = breakpoint 1.1
7 frame #0: mal`main.testMultiArrayList(list0=len=3 capacity=8, slice0=len=3 capacity=8, list1=len=3 capacity=12, slice1=len=3 capacity=12) at main.zig:11:1
8(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"'
9(std.multi_array_list.MultiArrayList(struct { u32, u8, u16 })) list0 = len=3 capacity=8 {
10 (struct { u32, u8, u16 }) [0] = {
11 (u32) .@"0" = 1
12 (u8) .@"1" = 2
13 (u16) .@"2" = 3
14 }
15 (struct { u32, u8, u16 }) [1] = {
16 (u32) .@"0" = 4
17 (u8) .@"1" = 5
18 (u16) .@"2" = 6
19 }
20 (struct { u32, u8, u16 }) [2] = {
21 (u32) .@"0" = 7
22 (u8) .@"1" = 8
23 (u16) .@"2" = 9
24 }
25}
26(usize) list0.len = 3
27(usize) list0.capacity = 8
28(struct { u32, u8, u16 }) list0[0] = {
29 (u32) .@"0" = 1
30 (u8) .@"1" = 2
31 (u16) .@"2" = 3
32}
33(struct { u32, u8, u16 }) list0[1] = {
34 (u32) .@"0" = 4
35 (u8) .@"1" = 5
36 (u16) .@"2" = 6
37}
38(struct { u32, u8, u16 }) list0[2] = {
39 (u32) .@"0" = 7
40 (u8) .@"1" = 8
41 (u16) .@"2" = 9
42}
43([3]u32) list0.@"0" = {
44 (u32) [0] = 1
45 (u32) [1] = 4
46 (u32) [2] = 7
47}
48([3]u8) list0.@"1" = {
49 (u8) [0] = 2
50 (u8) [1] = 5
51 (u8) [2] = 8
52}
53([3]u16) list0.@"2" = {
54 (u16) [0] = 3
55 (u16) [1] = 6
56 (u16) [2] = 9
57}
58(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"'
59(std.multi_array_list.MultiArrayList(struct { u32, u8, u16 }).Slice) slice0 = len=3 capacity=8 {
60 (struct { u32, u8, u16 }) [0] = {
61 (u32) .@"0" = 1
62 (u8) .@"1" = 2
63 (u16) .@"2" = 3
64 }
65 (struct { u32, u8, u16 }) [1] = {
66 (u32) .@"0" = 4
67 (u8) .@"1" = 5
68 (u16) .@"2" = 6
69 }
70 (struct { u32, u8, u16 }) [2] = {
71 (u32) .@"0" = 7
72 (u8) .@"1" = 8
73 (u16) .@"2" = 9
74 }
75}
76(usize) slice0.len = 3
77(usize) slice0.capacity = 8
78(struct { u32, u8, u16 }) slice0[0] = {
79 (u32) .@"0" = 1
80 (u8) .@"1" = 2
81 (u16) .@"2" = 3
82}
83(struct { u32, u8, u16 }) slice0[1] = {
84 (u32) .@"0" = 4
85 (u8) .@"1" = 5
86 (u16) .@"2" = 6
87}
88(struct { u32, u8, u16 }) slice0[2] = {
89 (u32) .@"0" = 7
90 (u8) .@"1" = 8
91 (u16) .@"2" = 9
92}
93([3]u32) slice0.@"0" = {
94 (u32) [0] = 1
95 (u32) [1] = 4
96 (u32) [2] = 7
97}
98([3]u8) slice0.@"1" = {
99 (u8) [0] = 2
100 (u8) [1] = 5
101 (u8) [2] = 8
102}
103([3]u16) slice0.@"2" = {
104 (u16) [0] = 3
105 (u16) [1] = 6
106 (u16) [2] = 9
107}
108(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
109(std.multi_array_list.MultiArrayList(main.Elem1)) list1 = len=3 capacity=12 {
110 (root.main.Elem1) [0] = {
111 (u32) .a = 1
112 (u8) .b = 2
113 (u16) .c = 3
114 }
115 (root.main.Elem1) [1] = {
116 (u32) .a = 4
117 (u8) .b = 5
118 (u16) .c = 6
119 }
120 (root.main.Elem1) [2] = {
121 (u32) .a = 7
122 (u8) .b = 8
123 (u16) .c = 9
124 }
125}
126(usize) list1.len = 3
127(usize) list1.capacity = 12
128(root.main.Elem1) list1[0] = {
129 (u32) .a = 1
130 (u8) .b = 2
131 (u16) .c = 3
132}
133(root.main.Elem1) list1[1] = {
134 (u32) .a = 4
135 (u8) .b = 5
136 (u16) .c = 6
137}
138(root.main.Elem1) list1[2] = {
139 (u32) .a = 7
140 (u8) .b = 8
141 (u16) .c = 9
142}
143([3]u32) list1.a = {
144 (u32) [0] = 1
145 (u32) [1] = 4
146 (u32) [2] = 7
147}
148([3]u8) list1.b = {
149 (u8) [0] = 2
150 (u8) [1] = 5
151 (u8) [2] = 8
152}
153([3]u16) list1.c = {
154 (u16) [0] = 3
155 (u16) [1] = 6
156 (u16) [2] = 9
157}
158(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
159(std.multi_array_list.MultiArrayList(main.Elem1).Slice) slice1 = len=3 capacity=12 {
160 (root.main.Elem1) [0] = {
161 (u32) .a = 1
162 (u8) .b = 2
163 (u16) .c = 3
164 }
165 (root.main.Elem1) [1] = {
166 (u32) .a = 4
167 (u8) .b = 5
168 (u16) .c = 6
169 }
170 (root.main.Elem1) [2] = {
171 (u32) .a = 7
172 (u8) .b = 8
173 (u16) .c = 9
174 }
175}
176(usize) slice1.len = 3
177(usize) slice1.capacity = 12
178(root.main.Elem1) slice1[0] = {
179 (u32) .a = 1
180 (u8) .b = 2
181 (u16) .c = 3
182}
183(root.main.Elem1) slice1[1] = {
184 (u32) .a = 4
185 (u8) .b = 5
186 (u16) .c = 6
187}
188(root.main.Elem1) slice1[2] = {
189 (u32) .a = 7
190 (u8) .b = 8
191 (u16) .c = 9
192}
193([3]u32) slice1.a = {
194 (u32) [0] = 1
195 (u32) [1] = 4
196 (u32) [2] = 7
197}
198([3]u8) slice1.b = {
199 (u8) [0] = 2
200 (u8) [1] = 5
201 (u8) [2] = 8
202}
203([3]u16) slice1.c = {
204 (u16) [0] = 3
205 (u16) [1] = 6
206 (u16) [2] = 9
207}
208(lldb) breakpoint delete --force 1
2091 breakpoints deleted; 0 breakpoint locations disabled.
test/debugger/multi_array_list/main.zig created+30
......@@ -0,0 +1,30 @@
1const std = @import("std");
2const Elem0 = struct { u32, u8, u16 };
3const Elem1 = struct { a: u32, b: u8, c: u16 };
4fn testMultiArrayList(
5 list0: std.MultiArrayList(Elem0),
6 slice0: std.MultiArrayList(Elem0).Slice,
7 list1: std.MultiArrayList(Elem1),
8 slice1: std.MultiArrayList(Elem1).Slice,
9) void {
10 _ = .{ list0, slice0, list1, slice1 };
11}
12pub fn main() !void {
13 var list0: std.MultiArrayList(Elem0) = .{};
14 defer list0.deinit(std.heap.page_allocator);
15 try list0.setCapacity(std.heap.page_allocator, 8);
16 list0.appendAssumeCapacity(.{ 1, 2, 3 });
17 list0.appendAssumeCapacity(.{ 4, 5, 6 });
18 list0.appendAssumeCapacity(.{ 7, 8, 9 });
19 const slice0 = list0.slice();
20
21 var list1: std.MultiArrayList(Elem1) = .{};
22 defer list1.deinit(std.heap.page_allocator);
23 try list1.setCapacity(std.heap.page_allocator, 12);
24 list1.appendAssumeCapacity(.{ .a = 1, .b = 2, .c = 3 });
25 list1.appendAssumeCapacity(.{ .a = 4, .b = 5, .c = 6 });
26 list1.appendAssumeCapacity(.{ .a = 7, .b = 8, .c = 9 });
27 const slice1 = list1.slice();
28
29 testMultiArrayList(list0, slice0, list1, slice1);
30}
test/debugger/multi_array_list/manifest created+8
......@@ -0,0 +1,8 @@
1#exe {
2--name mal
3-Mroot=main.zig
4#}
5
6#write main.zig main.zig
7#update
8#check lldb lldb
test/debugger/optionals created+54
......@@ -0,0 +1,54 @@
1#exe {
2--name optionals
3-Mroot=optionals.zig
4#}
5
6#write optionals.zig {
7pub fn main() void {
8 {
9 var null_u32: ?u32 = null;
10 var maybe_u32: ?u32 = null;
11 var nonnull_u32: ?u32 = 456;
12 null_u32 = null_u32;
13 maybe_u32 = 123;
14 nonnull_u32 = nonnull_u32;
15 }
16}
17#}
18#update
19#check lldb {
20(lldb) breakpoint set --file optionals.zig --source-pattern-regexp 'maybe_u32 = 123;'
21Breakpoint 1: where = optionals`optionals.main + #... at optionals.zig:7:9, address = 0x#...
22(lldb) process launch
23Process #... launched: '#.../optionals' (#...)
24Process #... stopped
25* thread #1, name = 'optionals', stop reason = breakpoint 1.1
26 frame #0: optionals`optionals.main at optionals.zig:7:9
27(lldb) frame variable --show-all-children -- null_u32 maybe_u32 nonnull_u32 nonnull_u32.?
28(?u32) null_u32 = null
29(?u32) maybe_u32 = null
30(?u32) nonnull_u32 = (nonnull_u32.? = 456)
31(u32) nonnull_u32.? = 456
32(lldb) breakpoint delete --force 1
331 breakpoints deleted; 0 breakpoint locations disabled.
34(lldb) #---
35(lldb) breakpoint set --file optionals.zig --source-pattern-regexp 'nonnull_u32 = nonnull_u32;'
36Breakpoint 2: where = optionals`optionals.main + #... at optionals.zig:8:9, address = 0x#...
37(lldb) process continue
38Process #... resuming
39Process #... stopped
40* thread #1, name = 'optionals', stop reason = breakpoint 2.1
41 frame #0: optionals`optionals.main at optionals.zig:8:9
42(lldb) frame variable --show-all-children --show-types -- null_u32 maybe_u32 maybe_u32.? nonnull_u32 nonnull_u32.?
43(?u32) null_u32 = null
44(?u32) maybe_u32 = {
45 (u32) maybe_u32.? = 123
46}
47(u32) maybe_u32.? = 123
48(?u32) nonnull_u32 = {
49 (u32) nonnull_u32.? = 456
50}
51(u32) nonnull_u32.? = 456
52(lldb) breakpoint delete --force 2
531 breakpoints deleted; 0 breakpoint locations disabled.
54#}
test/debugger/pointers created+135
......@@ -0,0 +1,135 @@
1#exe {
2--name pointers
3-Mroot=pointers.zig
4#}
5
6#write pointers.zig {
7var array: [7]u32 = .{
8 3010,
9 3014,
10 3018,
11 3022,
12 3026,
13 3030,
14 3034,
15};
16const Pointers = struct {
17 single: *u32 = @ptrFromInt(0x1010),
18 single_const: *const u32 = @ptrFromInt(0x1014),
19 single_volatile: *volatile u32 = @ptrFromInt(0x1018),
20 single_const_volatile: *const volatile u32 = @ptrFromInt(0x101c),
21 single_allowzero: *allowzero u32 = @ptrFromInt(0x1020),
22 single_allowzero_const: *allowzero const u32 = @ptrFromInt(0x1024),
23 single_allowzero_volatile: *allowzero volatile u32 = @ptrFromInt(0x1028),
24 single_allowzero_const_volatile: *allowzero const volatile u32 = @ptrFromInt(0x102c),
25
26 many: [*]u32 = @ptrFromInt(0x2010),
27 many_const: [*]const u32 = @ptrFromInt(0x2014),
28 many_volatile: [*]volatile u32 = @ptrFromInt(0x2018),
29 many_const_volatile: [*]const volatile u32 = @ptrFromInt(0x201c),
30 many_allowzero: [*]allowzero u32 = @ptrFromInt(0x2020),
31 many_allowzero_const: [*]allowzero const u32 = @ptrFromInt(0x2024),
32 many_allowzero_volatile: [*]allowzero volatile u32 = @ptrFromInt(0x2028),
33 many_allowzero_const_volatile: [*]allowzero const volatile u32 = @ptrFromInt(0x202c),
34 slice: []u32 = array[0..1],
35 slice_const: []const u32 = array[0..2],
36 slice_volatile: []volatile u32 = array[0..3],
37 slice_const_volatile: []const volatile u32 = array[0..4],
38 slice_allowzero: []allowzero u32 = array[4..4],
39 slice_allowzero_const: []allowzero const u32 = array[4..5],
40 slice_allowzero_volatile: []allowzero volatile u32 = array[4..6],
41 slice_allowzero_const_volatile: []allowzero const volatile u32 = array[4..7],
42
43 c: [*c]u32 = @ptrFromInt(0x4010),
44 c_const: [*c]const u32 = @ptrFromInt(0x4014),
45 c_volatile: [*c]volatile u32 = @ptrFromInt(0x4018),
46 c_const_volatile: [*c]const volatile u32 = @ptrFromInt(0x401c),
47};
48const Access = struct {
49 single: *u32 = &array[0],
50 many: [*]u32 = array[1..3],
51 slice: []u32 = array[3..5],
52 c: [*c]u32 = array[5..7],
53};
54fn testPointers(pointers: Pointers, access: Access) void {
55 _ = pointers;
56 _ = access;
57}
58pub fn main() void {
59 testPointers(.{}, .{});
60}
61#}
62#update
63#check lldb {
64(lldb) breakpoint set --file pointers.zig --source-pattern-regexp '_ = access;'
65Breakpoint 1: where = pointers`pointers.testPointers + #... at pointers.zig:51:1, address = 0x#...
66(lldb) process launch
67Process #... launched: '#.../pointers' (#...)
68Process #... stopped
69* thread #1, name = 'pointers', stop reason = breakpoint 1.1
70 frame #0: pointers`pointers.testPointers(pointers=Pointers @ 0x#..., access=Access @ 0x#...) at pointers.zig:51:1
71(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]
72(root.pointers.Pointers) pointers = {
73 (*u32) .single = 0x0000000000001010
74 (*const u32) .single_const = 0x0000000000001014
75 (*volatile u32) .single_volatile = 0x0000000000001018
76 (*const volatile u32) .single_const_volatile = 0x000000000000101c
77 (*allowzero u32) .single_allowzero = 0x0000000000001020
78 (*allowzero const u32) .single_allowzero_const = 0x0000000000001024
79 (*allowzero volatile u32) .single_allowzero_volatile = 0x0000000000001028
80 (*allowzero const volatile u32) .single_allowzero_const_volatile = 0x000000000000102c
81 ([*]u32) .many = 0x0000000000002010
82 ([*]const u32) .many_const = 0x0000000000002014
83 ([*]volatile u32) .many_volatile = 0x0000000000002018
84 ([*]const volatile u32) .many_const_volatile = 0x000000000000201c
85 ([*]allowzero u32) .many_allowzero = 0x0000000000002020
86 ([*]allowzero const u32) .many_allowzero_const = 0x0000000000002024
87 ([*]allowzero volatile u32) .many_allowzero_volatile = 0x0000000000002028
88 ([*]allowzero const volatile u32) .many_allowzero_const_volatile = 0x000000000000202c
89 ([]u32) .slice = len=1 {
90 (u32) [0] = 3010
91 }
92 ([]const u32) .slice_const = len=2 {
93 (u32) [0] = 3010
94 (u32) [1] = 3014
95 }
96 ([]volatile u32) .slice_volatile = len=3 {
97 (u32) [0] = 3010
98 (u32) [1] = 3014
99 (u32) [2] = 3018
100 }
101 ([]const volatile u32) .slice_const_volatile = len=4 {
102 (u32) [0] = 3010
103 (u32) [1] = 3014
104 (u32) [2] = 3018
105 (u32) [3] = 3022
106 }
107 ([]allowzero u32) .slice_allowzero = len=0 {}
108 ([]allowzero const u32) .slice_allowzero_const = len=1 {
109 (u32) [0] = 3026
110 }
111 ([]allowzero volatile u32) .slice_allowzero_volatile = len=2 {
112 (u32) [0] = 3026
113 (u32) [1] = 3030
114 }
115 ([]allowzero const volatile u32) .slice_allowzero_const_volatile = len=3 {
116 (u32) [0] = 3026
117 (u32) [1] = 3030
118 (u32) [2] = 3034
119 }
120 ([*c]u32) .c = 0x0000000000004010
121 ([*c]const u32) .c_const = 0x0000000000004014
122 ([*c]volatile u32) .c_volatile = 0x0000000000004018
123 ([*c]const volatile u32) .c_const_volatile = 0x000000000000401c
124}
125(u32) access.single.* = 3010
126(u32) access.many[0] = 3014
127(u32) access.many[1] = 3018
128(u32) access.slice[0] = 3022
129(u32) access.slice[1] = 3026
130(u32) access.c.* = 3030
131(u32) access.c[0] = 3030
132(u32) access.c[1] = 3034
133(lldb) breakpoint delete --force 1
1341 breakpoints deleted; 0 breakpoint locations disabled.
135#}
test/debugger/step_single_stmt_loops/lldb created+329
......@@ -0,0 +1,329 @@
1(lldb) breakpoint set --name step_single_stmt_loops.main
2Breakpoint 1: where = sssl`step_single_stmt_loops.main + #... at step_single_stmt_loops.zig:2:5, address = 0x#...
3(lldb) process launch
4Process #... launched: '#.../sssl' (#...)
5Process #... stopped
6* thread #1, name = 'sssl', stop reason = breakpoint 1.1
7 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:2:5
8(lldb) thread step-in
9Process #... stopped
10* thread #1, name = 'sssl', stop reason = step in
11 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:3:10
12(lldb) #00
13(lldb) frame variable --show-all-children x
14(u32) x = 0
15(lldb) thread step-in
16Process #... stopped
17* thread #1, name = 'sssl', stop reason = step in
18 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:4:9
19(lldb) #01
20(lldb) frame variable --show-all-children x
21(u32) x = 0
22(lldb) thread step-in
23Process #... stopped
24* thread #1, name = 'sssl', stop reason = step in
25 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:5:5
26(lldb) #02
27(lldb) frame variable --show-all-children x
28(u32) x = 1
29(lldb) thread step-in
30Process #... stopped
31* thread #1, name = 'sssl', stop reason = step in
32 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:3:10
33(lldb) #03
34(lldb) frame variable --show-all-children x
35(u32) x = 1
36(lldb) thread step-in
37Process #... stopped
38* thread #1, name = 'sssl', stop reason = step in
39 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:4:9
40(lldb) #04
41(lldb) frame variable --show-all-children x
42(u32) x = 1
43(lldb) thread step-in
44Process #... stopped
45* thread #1, name = 'sssl', stop reason = step in
46 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:5:5
47(lldb) #05
48(lldb) frame variable --show-all-children x
49(u32) x = 2
50(lldb) thread step-in
51Process #... stopped
52* thread #1, name = 'sssl', stop reason = step in
53 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:3:10
54(lldb) #06
55(lldb) frame variable --show-all-children x
56(u32) x = 2
57(lldb) thread step-in
58Process #... stopped
59* thread #1, name = 'sssl', stop reason = step in
60 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:4:9
61(lldb) #07
62(lldb) frame variable --show-all-children x
63(u32) x = 2
64(lldb) thread step-in
65Process #... stopped
66* thread #1, name = 'sssl', stop reason = step in
67 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:5:5
68(lldb) #08
69(lldb) frame variable --show-all-children x
70(u32) x = 3
71(lldb) thread step-in
72Process #... stopped
73* thread #1, name = 'sssl', stop reason = step in
74 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:3:10
75(lldb) #09
76(lldb) frame variable --show-all-children x
77(u32) x = 3
78(lldb) thread step-in
79Process #... stopped
80* thread #1, name = 'sssl', stop reason = step in
81 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:7:9
82(lldb) #10
83(lldb) frame variable --show-all-children x
84(u32) x = 3
85(lldb) thread step-in
86Process #... stopped
87* thread #1, name = 'sssl', stop reason = step in
88 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:8:16
89(lldb) #11
90(lldb) frame variable --show-all-children x
91(u32) x = 3
92(lldb) thread step-in
93Process #... stopped
94* thread #1, name = 'sssl', stop reason = step in
95 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:9:13
96(lldb) #12
97(lldb) frame variable --show-all-children x
98(u32) x = 3
99(lldb) thread step-in
100Process #... stopped
101* thread #1, name = 'sssl', stop reason = step in
102 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:10:9
103(lldb) #13
104(lldb) frame variable --show-all-children x
105(u32) x = 4
106(lldb) thread step-in
107Process #... stopped
108* thread #1, name = 'sssl', stop reason = step in
109 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:8:26
110(lldb) #14
111(lldb) frame variable --show-all-children x
112(u32) x = 4
113(lldb) thread step-in
114Process #... stopped
115* thread #1, name = 'sssl', stop reason = step in
116 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:9:13
117(lldb) #15
118(lldb) frame variable --show-all-children x
119(u32) x = 4
120(lldb) thread step-in
121Process #... stopped
122* thread #1, name = 'sssl', stop reason = step in
123 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:10:9
124(lldb) #16
125(lldb) frame variable --show-all-children x
126(u32) x = 5
127(lldb) thread step-in
128Process #... stopped
129* thread #1, name = 'sssl', stop reason = step in
130 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:8:26
131(lldb) #17
132(lldb) frame variable --show-all-children x
133(u32) x = 5
134(lldb) thread step-in
135Process #... stopped
136* thread #1, name = 'sssl', stop reason = step in
137 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:9:13
138(lldb) #18
139(lldb) frame variable --show-all-children x
140(u32) x = 5
141(lldb) thread step-in
142Process #... stopped
143* thread #1, name = 'sssl', stop reason = step in
144 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:10:9
145(lldb) #19
146(lldb) frame variable --show-all-children x
147(u32) x = 6
148(lldb) thread step-in
149Process #... stopped
150* thread #1, name = 'sssl', stop reason = step in
151 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:8:26
152(lldb) #20
153(lldb) frame variable --show-all-children x
154(u32) x = 6
155(lldb) thread step-in
156Process #... stopped
157* thread #1, name = 'sssl', stop reason = step in
158 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:13:9
159(lldb) #21
160(lldb) frame variable --show-all-children x
161(u32) x = 6
162(lldb) thread step-in
163Process #... stopped
164* thread #1, name = 'sssl', stop reason = step in
165 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:14:16
166(lldb) #22
167(lldb) frame variable --show-all-children x
168(u32) x = 6
169(lldb) thread step-in
170Process #... stopped
171* thread #1, name = 'sssl', stop reason = step in
172 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:15:13
173(lldb) #23
174(lldb) frame variable --show-all-children x
175(u32) x = 6
176(lldb) thread step-in
177Process #... stopped
178* thread #1, name = 'sssl', stop reason = step in
179 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:16:9
180(lldb) #24
181(lldb) frame variable --show-all-children x
182(u32) x = 6
183(lldb) thread step-in
184Process #... stopped
185* thread #1, name = 'sssl', stop reason = step in
186 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:14:16
187(lldb) #25
188(lldb) frame variable --show-all-children x
189(u32) x = 6
190(lldb) thread step-in
191Process #... stopped
192* thread #1, name = 'sssl', stop reason = step in
193 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:15:13
194(lldb) #26
195(lldb) frame variable --show-all-children x
196(u32) x = 6
197(lldb) thread step-in
198Process #... stopped
199* thread #1, name = 'sssl', stop reason = step in
200 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:16:9
201(lldb) #27
202(lldb) frame variable --show-all-children x
203(u32) x = 6
204(lldb) thread step-in
205Process #... stopped
206* thread #1, name = 'sssl', stop reason = step in
207 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:14:16
208(lldb) #28
209(lldb) frame variable --show-all-children x
210(u32) x = 6
211(lldb) thread step-in
212Process #... stopped
213* thread #1, name = 'sssl', stop reason = step in
214 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:15:13
215(lldb) #29
216(lldb) frame variable --show-all-children x
217(u32) x = 6
218(lldb) thread step-in
219Process #... stopped
220* thread #1, name = 'sssl', stop reason = step in
221 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:16:9
222(lldb) #30
223(lldb) frame variable --show-all-children x
224(u32) x = 6
225(lldb) thread step-in
226Process #... stopped
227* thread #1, name = 'sssl', stop reason = step in
228 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:14:16
229(lldb) #31
230(lldb) frame variable --show-all-children x
231(u32) x = 6
232(lldb) thread step-in
233Process #... stopped
234* thread #1, name = 'sssl', stop reason = step in
235 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:19:9
236(lldb) #32
237(lldb) frame variable --show-all-children x
238(u32) x = 6
239(lldb) thread step-in
240Process #... stopped
241* thread #1, name = 'sssl', stop reason = step in
242 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:20:5
243(lldb) #33
244(lldb) frame variable --show-all-children x
245(u32) x = 7
246(lldb) thread step-in
247Process #... stopped
248* thread #1, name = 'sssl', stop reason = step in
249 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:19:9
250(lldb) #34
251(lldb) frame variable --show-all-children x
252(u32) x = 7
253(lldb) thread step-in
254Process #... stopped
255* thread #1, name = 'sssl', stop reason = step in
256 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:20:5
257(lldb) #35
258(lldb) frame variable --show-all-children x
259(u32) x = 8
260(lldb) thread step-in
261Process #... stopped
262* thread #1, name = 'sssl', stop reason = step in
263 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:19:9
264(lldb) #36
265(lldb) frame variable --show-all-children x
266(u32) x = 8
267(lldb) thread step-in
268Process #... stopped
269* thread #1, name = 'sssl', stop reason = step in
270 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:20:5
271(lldb) #37
272(lldb) frame variable --show-all-children x
273(u32) x = 9
274(lldb) thread step-in
275Process #... stopped
276* thread #1, name = 'sssl', stop reason = step in
277 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:24:13
278(lldb) #38
279(lldb) frame variable --show-all-children x
280(u32) x = 9
281(lldb) thread step-in
282Process #... stopped
283* thread #1, name = 'sssl', stop reason = step in
284 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:25:9
285(lldb) #39
286(lldb) frame variable --show-all-children x
287(u32) x = 10
288(lldb) thread step-in
289Process #... stopped
290* thread #1, name = 'sssl', stop reason = step in
291 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:24:13
292(lldb) #40
293(lldb) frame variable --show-all-children x
294(u32) x = 10
295(lldb) thread step-in
296Process #... stopped
297* thread #1, name = 'sssl', stop reason = step in
298 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:25:9
299(lldb) #41
300(lldb) frame variable --show-all-children x
301(u32) x = 11
302(lldb) thread step-in
303Process #... stopped
304* thread #1, name = 'sssl', stop reason = step in
305 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:24:13
306(lldb) #42
307(lldb) frame variable --show-all-children x
308(u32) x = 11
309(lldb) thread step-in
310Process #... stopped
311* thread #1, name = 'sssl', stop reason = step in
312 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:25:9
313(lldb) #43
314(lldb) frame variable --show-all-children x
315(u32) x = 12
316(lldb) thread step-in
317Process #... stopped
318* thread #1, name = 'sssl', stop reason = step in
319 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:31:9
320(lldb) #44
321(lldb) frame variable --show-all-children x
322(u32) x = 12
323(lldb) thread step-in
324Process #... stopped
325* thread #1, name = 'sssl', stop reason = step in
326 frame #0: sssl`step_single_stmt_loops.main at step_single_stmt_loops.zig:33:5
327(lldb) #45
328(lldb) frame variable --show-all-children x
329(u32) x = 12
test/debugger/step_single_stmt_loops/manifest created+8
......@@ -0,0 +1,8 @@
1#exe {
2--name sssl
3-Mroot=step_single_stmt_loops.zig
4#}
5
6#write step_single_stmt_loops.zig step_single_stmt_loops.zig
7#update
8#check lldb lldb
test/debugger/step_single_stmt_loops/step_single_stmt_loops.zig created+34
......@@ -0,0 +1,34 @@
1pub fn main() void {
2 var x: u32 = 0;
3 for (0..3) |_| {
4 x +%= 1;
5 }
6 {
7 var i: u32 = 0;
8 while (i < 3) : (i +%= 1) {
9 x +%= 1;
10 }
11 }
12 {
13 var i: u32 = 0;
14 while (i < 3) {
15 i +%= 1;
16 }
17 }
18 inline for (0..3) |_| {
19 x +%= 1;
20 }
21 {
22 comptime var i: u32 = 0;
23 inline while (i < 3) : (i +%= 1) {
24 x +%= 1;
25 }
26 }
27 {
28 comptime var i: u32 = 0;
29 inline while (i < 3) {
30 i +%= 1;
31 }
32 }
33 x +%= 1;
34}
test/debugger/storage created+93
......@@ -0,0 +1,93 @@
1#exe {
2--name storage
3-Mroot=storage.zig
4#}
5
6#write storage.zig {
7comptime {
8 _ = @import("externs.zig");
9}
10const global_const: u64 = 0x19e50dc8d6002077;
11var global_var: u64 = 0xcc423cec08622e32;
12threadlocal var global_threadlocal1: u64 = 0xb4d643528c042121;
13threadlocal var global_threadlocal2: u64 = 0x43faea1cf5ad7a22;
14extern const extern_const: u64;
15extern var extern_var: u64;
16extern threadlocal var extern_threadlocal1: u64;
17extern threadlocal var extern_threadlocal2: u64;
18fn testStorage(
19 param1: u64,
20 param2: u64,
21 param3: u64,
22 param4: u64,
23 param5: u64,
24 param6: u64,
25 param7: u64,
26 param8: u64,
27) callconv(.c) void {
28 const local_comptime_val: u64 = global_const *% global_const;
29 const local_comptime_ptr: struct { u64 } = .{ local_comptime_val *% local_comptime_val };
30 const local_const: u64 = global_var ^ global_threadlocal1 ^ global_threadlocal2 ^
31 extern_const ^ extern_var ^ extern_threadlocal1 ^ extern_threadlocal2 ^
32 param1 ^ param2 ^ param3 ^ param4 ^ param5 ^ param6 ^ param7 ^ param8;
33 var local_var: u64 = local_comptime_ptr[0] ^ local_const;
34 local_var = local_var;
35}
36pub fn main() void {
37 testStorage(
38 0x6a607e08125c7e00,
39 0x98944cb2a45a8b51,
40 0xa320cf10601ee6fb,
41 0x691ed3535bad3274,
42 0x63690e6867a5799f,
43 0x8e163f0ec76067f2,
44 0xf9a252c455fb4c06,
45 0xc88533722601e481,
46 );
47}
48#}
49#write externs.zig {
50export const extern_const: u64 = 0x1b0c91ea0470b0b2;
51export var extern_var: u64 = 0x19bc17b3f0b61ebc;
52export threadlocal var extern_threadlocal1: u64 = 0x3034c4ce967ed64d;
53export threadlocal var extern_threadlocal2: u64 = 0xfd330ab00b4bc5eb;
54#}
55#update
56#check lldb {
57(lldb) breakpoint set --file storage.zig --source-pattern-regexp 'local_var = local_var;'
58Breakpoint 1: where = storage`storage.testStorage + #... at storage.zig:28:5, address = 0x#...
59(lldb) process launch
60Process #... launched: '#.../storage' (#...)
61Process #... stopped
62* thread #1, name = 'storage', stop reason = breakpoint 1.1
63 frame #0: storage`storage.testStorage(param1=7665265138917473792, param2=10994496920463510353, param3=11754622696676058875, param4=7574723978257576564, param5=7163272523887770015, param6=10238440135580477426, param7=17988030864880782342, param8=14449011544845051009) at storage.zig:28:5
64(lldb) target variable --show-types --format hex -- global_const global_var global_threadlocal1 global_threadlocal2 extern_const extern_var extern_threadlocal1 extern_threadlocal2
65(u64) global_const = 0x19e50dc8d6002077
66(u64) global_var = 0xcc423cec08622e32
67(u64) global_threadlocal1 = 0xb4d643528c042121
68(u64) global_threadlocal2 = 0x43faea1cf5ad7a22
69(u64) extern_const = 0x1b0c91ea0470b0b2
70(u64) extern_const = 0x1b0c91ea0470b0b2
71(u64) extern_var = 0x19bc17b3f0b61ebc
72(u64) extern_var = 0x19bc17b3f0b61ebc
73(u64) extern_threadlocal1 = 0x3034c4ce967ed64d
74(u64) extern_threadlocal1 = 0x3034c4ce967ed64d
75(u64) extern_threadlocal2 = 0xfd330ab00b4bc5eb
76(u64) extern_threadlocal2 = 0xfd330ab00b4bc5eb
77(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
78(u64) param1 = 0x6a607e08125c7e00
79(u64) param2 = 0x98944cb2a45a8b51
80(u64) param3 = 0xa320cf10601ee6fb
81(u64) param4 = 0x691ed3535bad3274
82(u64) param5 = 0x63690e6867a5799f
83(u64) param6 = 0x8e163f0ec76067f2
84(u64) param7 = 0xf9a252c455fb4c06
85(u64) param8 = 0xc88533722601e481
86(u64) local_comptime_val = 0x69490636f81df751
87(u64) local_comptime_ptr.@"0" = 0x82e834dae74767a1
88(u64) local_comptime_ptr[0] = 0x82e834dae74767a1
89(u64) local_const = 0x104ba3ac46b25fad
90(u64) local_var = 0x92a39776a1f5380c
91(lldb) breakpoint delete --force 1
921 breakpoints deleted; 0 breakpoint locations disabled.
93#}
test/debugger/strings created+72
......@@ -0,0 +1,72 @@
1#exe {
2--name strings
3-Mroot=strings.zig
4#}
5
6#write strings.zig {
7const Strings = struct {
8 c_ptr: [*c]const u8 = "c_ptr\x07\x08\t",
9 many_ptr: [*:0]const u8 = "many_ptr\n\x0b\x0c",
10 ptr_array: *const [12:0]u8 = "ptr_array\x00\r\x1b",
11 slice: [:0]const u8 = "slice\"\'\\\x00",
12};
13fn testStrings(strings: Strings) void {
14 _ = strings;
15}
16pub fn main() void {
17 testStrings(.{});
18}
19#}
20#update
21#check lldb {
22(lldb) breakpoint set --file strings.zig --source-pattern-regexp '_ = strings;'
23Breakpoint 1: where = strings`strings.testStrings + #... at strings.zig:9:1, address = 0x#...
24(lldb) process launch
25Process #... launched: '#.../strings' (#...)
26Process #... stopped
27* thread #1, name = 'strings', stop reason = breakpoint 1.1
28 frame #0: strings`strings.testStrings(strings=Strings @ 0x#...) at strings.zig:9:1
29(lldb) frame variable --show-all-children --show-types -- strings.slice
30([:0]const u8) strings.slice = len=9 {
31 (u8) [0] = 115
32 (u8) [1] = 108
33 (u8) [2] = 105
34 (u8) [3] = 99
35 (u8) [4] = 101
36 (u8) [5] = 34
37 (u8) [6] = 39
38 (u8) [7] = 92
39 (u8) [8] = 0
40}
41(lldb) frame variable --show-all-children --show-types --format character -- strings.slice
42([:0]const u8) strings.slice = len=9 {
43 (u8) [0] = 's'
44 (u8) [1] = 'l'
45 (u8) [2] = 'i'
46 (u8) [3] = 'c'
47 (u8) [4] = 'e'
48 (u8) [5] = '\"'
49 (u8) [6] = '\''
50 (u8) [7] = '\\'
51 (u8) [8] = '\x00'
52}
53(lldb) frame variable --show-all-children --show-types --format c-string -- strings
54(root.strings.Strings) strings = {
55 ([*c]const u8) .c_ptr = "c_ptr\x07\x08\t"
56 ([*:0]const u8) .many_ptr = "many_ptr\n\x0b\x0c"
57 (*const [12:0]u8) .ptr_array = "ptr_array\x00\r\x1b"
58 ([:0]const u8) .slice = "slice\"\'\\\x00" len=9 {
59 (u8) [0] = "s"
60 (u8) [1] = "l"
61 (u8) [2] = "i"
62 (u8) [3] = "c"
63 (u8) [4] = "e"
64 (u8) [5] = "\""
65 (u8) [6] = "\'"
66 (u8) [7] = "\\"
67 (u8) [8] = "\x00"
68 }
69}
70(lldb) breakpoint delete --force 1
711 breakpoints deleted; 0 breakpoint locations disabled.
72#}
test/debugger/switch_blocks created+44
......@@ -0,0 +1,44 @@
1#exe {
2--name switch_blocks
3-Mroot=switch_blocks.zig
4#}
5
6#write switch_blocks.zig {
7pub fn main() void {
8 for (0..2) |i| {
9 switch (i) {
10 0 => {
11 var x: u32 = 123;
12 _ = &x;
13 },
14 else => {
15 var x: f32 = 4.5;
16 _ = &x;
17 },
18 }
19 }
20}
21#}
22#update
23#check lldb {
24(lldb) breakpoint set --file switch_blocks.zig --source-pattern-regexp '_ = &x;'
25Breakpoint 1: 2 locations.
26(lldb) process launch
27Process #... launched: '#.../switch_blocks' (#...)
28Process #... stopped
29* thread #1, name = 'switch_blocks', stop reason = breakpoint 1.1
30 frame #0: switch_blocks`switch_blocks.main at switch_blocks.zig:6:17
31(lldb) frame variable --show-all-children
32(usize) i = 0
33(u32) x = 123
34(lldb) process continue
35Process #... resuming
36Process #... stopped
37* thread #1, name = 'switch_blocks', stop reason = breakpoint 1.2
38 frame #0: switch_blocks`switch_blocks.main at switch_blocks.zig:10:17
39(lldb) frame variable --show-all-children
40(usize) i = 1
41(f32) x = 4.5
42(lldb) breakpoint delete --force 1
431 breakpoints deleted; 0 breakpoint locations disabled.
44#}
test/debugger/types created+67
......@@ -0,0 +1,67 @@
1#exe {
2--name types
3-Mroot=types.zig
4#}
5
6#write types.zig {
7fn testTypes(
8 Anyopaque: type,
9 Bool: type,
10 Void: type,
11 Type: type,
12 ComptimeInt: type,
13 ComptimeFloat: type,
14 Noreturn: type,
15 Null: type,
16 Undefined: type,
17 EnumLiteral: type,
18) void {
19 _ = Anyopaque;
20 _ = Bool;
21 _ = Void;
22 _ = Type;
23 _ = ComptimeInt;
24 _ = ComptimeFloat;
25 _ = Noreturn;
26 _ = Null;
27 _ = Undefined;
28 _ = EnumLiteral;
29}
30pub fn main() void {
31 testTypes(
32 anyopaque,
33 bool,
34 void,
35 type,
36 comptime_int,
37 comptime_float,
38 noreturn,
39 @TypeOf(null),
40 @TypeOf(undefined),
41 @EnumLiteral(),
42 );
43}
44#}
45#update
46#check lldb {
47(lldb) breakpoint set --file types.zig --source-pattern-regexp '_ = Undefined;'
48Breakpoint 1: where = types`types.testTypes#... + #... at types.zig:23:1, address = 0x#...
49(lldb) process launch
50Process #... launched: '#.../types' (#...)
51Process #... stopped
52* thread #1, name = 'types', stop reason = breakpoint 1.1
53 frame #0: types`types.testTypes#...(anyopaque=anyopaque, bool=bool, void=void, type=type, comptime_int=comptime_int, comptime_float=comptime_float, noreturn=noreturn, @TypeOf(null)=@TypeOf(null), @TypeOf(undefined)=@TypeOf(undefined), @EnumLiteral()=@EnumLiteral()) at types.zig:23:1
54(lldb) frame variable --show-all-children --show-types -- Anyopaque Bool Void Type ComptimeInt ComptimeFloat Noreturn Null Undefined EnumLiteral
55(type) Anyopaque = anyopaque
56(type) Bool = bool
57(type) Void = void
58(type) Type = type
59(type) ComptimeInt = comptime_int
60(type) ComptimeFloat = comptime_float
61(type) Noreturn = noreturn
62(type) Null = @TypeOf(null)
63(type) Undefined = @TypeOf(undefined)
64(type) EnumLiteral = @EnumLiteral()
65(lldb) breakpoint delete --force 1
661 breakpoints deleted; 0 breakpoint locations disabled.
67#}
test/debugger/unions created+90
......@@ -0,0 +1,90 @@
1#todo {
2passes, but prints errors
3#}
4#skip x86_64-linux-none-whole-selfhosted-new-nopic
5#skip x86_64-linux-none-whole-selfhosted-new-pic
6#skip x86_64-linux-none-incremental-selfhosted-new-nopic
7#skip x86_64-linux-none-incremental-selfhosted-new-pic
8
9#exe {
10--name unions
11-Mroot=unions.zig
12#}
13
14#write unions.zig {
15const Unions = struct {
16 const Enum = enum { first, second, third };
17 const Untagged = extern union {
18 u32: u32,
19 i32: i32,
20 f32: f32,
21 };
22 const SafetyTagged = union {
23 void: void,
24 en: Enum,
25 eu: error{Error}!Enum,
26 };
27 const Tagged = union(enum) {
28 void: void,
29 en: Enum,
30 eu: error{Error}!Enum,
31 };
32
33 untagged: Untagged = .{ .f32 = -1.5 },
34 safety_tagged: SafetyTagged = .{ .en = .second },
35 tagged: Tagged = .{ .eu = error.Error },
36};
37fn testUnions(unions: Unions) void {
38 _ = unions;
39}
40pub fn main() void {
41 testUnions(.{});
42}
43#}
44#update
45#check lldb {
46(lldb) breakpoint set --file unions.zig --source-pattern-regexp '_ = unions;'
47Breakpoint 1: where = unions`unions.testUnions + #... at unions.zig:25:1, address = 0x#...
48(lldb) process launch
49Process #... launched: '#.../unions' (#...)
50Process #... stopped
51* thread #1, name = 'unions', stop reason = breakpoint 1.1
52 frame #0: unions`unions.testUnions(unions=Unions @ 0x#...) at unions.zig:25:1
53(lldb) expression --show-types -- Unions
54(type) $0 = struct {
55 (type) Untagged = union {}
56 (type) SafetyTagged = union(enum) {
57 (@typeInfo(unions.Unions.SafetyTagged).@"union".tag_type.?) void = .void
58 (@typeInfo(unions.Unions.SafetyTagged).@"union".tag_type.?) en = .en
59 (@typeInfo(unions.Unions.SafetyTagged).@"union".tag_type.?) eu = .eu
60 }
61 (type) Enum = enum {
62 (root.unions.Unions.Enum) first = .first
63 (root.unions.Unions.Enum) second = .second
64 (root.unions.Unions.Enum) third = .third
65 }
66 (type) Tagged = union(enum) {
67 (@typeInfo(unions.Unions.Tagged).@"union".tag_type.?) void = .void
68 (@typeInfo(unions.Unions.Tagged).@"union".tag_type.?) en = .en
69 (@typeInfo(unions.Unions.Tagged).@"union".tag_type.?) eu = .eu
70 }
71}
72(lldb) frame variable --show-all-children --show-types -- unions
73(root.unions.Unions) unions = {
74 (root.unions.Unions.Untagged) .untagged = {
75 (u32) .u32 = 3217031168
76 (i32) .i32 = -1077936128
77 (f32) .f32 = -1.5
78 }
79 (root.unions.Unions.SafetyTagged) .safety_tagged = {
80 (root.unions.Unions.Enum) .en = .second
81 }
82 (root.unions.Unions.Tagged) .tagged = {
83 (error{Error}!root.unions.Unions.Enum) .eu = {
84 (error{Error}) .error = error.Error
85 }
86 }
87}
88(lldb) breakpoint delete --force 1
891 breakpoints deleted; 0 breakpoint locations disabled.
90#}
test/src/Debugger.zig deleted-2468
......@@ -1,2468 +0,0 @@
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 }, // passes, but prints errors
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 .{},
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 .{},
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 .{},
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 .{},
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");
test/src/Runner.zig+408-126
......@@ -1,10 +1,11 @@
11const assert = std.debug.assert;
2const builtin = @import("builtin");
23const std = @import("std");
34const Runner = @This();
4const zig_version_string = @import("builtin").zig_version_string;
55
66gpa: std.mem.Allocator,
77arena: *std.heap.ArenaAllocator,
8environ_map: std.process.Environ.Map,
89io: std.Io,
910prog_node: std.Progress.Node,
1011args: Args,
......@@ -23,12 +24,17 @@ const Args = struct {
2324 src_dir: ?std.Io.Dir,
2425 targets: std.ArrayList(u32),
2526 target_bytes: std.ArrayList(u8),
27
2628 libc_runtimes_dir: ?std.Io.Dir,
2729 enable_darling: bool,
2830 enable_qemu: bool,
2931 enable_rosetta: bool,
3032 enable_wasmtime: bool,
3133 enable_wine: bool,
34
35 gdb_exe: ?std.Io.File,
36 lldb_exe: ?std.Io.File,
37
3238 quiet: bool,
3339
3440 fn deinit(args: *Args, gpa: std.mem.Allocator) void {
......@@ -46,6 +52,7 @@ const Args = struct {
4652};
4753
4854fn deinit(runner: *Runner) void {
55 runner.environ_map.deinit();
4956 runner.prog_node.end();
5057 runner.args.deinit(runner.gpa);
5158 runner.eb_wip.deinit();
......@@ -69,7 +76,7 @@ pub const ProtocolError = error{
6976 ServerEndOfStream,
7077} || FailError;
7178pub fn runServer(runner: *Runner) ProtocolError {
72 runner.server.serveStringMessage(.zig_version, zig_version_string) catch |err| switch (err) {
79 runner.server.serveStringMessage(.zig_version, builtin.zig_version_string) catch |err| switch (err) {
7380 error.WriteFailed => return error.ServerWriteFailed,
7481 };
7582 while (true) {
......@@ -92,20 +99,22 @@ pub fn runServer(runner: *Runner) ProtocolError {
9299 @"--src",
93100 @"--target",
94101 @"--libc-runtimes",
102 @"--gdb",
103 @"--lldb",
95104 };
96105 var state: State = .positional;
97 const state_expected: std.enums.EnumArray(State, enum {
98 path,
99 dir,
100 file,
101 string,
102 }) = .init(.{
106 const state_expected: std.enums.EnumArray(
107 State,
108 enum { path, dir, file, string },
109 ) = .init(.{
103110 .positional = .path,
104111 .@"--zig" = .file,
105112 .@"--lib" = .dir,
106113 .@"--src" = .dir,
107114 .@"--target" = .string,
108115 .@"--libc-runtimes" = .dir,
116 .@"--gdb" = .file,
117 .@"--lldb" = .file,
109118 });
110119 var input_dir: std.zig.Server.Message.InputDir = .cwd;
111120 var args_body_offset: usize = 0;
......@@ -137,6 +146,12 @@ pub fn runServer(runner: *Runner) ProtocolError {
137146 runner.args.enable_wasmtime = true;
138147 } else if (std.mem.eql(u8, string, "-fwine")) {
139148 runner.args.enable_wine = true;
149 } else if (std.mem.eql(u8, string, "--gdb")) {
150 state = .@"--gdb";
151 continue;
152 } else if (std.mem.eql(u8, string, "--lldb")) {
153 state = .@"--lldb";
154 continue;
140155 } else if (std.mem.eql(u8, string, "--quiet")) {
141156 runner.args.quiet = true;
142157 },
......@@ -160,6 +175,10 @@ pub fn runServer(runner: *Runner) ProtocolError {
160175 .@"--src"
161176 else if (std.mem.eql(u8, string, "--libc-runtimes="))
162177 .@"--libc-runtimes"
178 else if (std.mem.eql(u8, string, "--gdb="))
179 .@"--gdb"
180 else if (std.mem.eql(u8, string, "--lldb="))
181 .@"--lldb"
163182 else
164183 return runner.fail("unsupported arg prefix: {q}", .{string});
165184 continue;
......@@ -270,6 +289,20 @@ pub fn runServer(runner: *Runner) ProtocolError {
270289 );
271290 runner.args.zig_exe = file;
272291 },
292 .@"--gdb" => {
293 if (runner.args.gdb_exe != null) return runner.fail(
294 "\"{t}\" specified multiple times",
295 .{state},
296 );
297 runner.args.gdb_exe = file;
298 },
299 .@"--lldb" => {
300 if (runner.args.lldb_exe != null) return runner.fail(
301 "\"{t}\" specified multiple times",
302 .{state},
303 );
304 runner.args.lldb_exe = file;
305 },
273306 else => return runner.fail(
274307 "\"{t}\" expected {t}, got {t}",
275308 .{ state, state_expected.get(state), arg },
......@@ -746,20 +779,24 @@ fn handleCommand(
746779 .lib => .Lib,
747780 .obj => .Obj,
748781 }, contents_r, target: {
749 const backend_split = std.mem.findScalarLast(u8, update.target_query, '-') orelse
750 return runner.fail("target {q} missing query", .{update.target_query});
751 const mode_split =
752 std.mem.findScalarLast(u8, update.target_query[0..backend_split], '-') orelse
753 return runner.fail("target {q} missing mode", .{update.target_query});
754 const triple = update.target_query[0..mode_split];
755 const backend_str = update.target_query[backend_split + 1 ..];
782 var component_it = std.mem.splitBackwardsScalar(u8, update.target_query, '-');
783 const pic_str = component_it.next() orelse
784 return runner.fail("target {q} missing pic", .{update.target_query});
785 const pic = std.meta.stringToEnum(Compiler.Target.Pic, pic_str) orelse
786 return runner.fail("target {q} unknown pic {q}", .{ update.target_query, pic_str });
787 const linker_str = component_it.next() orelse
788 return runner.fail("target {q} missing linker", .{update.target_query});
789 const linker = std.meta.stringToEnum(Compiler.Target.Linker, linker_str) orelse
790 return runner.fail("target {q} unknown linker {q}", .{ update.target_query, linker_str });
791 const backend_str = component_it.next() orelse
792 return runner.fail("target {q} missing backend", .{update.target_query});
756793 const backend = std.meta.stringToEnum(Compiler.Target.Backend, backend_str) orelse
757 return runner.fail("target {q} unknown backend {q}", .{
758 update.target_query, backend_str,
759 });
760 const mode_str = update.target_query[mode_split + 1 .. backend_split];
761 const mode = std.meta.stringToEnum(Compiler.Target.Mode, mode_str) orelse
762 return runner.fail("target {q} unknown mode {q}", .{ update.target_query, mode_str });
794 return runner.fail("target {q} unknown backend {q}", .{ update.target_query, backend_str });
795 const cache_mode_str = component_it.next() orelse
796 return runner.fail("target {q} missing cache mode", .{update.target_query});
797 const cache_mode = std.meta.stringToEnum(Compiler.Target.CacheMode, cache_mode_str) orelse
798 return runner.fail("target {q} unknown cache mode {q}", .{ update.target_query, cache_mode_str });
799 const triple = component_it.rest();
763800 break :target .{
764801 .triple = triple,
765802 .resolved = std.zig.system.resolveTargetQuery(
......@@ -779,8 +816,10 @@ fn handleCommand(
779816 error.Canceled => |e| return e,
780817 else => |e| return runner.fail("unable to resolve target {q}: {t}", .{ triple, e }),
781818 },
782 .mode = mode,
819 .cache_mode = cache_mode,
783820 .backend = backend,
821 .linker = linker,
822 .pic = pic,
784823 };
785824 }) catch |err| switch (err) {
786825 error.Canceled, error.OutOfMemory, error.AlreadyReported => |e| return e,
......@@ -925,7 +964,7 @@ fn handleCommand(
925964 ),
926965 };
927966 },
928 .stdout, .exit, .lldb => if (eb.errorMessageCount() > 0) {
967 .stdout, .exit, .gdb, .lldb => if (eb.errorMessageCount() > 0) {
929968 eb.renderToStderr(runner.io, .{}, .auto) catch |err| switch (err) {
930969 error.Canceled => {},
931970 else => {},
......@@ -989,7 +1028,7 @@ fn spawnCompiler(
9891028 "--cache-dir",
9901029 ".zig-cache",
9911030 });
992 switch (target.mode) {
1031 switch (target.cache_mode) {
9931032 .whole => {},
9941033 .incremental => try argv.append(gpa, "-fincremental"),
9951034 }
......@@ -1005,7 +1044,19 @@ fn spawnCompiler(
10051044 error.Canceled => |e| return e,
10061045 else => |e| return runner.fail("unable to get lib path: {t}", .{e}),
10071046 }] });
1047 switch (target.linker) {
1048 .lld => try argv.appendSlice(gpa, &.{ "-flld", "-fno-new-linker" }),
1049 .old => try argv.appendSlice(gpa, &.{ "-fno-lld", "-fno-new-linker" }),
1050 .new => try argv.appendSlice(gpa, &.{ "-fno-lld", "-fnew-linker" }),
1051 }
1052 switch (target.pic) {
1053 .nopic => try argv.appendSlice(gpa, &.{ "-fno-PIC", "-fno-PIE" }),
1054 .pic => try argv.appendSlice(gpa, &.{ "-fPIC", "-fno-PIE" }),
1055 .pie => try argv.appendSlice(gpa, &.{ "-fPIC", "-fPIE" }),
1056 }
1057
10081058 var need: usize = 1;
1059 var state: enum { positional, @"--name" } = .positional;
10091060 var root_name: ?[]const u8 = null;
10101061 while (true) {
10111062 const done = if (args_r.fill(need)) false else |err| switch (err) {
......@@ -1017,10 +1068,18 @@ fn spawnCompiler(
10171068 const end = std.mem.findAnyPos(u8, buffered, start, "\n ") orelse buffered.len;
10181069 if (end - start > 0) {
10191070 const arg = try arena.dupe(u8, buffered[start..end]);
1020 if (std.mem.cutPrefix(u8, arg, "-M")) |module| {
1021 var module_name_it = std.mem.splitScalar(u8, module, '=');
1022 const module_name = module_name_it.next().?;
1023 root_name = root_name orelse module_name;
1071 switch (state) {
1072 .positional => if (std.mem.eql(u8, arg, "--name")) {
1073 state = .@"--name";
1074 } else if (std.mem.cutPrefix(u8, arg, "-M")) |module| {
1075 var module_name_it = std.mem.splitScalar(u8, module, '=');
1076 const module_name = module_name_it.next().?;
1077 root_name = root_name orelse module_name;
1078 },
1079 .@"--name" => {
1080 root_name = arg;
1081 state = .positional;
1082 },
10241083 }
10251084 try argv.append(gpa, arg);
10261085 args_r.toss(end);
......@@ -1101,13 +1160,12 @@ const Compiler = struct {
11011160 const Target = struct {
11021161 triple: []const u8,
11031162 resolved: std.Target,
1104 mode: Mode,
1163 cache_mode: CacheMode,
11051164 backend: ?Backend,
1165 linker: Linker,
1166 pic: Pic,
11061167
1107 const Mode = enum {
1108 whole,
1109 incremental,
1110 };
1168 const CacheMode = enum { whole, incremental };
11111169
11121170 const Backend = enum {
11131171 /// Run semantic analysis only. Runtime output will not be tested, but we still verify
......@@ -1123,6 +1181,10 @@ const Compiler = struct {
11231181 /// Corresponds to `-ofmt=c`.
11241182 cbe,
11251183 };
1184
1185 const Linker = enum { old, new, lld };
1186
1187 const Pic = enum { nopic, pic, pie };
11261188 };
11271189
11281190 fn receiveMessage(comp: *Compiler) FailError!?struct {
......@@ -1153,7 +1215,7 @@ const Compiler = struct {
11531215 return .{ .tag = header.tag, .body = body };
11541216 }
11551217
1156 const Check = enum { errors, stdout, exit, lldb };
1218 const Check = enum { errors, stdout, exit, gdb, lldb };
11571219 fn checkSuccess(
11581220 comp: *Compiler,
11591221 check: Check,
......@@ -1167,22 +1229,91 @@ const Compiler = struct {
11671229 const io = runner.io;
11681230 const target = &comp.target.resolved;
11691231 const config = &comp.config.?;
1170 const out_dir = ".zig-cache" ++ std.Io.Dir.path.sep_str ++
1232 var path_buffer: [std.Io.Dir.max_path_bytes]u8 = undefined;
1233
1234 // After a failure while running a script, the debugger starts accepting commands from stdin, and
1235 // because it is empty, the debugger exits normally with status 0. Choose a non-zero status to
1236 // return from the debugger script instead to detect it running to completion and indicate success.
1237 const debug_success = 99;
1238
1239 const tmp_dir_path = ".zig-cache" ++ std.Io.Dir.path.sep_str ++ "tmp";
1240 src_dir.createDirPath(io, tmp_dir_path) catch |err| switch (err) {
1241 error.Canceled => |e| return e,
1242 else => |e| return runner.fail("unable to create dir path {q}: {t}", .{
1243 tmp_dir_path, e,
1244 }),
1245 };
1246
1247 var argv: std.ArrayList([]const u8) = .initBuffer(try arena.alloc([]const u8, 5 + 4));
1248 var environ_map: std.process.Environ.Map = .init(gpa);
1249 defer environ_map.deinit();
1250 try environ_map.putAll(&runner.environ_map);
1251 var script_buffer: [512]u8 = undefined;
1252 const script_path, const script_file, var script_fw = script: switch (check) {
1253 .errors => return,
1254 .stdout, .exit => .{ undefined, null, undefined },
1255 .gdb => {
1256 const script_path = tmp_dir_path ++ std.Io.Dir.path.sep_str ++ "gdb";
1257 argv.appendSliceAssumeCapacity(&.{ "gdb", "--batch", "--command", script_path, "--args" });
1258 const script_file = src_dir.createFile(io, script_path, .{}) catch |err| switch (err) {
1259 error.Canceled => |e| return e,
1260 else => |e| return runner.fail("unable to create debugger script {q}: {t}", .{
1261 script_path, e,
1262 }),
1263 };
1264 errdefer script_file.close(io);
1265 var script_fw = script_file.writer(io, &script_buffer);
1266 script_fw.interface.writeAll(
1267 \\set remotetimeout 0
1268 \\
1269 \\
1270 ) catch |err| switch (err) {
1271 error.WriteFailed => switch (script_fw.err.?) {
1272 error.Canceled => |e| return e,
1273 else => |e| return runner.fail("unable to write debugger script {q}: {t}", .{ script_path, e }),
1274 },
1275 };
1276 break :script .{ script_path, script_file, script_fw };
1277 },
1278 .lldb => {
1279 const script_path = tmp_dir_path ++ std.Io.Dir.path.sep_str ++ "lldb";
1280 argv.appendSliceAssumeCapacity(&.{ "lldb", "--batch", "--source", script_path, "--" });
1281 try environ_map.put("LANG", "C.UTF-8"); // affects output formatting
1282 const script_file = src_dir.createFile(io, script_path, .{}) catch |err| switch (err) {
1283 error.Canceled => |e| return e,
1284 else => |e| return runner.fail("unable to create debugger script {q}: {t}", .{
1285 script_path,
1286 e,
1287 }),
1288 };
1289 errdefer script_file.close(io);
1290 var script_fw = script_file.writer(io, &script_buffer);
1291 script_fw.interface.writeAll(
1292 \\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'
1293 \\settings set plugin.process.gdb-remote.packet-timeout 0
1294 \\settings set stop-line-count-after 0
1295 \\settings set stop-line-count-before 0
1296 \\
1297 ) catch |err| switch (err) {
1298 error.WriteFailed => switch (script_fw.err.?) {
1299 error.Canceled => |e| return e,
1300 else => |e| return runner.fail("unable to write debugger script {q}: {t}", .{ script_path, e }),
1301 },
1302 };
1303 break :script .{ script_path, script_file, script_fw };
1304 },
1305 };
1306 defer if (script_file) |file| file.close(io);
1307
1308 const out_dir_path = ".zig-cache" ++ std.Io.Dir.path.sep_str ++
11711309 "o" ++ std.Io.Dir.path.sep_str ++ std.Build.Cache.binToHex(digest.*);
1172 const out_path = try std.Io.Dir.path.join(arena, &.{ out_dir, comp.out_name });
1310 const out_path = try std.Io.Dir.path.join(arena, &.{ out_dir_path, comp.out_name });
11731311 const bin_path = switch (comp.target.backend.?) {
11741312 .sema => return,
11751313 .selfhosted, .llvm => out_path,
11761314 .cbe => try comp.compileC(src_dir, out_path),
11771315 };
1178 switch (check) {
1179 .errors => return,
1180 .stdout, .exit, .lldb => {},
1181 }
11821316
1183 var argv: std.ArrayList([]const u8) = .initBuffer(try arena.alloc([]const u8, 4));
1184 var environ_map: std.process.Environ.Map = .init(gpa);
1185 defer environ_map.deinit();
11861317 const need_cross_libc =
11871318 target.os.tag == .linux and config.flags.link_libc and config.flags.link_mode == .dynamic;
11881319 const use_executor = use_executor: switch (std.zig.system.getExternalExecutor(io, target, .{
......@@ -1210,9 +1341,8 @@ const Compiler = struct {
12101341 if (need_cross_libc) {
12111342 const libc_runtimes_dir = runner.args.libc_runtimes_dir orelse
12121343 continue :use_executor .bad_os_or_cpu;
1213 var path_buffer: [std.Io.Dir.max_path_bytes]u8 = undefined;
12141344 const libc_runtimes_path = path_buffer[0 .. libc_runtimes_dir.realPath(
1215 runner.io,
1345 io,
12161346 &path_buffer,
12171347 ) catch |err| switch (err) {
12181348 error.Canceled => |e| return e,
......@@ -1252,6 +1382,18 @@ const Compiler = struct {
12521382 };
12531383 argv.appendAssumeCapacity(bin_path);
12541384
1385 if (!runner.args.quiet) std.log.info("{f}", .{std.zig.SubprocessCommand{
1386 .argv = argv.items,
1387 .cwd = cwd_path: {
1388 break :cwd_path path_buffer[0 .. src_dir.realPath(io, &path_buffer) catch |err| switch (err) {
1389 error.Canceled => |e| return e,
1390 else => break :cwd_path null,
1391 }];
1392 },
1393 .parent_env = &runner.environ_map,
1394 .child_env = &environ_map,
1395 }});
1396
12551397 var name_buffer: [std.Progress.Node.max_name_len]u8 = undefined;
12561398 const run_prog_node = runner.prog_node.start(std.mem.print(&name_buffer, "run {s}", .{
12571399 comp.out_name,
......@@ -1263,81 +1405,158 @@ const Compiler = struct {
12631405 else => |e| return runner.fail("unable to open {q}: {t}", .{ bin_path, e }),
12641406 };
12651407 defer bin_file.close(io);
1266 switch (check) {
1267 .errors => unreachable,
1268 .stdout, .exit => {
1269 const result = std.process.run(gpa, io, .{
1270 .exe = if (use_executor) .search else .{ .file = bin_file },
1271 .argv = argv.items,
1272 .cwd = .{ .dir = src_dir },
1273 .environ_map = &environ_map,
1274 .progress_node = run_prog_node,
1275 }) catch |err| if (use_executor) {
1276 // Chances are the foreign executor isn't available. Skip this evaluation.
1277 if (!runner.args.quiet) std.log.warn(
1278 "skipping execution of {q} via executor for foreign target {q}: {t}",
1279 .{ bin_path, comp.target.triple, err },
1280 );
1281 return;
1282 } else return runner.fail("unable to run the generated executable {q}: {t}", .{
1283 bin_path, err,
1284 });
1285 defer {
1286 gpa.free(result.stdout);
1287 gpa.free(result.stderr);
1288 }
1289 switch (result.term) {
1290 .exited => |code| switch (check) {
1291 .errors, .lldb => unreachable,
1292 .stdout => {
1293 if (code != 0) return runner.fail(
1294 "generated executable {q} failed with code {d}",
1295 .{ bin_path, code },
1296 );
1297 std.testing.expectEqualStrings(
1298 expected,
1299 result.stdout,
1300 ) catch |err| switch (err) {
1301 error.TestExpectedEqual => return runner.fail(
1302 "stdout did not match expected",
1303 .{},
1304 ),
1305 };
1408 const result = std.process.run(gpa, io, .{
1409 .exe = exe: switch (check) {
1410 .errors => unreachable,
1411 .stdout, .exit => if (use_executor) .search else .{ .file = bin_file },
1412 .gdb, .lldb => {
1413 if (use_executor) {
1414 if (!runner.args.quiet) std.log.warn(
1415 "skipping debugging of {q} via executor for foreign target {q}",
1416 .{ bin_path, comp.target.triple },
1417 );
1418 return;
1419 }
1420
1421 var line_it = std.mem.splitScalar(u8, expected, '\n');
1422 while (line_it.next()) |line| if (std.mem.cutPrefix(u8, line, switch (check) {
1423 else => unreachable,
1424 .gdb => "(gdb) ",
1425 .lldb => "(lldb) ",
1426 })) |cmd| script_fw.interface.print(
1427 \\{s}
1428 \\
1429 , .{cmd}) catch |err| switch (err) {
1430 error.WriteFailed => switch (script_fw.err.?) {
1431 error.Canceled => |e| return e,
1432 else => |e| return runner.fail("unable to write debugger script {q}: {t}", .{
1433 script_path, e,
1434 }),
13061435 },
1307 .exit => {
1308 var actual_code_buffer: [std.fmt.count("{d}", .{std.math.maxInt(u8)})]u8 =
1309 undefined;
1310 std.testing.expectEqualStrings(
1311 expected,
1312 std.mem.print(&actual_code_buffer, "{d}", .{code}) catch unreachable,
1313 ) catch |err| switch (err) {
1314 error.TestExpectedEqual => return runner.fail(
1315 "exit code did not match expected",
1316 .{},
1317 ),
1318 };
1436 };
1437 script_fw.interface.print(
1438 \\
1439 \\quit {d}
1440 \\
1441 , .{debug_success}) catch |err| switch (err) {
1442 error.WriteFailed => switch (script_fw.err.?) {
1443 error.Canceled => |e| return e,
1444 else => |e| return runner.fail("unable to write debugger script {q}: {t}", .{
1445 script_path, e,
1446 }),
13191447 },
1320 },
1321 .signal => |sig| return runner.fail(
1322 "generated executable {q} terminated with signal {t}",
1323 .{ bin_path, sig },
1324 ),
1325 .stopped => |sig| return runner.fail(
1326 "generated executable {q} stopped with signal {t}",
1327 .{ bin_path, sig },
1328 ),
1329 .unknown => return runner.fail(
1330 "generated executable {q} terminated unexpectedly",
1331 .{bin_path},
1332 ),
1333 }
1334 if (!use_executor and result.stderr.len > 0) {
1335 std.log.err("generated executable {q} had unexpected stderr:\n{s}", .{
1336 bin_path, result.stderr,
1337 });
1338 }
1448 };
1449 script_fw.flush() catch |err| switch (err) {
1450 error.Canceled => |e| return e,
1451 else => |e| return runner.fail("unable to write debugger script {q}: {t}", .{
1452 script_path, e,
1453 }),
1454 };
1455 break :exe .{ .file = switch (check) {
1456 else => unreachable,
1457 .gdb => runner.args.gdb_exe,
1458 .lldb => runner.args.lldb_exe,
1459 } orelse {
1460 if (!runner.args.quiet) std.log.warn(
1461 "skipping debugging of {q} because of missing \"--{t}=path/to/{[1]t}\" arg",
1462 .{ bin_path, check },
1463 );
1464 return;
1465 } };
1466 },
13391467 },
1340 .lldb => {},
1468 .argv = argv.items,
1469 .cwd = .{ .dir = src_dir },
1470 .environ_map = &environ_map,
1471 .progress_node = run_prog_node,
1472 }) catch |err| if (use_executor) {
1473 // Chances are the foreign executor isn't available. Skip this evaluation.
1474 if (!runner.args.quiet) std.log.warn(
1475 "skipping execution of {q} via executor for foreign target {q}: {t}",
1476 .{ bin_path, comp.target.triple, err },
1477 );
1478 return;
1479 } else return runner.fail("unable to run the generated executable {q}: {t}", .{
1480 bin_path, err,
1481 });
1482 defer {
1483 gpa.free(result.stdout);
1484 gpa.free(result.stderr);
1485 }
1486 switch (result.term) {
1487 .exited => |code| switch (check) {
1488 .errors => unreachable,
1489 .stdout => {
1490 if (code != 0) return runner.fail(
1491 "generated executable {q} failed with code {d}",
1492 .{ bin_path, code },
1493 );
1494 std.testing.expectEqualStrings(
1495 expected,
1496 result.stdout,
1497 ) catch |err| switch (err) {
1498 error.TestExpectedEqual => return runner.fail("stdout did not match expected", .{}),
1499 };
1500 },
1501 .exit => {
1502 var actual_code_buffer: [std.fmt.count("{d}", .{std.math.maxInt(u8)})]u8 = undefined;
1503 std.testing.expectEqualStrings(
1504 expected,
1505 std.mem.print(&actual_code_buffer, "{d}", .{code}) catch unreachable,
1506 ) catch |err| switch (err) {
1507 error.TestExpectedEqual => return runner.fail(
1508 "exit code did not match expected",
1509 .{},
1510 ),
1511 };
1512 },
1513 .gdb, .lldb => {
1514 if (code != debug_success) return runner.fail(
1515 "debugging {q} failed with code {d}",
1516 .{ bin_path, code },
1517 );
1518 var expected_match_it = std.mem.splitSequence(u8, expected, "#...");
1519 var pos: usize = 0;
1520 while (expected_match_it.next()) |expected_match| : (pos += expected_match.len) {
1521 var context_len: usize = expected_match.len;
1522 pos = while (true) : (context_len -= 1) break std.mem.findPos(
1523 u8,
1524 result.stdout,
1525 pos,
1526 expected_match[0..context_len],
1527 ) orelse continue;
1528 const actual_match = result.stdout[pos..];
1529 std.testing.expectEqualStrings(
1530 expected_match,
1531 actual_match[0..@min(actual_match.len, expected_match.len)],
1532 ) catch |err| switch (err) {
1533 error.TestExpectedEqual => {
1534 std.testing.failPrint("\n=============== full output: =========\n", .{});
1535 std.testing.failPrintWithVisibleNewlines(actual_match);
1536 std.testing.failPrint("\n======================================\n", .{});
1537 return runner.fail("stdout did not match expected", .{});
1538 },
1539 };
1540 }
1541 },
1542 },
1543 .signal => |sig| return runner.fail(
1544 "generated executable {q} terminated with signal {t}",
1545 .{ bin_path, sig },
1546 ),
1547 .stopped => |sig| return runner.fail(
1548 "generated executable {q} stopped with signal {t}",
1549 .{ bin_path, sig },
1550 ),
1551 .unknown => return runner.fail(
1552 "generated executable {q} terminated unexpectedly",
1553 .{bin_path},
1554 ),
1555 }
1556 if (!use_executor and result.stderr.len > 0) {
1557 std.log.err("generated executable {q} had unexpected stderr:\n{s}", .{
1558 bin_path, result.stderr,
1559 });
13411560 }
13421561 }
13431562
......@@ -1353,8 +1572,10 @@ const Compiler = struct {
13531572 resolved.ofmt = .default(resolved.os.tag, resolved.cpu.arch);
13541573 break :resolved resolved;
13551574 },
1356 .mode = .whole,
1575 .cache_mode = .whole,
13571576 .backend = null,
1577 .linker = .lld,
1578 .pic = parent_comp.target.pic,
13581579 }) catch |err| switch (err) {
13591580 error.Canceled, error.OutOfMemory, error.AlreadyReported => |e| return e,
13601581 error.ReadFailed => unreachable, // .fixed
......@@ -1439,14 +1660,19 @@ const ClientArgs = struct {
14391660 lib_dir: std.Io.Dir,
14401661 src_dir: std.Io.Dir,
14411662 targets: std.ArrayList([]const u8),
1442 keep_src: bool,
1663
14431664 libc_runtimes_dir: ?std.Io.Dir,
14441665 enable_darling: bool,
14451666 enable_qemu: bool,
14461667 enable_rosetta: bool,
14471668 enable_wine: bool,
14481669 enable_wasmtime: bool,
1670
1671 gdb_exe: ?std.Io.File,
1672 lldb_exe: ?std.Io.File,
1673
14491674 quiet: bool,
1675 keep_src: bool,
14501676};
14511677pub fn main(init: std.process.Init) (std.mem.Allocator.Error || std.Io.Cancelable)!u8 {
14521678 const fatal = struct {
......@@ -1461,6 +1687,8 @@ pub fn main(init: std.process.Init) (std.mem.Allocator.Error || std.Io.Cancelabl
14611687 var zig_path_arg: ?[]const u8 = null;
14621688 var lib_path_arg: ?[]const u8 = null;
14631689 var libc_runtimes_path_arg: ?[]const u8 = null;
1690 var gdb_path_arg: ?[]const u8 = null;
1691 var lldb_path_arg: ?[]const u8 = null;
14641692 var args: ClientArgs = .{
14651693 .test_file = undefined,
14661694 .test_kind = undefined,
......@@ -1468,14 +1696,19 @@ pub fn main(init: std.process.Init) (std.mem.Allocator.Error || std.Io.Cancelabl
14681696 .lib_dir = undefined,
14691697 .src_dir = undefined,
14701698 .targets = .empty,
1471 .keep_src = false,
1699
14721700 .libc_runtimes_dir = null,
14731701 .enable_darling = false,
14741702 .enable_qemu = false,
14751703 .enable_rosetta = false,
14761704 .enable_wine = false,
14771705 .enable_wasmtime = false,
1706
1707 .gdb_exe = null,
1708 .lldb_exe = null,
1709
14781710 .quiet = false,
1711 .keep_src = false,
14791712 };
14801713 defer args.targets.deinit(init.gpa);
14811714
......@@ -1490,6 +1723,10 @@ pub fn main(init: std.process.Init) (std.mem.Allocator.Error || std.Io.Cancelabl
14901723 var runner: Runner = .{
14911724 .gpa = init.gpa,
14921725 .arena = init.arena,
1726 .environ_map = init.minimal.environ.createMap(init.gpa) catch |err| switch (err) {
1727 error.OutOfMemory => |e| return e,
1728 else => |e| fatal("unable to get environment: {t}", .{e}),
1729 },
14931730 .io = init.io,
14941731 .prog_node = std.Progress.start(init.io, .{}),
14951732 .args = .{
......@@ -1500,12 +1737,17 @@ pub fn main(init: std.process.Init) (std.mem.Allocator.Error || std.Io.Cancelabl
15001737 .src_dir = null,
15011738 .targets = .empty,
15021739 .target_bytes = .empty,
1740
15031741 .libc_runtimes_dir = null,
15041742 .enable_darling = false,
15051743 .enable_qemu = false,
15061744 .enable_rosetta = false,
15071745 .enable_wasmtime = false,
15081746 .enable_wine = false,
1747
1748 .gdb_exe = null,
1749 .lldb_exe = null,
1750
15091751 .quiet = false,
15101752 },
15111753 .host = std.zig.system.resolveTargetQuery(init.io, .{}) catch |err| switch (err) {
......@@ -1555,8 +1797,6 @@ pub fn main(init: std.process.Init) (std.mem.Allocator.Error || std.Io.Cancelabl
15551797 );
15561798 } else if (std.mem.cutPrefix(u8, arg, "--target=")) |target| {
15571799 try args.targets.append(init.gpa, try arena.dupe(u8, target));
1558 } else if (std.mem.eql(u8, arg, "--keep-src")) {
1559 args.keep_src = true;
15601800 } else if (std.mem.eql(u8, arg, "--libc-runtimes")) {
15611801 libc_runtimes_path_arg = arg_it.next() orelse fatal("missing arg after {q}", .{arg});
15621802 } else if (std.mem.cutPrefix(u8, arg, "--libc-runtimes=")) |libc_runtimes_path| {
......@@ -1571,8 +1811,18 @@ pub fn main(init: std.process.Init) (std.mem.Allocator.Error || std.Io.Cancelabl
15711811 args.enable_wine = true;
15721812 } else if (std.mem.eql(u8, arg, "-fwasmtime")) {
15731813 args.enable_wasmtime = true;
1814 } else if (std.mem.eql(u8, arg, "--gdb")) {
1815 gdb_path_arg = arg_it.next() orelse fatal("missing arg after {q}", .{arg});
1816 } else if (std.mem.cutPrefix(u8, arg, "--gdb=")) |gdb_path| {
1817 gdb_path_arg = gdb_path;
1818 } else if (std.mem.eql(u8, arg, "--lldb")) {
1819 lldb_path_arg = arg_it.next() orelse fatal("missing arg after {q}", .{arg});
1820 } else if (std.mem.cutPrefix(u8, arg, "--lldb=")) |lldb_path| {
1821 lldb_path_arg = lldb_path;
15741822 } else if (std.mem.eql(u8, arg, "--quiet")) {
15751823 args.quiet = true;
1824 } else if (std.mem.eql(u8, arg, "--keep-src")) {
1825 args.keep_src = true;
15761826 } else {
15771827 if (test_path_arg) |_| fatal("unexpected arg {q}", .{arg});
15781828 test_path_arg = arg;
......@@ -1614,6 +1864,16 @@ pub fn main(init: std.process.Init) (std.mem.Allocator.Error || std.Io.Cancelabl
16141864 else => |e| fatal("unable to open {q}: {t}", .{ lib_path, e }),
16151865 };
16161866 defer if (args.libc_runtimes_dir) |libc_runtimes_dir| libc_runtimes_dir.close(init.io);
1867 if (gdb_path_arg) |gdb_path| args.gdb_exe = cwd.openFile(init.io, gdb_path, .{}) catch |err| switch (err) {
1868 error.Canceled => |e| return e,
1869 else => |e| fatal("unable to open {q}: {t}", .{ gdb_path, e }),
1870 };
1871 defer if (args.gdb_exe) |gdb_exe| gdb_exe.close(init.io);
1872 if (lldb_path_arg) |lldb_path| args.lldb_exe = cwd.openFile(init.io, lldb_path, .{}) catch |err| switch (err) {
1873 error.Canceled => |e| return e,
1874 else => |e| fatal("unable to open {q}: {t}", .{ lldb_path, e }),
1875 };
1876 defer if (args.lldb_exe) |lldb_exe| lldb_exe.close(init.io);
16171877
16181878 const src_dir_path = "src_" ++ std.fmt.hex(rand_int: {
16191879 var rand_int: u64 = undefined;
......@@ -1631,12 +1891,19 @@ pub fn main(init: std.process.Init) (std.mem.Allocator.Error || std.Io.Cancelabl
16311891 };
16321892 }
16331893
1894 var inherit_dirs: std.ArrayList(std.Io.Dir) = .initBuffer(try arena.alloc(std.Io.Dir, 3));
1895 var inherit_files: std.ArrayList(std.Io.File) = .initBuffer(try arena.alloc(std.Io.File, 4));
1896 inherit_files.appendSliceAssumeCapacity(&.{ args.test_file, args.zig_exe });
1897 inherit_dirs.appendSliceAssumeCapacity(&.{ args.lib_dir, args.src_dir });
1898 if (args.libc_runtimes_dir) |libc_runtimes_dir| inherit_dirs.appendAssumeCapacity(libc_runtimes_dir);
1899 if (args.gdb_exe) |gdb_exe| inherit_files.appendAssumeCapacity(gdb_exe);
1900 if (args.lldb_exe) |lldb_exe| inherit_files.appendAssumeCapacity(lldb_exe);
16341901 var child = std.process.spawn(init.io, .{
16351902 .argv = &.{ self, "--listen=-" },
16361903 .stdin = .pipe,
16371904 .stdout = .pipe,
1638 .inherit_dirs = &.{ args.lib_dir, args.src_dir },
1639 .inherit_files = &.{ args.zig_exe, args.test_file },
1905 .inherit_dirs = inherit_dirs.items,
1906 .inherit_files = inherit_files.items,
16401907 }) catch |err| switch (err) {
16411908 error.Canceled, error.OutOfMemory => |e| return e,
16421909 else => |e| fatal("unable to spawn runner: {t}", .{e}),
......@@ -1754,6 +2021,21 @@ fn runClient(
17542021 try argv.append(gpa, 0);
17552022 }
17562023
2024 if (args.gdb_exe) |gdb_exe| {
2025 try argv.append(gpa, @backingInt(Arg.prefix));
2026 try argv.appendSlice(gpa, "--gdb=");
2027 try argv.append(gpa, 0);
2028 try argv.append(gpa, @backingInt(Arg.input_file));
2029 try argv.appendSlice(gpa, @ptrCast(&gdb_exe.handle));
2030 }
2031 if (args.lldb_exe) |lldb_exe| {
2032 try argv.append(gpa, @backingInt(Arg.prefix));
2033 try argv.appendSlice(gpa, "--lldb=");
2034 try argv.append(gpa, 0);
2035 try argv.append(gpa, @backingInt(Arg.input_file));
2036 try argv.appendSlice(gpa, @ptrCast(&lldb_exe.handle));
2037 }
2038
17572039 if (args.quiet) {
17582040 try argv.append(gpa, @backingInt(Arg.string));
17592041 try argv.appendSlice(gpa, "--quiet");
......@@ -1803,10 +2085,10 @@ fn runClient(
18032085 else => try client.in.discardAll(hdr.bytes_len),
18042086 .zig_version => {
18052087 const actual_version = try client.in.take(hdr.bytes_len);
1806 if (!std.mem.eql(u8, zig_version_string, actual_version)) {
2088 if (!std.mem.eql(u8, builtin.zig_version_string, actual_version)) {
18072089 try stderr.print(
18082090 "error: zig version mismatch compiler test runner vs compiler: {q} vs {q}\n",
1809 .{ zig_version_string, actual_version },
2091 .{ builtin.zig_version_string, actual_version },
18102092 );
18112093 try stderr.flush();
18122094 std.process.exit(1);
test/tests.zig+84-42
......@@ -13,7 +13,6 @@ const link = @import("link.zig");
1313// Implementations
1414pub const ErrorTracesContext = @import("src/ErrorTrace.zig");
1515pub const StackTracesContext = @import("src/StackTrace.zig");
16pub const DebuggerContext = @import("src/Debugger.zig");
1716pub const LlvmIrContext = @import("src/LlvmIr.zig");
1817pub const LibcContext = @import("src/Libc.zig");
1918pub const LinkContext = @import("src/Link.zig");
......@@ -2207,17 +2206,20 @@ const link_targets = blk: {
22072206 };
22082207};
22092208
2210const IncrementalTarget = struct {
2211 target: std.Target.Query,
2212 backend: enum { selfhosted, llvm, cbe },
2213};
2214
2215/// These are passed to `incr-check` as `<target>-<backend>` strings.
2209/// These are passed to `src/Runner.zig` as `<target>-<cache_mode>-<backend>-<linker>-<pic>` strings.
22162210///
22172211/// If only one specific test is failing on a target, instead of entirely disabling the target here, you
22182212/// can skip the target for that specific test only by adding a line like this to top of the manifest:
22192213/// #skip x86_64-linux-selfhosted
2220const incremental_targets = &[_]IncrementalTarget{
2214const RunnerTarget = struct {
2215 target: std.Target.Query,
2216 cache_mode: enum { whole, incremental },
2217 backend: enum { selfhosted, llvm, cbe },
2218 linker: enum { lld, old, new },
2219 pic: enum { nopic, pic, pie },
2220};
2221
2222pub const incremental_matrix: []const RunnerTarget = &.{
22212223 // Avoid adding more CBE or LLVM targets without good reason: they're a lot slower than others
22222224 // to run due to the output (C source code or LLVM IR) being built non-incrementally (by Clang
22232225 // or LLVM). We just have a couple here to make sure that it works.
......@@ -2225,49 +2227,71 @@ const incremental_targets = &[_]IncrementalTarget{
22252227 .target = .{
22262228 .cpu_arch = .x86_64,
22272229 .os_tag = .linux,
2230 .abi = .musl,
22282231 },
2232 .cache_mode = .incremental,
22292233 .backend = .cbe,
2234 .linker = .old,
2235 .pic = .nopic,
22302236 },
22312237 .{
22322238 .target = .{
22332239 .cpu_arch = .x86_64,
22342240 .os_tag = .linux,
2241 .abi = .none,
22352242 },
2243 .cache_mode = .incremental,
22362244 .backend = .llvm,
2245 .linker = .lld,
2246 .pic = .nopic,
22372247 },
22382248
22392249 .{
22402250 .target = .{
22412251 .cpu_arch = .x86_64,
22422252 .os_tag = .linux,
2253 .abi = .none,
22432254 },
2255 .cache_mode = .incremental,
22442256 .backend = .selfhosted,
2257 .linker = .new,
2258 .pic = .nopic,
22452259 },
22462260 .{
22472261 .target = .{
22482262 .cpu_arch = .x86_64,
22492263 .os_tag = .windows,
2264 .abi = .none,
22502265 },
2266 .cache_mode = .incremental,
22512267 .backend = .selfhosted,
2268 .linker = .old,
2269 .pic = .pic,
22522270 },
22532271 .{
22542272 .target = .{
22552273 .cpu_arch = .wasm32,
22562274 .os_tag = .wasi,
2275 .abi = .none,
22572276 },
2277 .cache_mode = .incremental,
22582278 .backend = .selfhosted,
2279 .linker = .old,
2280 .pic = .nopic,
22592281 },
22602282};
22612283
2262const debugger_matrix: []const DebuggerContext.TestTarget = &.{
2284pub const debugger_matrix: []const RunnerTarget = &.{
22632285 .{
22642286 .target = .{
22652287 .cpu_arch = .x86_64,
22662288 .os_tag = .linux,
22672289 .abi = .none,
22682290 },
2269 .pic = false,
2291 .cache_mode = .whole,
2292 .backend = .selfhosted,
22702293 .linker = .old,
2294 .pic = .nopic,
22712295 },
22722296 .{
22732297 .target = .{
......@@ -2275,8 +2299,21 @@ const debugger_matrix: []const DebuggerContext.TestTarget = &.{
22752299 .os_tag = .linux,
22762300 .abi = .none,
22772301 },
2278 .pic = true,
2302 .cache_mode = .whole,
2303 .backend = .selfhosted,
22792304 .linker = .old,
2305 .pic = .pic,
2306 },
2307 .{
2308 .target = .{
2309 .cpu_arch = .x86_64,
2310 .os_tag = .linux,
2311 .abi = .none,
2312 },
2313 .cache_mode = .whole,
2314 .backend = .selfhosted,
2315 .linker = .new,
2316 .pic = .nopic,
22802317 },
22812318 .{
22822319 .target = .{
......@@ -2284,8 +2321,10 @@ const debugger_matrix: []const DebuggerContext.TestTarget = &.{
22842321 .os_tag = .linux,
22852322 .abi = .none,
22862323 },
2287 .pic = false,
2324 .cache_mode = .whole,
2325 .backend = .selfhosted,
22882326 .linker = .new,
2327 .pic = .pic,
22892328 },
22902329 .{
22912330 .target = .{
......@@ -2293,8 +2332,21 @@ const debugger_matrix: []const DebuggerContext.TestTarget = &.{
22932332 .os_tag = .linux,
22942333 .abi = .none,
22952334 },
2296 .pic = true,
2335 .cache_mode = .incremental,
2336 .backend = .selfhosted,
22972337 .linker = .new,
2338 .pic = .nopic,
2339 },
2340 .{
2341 .target = .{
2342 .cpu_arch = .x86_64,
2343 .os_tag = .linux,
2344 .abi = .none,
2345 },
2346 .cache_mode = .incremental,
2347 .backend = .selfhosted,
2348 .linker = .new,
2349 .pic = .pic,
22982350 },
22992351};
23002352
......@@ -3311,24 +3363,7 @@ pub fn addCases(
33113363 );
33123364}
33133365
3314pub fn addDebuggerTests(b: *std.Build, options: DebuggerContext.Options) ?*Step {
3315 const step = b.step("test-debugger", "Run the debugger tests");
3316 if (options.gdb == null and options.lldb == null) {
3317 step.dependOn(&b.addFail("test-debugger requires -Dgdb and/or -Dlldb").step);
3318 return null;
3319 }
3320
3321 var context: DebuggerContext = .{
3322 .b = b,
3323 .options = options,
3324 .root_step = step,
3325 .test_matrix = debugger_matrix,
3326 };
3327 context.addTests();
3328 return step;
3329}
3330
3331const IncrementalTestOptions = struct {
3366pub const RunnerOptions = struct {
33323367 test_filters: []const []const u8,
33333368 test_target_filters: []const []const u8,
33343369 skip_non_native: bool,
......@@ -3340,19 +3375,22 @@ const IncrementalTestOptions = struct {
33403375 skip_darwin: bool,
33413376 skip_linux: bool,
33423377 skip_llvm: bool,
3378 gdb: ?[]const u8,
3379 lldb: ?[]const u8,
33433380};
33443381
3345pub fn addIncrementalTests(
3382pub fn addRunnerTests(
33463383 b: *std.Build,
33473384 runner: *std.Build.Step.Compile,
3348 options: IncrementalTestOptions,
3349) !*Step {
3350 const tests_step = b.step("test-incremental", "Run the new incremental compilation test cases");
3351
3352 const tests_path = b.path("test/incremental");
3385 tests_step: *Step,
3386 tests: []const u8,
3387 matrix: []const RunnerTarget,
3388 options: RunnerOptions,
3389) !void {
3390 const tests_path = b.path(tests);
33533391 b.dependOnDirectoryContents(tests_path);
33543392
3355 var tests_dir = try b.root.openDir(b.graph.io, "test/incremental", .{ .iterate = true });
3393 var tests_dir = try b.root.openDir(b.graph.io, tests, .{ .iterate = true });
33563394 defer tests_dir.close(b.graph.io);
33573395 var test_it = tests_dir.iterate();
33583396 while (try test_it.next(b.graph.io)) |@"test"| {
......@@ -3380,7 +3418,7 @@ pub fn addIncrementalTests(
33803418 run.addPrefixedDirectoryArg("--lib=", .zig_lib);
33813419 _ = run.addPrefixedOutputDirectoryArg("--src=", "src");
33823420
3383 for (incremental_targets) |test_target| {
3421 for (matrix) |test_target| {
33843422 const resolved_target = b.resolveTargetQuery(test_target.target);
33853423
33863424 if (options.skip_non_native and !isNative(&resolved_target, &b.graph.host.result))
......@@ -3399,9 +3437,12 @@ pub fn addIncrementalTests(
33993437
34003438 if (options.skip_llvm and test_target.backend == .llvm) continue;
34013439
3402 const target_str = b.fmt("{s}-incremental-{t}", .{
3440 const target_str = b.fmt("{s}-{t}-{t}-{t}-{t}", .{
34033441 resolved_target.query.zigTriple(b.allocator) catch @panic("OOM"),
3442 test_target.cache_mode,
34043443 test_target.backend,
3444 test_target.linker,
3445 test_target.pic,
34053446 });
34063447
34073448 for (options.test_target_filters) |filter| {
......@@ -3418,12 +3459,13 @@ pub fn addIncrementalTests(
34183459 run.addThirdPartyEnabledArgWasmtime(.{ .enabled = "-fwasmtime" });
34193460 run.addThirdPartyEnabledArgWine(.{ .enabled = "-fwine" });
34203461
3462 if (options.gdb) |gdb| run.addPrefixedFileArg("--gdb=", b.graph.cwdRelativePath(gdb));
3463 if (options.lldb) |lldb| run.addPrefixedFileArg("--lldb=", b.graph.cwdRelativePath(lldb));
3464
34213465 run.addArg("--quiet"); // don't fill stderr telling us about skipped tests etc
34223466
34233467 tests_step.dependOn(&run.step);
34243468 }
3425
3426 return tests_step;
34273469}
34283470
34293471fn isEditorFileName(name: []const u8) bool {