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 \...@@ -50,7 +50,7 @@ stage3-debug/bin/zig build \
5050
51stage3-debug/bin/zig build test docs \51stage3-debug/bin/zig build test docs \
52 --maxrss ${ZSF_MAX_RSS:-0} \52 --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 \
54 -Dlibc-test-path=$HOME/deps/libc-test-f2bac77 \54 -Dlibc-test-path=$HOME/deps/libc-test-f2bac77 \
55 -fqemu \55 -fqemu \
56 --libc-runtimes $HOME/deps/glibc-2.43-musl-1.2.5 \56 --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 \...@@ -50,7 +50,7 @@ stage3-debug/bin/zig build \
50stage3-debug/bin/zig build test docs \50stage3-debug/bin/zig build test docs \
51 --maker-opt=Debug \51 --maker-opt=Debug \
52 --maxrss ${ZSF_MAX_RSS:-0} \52 --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 \
54 -fqemu \54 -fqemu \
55 --libc-runtimes $HOME/deps/glibc-2.43-musl-1.2.5 \55 --libc-runtimes $HOME/deps/glibc-2.43-musl-1.2.5 \
56 -fwasmtime \56 -fwasmtime \
ci/x86_64-linux-release.sh+1-1
...@@ -58,7 +58,7 @@ stage3-release/bin/zig build \...@@ -58,7 +58,7 @@ stage3-release/bin/zig build \
5858
59stage3-release/bin/zig build test docs \59stage3-release/bin/zig build test docs \
60 --maxrss ${ZSF_MAX_RSS:-0} \60 --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 \
62 -Dlibc-test-path=$HOME/deps/libc-test-f2bac77 \62 -Dlibc-test-path=$HOME/deps/libc-test-f2bac77 \
63 -fqemu \63 -fqemu \
64 --libc-runtimes $HOME/deps/glibc-2.43-musl-1.2.5 \64 --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 {...@@ -180,6 +180,41 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {
180 \\1 breakpoints deleted; 0 breakpoint locations disabled.180 \\1 breakpoints deleted; 0 breakpoint locations disabled.
181 },181 },
182 );182 );
183 db.addLldbTest(
184 "identifiers",
185 target,
186 &.{
187 .{
188 .path = "identifiers.zig",
189 .source =
190 \\const Struct = struct { @"zwölf": u32 };
191 \\fn testIdentifiers(@"fünf": u32, @"struct": Struct) void {
192 \\ _ = @"fünf";
193 \\ _ = @"struct";
194 \\}
195 \\pub fn main() void {
196 \\ testIdentifiers(5, .{ .@"zwölf" = 12 });
197 \\}
198 ,
199 },
200 },
201 \\breakpoint set --file identifiers.zig --source-pattern-regexp '_ = @"struct";'
202 \\process launch
203 \\frame variable --show-all-children --show-types -- @\"fünf'"' '@"f\xC3\xBCnf"' '@"f\u{FC}nf"' '@"struct".@"zwölf"' '@"struct".@"zw\xC3\xB6lf"' '@"struct".@"zw\u{F6}lf"'
204 \\breakpoint delete --force 1
205 ,
206 &.{
207 \\(lldb) frame variable --show-all-children --show-types -- @\"fünf'"' '@"f\xC3\xBCnf"' '@"f\u{FC}nf"' '@"struct".@"zwölf"' '@"struct".@"zw\xC3\xB6lf"' '@"struct".@"zw\u{F6}lf"'
208 \\(u32) @"fünf" = 5
209 \\(u32) @"f\xC3\xBCnf" = 5
210 \\(u32) @"f\u{FC}nf" = 5
211 \\(u32) @"struct".@"zwölf" = 12
212 \\(u32) @"struct".@"zw\xC3\xB6lf" = 12
213 \\(u32) @"struct".@"zw\u{F6}lf" = 12
214 \\(lldb) breakpoint delete --force 1
215 \\1 breakpoints deleted; 0 breakpoint locations disabled.
216 },
217 );
183 db.addLldbTest(218 db.addLldbTest(
184 "pointers",219 "pointers",
185 target,220 target,
...@@ -187,17 +222,16 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {...@@ -187,17 +222,16 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {
187 .{222 .{
188 .path = "pointers.zig",223 .path = "pointers.zig",
189 .source =224 .source =
225 \\var array: [7]u32 = .{
226 \\ 3010,
227 \\ 3014,
228 \\ 3018,
229 \\ 3022,
230 \\ 3026,
231 \\ 3030,
232 \\ 3034,
233 \\};
190 \\const Pointers = struct {234 \\const Pointers = struct {
191 \\ var array: [7]u32 = .{
192 \\ 3010,
193 \\ 3014,
194 \\ 3018,
195 \\ 3022,
196 \\ 3026,
197 \\ 3030,
198 \\ 3034,
199 \\ };
200 \\
201 \\ single: *u32 = @ptrFromInt(0x1010),235 \\ single: *u32 = @ptrFromInt(0x1010),
202 \\ single_const: *const u32 = @ptrFromInt(0x1014),236 \\ single_const: *const u32 = @ptrFromInt(0x1014),
203 \\ single_volatile: *volatile u32 = @ptrFromInt(0x1018),237 \\ single_volatile: *volatile u32 = @ptrFromInt(0x1018),
...@@ -229,23 +263,30 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {...@@ -229,23 +263,30 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {
229 \\ c_volatile: [*c]volatile u32 = @ptrFromInt(0x4018),263 \\ c_volatile: [*c]volatile u32 = @ptrFromInt(0x4018),
230 \\ c_const_volatile: [*c]const volatile u32 = @ptrFromInt(0x401c),264 \\ c_const_volatile: [*c]const volatile u32 = @ptrFromInt(0x401c),
231 \\};265 \\};
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 {
233 \\ _ = pointers;273 \\ _ = pointers;
274 \\ _ = access;
234 \\}275 \\}
235 \\pub fn main() void {276 \\pub fn main() void {
236 \\ testPointers(.{});277 \\ testPointers(.{}, .{});
237 \\}278 \\}
238 \\279 \\
239 ,280 ,
240 },281 },
241 },282 },
242 \\breakpoint set --file pointers.zig --source-pattern-regexp '_ = pointers;'283 \\breakpoint set --file pointers.zig --source-pattern-regexp '_ = access;'
243 \\process launch284 \\process launch
244 \\frame variable --show-all-children --show-types -- pointers285 \\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]
245 \\breakpoint delete --force 1286 \\breakpoint delete --force 1
246 ,287 ,
247 &.{288 &.{
248 \\(lldb) frame variable --show-all-children --show-types -- pointers289 \\(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]
249 \\(root.pointers.Pointers) pointers = {290 \\(root.pointers.Pointers) pointers = {
250 \\ (*u32) .single = 0x0000000000001010291 \\ (*u32) .single = 0x0000000000001010
251 \\ (*const u32) .single_const = 0x0000000000001014292 \\ (*const u32) .single_const = 0x0000000000001014
...@@ -299,6 +340,14 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {...@@ -299,6 +340,14 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {
299 \\ ([*c]volatile u32) .c_volatile = 0x0000000000004018340 \\ ([*c]volatile u32) .c_volatile = 0x0000000000004018
300 \\ ([*c]const volatile u32) .c_const_volatile = 0x000000000000401c341 \\ ([*c]const volatile u32) .c_const_volatile = 0x000000000000401c
301 \\}342 \\}
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
302 \\(lldb) breakpoint delete --force 1351 \\(lldb) breakpoint delete --force 1
303 \\1 breakpoints deleted; 0 breakpoint locations disabled.352 \\1 breakpoints deleted; 0 breakpoint locations disabled.
304 },353 },
...@@ -534,30 +583,33 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {...@@ -534,30 +583,33 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void {
534 },583 },
535 \\breakpoint set --file optionals.zig --source-pattern-regexp 'maybe_u32 = 123;'584 \\breakpoint set --file optionals.zig --source-pattern-regexp 'maybe_u32 = 123;'
536 \\process launch585 \\process launch
537 \\frame variable --show-all-children -- null_u32 maybe_u32 nonnull_u32586 \\frame variable --show-all-children -- null_u32 maybe_u32 nonnull_u32 nonnull_u32.?
538 \\breakpoint delete --force 1587 \\breakpoint delete --force 1
539 \\588 \\
540 \\breakpoint set --file optionals.zig --source-pattern-regexp 'nonnull_u32 = nonnull_u32;'589 \\breakpoint set --file optionals.zig --source-pattern-regexp 'nonnull_u32 = nonnull_u32;'
541 \\process continue590 \\process continue
542 \\frame variable --show-all-children --show-types -- null_u32 maybe_u32 nonnull_u32591 \\frame variable --show-all-children --show-types -- null_u32 maybe_u32 maybe_u32.? nonnull_u32 nonnull_u32.?
543 \\breakpoint delete --force 2592 \\breakpoint delete --force 2
544 ,593 ,
545 &.{594 &.{
546 \\(lldb) frame variable --show-all-children -- null_u32 maybe_u32 nonnull_u32595 \\(lldb) frame variable --show-all-children -- null_u32 maybe_u32 nonnull_u32 nonnull_u32.?
547 \\(?u32) null_u32 = null596 \\(?u32) null_u32 = null
548 \\(?u32) maybe_u32 = null597 \\(?u32) maybe_u32 = null
549 \\(?u32) nonnull_u32 = (nonnull_u32.? = 456)598 \\(?u32) nonnull_u32 = (nonnull_u32.? = 456)
599 \\(u32) nonnull_u32.? = 456
550 \\(lldb) breakpoint delete --force 1600 \\(lldb) breakpoint delete --force 1
551 \\1 breakpoints deleted; 0 breakpoint locations disabled.601 \\1 breakpoints deleted; 0 breakpoint locations disabled.
552 ,602 ,
553 \\(lldb) frame variable --show-all-children --show-types -- null_u32 maybe_u32 nonnull_u32603 \\(lldb) frame variable --show-all-children --show-types -- null_u32 maybe_u32 maybe_u32.? nonnull_u32 nonnull_u32.?
554 \\(?u32) null_u32 = null604 \\(?u32) null_u32 = null
555 \\(?u32) maybe_u32 = {605 \\(?u32) maybe_u32 = {
556 \\ (u32) maybe_u32.? = 123606 \\ (u32) maybe_u32.? = 123
557 \\}607 \\}
608 \\(u32) maybe_u32.? = 123
558 \\(?u32) nonnull_u32 = {609 \\(?u32) nonnull_u32 = {
559 \\ (u32) nonnull_u32.? = 456610 \\ (u32) nonnull_u32.? = 456
560 \\}611 \\}
612 \\(u32) nonnull_u32.? = 456
561 \\(lldb) breakpoint delete --force 2613 \\(lldb) breakpoint delete --force 2
562 \\1 breakpoints deleted; 0 breakpoint locations disabled.614 \\1 breakpoints deleted; 0 breakpoint locations disabled.
563 },615 },
...@@ -2203,6 +2255,7 @@ fn addGdbTest(...@@ -2203,6 +2255,7 @@ fn addGdbTest(
2203 name,2255 name,
2204 target,2256 target,
2205 files,2257 files,
2258 &.{},
2206 &.{2259 &.{
2207 db.options.gdb orelse return,2260 db.options.gdb orelse return,
2208 "--batch",2261 "--batch",
...@@ -2229,6 +2282,7 @@ fn addLldbTest(...@@ -2229,6 +2282,7 @@ fn addLldbTest(
2229 name,2282 name,
2230 target,2283 target,
2231 files,2284 files,
2285 &.{.{ "LANG", "C.UTF-8" }}, // affects output formatting
2232 &.{2286 &.{
2233 db.options.lldb orelse return,2287 db.options.lldb orelse return,
2234 "--batch",2288 "--batch",
...@@ -2253,6 +2307,7 @@ fn addTest(...@@ -2253,6 +2307,7 @@ fn addTest(
2253 name: []const u8,2307 name: []const u8,
2254 target: *const Target,2308 target: *const Target,
2255 files: []const File,2309 files: []const File,
2310 env: []const struct { []const u8, []const u8 },
2256 db_argv1: []const []const u8,2311 db_argv1: []const []const u8,
2257 db_commands: []const u8,2312 db_commands: []const u8,
2258 commands: []const u8,2313 commands: []const u8,
...@@ -2297,6 +2352,7 @@ fn addTest(...@@ -2297,6 +2352,7 @@ fn addTest(
22972352
2298 const commands_wf = db.b.addWriteFiles();2353 const commands_wf = db.b.addWriteFiles();
2299 const run = std.Build.Step.Run.create(db.b, db.b.fmt("run {s} {s}", .{ name, target.test_name_suffix }));2354 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]);
2300 run.addArgs(db_argv1);2356 run.addArgs(db_argv1);
2301 run.addFileArg(commands_wf.add(2357 run.addFileArg(commands_wf.add(
2302 db.b.fmt("{s}.cmd", .{name}),2358 db.b.fmt("{s}.cmd", .{name}),