| ... | @@ -190,7 +190,7 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { | ... | @@ -190,7 +190,7 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 190 | .path = "pointers.zig", | 190 | .path = "pointers.zig", |
| 191 | .source = | 191 | .source = |
| 192 | \\const Pointers = struct { | 192 | \\const Pointers = struct { |
| 193 | \\ var array: [8]u32 = .{ | 193 | \\ var array: [7]u32 = .{ |
| 194 | \\ 3010, | 194 | \\ 3010, |
| 195 | \\ 3014, | 195 | \\ 3014, |
| 196 | \\ 3018, | 196 | \\ 3018, |
| ... | @@ -198,7 +198,6 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { | ... | @@ -198,7 +198,6 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 198 | \\ 3026, | 198 | \\ 3026, |
| 199 | \\ 3030, | 199 | \\ 3030, |
| 200 | \\ 3034, | 200 | \\ 3034, |
| 201 | \\ 3038, | | |
| 202 | \\ }; | 201 | \\ }; |
| 203 | \\ | 202 | \\ |
| 204 | \\ single: *u32 = @ptrFromInt(0x1010), | 203 | \\ single: *u32 = @ptrFromInt(0x1010), |
| ... | @@ -222,17 +221,17 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { | ... | @@ -222,17 +221,17 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 222 | \\ slice_const: []const u32 = array[0..2], | 221 | \\ slice_const: []const u32 = array[0..2], |
| 223 | \\ slice_volatile: []volatile u32 = array[0..3], | 222 | \\ slice_volatile: []volatile u32 = array[0..3], |
| 224 | \\ slice_const_volatile: []const volatile u32 = array[0..4], | 223 | \\ slice_const_volatile: []const volatile u32 = array[0..4], |
| 225 | \\ slice_allowzero: []allowzero u32 = array[4..5], | 224 | \\ slice_allowzero: []allowzero u32 = array[4..4], |
| 226 | \\ slice_const_allowzero: []const allowzero u32 = array[4..6], | 225 | \\ slice_const_allowzero: []const allowzero u32 = array[4..5], |
| 227 | \\ slice_volatile_allowzero: []volatile allowzero u32 = array[4..7], | 226 | \\ slice_volatile_allowzero: []volatile allowzero u32 = array[4..6], |
| 228 | \\ slice_const_volatile_allowzero: []const volatile allowzero u32 = array[4..8], | 227 | \\ slice_const_volatile_allowzero: []const volatile allowzero u32 = array[4..7], |
| 229 | \\ | 228 | \\ |
| 230 | \\ c: [*c]u32 = @ptrFromInt(0x4010), | 229 | \\ c: [*c]u32 = @ptrFromInt(0x4010), |
| 231 | \\ c_const: [*c]const u32 = @ptrFromInt(0x4014), | 230 | \\ c_const: [*c]const u32 = @ptrFromInt(0x4014), |
| 232 | \\ c_volatile: [*c]volatile u32 = @ptrFromInt(0x4018), | 231 | \\ c_volatile: [*c]volatile u32 = @ptrFromInt(0x4018), |
| 233 | \\ c_const_volatile: [*c]const volatile u32 = @ptrFromInt(0x401c), | 232 | \\ c_const_volatile: [*c]const volatile u32 = @ptrFromInt(0x401c), |
| 234 | \\}; | 233 | \\}; |
| 235 | \\pub fn testPointers(pointers: Pointers) void { | 234 | \\fn testPointers(pointers: Pointers) void { |
| 236 | \\ _ = pointers; | 235 | \\ _ = pointers; |
| 237 | \\} | 236 | \\} |
| 238 | \\pub fn main() void { | 237 | \\pub fn main() void { |
| ... | @@ -266,42 +265,37 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { | ... | @@ -266,42 +265,37 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 266 | \\ ([*]const allowzero u32) many_const_allowzero = 0x0000000000002024 | 265 | \\ ([*]const allowzero u32) many_const_allowzero = 0x0000000000002024 |
| 267 | \\ ([*]volatile allowzero u32) many_volatile_allowzero = 0x0000000000002028 | 266 | \\ ([*]volatile allowzero u32) many_volatile_allowzero = 0x0000000000002028 |
| 268 | \\ ([*]const volatile allowzero u32) many_const_volatile_allowzero = 0x000000000000202c | 267 | \\ ([*]const volatile allowzero u32) many_const_volatile_allowzero = 0x000000000000202c |
| 269 | \\ ([]u32) slice = { | 268 | \\ ([]u32) slice = len=1 { |
| 270 | \\ (u32) [0] = 3010 | 269 | \\ (u32) [0] = 3010 |
| 271 | \\ } | 270 | \\ } |
| 272 | \\ ([]const u32) slice_const = { | 271 | \\ ([]const u32) slice_const = len=2 { |
| 273 | \\ (u32) [0] = 3010 | 272 | \\ (u32) [0] = 3010 |
| 274 | \\ (u32) [1] = 3014 | 273 | \\ (u32) [1] = 3014 |
| 275 | \\ } | 274 | \\ } |
| 276 | \\ ([]volatile u32) slice_volatile = { | 275 | \\ ([]volatile u32) slice_volatile = len=3 { |
| 277 | \\ (u32) [0] = 3010 | 276 | \\ (u32) [0] = 3010 |
| 278 | \\ (u32) [1] = 3014 | 277 | \\ (u32) [1] = 3014 |
| 279 | \\ (u32) [2] = 3018 | 278 | \\ (u32) [2] = 3018 |
| 280 | \\ } | 279 | \\ } |
| 281 | \\ ([]const volatile u32) slice_const_volatile = { | 280 | \\ ([]const volatile u32) slice_const_volatile = len=4 { |
| 282 | \\ (u32) [0] = 3010 | 281 | \\ (u32) [0] = 3010 |
| 283 | \\ (u32) [1] = 3014 | 282 | \\ (u32) [1] = 3014 |
| 284 | \\ (u32) [2] = 3018 | 283 | \\ (u32) [2] = 3018 |
| 285 | \\ (u32) [3] = 3022 | 284 | \\ (u32) [3] = 3022 |
| 286 | \\ } | 285 | \\ } |
| 287 | \\ ([]allowzero u32) slice_allowzero = { | 286 | \\ ([]allowzero u32) slice_allowzero = len=0 {} |
| | 287 | \\ ([]const allowzero u32) slice_const_allowzero = len=1 { |
| 288 | \\ (u32) [0] = 3026 | 288 | \\ (u32) [0] = 3026 |
| 289 | \\ } | 289 | \\ } |
| 290 | \\ ([]const allowzero u32) slice_const_allowzero = { | 290 | \\ ([]volatile allowzero u32) slice_volatile_allowzero = len=2 { |
| 291 | \\ (u32) [0] = 3026 | 291 | \\ (u32) [0] = 3026 |
| 292 | \\ (u32) [1] = 3030 | 292 | \\ (u32) [1] = 3030 |
| 293 | \\ } | 293 | \\ } |
| 294 | \\ ([]volatile allowzero u32) slice_volatile_allowzero = { | 294 | \\ ([]const volatile allowzero u32) slice_const_volatile_allowzero = len=3 { |
| 295 | \\ (u32) [0] = 3026 | 295 | \\ (u32) [0] = 3026 |
| 296 | \\ (u32) [1] = 3030 | 296 | \\ (u32) [1] = 3030 |
| 297 | \\ (u32) [2] = 3034 | 297 | \\ (u32) [2] = 3034 |
| 298 | \\ } | 298 | \\ } |
| 299 | \\ ([]const volatile allowzero u32) slice_const_volatile_allowzero = { | | |
| 300 | \\ (u32) [0] = 3026 | | |
| 301 | \\ (u32) [1] = 3030 | | |
| 302 | \\ (u32) [2] = 3034 | | |
| 303 | \\ (u32) [3] = 3038 | | |
| 304 | \\ } | | |
| 305 | \\ ([*c]u32) c = 0x0000000000004010 | 299 | \\ ([*c]u32) c = 0x0000000000004010 |
| 306 | \\ ([*c]const u32) c_const = 0x0000000000004014 | 300 | \\ ([*c]const u32) c_const = 0x0000000000004014 |
| 307 | \\ ([*c]volatile u32) c_volatile = 0x0000000000004018 | 301 | \\ ([*c]volatile u32) c_volatile = 0x0000000000004018 |
| ... | @@ -311,6 +305,104 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { | ... | @@ -311,6 +305,104 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 311 | \\1 breakpoints deleted; 0 breakpoint locations disabled. | 305 | \\1 breakpoints deleted; 0 breakpoint locations disabled. |
| 312 | }, | 306 | }, |
| 313 | ); | 307 | ); |
| | 308 | db.addLldbTest( |
| | 309 | "errors", |
| | 310 | target, |
| | 311 | &.{ |
| | 312 | .{ |
| | 313 | .path = "errors.zig", |
| | 314 | .source = |
| | 315 | \\const Errors = struct { |
| | 316 | \\ one: error{One} = error.One, |
| | 317 | \\ two: error{One,Two} = error.Two, |
| | 318 | \\ three: error{One,Two,Three} = error.Three, |
| | 319 | \\ any: anyerror = error.Any, |
| | 320 | \\ any_void: anyerror!void = error.NotVoid, |
| | 321 | \\ any_u32: error{One}!u32 = 42, |
| | 322 | \\}; |
| | 323 | \\fn testErrors(errors: Errors) void { |
| | 324 | \\ _ = errors; |
| | 325 | \\} |
| | 326 | \\pub fn main() void { |
| | 327 | \\ testErrors(.{}); |
| | 328 | \\} |
| | 329 | \\ |
| | 330 | , |
| | 331 | }, |
| | 332 | }, |
| | 333 | \\breakpoint set --file errors.zig --source-pattern-regexp '_ = errors;' |
| | 334 | \\process launch |
| | 335 | \\frame variable --show-types errors |
| | 336 | \\breakpoint delete --force 1 |
| | 337 | , |
| | 338 | &.{ |
| | 339 | \\(lldb) frame variable --show-types errors |
| | 340 | \\(root.errors.Errors) errors = { |
| | 341 | \\ (error{One}) one = error.One |
| | 342 | \\ (error{One,Two}) two = error.Two |
| | 343 | \\ (error{One,Two,Three}) three = error.Three |
| | 344 | \\ (anyerror) any = error.Any |
| | 345 | \\ (anyerror!void) any_void = { |
| | 346 | \\ (anyerror) error = error.NotVoid |
| | 347 | \\ } |
| | 348 | \\ (error{One}!u32) any_u32 = { |
| | 349 | \\ (u32) value = 42 |
| | 350 | \\ } |
| | 351 | \\} |
| | 352 | \\(lldb) breakpoint delete --force 1 |
| | 353 | \\1 breakpoints deleted; 0 breakpoint locations disabled. |
| | 354 | }, |
| | 355 | ); |
| | 356 | db.addLldbTest( |
| | 357 | "optionals", |
| | 358 | target, |
| | 359 | &.{ |
| | 360 | .{ |
| | 361 | .path = "optionals.zig", |
| | 362 | .source = |
| | 363 | \\pub fn main() void { |
| | 364 | \\ { |
| | 365 | \\ var null_u32: ?u32 = null; |
| | 366 | \\ var maybe_u32: ?u32 = null; |
| | 367 | \\ var nonnull_u32: ?u32 = 456; |
| | 368 | \\ maybe_u32 = 123; |
| | 369 | \\ _ = .{ &null_u32, &nonnull_u32 }; |
| | 370 | \\ } |
| | 371 | \\} |
| | 372 | \\ |
| | 373 | , |
| | 374 | }, |
| | 375 | }, |
| | 376 | \\breakpoint set --file optionals.zig --source-pattern-regexp 'maybe_u32 = 123;' |
| | 377 | \\process launch |
| | 378 | \\frame variable null_u32 maybe_u32 nonnull_u32 |
| | 379 | \\breakpoint delete --force 1 |
| | 380 | \\ |
| | 381 | \\breakpoint set --file optionals.zig --source-pattern-regexp '_ = .{ &null_u32, &nonnull_u32 };' |
| | 382 | \\process continue |
| | 383 | \\frame variable --show-types null_u32 maybe_u32 nonnull_u32 |
| | 384 | \\breakpoint delete --force 2 |
| | 385 | , |
| | 386 | &.{ |
| | 387 | \\(lldb) frame variable null_u32 maybe_u32 nonnull_u32 |
| | 388 | \\(?u32) null_u32 = null |
| | 389 | \\(?u32) maybe_u32 = null |
| | 390 | \\(?u32) nonnull_u32 = (nonnull_u32.? = 456) |
| | 391 | \\(lldb) breakpoint delete --force 1 |
| | 392 | \\1 breakpoints deleted; 0 breakpoint locations disabled. |
| | 393 | , |
| | 394 | \\(lldb) frame variable --show-types null_u32 maybe_u32 nonnull_u32 |
| | 395 | \\(?u32) null_u32 = null |
| | 396 | \\(?u32) maybe_u32 = { |
| | 397 | \\ (u32) maybe_u32.? = 123 |
| | 398 | \\} |
| | 399 | \\(?u32) nonnull_u32 = { |
| | 400 | \\ (u32) nonnull_u32.? = 456 |
| | 401 | \\} |
| | 402 | \\(lldb) breakpoint delete --force 2 |
| | 403 | \\1 breakpoints deleted; 0 breakpoint locations disabled. |
| | 404 | }, |
| | 405 | ); |
| 314 | db.addLldbTest( | 406 | db.addLldbTest( |
| 315 | "storage", | 407 | "storage", |
| 316 | target, | 408 | target, |
| ... | @@ -384,56 +476,6 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { | ... | @@ -384,56 +476,6 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 384 | \\1 breakpoints deleted; 0 breakpoint locations disabled. | 476 | \\1 breakpoints deleted; 0 breakpoint locations disabled. |
| 385 | }, | 477 | }, |
| 386 | ); | 478 | ); |
| 387 | db.addLldbTest( | | |
| 388 | "optionals", | | |
| 389 | target, | | |
| 390 | &.{ | | |
| 391 | .{ | | |
| 392 | .path = "optionals.zig", | | |
| 393 | .source = | | |
| 394 | \\pub fn main() void { | | |
| 395 | \\ { | | |
| 396 | \\ var null_u32: ?u32 = null; | | |
| 397 | \\ var maybe_u32: ?u32 = null; | | |
| 398 | \\ var nonnull_u32: ?u32 = 456; | | |
| 399 | \\ maybe_u32 = 123; | | |
| 400 | \\ _ = .{ &null_u32, &nonnull_u32 }; | | |
| 401 | \\ } | | |
| 402 | \\} | | |
| 403 | \\ | | |
| 404 | , | | |
| 405 | }, | | |
| 406 | }, | | |
| 407 | \\breakpoint set --file optionals.zig --source-pattern-regexp 'maybe_u32 = 123;' | | |
| 408 | \\process launch | | |
| 409 | \\frame variable null_u32 maybe_u32 nonnull_u32 | | |
| 410 | \\breakpoint delete --force 1 | | |
| 411 | \\ | | |
| 412 | \\breakpoint set --file optionals.zig --source-pattern-regexp '_ = .{ &null_u32, &nonnull_u32 };' | | |
| 413 | \\process continue | | |
| 414 | \\frame variable --show-types null_u32 maybe_u32 nonnull_u32 | | |
| 415 | \\breakpoint delete --force 2 | | |
| 416 | , | | |
| 417 | &.{ | | |
| 418 | \\(lldb) frame variable null_u32 maybe_u32 nonnull_u32 | | |
| 419 | \\(?u32) null_u32 = null | | |
| 420 | \\(?u32) maybe_u32 = null | | |
| 421 | \\(?u32) nonnull_u32 = (nonnull_u32.? = 456) | | |
| 422 | \\(lldb) breakpoint delete --force 1 | | |
| 423 | \\1 breakpoints deleted; 0 breakpoint locations disabled. | | |
| 424 | , | | |
| 425 | \\(lldb) frame variable --show-types null_u32 maybe_u32 nonnull_u32 | | |
| 426 | \\(?u32) null_u32 = null | | |
| 427 | \\(?u32) maybe_u32 = { | | |
| 428 | \\ (u32) maybe_u32.? = 123 | | |
| 429 | \\} | | |
| 430 | \\(?u32) nonnull_u32 = { | | |
| 431 | \\ (u32) nonnull_u32.? = 456 | | |
| 432 | \\} | | |
| 433 | \\(lldb) breakpoint delete --force 2 | | |
| 434 | \\1 breakpoints deleted; 0 breakpoint locations disabled. | | |
| 435 | }, | | |
| 436 | ); | | |
| 437 | db.addLldbTest( | 479 | db.addLldbTest( |
| 438 | "cross_module_call", | 480 | "cross_module_call", |
| 439 | target, | 481 | target, |