authorgravatar for jacobly@ziglang.orgJacob Young <jacobly@ziglang.org> 2026-05-27 09:48:35-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2026-05-28 01:41:37+02:00
log2a07273224d0e81185c3ce22673e79d4438431af
tree99f93e9f36d437ce8143c11f6896710cd82bab8a
parent7b5280b687039faebfcb4d670507d0826f3ecba3

lldb: fix and test some regressions


4 files changed, 78 insertions(+), 22 deletions(-)

ci/x86_64-linux-debug-llvm.sh+1-1
......@@ -50,7 +50,7 @@ stage3-debug/bin/zig build \
5050
5151stage3-debug/bin/zig build test docs \
5252 --maxrss ${ZSF_MAX_RSS:-0} \
53 -Dlldb=$HOME/deps/lldb-zig/Debug-33ec8d3c11/bin/lldb \
53 -Dlldb=$HOME/deps/lldb-zig/Debug-ccb7ae89a9/bin/lldb \
5454 -Dlibc-test-path=$HOME/deps/libc-test-f2bac77 \
5555 -fqemu \
5656 --libc-runtimes $HOME/deps/glibc-2.43-musl-1.2.5 \
ci/x86_64-linux-debug.sh+1-1
......@@ -50,7 +50,7 @@ stage3-debug/bin/zig build \
5050stage3-debug/bin/zig build test docs \
5151 --maker-opt=Debug \
5252 --maxrss ${ZSF_MAX_RSS:-0} \
53 -Dlldb=$HOME/deps/lldb-zig/Debug-33ec8d3c11/bin/lldb \
53 -Dlldb=$HOME/deps/lldb-zig/Debug-ccb7ae89a9/bin/lldb \
5454 -fqemu \
5555 --libc-runtimes $HOME/deps/glibc-2.43-musl-1.2.5 \
5656 -fwasmtime \
ci/x86_64-linux-release.sh+1-1
......@@ -58,7 +58,7 @@ stage3-release/bin/zig build \
5858
5959stage3-release/bin/zig build test docs \
6060 --maxrss ${ZSF_MAX_RSS:-0} \
61 -Dlldb=$HOME/deps/lldb-zig/Release-33ec8d3c11/bin/lldb \
61 -Dlldb=$HOME/deps/lldb-zig/Release-ccb7ae89a9/bin/lldb \
6262 -Dlibc-test-path=$HOME/deps/libc-test-f2bac77 \
6363 -fqemu \
6464 --libc-runtimes $HOME/deps/glibc-2.43-musl-1.2.5 \
test/src/Debugger.zig+75-19
......@@ -180,6 +180,41 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {
180180 \\1 breakpoints deleted; 0 breakpoint locations disabled.
181181 },
182182 );
183 db.addLldbTest(
184 "identifiers",
185 target,
186 &.{
187 .{
188 .path = "identifiers.zig",
189 .source =
190 \\const Struct = struct { @"zwölf": u32 };
191 \\fn testIdentifiers(@"fünf": u32, @"struct": Struct) void {
192 \\ _ = @"fünf";
193 \\ _ = @"struct";
194 \\}
195 \\pub fn main() void {
196 \\ testIdentifiers(5, .{ .@"zwölf" = 12 });
197 \\}
198 ,
199 },
200 },
201 \\breakpoint set --file identifiers.zig --source-pattern-regexp '_ = @"struct";'
202 \\process launch
203 \\frame variable --show-all-children --show-types -- @\"fünf'"' '@"f\xC3\xBCnf"' '@"f\u{FC}nf"' '@"struct".@"zwölf"' '@"struct".@"zw\xC3\xB6lf"' '@"struct".@"zw\u{F6}lf"'
204 \\breakpoint delete --force 1
205 ,
206 &.{
207 \\(lldb) frame variable --show-all-children --show-types -- @\"fünf'"' '@"f\xC3\xBCnf"' '@"f\u{FC}nf"' '@"struct".@"zwölf"' '@"struct".@"zw\xC3\xB6lf"' '@"struct".@"zw\u{F6}lf"'
208 \\(u32) @"fünf" = 5
209 \\(u32) @"f\xC3\xBCnf" = 5
210 \\(u32) @"f\u{FC}nf" = 5
211 \\(u32) @"struct".@"zwölf" = 12
212 \\(u32) @"struct".@"zw\xC3\xB6lf" = 12
213 \\(u32) @"struct".@"zw\u{F6}lf" = 12
214 \\(lldb) breakpoint delete --force 1
215 \\1 breakpoints deleted; 0 breakpoint locations disabled.
216 },
217 );
183218 db.addLldbTest(
184219 "pointers",
185220 target,
......@@ -187,17 +222,16 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {
187222 .{
188223 .path = "pointers.zig",
189224 .source =
225 \\var array: [7]u32 = .{
226 \\ 3010,
227 \\ 3014,
228 \\ 3018,
229 \\ 3022,
230 \\ 3026,
231 \\ 3030,
232 \\ 3034,
233 \\};
190234 \\const Pointers = struct {
191 \\ var array: [7]u32 = .{
192 \\ 3010,
193 \\ 3014,
194 \\ 3018,
195 \\ 3022,
196 \\ 3026,
197 \\ 3030,
198 \\ 3034,
199 \\ };
200 \\
201235 \\ single: *u32 = @ptrFromInt(0x1010),
202236 \\ single_const: *const u32 = @ptrFromInt(0x1014),
203237 \\ single_volatile: *volatile u32 = @ptrFromInt(0x1018),
......@@ -229,23 +263,30 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {
229263 \\ c_volatile: [*c]volatile u32 = @ptrFromInt(0x4018),
230264 \\ c_const_volatile: [*c]const volatile u32 = @ptrFromInt(0x401c),
231265 \\};
232 \\fn testPointers(pointers: Pointers) void {
266 \\const Access = struct {
267 \\ single: *u32 = &array[0],
268 \\ many: [*]u32 = array[1..3],
269 \\ slice: []u32 = array[3..5],
270 \\ c: [*c]u32 = array[5..7],
271 \\};
272 \\fn testPointers(pointers: Pointers, access: Access) void {
233273 \\ _ = pointers;
274 \\ _ = access;
234275 \\}
235276 \\pub fn main() void {
236 \\ testPointers(.{});
277 \\ testPointers(.{}, .{});
237278 \\}
238279 \\
239280 ,
240281 },
241282 },
242 \\breakpoint set --file pointers.zig --source-pattern-regexp '_ = pointers;'
283 \\breakpoint set --file pointers.zig --source-pattern-regexp '_ = access;'
243284 \\process launch
244 \\frame variable --show-all-children --show-types -- pointers
285 \\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]
245286 \\breakpoint delete --force 1
246287 ,
247288 &.{
248 \\(lldb) frame variable --show-all-children --show-types -- pointers
289 \\(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]
249290 \\(root.pointers.Pointers) pointers = {
250291 \\ (*u32) .single = 0x0000000000001010
251292 \\ (*const u32) .single_const = 0x0000000000001014
......@@ -299,6 +340,14 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {
299340 \\ ([*c]volatile u32) .c_volatile = 0x0000000000004018
300341 \\ ([*c]const volatile u32) .c_const_volatile = 0x000000000000401c
301342 \\}
343 \\(u32) access.single.* = 3010
344 \\(u32) access.many[0] = 3014
345 \\(u32) access.many[1] = 3018
346 \\(u32) access.slice[0] = 3022
347 \\(u32) access.slice[1] = 3026
348 \\(u32) access.c.* = 3030
349 \\(u32) access.c[0] = 3030
350 \\(u32) access.c[1] = 3034
302351 \\(lldb) breakpoint delete --force 1
303352 \\1 breakpoints deleted; 0 breakpoint locations disabled.
304353 },
......@@ -534,30 +583,33 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {
534583 },
535584 \\breakpoint set --file optionals.zig --source-pattern-regexp 'maybe_u32 = 123;'
536585 \\process launch
537 \\frame variable --show-all-children -- null_u32 maybe_u32 nonnull_u32
586 \\frame variable --show-all-children -- null_u32 maybe_u32 nonnull_u32 nonnull_u32.?
538587 \\breakpoint delete --force 1
539588 \\
540589 \\breakpoint set --file optionals.zig --source-pattern-regexp 'nonnull_u32 = nonnull_u32;'
541590 \\process continue
542 \\frame variable --show-all-children --show-types -- null_u32 maybe_u32 nonnull_u32
591 \\frame variable --show-all-children --show-types -- null_u32 maybe_u32 maybe_u32.? nonnull_u32 nonnull_u32.?
543592 \\breakpoint delete --force 2
544593 ,
545594 &.{
546 \\(lldb) frame variable --show-all-children -- null_u32 maybe_u32 nonnull_u32
595 \\(lldb) frame variable --show-all-children -- null_u32 maybe_u32 nonnull_u32 nonnull_u32.?
547596 \\(?u32) null_u32 = null
548597 \\(?u32) maybe_u32 = null
549598 \\(?u32) nonnull_u32 = (nonnull_u32.? = 456)
599 \\(u32) nonnull_u32.? = 456
550600 \\(lldb) breakpoint delete --force 1
551601 \\1 breakpoints deleted; 0 breakpoint locations disabled.
552602 ,
553 \\(lldb) frame variable --show-all-children --show-types -- null_u32 maybe_u32 nonnull_u32
603 \\(lldb) frame variable --show-all-children --show-types -- null_u32 maybe_u32 maybe_u32.? nonnull_u32 nonnull_u32.?
554604 \\(?u32) null_u32 = null
555605 \\(?u32) maybe_u32 = {
556606 \\ (u32) maybe_u32.? = 123
557607 \\}
608 \\(u32) maybe_u32.? = 123
558609 \\(?u32) nonnull_u32 = {
559610 \\ (u32) nonnull_u32.? = 456
560611 \\}
612 \\(u32) nonnull_u32.? = 456
561613 \\(lldb) breakpoint delete --force 2
562614 \\1 breakpoints deleted; 0 breakpoint locations disabled.
563615 },
......@@ -2203,6 +2255,7 @@ fn addGdbTest(
22032255 name,
22042256 target,
22052257 files,
2258 &.{},
22062259 &.{
22072260 db.options.gdb orelse return,
22082261 "--batch",
......@@ -2229,6 +2282,7 @@ fn addLldbTest(
22292282 name,
22302283 target,
22312284 files,
2285 &.{.{ "LANG", "C.UTF-8" }}, // affects output formatting
22322286 &.{
22332287 db.options.lldb orelse return,
22342288 "--batch",
......@@ -2253,6 +2307,7 @@ fn addTest(
22532307 name: []const u8,
22542308 target: *const Target,
22552309 files: []const File,
2310 env: []const struct { []const u8, []const u8 },
22562311 db_argv1: []const []const u8,
22572312 db_commands: []const u8,
22582313 commands: []const u8,
......@@ -2297,6 +2352,7 @@ fn addTest(
22972352
22982353 const commands_wf = db.b.addWriteFiles();
22992354 const run = std.Build.Step.Run.create(db.b, db.b.fmt("run {s} {s}", .{ name, target.test_name_suffix }));
2355 for (env) |env_var| run.setEnvironmentVariable(env_var[0], env_var[1]);
23002356 run.addArgs(db_argv1);
23012357 run.addFileArg(commands_wf.add(
23022358 db.b.fmt("{s}.cmd", .{name}),