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

builtin: support -d no_backtrace, to ease compiling V code on older distros easier

This commit is contained in:
Delyan Angelov 2020-11-19 17:57:51 +02:00
parent f807fd973e
commit 48b117618d

View File

@ -87,6 +87,9 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
C.tcc_backtrace("Backtrace")
return false
}
$if no_backtrace ? {
return false
} $else {
buffer := [100]byteptr{}
nr_ptrs := C.backtrace(voidptr(buffer), 100)
if nr_ptrs < 2 {
@ -130,6 +133,7 @@ fn print_backtrace_skipping_top_frames_linux(skipframes int) bool {
output = output.replace(' (discriminator', ': (d.')
eprintln('${output:-46s} | ${addr:14s} | $beforeaddr')
}
}
return true
}