Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Add Nil return type restrictions to load_debug_info #12992

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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