mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
Dwarf: implement and test segmented list
This commit is contained in:
parent
f34b198251
commit
6459212ebe
@ -1299,6 +1299,7 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void {
|
||||
\\ x = fabsf(x);
|
||||
\\ _ = &x;
|
||||
\\}
|
||||
\\
|
||||
,
|
||||
},
|
||||
},
|
||||
@ -1324,6 +1325,187 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void {
|
||||
\\1 breakpoints deleted; 0 breakpoint locations disabled.
|
||||
},
|
||||
);
|
||||
db.addLldbTest(
|
||||
"segmented_list",
|
||||
target,
|
||||
&.{
|
||||
.{
|
||||
.path = "main.zig",
|
||||
.source =
|
||||
\\const std = @import("std");
|
||||
\\fn testSegmentedList() void {}
|
||||
\\pub fn main() !void {
|
||||
\\ var list0: std.SegmentedList(usize, 0) = .{};
|
||||
\\ defer list0.deinit(std.heap.page_allocator);
|
||||
\\
|
||||
\\ var list1: std.SegmentedList(usize, 1) = .{};
|
||||
\\ defer list1.deinit(std.heap.page_allocator);
|
||||
\\
|
||||
\\ var list2: std.SegmentedList(usize, 2) = .{};
|
||||
\\ defer list2.deinit(std.heap.page_allocator);
|
||||
\\
|
||||
\\ var list4: std.SegmentedList(usize, 4) = .{};
|
||||
\\ defer list4.deinit(std.heap.page_allocator);
|
||||
\\
|
||||
\\ for (0..32) |i| {
|
||||
\\ try list0.append(std.heap.page_allocator, i);
|
||||
\\ try list1.append(std.heap.page_allocator, i);
|
||||
\\ try list2.append(std.heap.page_allocator, i);
|
||||
\\ try list4.append(std.heap.page_allocator, i);
|
||||
\\ }
|
||||
\\ testSegmentedList();
|
||||
\\}
|
||||
\\
|
||||
,
|
||||
},
|
||||
},
|
||||
\\breakpoint set --file main.zig --source-pattern-regexp 'testSegmentedList\(\);'
|
||||
\\process launch
|
||||
\\frame variable list0 list1 list2 list4
|
||||
\\breakpoint delete --force 1
|
||||
,
|
||||
&.{
|
||||
\\(lldb) frame variable list0 list1 list2 list4
|
||||
\\(std.segmented_list.SegmentedList(usize,0)) list0 = len=32 {
|
||||
\\ [0] = 0
|
||||
\\ [1] = 1
|
||||
\\ [2] = 2
|
||||
\\ [3] = 3
|
||||
\\ [4] = 4
|
||||
\\ [5] = 5
|
||||
\\ [6] = 6
|
||||
\\ [7] = 7
|
||||
\\ [8] = 8
|
||||
\\ [9] = 9
|
||||
\\ [10] = 10
|
||||
\\ [11] = 11
|
||||
\\ [12] = 12
|
||||
\\ [13] = 13
|
||||
\\ [14] = 14
|
||||
\\ [15] = 15
|
||||
\\ [16] = 16
|
||||
\\ [17] = 17
|
||||
\\ [18] = 18
|
||||
\\ [19] = 19
|
||||
\\ [20] = 20
|
||||
\\ [21] = 21
|
||||
\\ [22] = 22
|
||||
\\ [23] = 23
|
||||
\\ [24] = 24
|
||||
\\ [25] = 25
|
||||
\\ [26] = 26
|
||||
\\ [27] = 27
|
||||
\\ [28] = 28
|
||||
\\ [29] = 29
|
||||
\\ [30] = 30
|
||||
\\ [31] = 31
|
||||
\\}
|
||||
\\(std.segmented_list.SegmentedList(usize,1)) list1 = len=32 {
|
||||
\\ [0] = 0
|
||||
\\ [1] = 1
|
||||
\\ [2] = 2
|
||||
\\ [3] = 3
|
||||
\\ [4] = 4
|
||||
\\ [5] = 5
|
||||
\\ [6] = 6
|
||||
\\ [7] = 7
|
||||
\\ [8] = 8
|
||||
\\ [9] = 9
|
||||
\\ [10] = 10
|
||||
\\ [11] = 11
|
||||
\\ [12] = 12
|
||||
\\ [13] = 13
|
||||
\\ [14] = 14
|
||||
\\ [15] = 15
|
||||
\\ [16] = 16
|
||||
\\ [17] = 17
|
||||
\\ [18] = 18
|
||||
\\ [19] = 19
|
||||
\\ [20] = 20
|
||||
\\ [21] = 21
|
||||
\\ [22] = 22
|
||||
\\ [23] = 23
|
||||
\\ [24] = 24
|
||||
\\ [25] = 25
|
||||
\\ [26] = 26
|
||||
\\ [27] = 27
|
||||
\\ [28] = 28
|
||||
\\ [29] = 29
|
||||
\\ [30] = 30
|
||||
\\ [31] = 31
|
||||
\\}
|
||||
\\(std.segmented_list.SegmentedList(usize,2)) list2 = len=32 {
|
||||
\\ [0] = 0
|
||||
\\ [1] = 1
|
||||
\\ [2] = 2
|
||||
\\ [3] = 3
|
||||
\\ [4] = 4
|
||||
\\ [5] = 5
|
||||
\\ [6] = 6
|
||||
\\ [7] = 7
|
||||
\\ [8] = 8
|
||||
\\ [9] = 9
|
||||
\\ [10] = 10
|
||||
\\ [11] = 11
|
||||
\\ [12] = 12
|
||||
\\ [13] = 13
|
||||
\\ [14] = 14
|
||||
\\ [15] = 15
|
||||
\\ [16] = 16
|
||||
\\ [17] = 17
|
||||
\\ [18] = 18
|
||||
\\ [19] = 19
|
||||
\\ [20] = 20
|
||||
\\ [21] = 21
|
||||
\\ [22] = 22
|
||||
\\ [23] = 23
|
||||
\\ [24] = 24
|
||||
\\ [25] = 25
|
||||
\\ [26] = 26
|
||||
\\ [27] = 27
|
||||
\\ [28] = 28
|
||||
\\ [29] = 29
|
||||
\\ [30] = 30
|
||||
\\ [31] = 31
|
||||
\\}
|
||||
\\(std.segmented_list.SegmentedList(usize,4)) list4 = len=32 {
|
||||
\\ [0] = 0
|
||||
\\ [1] = 1
|
||||
\\ [2] = 2
|
||||
\\ [3] = 3
|
||||
\\ [4] = 4
|
||||
\\ [5] = 5
|
||||
\\ [6] = 6
|
||||
\\ [7] = 7
|
||||
\\ [8] = 8
|
||||
\\ [9] = 9
|
||||
\\ [10] = 10
|
||||
\\ [11] = 11
|
||||
\\ [12] = 12
|
||||
\\ [13] = 13
|
||||
\\ [14] = 14
|
||||
\\ [15] = 15
|
||||
\\ [16] = 16
|
||||
\\ [17] = 17
|
||||
\\ [18] = 18
|
||||
\\ [19] = 19
|
||||
\\ [20] = 20
|
||||
\\ [21] = 21
|
||||
\\ [22] = 22
|
||||
\\ [23] = 23
|
||||
\\ [24] = 24
|
||||
\\ [25] = 25
|
||||
\\ [26] = 26
|
||||
\\ [27] = 27
|
||||
\\ [28] = 28
|
||||
\\ [29] = 29
|
||||
\\ [30] = 30
|
||||
\\ [31] = 31
|
||||
\\}
|
||||
\\(lldb) breakpoint delete --force 1
|
||||
\\1 breakpoints deleted; 0 breakpoint locations disabled.
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
const File = struct { import: ?[]const u8 = null, path: []const u8, source: []const u8 };
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user