PANICTRACE bits
Add missing check for NO_SIGNAL in PANICTRACE versionof NH_abort(). Fix indentation of pre-processing directives. Add #endif comments to make things clearer.
This commit is contained in:
@@ -55,7 +55,7 @@ STATIC_DCL boolean FDECL(should_query_disclose_option, (int,char *));
|
|||||||
#if defined(__BEOS__) || defined(MICRO) || defined(WIN32) || defined(OS2)
|
#if defined(__BEOS__) || defined(MICRO) || defined(WIN32) || defined(OS2)
|
||||||
extern void FDECL(nethack_exit,(int));
|
extern void FDECL(nethack_exit,(int));
|
||||||
#else
|
#else
|
||||||
#define nethack_exit exit
|
# define nethack_exit exit
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define done_stopprint program_state.stopprint
|
#define done_stopprint program_state.stopprint
|
||||||
@@ -68,15 +68,15 @@ extern void FDECL(nethack_exit,(int));
|
|||||||
# define NH_abort_() Abort(0)
|
# define NH_abort_() Abort(0)
|
||||||
#else
|
#else
|
||||||
# ifdef SYSV
|
# ifdef SYSV
|
||||||
# define NH_abort_() (void) abort()
|
# define NH_abort_() (void) abort()
|
||||||
# else
|
# else
|
||||||
# ifdef WIN32
|
# ifdef WIN32
|
||||||
# define NH_abort_() win32_abort()
|
# define NH_abort_() win32_abort()
|
||||||
# else
|
# else
|
||||||
# define NH_abort_() abort()
|
# define NH_abort_() abort()
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif /* !SYSV */
|
||||||
#endif
|
#endif /* !AMIGA */
|
||||||
|
|
||||||
#ifdef PANICTRACE
|
#ifdef PANICTRACE
|
||||||
# include <errno.h>
|
# include <errno.h>
|
||||||
@@ -109,19 +109,19 @@ extern void FDECL(nethack_exit,(int));
|
|||||||
# endif
|
# endif
|
||||||
|
|
||||||
static void NDECL(NH_abort);
|
static void NDECL(NH_abort);
|
||||||
#ifndef NO_SIGNAL
|
# ifndef NO_SIGNAL
|
||||||
static void FDECL(panictrace_handler, (int));
|
static void FDECL(panictrace_handler, (int));
|
||||||
#endif
|
# endif
|
||||||
static boolean NDECL(NH_panictrace_glibc);
|
static boolean NDECL(NH_panictrace_glibc);
|
||||||
static boolean NDECL(NH_panictrace_gdb);
|
static boolean NDECL(NH_panictrace_gdb);
|
||||||
|
|
||||||
#ifndef NO_SIGNAL
|
# ifndef NO_SIGNAL
|
||||||
/*ARGSUSED*/
|
/*ARGSUSED*/
|
||||||
void
|
void
|
||||||
panictrace_handler(sig_unused) /* called as signal() handler, so sent at least one arg */
|
panictrace_handler(sig_unused) /* called as signal() handler, so sent at least one arg */
|
||||||
int sig_unused;
|
int sig_unused;
|
||||||
{
|
{
|
||||||
# define SIG_MSG "\nSignal received.\n"
|
# define SIG_MSG "\nSignal received.\n"
|
||||||
(void) write(2, SIG_MSG, sizeof(SIG_MSG)-1);
|
(void) write(2, SIG_MSG, sizeof(SIG_MSG)-1);
|
||||||
NH_abort();
|
NH_abort();
|
||||||
}
|
}
|
||||||
@@ -130,7 +130,7 @@ void
|
|||||||
panictrace_setsignals(set)
|
panictrace_setsignals(set)
|
||||||
boolean set;
|
boolean set;
|
||||||
{
|
{
|
||||||
# define SETSIGNAL(sig) (void) signal(sig, set?(SIG_RET_TYPE)panictrace_handler:SIG_DFL);
|
# define SETSIGNAL(sig) (void) signal(sig, set?(SIG_RET_TYPE)panictrace_handler:SIG_DFL);
|
||||||
# ifdef SIGILL
|
# ifdef SIGILL
|
||||||
SETSIGNAL(SIGILL);
|
SETSIGNAL(SIGILL);
|
||||||
# endif
|
# endif
|
||||||
@@ -158,9 +158,9 @@ boolean set;
|
|||||||
# ifdef SIGEMT
|
# ifdef SIGEMT
|
||||||
SETSIGNAL(SIGEMT);
|
SETSIGNAL(SIGEMT);
|
||||||
# endif
|
# endif
|
||||||
# undef SETSIGNAL
|
# undef SETSIGNAL
|
||||||
}
|
}
|
||||||
#endif
|
# endif /* NO_SIGNAL */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
NH_abort(){
|
NH_abort(){
|
||||||
@@ -179,7 +179,9 @@ NH_abort(){
|
|||||||
NH_panictrace_glibc() || (gdb_prio && NH_panictrace_gdb());
|
NH_panictrace_glibc() || (gdb_prio && NH_panictrace_gdb());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifndef NO_SIGNAL
|
||||||
panictrace_setsignals(FALSE);
|
panictrace_setsignals(FALSE);
|
||||||
|
# endif
|
||||||
NH_abort_();
|
NH_abort_();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -201,7 +203,7 @@ NH_panictrace_glibc(){
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
# else
|
# else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
# endif
|
# endif /* !PANICTRACE_GLIBC */
|
||||||
}
|
}
|
||||||
|
|
||||||
# ifdef PANICTRACE_GDB
|
# ifdef PANICTRACE_GDB
|
||||||
@@ -212,8 +214,8 @@ NH_panictrace_glibc(){
|
|||||||
# ifndef GDBPATH
|
# ifndef GDBPATH
|
||||||
# define GDBPATH "/usr/bin/gdb"
|
# define GDBPATH "/usr/bin/gdb"
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif /* !SYSCF */
|
||||||
# endif
|
# endif /* PANICTRACE_GDB */
|
||||||
|
|
||||||
static boolean
|
static boolean
|
||||||
NH_panictrace_gdb(){
|
NH_panictrace_gdb(){
|
||||||
@@ -240,9 +242,9 @@ NH_panictrace_gdb(){
|
|||||||
}
|
}
|
||||||
# else
|
# else
|
||||||
return FALSE;
|
return FALSE;
|
||||||
# endif
|
# endif /* !PANICTRACE_GDB */
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* PANICTRACE */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The order of these needs to match the macros in hack.h.
|
* The order of these needs to match the macros in hack.h.
|
||||||
|
|||||||
Reference in New Issue
Block a user