| ... | @@ -182,6 +182,135 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { | ... | @@ -182,6 +182,135 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 182 | \\1 breakpoints deleted; 0 breakpoint locations disabled. | 182 | \\1 breakpoints deleted; 0 breakpoint locations disabled. |
| 183 | }, | 183 | }, |
| 184 | ); | 184 | ); |
| | 185 | db.addLldbTest( |
| | 186 | "pointers", |
| | 187 | target, |
| | 188 | &.{ |
| | 189 | .{ |
| | 190 | .path = "pointers.zig", |
| | 191 | .source = |
| | 192 | \\const Pointers = struct { |
| | 193 | \\ var array: [8]u32 = .{ |
| | 194 | \\ 3010, |
| | 195 | \\ 3014, |
| | 196 | \\ 3018, |
| | 197 | \\ 3022, |
| | 198 | \\ 3026, |
| | 199 | \\ 3030, |
| | 200 | \\ 3034, |
| | 201 | \\ 3038, |
| | 202 | \\ }; |
| | 203 | \\ |
| | 204 | \\ single: *u32 = @ptrFromInt(0x1010), |
| | 205 | \\ single_const: *const u32 = @ptrFromInt(0x1014), |
| | 206 | \\ single_volatile: *volatile u32 = @ptrFromInt(0x1018), |
| | 207 | \\ single_const_volatile: *const volatile u32 = @ptrFromInt(0x101c), |
| | 208 | \\ single_allowzero: *allowzero u32 = @ptrFromInt(0x1020), |
| | 209 | \\ single_const_allowzero: *const allowzero u32 = @ptrFromInt(0x1024), |
| | 210 | \\ single_volatile_allowzero: *volatile allowzero u32 = @ptrFromInt(0x1028), |
| | 211 | \\ single_const_volatile_allowzero: *const volatile allowzero u32 = @ptrFromInt(0x102c), |
| | 212 | \\ |
| | 213 | \\ many: [*]u32 = @ptrFromInt(0x2010), |
| | 214 | \\ many_const: [*]const u32 = @ptrFromInt(0x2014), |
| | 215 | \\ many_volatile: [*]volatile u32 = @ptrFromInt(0x2018), |
| | 216 | \\ many_const_volatile: [*]const volatile u32 = @ptrFromInt(0x201c), |
| | 217 | \\ many_allowzero: [*]allowzero u32 = @ptrFromInt(0x2020), |
| | 218 | \\ many_const_allowzero: [*]const allowzero u32 = @ptrFromInt(0x2024), |
| | 219 | \\ many_volatile_allowzero: [*]volatile allowzero u32 = @ptrFromInt(0x2028), |
| | 220 | \\ many_const_volatile_allowzero: [*]const volatile allowzero u32 = @ptrFromInt(0x202c), |
| | 221 | \\ slice: []u32 = array[0..1], |
| | 222 | \\ slice_const: []const u32 = array[0..2], |
| | 223 | \\ slice_volatile: []volatile u32 = array[0..3], |
| | 224 | \\ 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], |
| | 229 | \\ |
| | 230 | \\ c: [*c]u32 = @ptrFromInt(0x4010), |
| | 231 | \\ c_const: [*c]const u32 = @ptrFromInt(0x4014), |
| | 232 | \\ c_volatile: [*c]volatile u32 = @ptrFromInt(0x4018), |
| | 233 | \\ c_const_volatile: [*c]const volatile u32 = @ptrFromInt(0x401c), |
| | 234 | \\}; |
| | 235 | \\pub fn testPointers(pointers: Pointers) void { |
| | 236 | \\ _ = pointers; |
| | 237 | \\} |
| | 238 | \\pub fn main() void { |
| | 239 | \\ testPointers(.{}); |
| | 240 | \\} |
| | 241 | \\ |
| | 242 | , |
| | 243 | }, |
| | 244 | }, |
| | 245 | \\breakpoint set --file pointers.zig --source-pattern-regexp '_ = pointers;' |
| | 246 | \\process launch |
| | 247 | \\frame variable --show-types pointers |
| | 248 | \\breakpoint delete --force 1 |
| | 249 | , |
| | 250 | &.{ |
| | 251 | \\(lldb) frame variable --show-types pointers |
| | 252 | \\(root.pointers.Pointers) pointers = { |
| | 253 | \\ (*u32) single = 0x0000000000001010 |
| | 254 | \\ (*const u32) single_const = 0x0000000000001014 |
| | 255 | \\ (*volatile u32) single_volatile = 0x0000000000001018 |
| | 256 | \\ (*const volatile u32) single_const_volatile = 0x000000000000101c |
| | 257 | \\ (*allowzero u32) single_allowzero = 0x0000000000001020 |
| | 258 | \\ (*const allowzero u32) single_const_allowzero = 0x0000000000001024 |
| | 259 | \\ (*volatile allowzero u32) single_volatile_allowzero = 0x0000000000001028 |
| | 260 | \\ (*const volatile allowzero u32) single_const_volatile_allowzero = 0x000000000000102c |
| | 261 | \\ ([*]u32) many = 0x0000000000002010 |
| | 262 | \\ ([*]const u32) many_const = 0x0000000000002014 |
| | 263 | \\ ([*]volatile u32) many_volatile = 0x0000000000002018 |
| | 264 | \\ ([*]const volatile u32) many_const_volatile = 0x000000000000201c |
| | 265 | \\ ([*]allowzero u32) many_allowzero = 0x0000000000002020 |
| | 266 | \\ ([*]const allowzero u32) many_const_allowzero = 0x0000000000002024 |
| | 267 | \\ ([*]volatile allowzero u32) many_volatile_allowzero = 0x0000000000002028 |
| | 268 | \\ ([*]const volatile allowzero u32) many_const_volatile_allowzero = 0x000000000000202c |
| | 269 | \\ ([]u32) slice = { |
| | 270 | \\ (u32) [0] = 3010 |
| | 271 | \\ } |
| | 272 | \\ ([]const u32) slice_const = { |
| | 273 | \\ (u32) [0] = 3010 |
| | 274 | \\ (u32) [1] = 3014 |
| | 275 | \\ } |
| | 276 | \\ ([]volatile u32) slice_volatile = { |
| | 277 | \\ (u32) [0] = 3010 |
| | 278 | \\ (u32) [1] = 3014 |
| | 279 | \\ (u32) [2] = 3018 |
| | 280 | \\ } |
| | 281 | \\ ([]const volatile u32) slice_const_volatile = { |
| | 282 | \\ (u32) [0] = 3010 |
| | 283 | \\ (u32) [1] = 3014 |
| | 284 | \\ (u32) [2] = 3018 |
| | 285 | \\ (u32) [3] = 3022 |
| | 286 | \\ } |
| | 287 | \\ ([]allowzero u32) slice_allowzero = { |
| | 288 | \\ (u32) [0] = 3026 |
| | 289 | \\ } |
| | 290 | \\ ([]const allowzero u32) slice_const_allowzero = { |
| | 291 | \\ (u32) [0] = 3026 |
| | 292 | \\ (u32) [1] = 3030 |
| | 293 | \\ } |
| | 294 | \\ ([]volatile allowzero u32) slice_volatile_allowzero = { |
| | 295 | \\ (u32) [0] = 3026 |
| | 296 | \\ (u32) [1] = 3030 |
| | 297 | \\ (u32) [2] = 3034 |
| | 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 |
| | 306 | \\ ([*c]const u32) c_const = 0x0000000000004014 |
| | 307 | \\ ([*c]volatile u32) c_volatile = 0x0000000000004018 |
| | 308 | \\ ([*c]const volatile u32) c_const_volatile = 0x000000000000401c |
| | 309 | \\} |
| | 310 | \\(lldb) breakpoint delete --force 1 |
| | 311 | \\1 breakpoints deleted; 0 breakpoint locations disabled. |
| | 312 | }, |
| | 313 | ); |
| 185 | db.addLldbTest( | 314 | db.addLldbTest( |
| 186 | "storage", | 315 | "storage", |
| 187 | target, | 316 | target, |
| ... | @@ -255,47 +384,6 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { | ... | @@ -255,47 +384,6 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 255 | \\1 breakpoints deleted; 0 breakpoint locations disabled. | 384 | \\1 breakpoints deleted; 0 breakpoint locations disabled. |
| 256 | }, | 385 | }, |
| 257 | ); | 386 | ); |
| 258 | db.addLldbTest( | | |
| 259 | "slices", | | |
| 260 | target, | | |
| 261 | &.{ | | |
| 262 | .{ | | |
| 263 | .path = "slices.zig", | | |
| 264 | .source = | | |
| 265 | \\pub fn main() void { | | |
| 266 | \\ { | | |
| 267 | \\ var array: [4]u32 = .{ 1, 2, 4, 8 }; | | |
| 268 | \\ const slice: []u32 = &array; | | |
| 269 | \\ _ = slice; | | |
| 270 | \\ } | | |
| 271 | \\} | | |
| 272 | \\ | | |
| 273 | , | | |
| 274 | }, | | |
| 275 | }, | | |
| 276 | \\breakpoint set --file slices.zig --source-pattern-regexp '_ = slice;' | | |
| 277 | \\process launch | | |
| 278 | \\frame variable --show-types array slice | | |
| 279 | \\breakpoint delete --force 1 | | |
| 280 | , | | |
| 281 | &.{ | | |
| 282 | \\(lldb) frame variable --show-types array slice | | |
| 283 | \\([4]u32) array = { | | |
| 284 | \\ (u32) [0] = 1 | | |
| 285 | \\ (u32) [1] = 2 | | |
| 286 | \\ (u32) [2] = 4 | | |
| 287 | \\ (u32) [3] = 8 | | |
| 288 | \\} | | |
| 289 | \\([]u32) slice = { | | |
| 290 | \\ (u32) [0] = 1 | | |
| 291 | \\ (u32) [1] = 2 | | |
| 292 | \\ (u32) [2] = 4 | | |
| 293 | \\ (u32) [3] = 8 | | |
| 294 | \\} | | |
| 295 | \\(lldb) breakpoint delete --force 1 | | |
| 296 | \\1 breakpoints deleted; 0 breakpoint locations disabled. | | |
| 297 | }, | | |
| 298 | ); | | |
| 299 | db.addLldbTest( | 387 | db.addLldbTest( |
| 300 | "optionals", | 388 | "optionals", |
| 301 | target, | 389 | target, |
| ... | @@ -358,6 +446,7 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { | ... | @@ -358,6 +446,7 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 358 | \\ module.foo(123); | 446 | \\ module.foo(123); |
| 359 | \\ module.bar(456); | 447 | \\ module.bar(456); |
| 360 | \\} | 448 | \\} |
| | 449 | \\ |
| 361 | , | 450 | , |
| 362 | }, | 451 | }, |
| 363 | .{ | 452 | .{ |
| ... | @@ -370,6 +459,7 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { | ... | @@ -370,6 +459,7 @@ pub fn addTestsForTarget(db: *Debugger, target: Target) void { |
| 370 | \\pub inline fn bar(y: u32) void { | 459 | \\pub inline fn bar(y: u32) void { |
| 371 | \\ _ = y; | 460 | \\ _ = y; |
| 372 | \\} | 461 | \\} |
| | 462 | \\ |
| 373 | , | 463 | , |
| 374 | }, | 464 | }, |
| 375 | }, | 465 | }, |