1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

backtraces: cleaner looking backtrace output on linux

This commit is contained in:
Delyan Angelov 2019-11-23 13:22:55 +02:00 committed by Alexander Medvednikov
parent 9c1107f723
commit 9b4bc0189b

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