From d852d54e4c9f7cc3fe4050c526a5ff960bfd0a68 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 9 Sep 2024 17:26:53 -0400 Subject: [PATCH] debug_fuzzer change I don't always want to abort() on an impossible() when debug_fuzzing, especially if the first impossible() encountered isn't related to the bug I'm in the midst of trying to hunt down. I often have breakpoints on impossible() anyway, and I'd like a simple way to avoid the panic() call during a lengthy debug session. Make iflags.debug_fuzzer an xint8 instead of a boolean. Call abort() only if iflags.debug_fuzzer is set to 1. That allows setting iflags.debug_fuzzer to 2 in order to bypass the abort call, and make use of other breakpoints that have been set to narrow down a particular issue. --- include/flag.h | 2 +- src/pline.c | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/flag.h b/include/flag.h index 95c7943a8..e774a1c31 100644 --- a/include/flag.h +++ b/include/flag.h @@ -233,7 +233,6 @@ struct accessibility_data { struct instance_flags { boolean query_menu; /* use a menu for yes/no queries */ boolean showdamage; - boolean debug_fuzzer; /* fuzz testing */ boolean defer_plname; /* X11 hack: askname() might not set svp.plname */ boolean herecmd_menu; /* use menu when mouseclick on yourself */ boolean invis_goldsym; /* gold symbol is ' '? */ @@ -244,6 +243,7 @@ struct instance_flags { * indirectly so we can't use xname_flags() */ boolean remember_getpos; /* save getpos() positioning in do-again queue */ boolean sad_feeling; /* unseen pet is dying */ + xint8 debug_fuzzer; /* fuzz testing */ int at_midnight; /* only valid during end of game disclosure */ int at_night; /* also only valid during end of game disclosure */ int failing_untrap; /* move_into_trap() -> spoteffects() -> dotrap() */ diff --git a/src/pline.c b/src/pline.c index 010dea488..17b29f2d8 100644 --- a/src/pline.c +++ b/src/pline.c @@ -587,7 +587,8 @@ impossible(const char *s, ...) va_end(the_args); pbuf[BUFSZ - 1] = '\0'; /* sanity */ paniclog("impossible", pbuf); - if (iflags.debug_fuzzer) + if (iflags.debug_fuzzer + && iflags.debug_fuzzer == 1) panic("%s", pbuf); gp.pline_flags = URGENT_MESSAGE;