diff options
Diffstat (limited to 'gdb/testsuite/gdb.reverse/sigall-reverse.c')
-rw-r--r-- | gdb/testsuite/gdb.reverse/sigall-reverse.c | 113 |
1 files changed, 65 insertions, 48 deletions
diff --git a/gdb/testsuite/gdb.reverse/sigall-reverse.c b/gdb/testsuite/gdb.reverse/sigall-reverse.c index 6ccea42..9053163 100644 --- a/gdb/testsuite/gdb.reverse/sigall-reverse.c +++ b/gdb/testsuite/gdb.reverse/sigall-reverse.c @@ -377,7 +377,21 @@ handle_TERM (int sig) { } -/* Functions to send signals. These also serve as markers. */ +/* Functions to send signals. These also serve as markers. + Ordered ANSI-standard signals first, other signals second, + with signals in each block ordered by their numerical values + on a typical POSIX platform. */ + +/* SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM + are ANSI-standard signals and are always available. */ + +int +gen_ILL (void) +{ + kill (getpid (), SIGILL); + return 0; +} + int gen_ABRT (void) { @@ -385,6 +399,44 @@ gen_ABRT (void) return 0; } +int x; + +int +gen_FPE (void) +{ + /* The intent behind generating SIGFPE this way is to check the mapping + from the CPU exception itself to the signals. It would be nice to + do the same for SIGBUS, SIGSEGV, etc., but I suspect that even this + test might turn out to be insufficiently portable. */ + +#if 0 + /* Loses on the PA because after the signal handler executes we try to + re-execute the failing instruction again. Perhaps we could siglongjmp + out of the signal handler? */ + /* The expect script looks for the word "kill"; don't delete it. */ + return 5 / x; /* and we both started jumping up and down yelling kill */ +#else + kill (getpid (), SIGFPE); +#endif + return 0; +} + +int +gen_SEGV (void) +{ + kill (getpid (), SIGSEGV); + return 0; +} + +int +gen_TERM (void) +{ + kill (getpid (), SIGTERM); + return 0; +} + +/* All other signals need preprocessor conditionals. */ + int gen_HUP (void) { @@ -408,13 +460,6 @@ return 0; } int -gen_ILL (void) -{ - kill (getpid (), SIGILL); -return 0; -} - -int gen_EMT (void) { #ifdef SIGEMT @@ -425,28 +470,6 @@ gen_EMT (void) return 0; } -int x; - -int -gen_FPE (void) -{ - /* The intent behind generating SIGFPE this way is to check the mapping - from the CPU exception itself to the signals. It would be nice to - do the same for SIGBUS, SIGSEGV, etc., but I suspect that even this - test might turn out to be insufficiently portable. */ - -#if 0 - /* Loses on the PA because after the signal handler executes we try to - re-execute the failing instruction again. Perhaps we could siglongjmp - out of the signal handler? */ - /* The expect script looks for the word "kill"; don't delete it. */ - return 5 / x; /* and we both started jumping up and down yelling kill */ -#else - kill (getpid (), SIGFPE); -#endif -return 0; -} - int gen_BUS (void) { @@ -459,13 +482,6 @@ return 0; } int -gen_SEGV (void) -{ - kill (getpid (), SIGSEGV); -return 0; -} - -int gen_SYS (void) { #ifdef SIGSYS @@ -1146,13 +1162,6 @@ gen_63 (void) #endif return 0; } - -int -gen_TERM (void) -{ - kill (getpid (), SIGTERM); -return 0; -} int main () @@ -1168,22 +1177,31 @@ main () } #endif + /* Signals are ordered ANSI-standard signals first, other signals + second, with signals in each block ordered by their numerical + values on a typical POSIX platform. */ + + /* SIGINT, SIGILL, SIGABRT, SIGFPE, SIGSEGV and SIGTERM + are ANSI-standard signals and are always available. */ + signal (SIGILL, handle_ILL); signal (SIGABRT, handle_ABRT); + signal (SIGFPE, handle_FPE); + signal (SIGSEGV, handle_SEGV); + signal (SIGTERM, handle_TERM); + + /* All other signals need preprocessor conditionals. */ #ifdef SIGHUP signal (SIGHUP, handle_HUP); #endif #ifdef SIGQUIT signal (SIGQUIT, handle_QUIT); #endif - signal (SIGILL, handle_ILL); #ifdef SIGEMT signal (SIGEMT, handle_EMT); #endif - signal (SIGFPE, handle_FPE); #ifdef SIGBUS signal (SIGBUS, handle_BUS); #endif - signal (SIGSEGV, handle_SEGV); #ifdef SIGSYS signal (SIGSYS, handle_SYS); #endif @@ -1311,7 +1329,6 @@ main () signal (62, handle_62); signal (63, handle_63); #endif /* lynx */ - signal (SIGTERM, handle_TERM); x = 0; |