From 056fcf7173f121581e69bbfa8130f604bb91c6e6 Mon Sep 17 00:00:00 2001 From: nhmall Date: Thu, 7 Mar 2024 12:42:19 -0500 Subject: [PATCH] more CI build fixes --- include/extern.h | 6 ++- src/end.c | 4 -- src/report.c | 138 ++++++++++++++++++++++++----------------------- 3 files changed, 74 insertions(+), 74 deletions(-) diff --git a/include/extern.h b/include/extern.h index e0a53ffc5..baba78970 100644 --- a/include/extern.h +++ b/include/extern.h @@ -2522,22 +2522,24 @@ extern void region_safety(void); /* ### report.c ### */ #ifdef CRASHREPORT -extern const char *get_saved_pline(int); extern boolean submit_web_report(int, const char *, const char *); extern boolean submit_web_report(int, const char *, const char *); extern void crashreport_init(int, char *[]); extern void crashreport_bidshow(void); extern boolean swr_add_uricoded(const char *, char **, int *, char *); extern int dobugreport(void); +#endif /* CRASHREPORT */ # ifndef NO_SIGNAL extern void panictrace_handler(int); # endif +#ifdef PANICTRACE +extern const char *get_saved_pline(int); extern boolean NH_panictrace_libc(void); extern boolean NH_panictrace_gdb(void); -#endif #if defined(PANICTRACE) && !defined(NO_SIGNAL) extern void panictrace_setsignals(boolean); #endif +#endif /* PANICTRACE */ /* ### restore.c ### */ diff --git a/src/end.c b/src/end.c index bc6aa5588..9803079ce 100644 --- a/src/end.c +++ b/src/end.c @@ -1898,10 +1898,8 @@ build_english_list(char *in) void NH_abort(char *why USED_FOR_CRASHREPORT) { -#ifdef PANICTRACE int gdb_prio = SYSOPT_PANICTRACE_GDB; int libc_prio = SYSOPT_PANICTRACE_LIBC; -#endif static volatile boolean aborting = FALSE; /* don't execute this code recursively if a second abort is requested @@ -1910,7 +1908,6 @@ NH_abort(char *why USED_FOR_CRASHREPORT) return; aborting = TRUE; -#ifdef PANICTRACE #ifdef CRASHREPORT if(!submit_web_report(1, "Panic", why)) #endif @@ -1938,7 +1935,6 @@ NH_abort(char *why USED_FOR_CRASHREPORT) #ifndef NO_SIGNAL panictrace_setsignals(FALSE); #endif -#endif /* PANICTRACE */ NH_abort_; } #undef USED_FOR_CRASHREPORT diff --git a/src/report.c b/src/report.c index 3979151c0..fce7dc956 100644 --- a/src/report.c +++ b/src/report.c @@ -6,8 +6,6 @@ /* NB: CRASHREPORT implies PANICTRACE */ -#ifdef CRASHREPORT - # ifndef NO_SIGNAL #include # endif @@ -23,70 +21,7 @@ #include # endif -# ifndef NO_SIGNAL -/* called as signal() handler, so sent at least one arg */ -/*ARGUSED*/ -void -panictrace_handler(int sig_unused UNUSED) -{ -#define SIG_MSG "\nSignal received.\n" - int f2; - -# ifdef CURSES_GRAPHICS - if (iflags.window_inited && WINDOWPORT(curses)) { - extern void curses_uncurse_terminal(void); /* wincurs.h */ - - /* it is risky calling this during a program-terminating signal, - but without it the subsequent backtrace is useless because - that ends up being scrawled all over the screen; call is - here rather than in NH_abort() because panic() calls both - exit_nhwindows(), which makes this same call under curses, - then NH_abort() and we don't want to call this twice */ - curses_uncurse_terminal(); - } -# endif - - f2 = (int) write(2, SIG_MSG, sizeof SIG_MSG - 1); - nhUse(f2); /* what could we do if write to fd#2 (stderr) fails */ - NH_abort(NULL); /* ... and we're already in the process of quitting? */ -} - -void -panictrace_setsignals(boolean set) -{ -#define SETSIGNAL(sig) \ - (void) signal(sig, set ? (SIG_RET_TYPE) panictrace_handler : SIG_DFL); -# ifdef SIGILL - SETSIGNAL(SIGILL); -# endif -# ifdef SIGTRAP - SETSIGNAL(SIGTRAP); -# endif -# ifdef SIGIOT - SETSIGNAL(SIGIOT); -# endif -# ifdef SIGBUS - SETSIGNAL(SIGBUS); -# endif -# ifdef SIGFPE - SETSIGNAL(SIGFPE); -# endif -# ifdef SIGSEGV - SETSIGNAL(SIGSEGV); -# endif -# ifdef SIGSTKFLT - SETSIGNAL(SIGSTKFLT); -# endif -# ifdef SIGSYS - SETSIGNAL(SIGSYS); -# endif -# ifdef SIGEMT - SETSIGNAL(SIGEMT); -# endif -#undef SETSIGNAL -} -# endif /* NO_SIGNAL */ - +#ifdef CRASHREPORT # ifdef WIN32 # define HASH_PRAGMA_START # define HASH_PRAGMA_END @@ -516,6 +451,10 @@ dobugreport(void) #undef SWR_HDR #undef SWR_LINES +#endif /* CRASHREPORT */ + +#ifdef PANICTRACE + /*ARGSUSED*/ boolean NH_panictrace_libc(void) @@ -618,6 +557,69 @@ get_saved_pline(int lineno) return NULL; } -#endif /* CRASHREPORT */ +# ifndef NO_SIGNAL +/* called as signal() handler, so sent at least one arg */ +/*ARGUSED*/ +void +panictrace_handler(int sig_unused UNUSED) +{ +#define SIG_MSG "\nSignal received.\n" + int f2; - /*report.c*/ +# ifdef CURSES_GRAPHICS + if (iflags.window_inited && WINDOWPORT(curses)) { + extern void curses_uncurse_terminal(void); /* wincurs.h */ + + /* it is risky calling this during a program-terminating signal, + but without it the subsequent backtrace is useless because + that ends up being scrawled all over the screen; call is + here rather than in NH_abort() because panic() calls both + exit_nhwindows(), which makes this same call under curses, + then NH_abort() and we don't want to call this twice */ + curses_uncurse_terminal(); + } +# endif + + f2 = (int) write(2, SIG_MSG, sizeof SIG_MSG - 1); + nhUse(f2); /* what could we do if write to fd#2 (stderr) fails */ + NH_abort(NULL); /* ... and we're already in the process of quitting? */ +} + +void +panictrace_setsignals(boolean set) +{ +#define SETSIGNAL(sig) \ + (void) signal(sig, set ? (SIG_RET_TYPE) panictrace_handler : SIG_DFL); +# ifdef SIGILL + SETSIGNAL(SIGILL); +# endif +# ifdef SIGTRAP + SETSIGNAL(SIGTRAP); +# endif +# ifdef SIGIOT + SETSIGNAL(SIGIOT); +# endif +# ifdef SIGBUS + SETSIGNAL(SIGBUS); +# endif +# ifdef SIGFPE + SETSIGNAL(SIGFPE); +# endif +# ifdef SIGSEGV + SETSIGNAL(SIGSEGV); +# endif +# ifdef SIGSTKFLT + SETSIGNAL(SIGSTKFLT); +# endif +# ifdef SIGSYS + SETSIGNAL(SIGSYS); +# endif +# ifdef SIGEMT + SETSIGNAL(SIGEMT); +# endif +#undef SETSIGNAL +} +# endif /* NO_SIGNAL */ +#endif /* PANICTRACE */ + +/*report.c*/