mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: remove commented code; improve print_backtrace with tcc
This commit is contained in:
@@ -23,15 +23,21 @@ fn on_panic(f fn(int)int) {
|
||||
|
||||
// print_backtrace shows a backtrace of the current call stack on stdout
|
||||
pub fn print_backtrace() {
|
||||
// at the time of backtrace_symbols_fd call, the C stack would look something like this:
|
||||
// 1 frame for print_backtrace_skipping_top_frames
|
||||
// 1 frame for print_backtrace itself
|
||||
// ... print the rest of the backtrace frames ...
|
||||
// At the time of backtrace_symbols_fd call, the C stack would look something like this:
|
||||
// * print_backtrace_skipping_top_frames
|
||||
// * print_backtrace itself
|
||||
// * the rest of the backtrace frames
|
||||
// => top 2 frames should be skipped, since they will not be informative to the developer
|
||||
$if freestanding {
|
||||
println(bare_backtrace())
|
||||
} $else {
|
||||
print_backtrace_skipping_top_frames(2)
|
||||
$if !no_backtrace ? {
|
||||
$if freestanding {
|
||||
println(bare_backtrace())
|
||||
} $else {
|
||||
$if tinyc {
|
||||
C.tcc_backtrace(c'Backtrace')
|
||||
} $else {
|
||||
print_backtrace_skipping_top_frames(2)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user