diff --git a/vlib/builtin/builtin.c.v b/vlib/builtin/builtin.c.v index af2a872674..6a0c3506f5 100644 --- a/vlib/builtin/builtin.c.v +++ b/vlib/builtin/builtin.c.v @@ -9,6 +9,10 @@ pub fn exit(code int) { 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 // recent versions of tcc print nicer backtraces automatically // 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(' message: $s') eprintln(' file: $file:$line_no') + eprintln(' v hash: $vcommithash()') eprintln('=========================================') } $else { eprint('V panic: ') @@ -63,6 +68,7 @@ pub fn panic_optional_not_set(s string) { pub fn panic(s string) { eprint('V panic: ') eprintln(s) + eprintln('v hash: $vcommithash()') $if exit_after_panic_message ? { C.exit(1) } $else {