| ... | ... | @@ -180,6 +180,41 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void { |
| 180 | 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 | 218 | db.addLldbTest( |
| 184 | 219 | "pointers", |
| 185 | 220 | target, |
| ... | ... | @@ -187,17 +222,16 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void { |
| 187 | 222 | .{ |
| 188 | 223 | .path = "pointers.zig", |
| 189 | 224 | .source = |
| 225 | \\var array: [7]u32 = .{ |
| 226 | \\ 3010, |
| 227 | \\ 3014, |
| 228 | \\ 3018, |
| 229 | \\ 3022, |
| 230 | \\ 3026, |
| 231 | \\ 3030, |
| 232 | \\ 3034, |
| 233 | \\}; |
| 190 | 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 | 235 | \\ single: *u32 = @ptrFromInt(0x1010), |
| 202 | 236 | \\ single_const: *const u32 = @ptrFromInt(0x1014), |
| 203 | 237 | \\ single_volatile: *volatile u32 = @ptrFromInt(0x1018), |
| ... | ... | @@ -229,23 +263,30 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void { |
| 229 | 263 | \\ c_volatile: [*c]volatile u32 = @ptrFromInt(0x4018), |
| 230 | 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 | 273 | \\ _ = pointers; |
| 274 | \\ _ = access; |
| 234 | 275 | \\} |
| 235 | 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 | 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 | 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 | 290 | \\(root.pointers.Pointers) pointers = { |
| 250 | 291 | \\ (*u32) .single = 0x0000000000001010 |
| 251 | 292 | \\ (*const u32) .single_const = 0x0000000000001014 |
| ... | ... | @@ -299,6 +340,14 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void { |
| 299 | 340 | \\ ([*c]volatile u32) .c_volatile = 0x0000000000004018 |
| 300 | 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 | 351 | \\(lldb) breakpoint delete --force 1 |
| 303 | 352 | \\1 breakpoints deleted; 0 breakpoint locations disabled. |
| 304 | 353 | }, |
| ... | ... | @@ -534,30 +583,33 @@ pub fn addTestsForTarget(db: *Debugger, target: *const Target) void { |
| 534 | 583 | }, |
| 535 | 584 | \\breakpoint set --file optionals.zig --source-pattern-regexp 'maybe_u32 = 123;' |
| 536 | 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 | 587 | \\breakpoint delete --force 1 |
| 539 | 588 | \\ |
| 540 | 589 | \\breakpoint set --file optionals.zig --source-pattern-regexp 'nonnull_u32 = nonnull_u32;' |
| 541 | 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 | 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 | 596 | \\(?u32) null_u32 = null |
| 548 | 597 | \\(?u32) maybe_u32 = null |
| 549 | 598 | \\(?u32) nonnull_u32 = (nonnull_u32.? = 456) |
| 599 | \\(u32) nonnull_u32.? = 456 |
| 550 | 600 | \\(lldb) breakpoint delete --force 1 |
| 551 | 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 | 604 | \\(?u32) null_u32 = null |
| 555 | 605 | \\(?u32) maybe_u32 = { |
| 556 | 606 | \\ (u32) maybe_u32.? = 123 |
| 557 | 607 | \\} |
| 608 | \\(u32) maybe_u32.? = 123 |
| 558 | 609 | \\(?u32) nonnull_u32 = { |
| 559 | 610 | \\ (u32) nonnull_u32.? = 456 |
| 560 | 611 | \\} |
| 612 | \\(u32) nonnull_u32.? = 456 |
| 561 | 613 | \\(lldb) breakpoint delete --force 2 |
| 562 | 614 | \\1 breakpoints deleted; 0 breakpoint locations disabled. |
| 563 | 615 | }, |
| ... | ... | @@ -2203,6 +2255,7 @@ fn addGdbTest( |
| 2203 | 2255 | name, |
| 2204 | 2256 | target, |
| 2205 | 2257 | files, |
| 2258 | &.{}, |
| 2206 | 2259 | &.{ |
| 2207 | 2260 | db.options.gdb orelse return, |
| 2208 | 2261 | "--batch", |
| ... | ... | @@ -2229,6 +2282,7 @@ fn addLldbTest( |
| 2229 | 2282 | name, |
| 2230 | 2283 | target, |
| 2231 | 2284 | files, |
| 2285 | &.{.{ "LANG", "C.UTF-8" }}, // affects output formatting |
| 2232 | 2286 | &.{ |
| 2233 | 2287 | db.options.lldb orelse return, |
| 2234 | 2288 | "--batch", |
| ... | ... | @@ -2253,6 +2307,7 @@ fn addTest( |
| 2253 | 2307 | name: []const u8, |
| 2254 | 2308 | target: *const Target, |
| 2255 | 2309 | files: []const File, |
| 2310 | env: []const struct { []const u8, []const u8 }, |
| 2256 | 2311 | db_argv1: []const []const u8, |
| 2257 | 2312 | db_commands: []const u8, |
| 2258 | 2313 | commands: []const u8, |
| ... | ... | @@ -2297,6 +2352,7 @@ fn addTest( |
| 2297 | 2352 | |
| 2298 | 2353 | const commands_wf = db.b.addWriteFiles(); |
| 2299 | 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 | 2356 | run.addArgs(db_argv1); |
| 2301 | 2357 | run.addFileArg(commands_wf.add( |
| 2302 | 2358 | db.b.fmt("{s}.cmd", .{name}), |