Skip to content

Commit

Permalink
Fix: Add Nil return type restrictions to load_debug_info (#12992)
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota authored Jan 23, 2023
1 parent 01c0ba2 commit f1b7323
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/exception/call_stack/dwarf.cr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ struct Exception::CallStack
@@dwarf_function_names : Array(Tuple(LibC::SizeT, LibC::SizeT, String))?

# :nodoc:
def self.load_debug_info
def self.load_debug_info : Nil
return if ENV["CRYSTAL_LOAD_DEBUG_INFO"]? == "0"

unless @@dwarf_loaded
Expand Down
2 changes: 1 addition & 1 deletion src/exception/call_stack/elf.cr
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require "crystal/elf"
{% end %}

struct Exception::CallStack
protected def self.load_debug_info_impl
protected def self.load_debug_info_impl : Nil
base_address : LibC::Elf_Addr = 0
phdr_callback = LibC::DlPhdrCallback.new do |info, size, data|
# The first entry is the header for the current program.
Expand Down
4 changes: 2 additions & 2 deletions src/exception/call_stack/mach_o.cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ end
struct Exception::CallStack
@@image_slide : LibC::Long?

protected def self.load_debug_info_impl
protected def self.load_debug_info_impl : Nil
read_dwarf_sections
end

protected def self.read_dwarf_sections
protected def self.read_dwarf_sections : Nil
locate_dsym_bundle do |mach_o|
line_strings = mach_o.read_section?("__debug_line_str") do |sh, io|
Crystal::DWARF::Strings.new(io, sh.offset, sh.size)
Expand Down
4 changes: 2 additions & 2 deletions src/exception/call_stack/stackwalk.cr
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ struct Exception::CallStack

@@sym_loaded = false

def self.load_debug_info
def self.load_debug_info : Nil
return if ENV["CRYSTAL_LOAD_DEBUG_INFO"]? == "0"

unless @@sym_loaded
Expand All @@ -20,7 +20,7 @@ struct Exception::CallStack
end
end

private def self.load_debug_info_impl
private def self.load_debug_info_impl : Nil
# TODO: figure out if and when to call SymCleanup (it cannot be done in
# `at_exit` because unhandled exceptions in `main_user_code` are printed
# after those handlers)
Expand Down

0 comments on commit f1b7323

Please sign in to comment.