diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-02-17 17:21:41 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-02-17 17:21:41 -0800 |
commit | aa2d3dbdf56e835e34c8255815019bcfee5066d2 (patch) | |
tree | 4ad0db82f6f37dba7c7e22b57437dc510b70c328 /usage.c | |
parent | Merge branch 'js/range-diff-one-side-only' (diff) | |
parent | usage: trace2 BUG() invocations (diff) | |
download | tgif-aa2d3dbdf56e835e34c8255815019bcfee5066d2.tar.xz |
Merge branch 'jt/trace2-BUG'
Even though invocations of "die()" were logged to the trace2
system, "BUG()"s were not, which has been corrected.
* jt/trace2-BUG:
usage: trace2 BUG() invocations
Diffstat (limited to 'usage.c')
-rw-r--r-- | usage.c | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -266,6 +266,10 @@ int BUG_exit_code; static NORETURN void BUG_vfl(const char *file, int line, const char *fmt, va_list params) { char prefix[256]; + va_list params_copy; + static int in_bug; + + va_copy(params_copy, params); /* truncation via snprintf is OK here */ if (file) @@ -274,6 +278,13 @@ static NORETURN void BUG_vfl(const char *file, int line, const char *fmt, va_lis snprintf(prefix, sizeof(prefix), "BUG: "); vreportf(prefix, fmt, params); + + if (in_bug) + abort(); + in_bug = 1; + + trace2_cmd_error_va(fmt, params_copy); + if (BUG_exit_code) exit(BUG_exit_code); abort(); |