package back

⌘K
Ctrl+K
or
/

    Types

    Line ¶

    Line :: struct {
    	location: string,
    	symbol:   string,
    }

    Lines_Error ¶

    Lines_Error :: enum int {
    	None, 
    	Parse_Address_Fail, 
    	Addr2line_Unexpected_EOF, 
    	Addr2line_Output_Error, 
    	Addr2line_Unresolved, 
    	Fork_Limited             = 11, 
    	Out_Of_Memory            = 12, 
    	Invalid_Fd               = 14, 
    	Pipe_Process_Limited     = 24, 
    	Pipe_System_Limited      = 23, 
    	Fork_Not_Supported       = 38, 
    	Info_Not_Found, 
    }
    Related Procedures With Returns

    Result_Type ¶

    Result_Type :: enum int {
    	Both, 
    	Leaks, 
    	Bad_Frees, 
    }
    Related Procedures With Parameters

    Trace ¶

    Trace :: []rawptr

    Trace_Const ¶

    Trace_Const :: struct {
    	trace: [16]rawptr,
    	len:   int,
    }
    Related Procedures With Parameters
    Related Procedures With Returns

    Trace_Entry ¶

    Trace_Entry :: rawptr
     

    Platform specific.

    Tracking_Allocator ¶

    Tracking_Allocator :: struct {
    	backing:             runtime.Allocator,
    	internals_allocator: runtime.Allocator,
    	allocation_map:      map[rawptr]Tracking_Allocator_Entry,
    	bad_free_array:      [dynamic]Tracking_Allocator_Bad_Free_Entry,
    	mutex:               sync.Mutex,
    	clear_on_free_all:   bool,
    }
     

    The backtrace tracking allocator is the same allocator as the core tracking allocator but keeps backtraces for each allocation.

    See examples/allocator for a usage snippet.

    Print results at the end using tracking_allocator_print_results().

    Related Procedures With Parameters

    Tracking_Allocator_Bad_Free_Entry ¶

    Tracking_Allocator_Bad_Free_Entry :: struct {
    	memory:    rawptr,
    	location:  runtime.Source_Code_Location,
    	backtrace: Trace_Const,
    }

    Tracking_Allocator_Entry ¶

    Tracking_Allocator_Entry :: struct {
    	memory:    rawptr,
    	size:      int,
    	alignment: int,
    	mode:      runtime.Allocator_Mode,
    	err:       runtime.Allocator_Error,
    	location:  runtime.Source_Code_Location,
    	backtrace: Trace_Const,
    }

    Constants

    BACKTRACE_SIZE ¶

    BACKTRACE_SIZE :: #config(BACKTRACE_SIZE, 16)
     

    Size of a constant backtrace, as used by the allocator for example.

    EAGAIN ¶

    EAGAIN: linux.Errno : os.EAGAIN when ODIN_OS == .Linux || ODIN_OS == .Darwin else 5

    EFAULT ¶

    EFAULT: linux.Errno : os.EFAULT when ODIN_OS == .Linux || ODIN_OS == .Darwin else 7

    EMFILE ¶

    EMFILE: linux.Errno : os.EMFILE when ODIN_OS == .Linux || ODIN_OS == .Darwin else 8

    ENFILE ¶

    ENFILE: linux.Errno : os.ENFILE when ODIN_OS == .Linux || ODIN_OS == .Darwin else 9

    ENOMEM ¶

    ENOMEM: linux.Errno : os.ENOMEM when ODIN_OS == .Linux || ODIN_OS == .Darwin else 6

    ENOSYS ¶

    ENOSYS: linux.Errno : os.ENOSYS when ODIN_OS == .Linux || ODIN_OS == .Darwin else 10

    FORCE_FALLBACK ¶

    FORCE_FALLBACK :: #config(BACK_FORCE_FALLBACK, false)
     

    Force the fallback instrumentation based implementation instead of debug info based.

    OTHER_CUSTOM_INSTRUMENTATION ¶

    OTHER_CUSTOM_INSTRUMENTATION :: #config(BACK_OTHER_CUSTOM_INSTRUMENTATION, false)
     

    For targets that do not have native support (using debug info), backtraces are done through instrumentation, Odin only allows one enter/exit instrumentation procedure though, so you can set this to true, add your own instrumentation procs, and have them call back.other_instrumentation_enter and back.other_instrumentation_exit to hook up the backtraces.

    The custom proc must have #force_inline.

    USE_FALLBACK ¶

    USE_FALLBACK :: FORCE_FALLBACK || (ODIN_OS != .Darwin && ODIN_OS != .Linux && ODIN_OS != .Windows)

    Variables

    This section is empty.

    Procedures

    assertion_failure_proc ¶

    assertion_failure_proc :: proc(prefix, message: string, loc: runtime.Source_Code_Location) -> ! {…}

    lines_const ¶

    lines_const :: proc(bt: Trace_Const, allocator := context.allocator) -> (out: []Line, err: Lines_Error) {…}

    lines_destroy ¶

    lines_destroy :: proc(lines: []Line, allocator := context.allocator) {…}

    lines_n ¶

    lines_n :: proc(bt: []rawptr, allocator := context.allocator) -> (out: []Line, err: Lines_Error) {…}

    print ¶

    print :: proc(lines: []Line, padding: string = "    ", w: runtime.Maybe($T=Stream) = nil, no_temp_guard: bool = false) {…}

    register_segfault_handler ¶

    register_segfault_handler :: proc() {…}

    trace ¶

    trace :: proc() -> (bt: Trace_Const) {…}

    trace_fill ¶

    trace_fill :: proc(buf: []rawptr) -> int {…}

    trace_n ¶

    trace_n :: proc(max_len: i32, allocator := context.allocator) -> []rawptr {…}

    trace_n_destroy ¶

    trace_n_destroy :: proc(b: []rawptr, allocator := context.allocator) {…}

    tracking_allocator ¶

    tracking_allocator :: proc(data: ^Tracking_Allocator) -> runtime.Allocator {…}

    tracking_allocator_clear ¶

    tracking_allocator_clear :: proc(t: ^Tracking_Allocator) {…}

    tracking_allocator_destroy ¶

    tracking_allocator_destroy :: proc(t: ^Tracking_Allocator) {…}

    tracking_allocator_init ¶

    tracking_allocator_init :: proc(t: ^Tracking_Allocator, backing_allocator: runtime.Allocator, internals_allocator := context.allocator) {…}

    tracking_allocator_print_results ¶

    tracking_allocator_print_results :: proc(t: ^Tracking_Allocator, type: Result_Type = .Both) {…}

    tracking_allocator_proc ¶

    tracking_allocator_proc :: proc(
    	allocator_data:  rawptr, 
    	mode:            runtime.Allocator_Mode, 
    	size, alignment: int, 
    	old_memory:      rawptr, 
    	old_size:        int, 
    	loc := #caller_location, 
    ) -> (result: []u8, err: runtime.Allocator_Error) {…}

    Procedure Groups

    lines ¶

    lines :: proc{
    	lines_n,
    	lines_const,
    }
    
     

    Processes the message trying to get more/useful information. This adds file and line information if the program is running in debug mode.

    If an error is returned the original message will be the result and is save to use.

    Source Files

    Generation Information

    Generated with odin version dev-2024-10 (vendor "odin") Linux_amd64 @ 2024-10-02 09:04:27.163739539 +0000 UTC