| ... | @@ -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 launch | 284 | \\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] |
| 245 | \\breakpoint delete --force 1 | 286 | \\breakpoint delete --force 1 |
| 246 | , | 287 | , |
| 247 | &.{ | 288 | &.{ |
| 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] |
| 249 | \\(root.pointers.Pointers) pointers = { | 290 | \\(root.pointers.Pointers) pointers = { |
| 250 | \\ (*u32) .single = 0x0000000000001010 | 291 | \\ (*u32) .single = 0x0000000000001010 |
| 251 | \\ (*const u32) .single_const = 0x0000000000001014 | 292 | \\ (*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 = 0x0000000000004018 | 340 | \\ ([*c]volatile u32) .c_volatile = 0x0000000000004018 |
| 300 | \\ ([*c]const volatile u32) .c_const_volatile = 0x000000000000401c | 341 | \\ ([*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 1 | 351 | \\(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 launch | 585 | \\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.? |
| 538 | \\breakpoint delete --force 1 | 587 | \\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 continue | 590 | \\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.? |
| 543 | \\breakpoint delete --force 2 | 592 | \\breakpoint delete --force 2 |
| 544 | , | 593 | , |
| 545 | &.{ | 594 | &.{ |
| 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.? |
| 547 | \\(?u32) null_u32 = null | 596 | \\(?u32) null_u32 = null |
| 548 | \\(?u32) maybe_u32 = null | 597 | \\(?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 1 | 600 | \\(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_u32 | 603 | \\(lldb) frame variable --show-all-children --show-types -- null_u32 maybe_u32 maybe_u32.? nonnull_u32 nonnull_u32.? |
| 554 | \\(?u32) null_u32 = null | 604 | \\(?u32) null_u32 = null |
| 555 | \\(?u32) maybe_u32 = { | 605 | \\(?u32) maybe_u32 = { |
| 556 | \\ (u32) maybe_u32.? = 123 | 606 | \\ (u32) maybe_u32.? = 123 |
| 557 | \\} | 607 | \\} |
| | 608 | \\(u32) maybe_u32.? = 123 |
| 558 | \\(?u32) nonnull_u32 = { | 609 | \\(?u32) nonnull_u32 = { |
| 559 | \\ (u32) nonnull_u32.? = 456 | 610 | \\ (u32) nonnull_u32.? = 456 |
| 560 | \\} | 611 | \\} |
| | 612 | \\(u32) nonnull_u32.? = 456 |
| 561 | \\(lldb) breakpoint delete --force 2 | 613 | \\(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( |
| 2297 | | 2352 | |
| 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}), |