Skip to content

Commit 3072e8f

Browse files
authored
Fix crash stack trace decoding on macOS (#14335)
1 parent f76a512 commit 3072e8f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/exception/call_stack/libunwind.cr

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -110,12 +110,14 @@ struct Exception::CallStack
110110

111111
private def self.print_frame_location(repeated_frame)
112112
{% if flag?(:debug) %}
113-
if @@dwarf_loaded &&
114-
(name = decode_function_name(repeated_frame.ip.address))
115-
file, line, column = Exception::CallStack.decode_line_number(repeated_frame.ip.address)
116-
if file && file != "??"
117-
Crystal::System.print_error "%s at %s:%d:%d", name, file, line, column
118-
return
113+
if @@dwarf_loaded
114+
pc = CallStack.decode_address(repeated_frame.ip)
115+
if name = decode_function_name(pc)
116+
file, line, column = Exception::CallStack.decode_line_number(pc)
117+
if file && file != "??"
118+
Crystal::System.print_error "%s at %s:%d:%d", name, file, line, column
119+
return
120+
end
119121
end
120122
end
121123
{% end %}

0 commit comments

Comments
 (0)