backtraces: cleaner looking backtrace output on linux

pull/2855/head^2
Delyan Angelov 2019-11-23 13:22:55 +02:00 committed by Alexander Medvednikov
parent 9c1107f723
commit 9b4bc0189b
1 changed files with 3 additions and 1 deletions

View File

@ -50,6 +50,7 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
for sframe in sframes {
executable := sframe.all_before('(')
addr := sframe.all_after('[').all_before(']')
beforeaddr := sframe.all_before('[')
cmd := 'addr2line -e $executable $addr'
// taken from os, to avoid depending on the os module inside builtin.v
@ -66,7 +67,8 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
if 0 != int(C.pclose(f)) {
println(sframe) continue
}
println( '${output:-45s} | $sframe')
if output in ['??:0:','??:?:'] { output = '' }
println( '${output:-46s} | ${addr:14s} | $beforeaddr')
}
//C.backtrace_symbols_fd(*voidptr(&buffer[skipframes]), nr_actual_frames, 1)
return true