Commit b18031335a

kcbanner <kcbanner@gmail.com>
2023-07-12 08:02:21
dwarf: use cie.return_address_register instead of assuming it's in the IP register
1 parent 9b25bee
Changed files (2)
lib/std/debug.zig
@@ -868,7 +868,7 @@ fn printUnknownSource(debug_info: *DebugInfo, out_stream: anytype, address: usiz
 pub fn printUnwindError(debug_info: *DebugInfo, out_stream: anytype, address: usize, err: UnwindError, tty_config: io.tty.Config) !void {
     const module_name = debug_info.getModuleNameForAddress(address) orelse "???";
     try tty_config.setColor(out_stream, .dim);
-    try out_stream.print("Unwind information for `{s}` was not available ({}), trace may be incomplete\n\n", .{ module_name, err });
+    try out_stream.print("Unwind information for `{s}:{}` was not available ({}), trace may be incomplete\n\n", .{ module_name, address, err });
     try tty_config.setColor(out_stream, .reset);
 }
 
lib/std/dwarf.zig
@@ -1758,7 +1758,7 @@ pub const DwarfInfo = struct {
         }
 
         if (has_next_ip) {
-            context.pc = mem.readIntSliceNative(usize, try abi.regBytes(context.thread_context, comptime abi.ipRegNum(), context.reg_context));
+            context.pc = mem.readIntSliceNative(usize, try abi.regBytes(context.thread_context, cie.return_address_register, context.reg_context));
         } else {
             context.pc = 0;
         }