class Cradare2::CrystalHelper

Overview

Crystal-specific binary analysis, memory layout inspection, and debugging tools.

Defined in:

cradare2/crystal.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(client : Client) #

[View source]

Instance Method Detail

def classes : Array(String) #

Discovers all distinct Crystal class, struct, and module names present in the binary.


[View source]
def client : Client #

[View source]
def crash_report : String #

Generates a detailed crash report with demangled Crystal stack traces, registers, and binary context.


[View source]
def crystal_binary? : Bool #

Returns true if the binary appears to be compiled with Crystal. Checks for the presence of __crystal_main, *Crystal::*, Boehm GC symbols, or Crystal mangling.


[View source]
def crystal_main_function : Model::Function | Nil #

Returns the __crystal_main function model if analyzed.


[View source]
def decompile_method(class_name : String, method_name : String, side_by_side : Bool = false) : String #

Decompiles a specific method belonging to a Crystal class or struct.


[View source]
def demangle_all(apply_to_r2 : Bool = false) : Hash(UInt64, String) #

Discovers all mangled Crystal symbols and functions, demangles them, and optionally applies the demangled names directly into the radare2 session via afn (analyze function name) and fr (flag rename).


[View source]
def demangle_symbol(symbol : String) : String #

Demangles a single symbol using the multi-language demangler.


[View source]
def demangled_backtrace : Array(Model::StackFrame) #

Returns the current call stack with demangled Crystal function and class names.


[View source]
def entrypoint : UInt64 | Nil #

Returns the address of __crystal_main or entry function if found.


[View source]
def gc_functions : Array(Model::Function) #

Returns all Boehm GC related functions found in the binary.


[View source]
def gc_symbols : Array(Model::Symbol) #

Returns all Boehm GC related symbols found in the binary.


[View source]
def lines : Lines::LineHelper #

Accessor for source-line-to-assembly instruction matching tools.


[View source]
def lines(&block : Lines::LineHelper -> U) : U forall U #

Block form for #lines DSL.


[View source]
def methods_for_class(class_name : String) : Array(Model::Function) #

Finds all analyzed functions belonging to a given Crystal class name.


[View source]
def parse_symbol(symbol : String) : CrystalSymbolInfo #

Parses a Crystal symbol into its constituent class and method parts.


[View source]
def read_array_header(address : Address) : CrystalArrayHeader #

Inspects and reads a Crystal Array(T) header from memory at address.


[View source]
def read_fiber(address : Address) : CrystalFiber #

Inspects and reads a Crystal Fiber struct from memory at address.


[View source]
def read_hash_header(address : Address) : CrystalHashHeader #

Inspects and reads a Crystal Hash(K, V) header from memory at address.


[View source]
def read_slice_header(address : Address) : CrystalSliceHeader #

Inspects and reads a Crystal Slice(T) struct header from memory at address.


[View source]
def read_string(address : Address, max_bytes : Int32 = 1048576) : CrystalString #

Inspects and reads a Crystal String from memory at address.


[View source]
def read_string_value(address : Address, max_bytes : Int32 = 1048576) : String #

Convenience method to read just the UTF-8 String value of a Crystal String at address.


[View source]
def read_type_id(address : Address) : Int32 #

Reads the 4-byte type_id of a Crystal reference object at address.


[View source]
def symbols_for_class(class_name : String) : Array(Model::Symbol) #

Finds all symbols belonging to a given Crystal class name.


[View source]