builtin: add a 'v hash:' line to V panics
parent
466dc4540b
commit
cb69c4c91a
|
@ -9,6 +9,10 @@ pub fn exit(code int) {
|
||||||
C.exit(code)
|
C.exit(code)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn vcommithash() string {
|
||||||
|
return unsafe { tos5(&char(C.V_CURRENT_COMMIT_HASH)) }
|
||||||
|
}
|
||||||
|
|
||||||
// panic_debug private function that V uses for panics, -cg/-g is passed
|
// panic_debug private function that V uses for panics, -cg/-g is passed
|
||||||
// recent versions of tcc print nicer backtraces automatically
|
// recent versions of tcc print nicer backtraces automatically
|
||||||
// NB: the duplication here is because tcc_backtrace should be called directly
|
// NB: the duplication here is because tcc_backtrace should be called directly
|
||||||
|
@ -24,6 +28,7 @@ fn panic_debug(line_no int, file string, mod string, fn_name string, s string) {
|
||||||
eprintln(' function: ${fn_name}()')
|
eprintln(' function: ${fn_name}()')
|
||||||
eprintln(' message: $s')
|
eprintln(' message: $s')
|
||||||
eprintln(' file: $file:$line_no')
|
eprintln(' file: $file:$line_no')
|
||||||
|
eprintln(' v hash: $vcommithash()')
|
||||||
eprintln('=========================================')
|
eprintln('=========================================')
|
||||||
} $else {
|
} $else {
|
||||||
eprint('V panic: ')
|
eprint('V panic: ')
|
||||||
|
@ -63,6 +68,7 @@ pub fn panic_optional_not_set(s string) {
|
||||||
pub fn panic(s string) {
|
pub fn panic(s string) {
|
||||||
eprint('V panic: ')
|
eprint('V panic: ')
|
||||||
eprintln(s)
|
eprintln(s)
|
||||||
|
eprintln('v hash: $vcommithash()')
|
||||||
$if exit_after_panic_message ? {
|
$if exit_after_panic_message ? {
|
||||||
C.exit(1)
|
C.exit(1)
|
||||||
} $else {
|
} $else {
|
||||||
|
|
Loading…
Reference in New Issue