| ... | ... | @@ -190,7 +190,7 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 190 | 190 | .path = "pointers.zig", |
| 191 | 191 | .source = |
| 192 | 192 | \\const Pointers = struct { |
| 193 | | \\ var array: [8]u32 = .{ |
| 193 | \\ var array: [7]u32 = .{ |
| 194 | 194 | \\ 3010, |
| 195 | 195 | \\ 3014, |
| 196 | 196 | \\ 3018, |
| ... | ... | @@ -198,7 +198,6 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 198 | 198 | \\ 3026, |
| 199 | 199 | \\ 3030, |
| 200 | 200 | \\ 3034, |
| 201 | | \\ 3038, |
| 202 | 201 | \\ }; |
| 203 | 202 | \\ |
| 204 | 203 | \\ single: *u32 = @ptrFromInt(0x1010), |
| ... | ... | @@ -222,17 +221,17 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 222 | 221 | \\ slice_const: []const u32 = array[0..2], |
| 223 | 222 | \\ slice_volatile: []volatile u32 = array[0..3], |
| 224 | 223 | \\ slice_const_volatile: []const volatile u32 = array[0..4], |
| 225 | | \\ slice_allowzero: []allowzero u32 = array[4..5], |
| 226 | | \\ slice_const_allowzero: []const allowzero u32 = array[4..6], |
| 227 | | \\ slice_volatile_allowzero: []volatile allowzero u32 = array[4..7], |
| 228 | | \\ slice_const_volatile_allowzero: []const volatile allowzero u32 = array[4..8], |
| 224 | \\ slice_allowzero: []allowzero u32 = array[4..4], |
| 225 | \\ slice_const_allowzero: []const allowzero u32 = array[4..5], |
| 226 | \\ slice_volatile_allowzero: []volatile allowzero u32 = array[4..6], |
| 227 | \\ slice_const_volatile_allowzero: []const volatile allowzero u32 = array[4..7], |
| 229 | 228 | \\ |
| 230 | 229 | \\ c: [*c]u32 = @ptrFromInt(0x4010), |
| 231 | 230 | \\ c_const: [*c]const u32 = @ptrFromInt(0x4014), |
| 232 | 231 | \\ c_volatile: [*c]volatile u32 = @ptrFromInt(0x4018), |
| 233 | 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 | 235 | \\ _ = pointers; |
| 237 | 236 | \\} |
| 238 | 237 | \\pub fn main() void { |
| ... | ... | @@ -266,42 +265,37 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 266 | 265 | \\ ([*]const allowzero u32) many_const_allowzero = 0x0000000000002024 |
| 267 | 266 | \\ ([*]volatile allowzero u32) many_volatile_allowzero = 0x0000000000002028 |
| 268 | 267 | \\ ([*]const volatile allowzero u32) many_const_volatile_allowzero = 0x000000000000202c |
| 269 | | \\ ([]u32) slice = { |
| 268 | \\ ([]u32) slice = len=1 { |
| 270 | 269 | \\ (u32) [0] = 3010 |
| 271 | 270 | \\ } |
| 272 | | \\ ([]const u32) slice_const = { |
| 271 | \\ ([]const u32) slice_const = len=2 { |
| 273 | 272 | \\ (u32) [0] = 3010 |
| 274 | 273 | \\ (u32) [1] = 3014 |
| 275 | 274 | \\ } |
| 276 | | \\ ([]volatile u32) slice_volatile = { |
| 275 | \\ ([]volatile u32) slice_volatile = len=3 { |
| 277 | 276 | \\ (u32) [0] = 3010 |
| 278 | 277 | \\ (u32) [1] = 3014 |
| 279 | 278 | \\ (u32) [2] = 3018 |
| 280 | 279 | \\ } |
| 281 | | \\ ([]const volatile u32) slice_const_volatile = { |
| 280 | \\ ([]const volatile u32) slice_const_volatile = len=4 { |
| 282 | 281 | \\ (u32) [0] = 3010 |
| 283 | 282 | \\ (u32) [1] = 3014 |
| 284 | 283 | \\ (u32) [2] = 3018 |
| 285 | 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 | 288 | \\ (u32) [0] = 3026 |
| 289 | 289 | \\ } |
| 290 | | \\ ([]const allowzero u32) slice_const_allowzero = { |
| 290 | \\ ([]volatile allowzero u32) slice_volatile_allowzero = len=2 { |
| 291 | 291 | \\ (u32) [0] = 3026 |
| 292 | 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 | 295 | \\ (u32) [0] = 3026 |
| 296 | 296 | \\ (u32) [1] = 3030 |
| 297 | 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 | 299 | \\ ([*c]u32) c = 0x0000000000004010 |
| 306 | 300 | \\ ([*c]const u32) c_const = 0x0000000000004014 |
| 307 | 301 | \\ ([*c]volatile u32) c_volatile = 0x0000000000004018 |
| ... | ... | @@ -311,6 +305,104 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 311 | 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 | 406 | db.addLldbTest( |
| 315 | 407 | "storage", |
| 316 | 408 | target, |
| ... | ... | @@ -384,56 +476,6 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 384 | 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 | 479 | db.addLldbTest( |
| 438 | 480 | "cross_module_call", |
| 439 | 481 | target, |