Skip to content

Commit

Permalink
Fix crash stack trace decoding on macOS (#14335)
Browse files Browse the repository at this point in the history
  • Loading branch information
HertzDevil authored Mar 1, 2024
1 parent f76a512 commit 3072e8f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/exception/call_stack/libunwind.cr
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,14 @@ struct Exception::CallStack

private def self.print_frame_location(repeated_frame)
{% if flag?(:debug) %}
if @@dwarf_loaded &&
(name = decode_function_name(repeated_frame.ip.address))
file, line, column = Exception::CallStack.decode_line_number(repeated_frame.ip.address)
if file && file != "??"
Crystal::System.print_error "%s at %s:%d:%d", name, file, line, column
return
if @@dwarf_loaded
pc = CallStack.decode_address(repeated_frame.ip)
if name = decode_function_name(pc)
file, line, column = Exception::CallStack.decode_line_number(pc)
if file && file != "??"
Crystal::System.print_error "%s at %s:%d:%d", name, file, line, column
return
end
end
end
{% end %}
Expand Down

0 comments on commit 3072e8f

Please sign in to comment.