package back
- License: MIT
- Repository: https://github.com/laytan/back/blob/main
Index
Variables (0)
This section is empty.
Procedure Groups (1)
`#config` values (4)
Types
Lines_Error ¶
Lines_Error :: enum int { None, Parse_Address_Fail, Addr2line_Unexpected_EOF, Addr2line_Output_Error, Addr2line_Unresolved, Addr2line_Process_Error, Out_Of_Memory, Info_Not_Found, }
TODO: improve errors.
Related Procedures With Returns
- lines_const
- lines_n
- lines (procedure groups)
Trace ¶
Trace :: []rawptr
Related Procedures With Parameters
- lines_n
- trace_fill
- trace_n_destroy
- lines (procedure groups)
Related Procedures With Returns
Trace_Const ¶
Related Procedures With Parameters
- lines_const
- lines (procedure groups)
Related Procedures With Returns
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 a similar allocator as the core:mem 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
ADDR2LINE_PATH ¶
ADDR2LINE_PATH :: #config(TRACE_ADDR2LINE_PATH, "addr2line")
BACKTRACE_SIZE ¶
BACKTRACE_SIZE :: #config(BACKTRACE_SIZE, 16)
Size of a constant backtrace, as used by the tracking allocator for example.
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 || (_COULD_USE_FALLBACK_WITHOUT_ERROR && !ODIN_DEBUG) || (ODIN_OS != .Darwin && ODIN_OS != .Linux && ODIN_OS != .Windows)
Use the fallback (instrumentation based) implementation: if it is forced, or it can be used without error and debug info is off, or if the target has no debug info based support.
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, temp_allocator := context.temp_allocator) -> (out: []Line, err: Lines_Error) {…}
Related Procedure Groups
lines_destroy ¶
lines_destroy :: proc(lines: []Line, allocator := context.allocator) {…}
lines_n ¶
lines_n :: proc(bt: []rawptr, allocator := context.allocator, temp_allocator := context.temp_allocator) -> (out: []Line, err: Lines_Error) {…}
Related Procedure Groups
print ¶
print :: proc(lines: []Line, padding: string = " ", w: runtime.Maybe($T=Stream) = nil, temp_allocator := context.temp_allocator) {…}
register_segfault_handler ¶
register_segfault_handler :: proc() {…}
trace ¶
trace :: proc() -> (bt: Trace_Const) {…}
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, temp_allocator := context.temp_allocator) {…}
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.
`#config` values
ADDR2LINE_PATH ¶
ADDR2LINE_PATH :: #config(TRACE_ADDR2LINE_PATH, "addr2line")
BACKTRACE_SIZE ¶
BACKTRACE_SIZE :: #config(BACKTRACE_SIZE, 16)
Size of a constant backtrace, as used by the tracking allocator for example.
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.
Source Files
Generation Information
Generated with odin version dev-2026-07 (vendor "odin") Linux_amd64 @ 2026-07-18 19:34:24.720012805 +0000 UTC