| ... | ... | @@ -168,7 +168,7 @@ fn nextInner(unwinder: *SelfUnwinder, gpa: Allocator, cache_entry: *const CacheE |
| 168 | 168 | .none => return error.InvalidDebugInfo, |
| 169 | 169 | .reg_off => |ro| cfa: { |
| 170 | 170 | const ptr = try regNative(&unwinder.cpu_state, ro.register); |
| 171 | | break :cfa try applyOffset(ptr.*, ro.offset); |
| 171 | break :cfa try applyOffset(@intCast(ptr.*), ro.offset); |
| 172 | 172 | }, |
| 173 | 173 | .expression => |expr| cfa: { |
| 174 | 174 | // On most implemented architectures, the CFA is defined to be the previous frame's SP. |
| ... | ... | @@ -181,7 +181,7 @@ fn nextInner(unwinder: *SelfUnwinder, gpa: Allocator, cache_entry: *const CacheE |
| 181 | 181 | const value = try unwinder.expr_vm.run(expr, gpa, .{ |
| 182 | 182 | .format = format, |
| 183 | 183 | .cpu_context = &unwinder.cpu_state, |
| 184 | | }, prev_cfa_val) orelse return error.InvalidDebugInfo; |
| 184 | }, @intCast(prev_cfa_val)) orelse return error.InvalidDebugInfo; |
| 185 | 185 | switch (value) { |
| 186 | 186 | .generic => |g| break :cfa g, |
| 187 | 187 | else => return error.InvalidDebugInfo, |
| ... | ... | @@ -203,7 +203,7 @@ fn nextInner(unwinder: *SelfUnwinder, gpa: Allocator, cache_entry: *const CacheE |
| 203 | 203 | const new_val: union(enum) { |
| 204 | 204 | same, |
| 205 | 205 | undefined, |
| 206 | | val: usize, |
| 206 | val: std.debug.cpu_context.Native.Gpr, |
| 207 | 207 | bytes: []const u8, |
| 208 | 208 | } = switch (rule) { |
| 209 | 209 | .default => val: { |
| ... | ... | @@ -219,7 +219,7 @@ fn nextInner(unwinder: *SelfUnwinder, gpa: Allocator, cache_entry: *const CacheE |
| 219 | 219 | .undefined => .undefined, |
| 220 | 220 | .same_value => .same, |
| 221 | 221 | .offset => |offset| val: { |
| 222 | | const ptr: *const usize = @ptrFromInt(try applyOffset(cfa, offset)); |
| 222 | const ptr: *const std.debug.cpu_context.Native.Gpr = @ptrFromInt(try applyOffset(cfa, offset)); |
| 223 | 223 | break :val .{ .val = ptr.* }; |
| 224 | 224 | }, |
| 225 | 225 | .val_offset => |offset| .{ .val = try applyOffset(cfa, offset) }, |
| ... | ... | @@ -260,12 +260,7 @@ fn nextInner(unwinder: *SelfUnwinder, gpa: Allocator, cache_entry: *const CacheE |
| 260 | 260 | has_return_address = false; |
| 261 | 261 | } |
| 262 | 262 | }, |
| 263 | | .val => |val| { |
| 264 | | const dest = try new_cpu_state.dwarfRegisterBytes(@intCast(register)); |
| 265 | | if (dest.len != @sizeOf(usize)) return error.InvalidDebugInfo; |
| 266 | | const dest_ptr: *align(1) usize = @ptrCast(dest); |
| 267 | | dest_ptr.* = val; |
| 268 | | }, |
| 263 | .val => |val| (try regNative(&new_cpu_state, register)).* = val, |
| 269 | 264 | .bytes => |src| { |
| 270 | 265 | const dest = try new_cpu_state.dwarfRegisterBytes(@intCast(register)); |
| 271 | 266 | if (dest.len != src.len) return error.InvalidDebugInfo; |
| ... | ... | @@ -275,7 +270,7 @@ fn nextInner(unwinder: *SelfUnwinder, gpa: Allocator, cache_entry: *const CacheE |
| 275 | 270 | } |
| 276 | 271 | |
| 277 | 272 | const return_address = if (has_return_address) |
| 278 | | stripInstructionPtrAuthCode((try regNative(&new_cpu_state, return_address_register)).*) |
| 273 | stripInstructionPtrAuthCode(@intCast((try regNative(&new_cpu_state, return_address_register)).*)) |
| 279 | 274 | else |
| 280 | 275 | 0; |
| 281 | 276 | |
| ... | ... | @@ -303,9 +298,9 @@ pub fn regNative(ctx: *std.debug.cpu_context.Native, num: u16) error{ |
| 303 | 298 | InvalidRegister, |
| 304 | 299 | UnsupportedRegister, |
| 305 | 300 | IncompatibleRegisterSize, |
| 306 | | }!*align(1) usize { |
| 301 | }!*align(1) std.debug.cpu_context.Native.Gpr { |
| 307 | 302 | const bytes = try ctx.dwarfRegisterBytes(num); |
| 308 | | if (bytes.len != @sizeOf(usize)) return error.IncompatibleRegisterSize; |
| 303 | if (bytes.len != @sizeOf(std.debug.cpu_context.Native.Gpr)) return error.IncompatibleRegisterSize; |
| 309 | 304 | return @ptrCast(bytes); |
| 310 | 305 | } |
| 311 | 306 | |