check error earlier in allocator, return count correctly in linux

This commit is contained in:
Laytan Laats
2026-07-26 19:28:04 +02:00
parent 065d58e5b8
commit 0845ff2502
2 changed files with 9 additions and 11 deletions

View File

@@ -214,15 +214,14 @@ tracking_allocator_print_results :: proc(t: ^Tracking_Allocator, temp_allocator
continue
}
trace, err := resolve(leak.backtrace, temp_allocator, temp_allocator)
defer locations_destroy(trace, temp_allocator)
fmt.eprintln("[back trace]")
trace, err := resolve(leak.backtrace, temp_allocator, temp_allocator)
if err != nil {
fmt.eprintfln("backtrace error: %v", err)
fmt.eprintfln("\tbacktrace error: %v", err)
continue
}
defer locations_destroy(trace, temp_allocator)
print(trace)
fmt.eprintln()
@@ -240,15 +239,14 @@ tracking_allocator_print_results :: proc(t: ^Tracking_Allocator, temp_allocator
continue
}
trace, err := resolve(bad_free.backtrace, temp_allocator, temp_allocator)
defer locations_destroy(trace, temp_allocator)
fmt.eprintln("[back trace]")
trace, err := resolve(bad_free.backtrace, temp_allocator, temp_allocator)
if err != nil {
fmt.eprintf("backtrace error: %v\n", err)
fmt.eprintfln("\tbacktrace error: %v", err)
continue
}
defer locations_destroy(trace, temp_allocator)
print(trace)
}

View File

@@ -157,18 +157,18 @@ _resolve :: proc(bt: Capture, allocator, temp_allocator: runtime.Allocator) -> (
defer delete(stdout, temp_allocator)
defer delete(stderr, temp_allocator)
count := len(command)-COMMAND_START_LEN
// `SYMBOLIZER_PROGRAM` does not exist, lets fall back to unresolved info.
if perr == .Not_Exist {
fill_unresolved(locations, msgs, allocator)
return
return count, nil
}
if perr != nil || !state.success {
return 0, .Resolve_Aborted
}
count := len(command)-COMMAND_START_LEN
sstdout := string(stdout)
for i in 0..<count {
exe, address, parse_err := parse_address(msgs[i])