diff options
author | David Taylor <taylor@redhat.com> | 1998-01-05 15:36:49 +0000 |
---|---|---|
committer | David Taylor <taylor@redhat.com> | 1998-01-05 15:36:49 +0000 |
commit | 4b65fd38798807a481eb9c915af10bc36db0adc6 (patch) | |
tree | b563a8876cbed08d2aa19fa20eb24daf572877c8 /gdb | |
parent | f6428b86cccb6a2aa2fc3b9d659fedc5200b1047 (diff) | |
download | gdb-4b65fd38798807a481eb9c915af10bc36db0adc6.zip gdb-4b65fd38798807a481eb9c915af10bc36db0adc6.tar.gz gdb-4b65fd38798807a481eb9c915af10bc36db0adc6.tar.bz2 |
fix gdb/13620 -- control-c to interrupt gdb command only works once.
if HAVE_SIGSETJMP is not defined, nothing is changed; if it is defined
(as it now is for sysv4 based systems), then the fix is enabled.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/config/xm-sysv4.h | 3 | ||||
-rw-r--r-- | gdb/top.c | 26 | ||||
-rw-r--r-- | gdb/top.h | 14 |
3 files changed, 28 insertions, 15 deletions
diff --git a/gdb/config/xm-sysv4.h b/gdb/config/xm-sysv4.h index 1ffe8fa..06215e6 100644 --- a/gdb/config/xm-sysv4.h +++ b/gdb/config/xm-sysv4.h @@ -31,6 +31,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #define NEED_POSIX_SETPGID +/* SVR4 has sigsetjmp and siglongjmp */ +#define HAVE_SIGSETJMP + /* We have to include these files now, so that GDB will not make competing definitions in defs.h. */ #include <limits.h> @@ -458,9 +458,9 @@ NORETURN void (*error_hook) PARAMS ((void)) ATTR_NORETURN; /* Where to go for return_to_top_level (RETURN_ERROR). */ -jmp_buf error_return; +SIGJMP_BUF error_return; /* Where to go for return_to_top_level (RETURN_QUIT). */ -jmp_buf quit_return; +SIGJMP_BUF quit_return; /* Return for reason REASON. This generally gets back to the command loop, but can be caught via catch_errors. */ @@ -490,7 +490,7 @@ return_to_top_level (reason) break; } - (NORETURN void) longjmp + (NORETURN void) SIGLONGJMP (reason == RETURN_ERROR ? error_return : quit_return, 1); } @@ -520,9 +520,9 @@ catch_errors (func, args, errstring, mask) char *errstring; return_mask mask; { - jmp_buf saved_error; - jmp_buf saved_quit; - jmp_buf tmp_jmp; + SIGJMP_BUF saved_error; + SIGJMP_BUF saved_quit; + SIGJMP_BUF tmp_jmp; int val; struct cleanup *saved_cleanup_chain; char *saved_error_pre_print; @@ -534,21 +534,21 @@ catch_errors (func, args, errstring, mask) if (mask & RETURN_MASK_ERROR) { - memcpy ((char *)saved_error, (char *)error_return, sizeof (jmp_buf)); + memcpy ((char *)saved_error, (char *)error_return, sizeof (SIGJMP_BUF)); error_pre_print = errstring; } if (mask & RETURN_MASK_QUIT) { - memcpy (saved_quit, quit_return, sizeof (jmp_buf)); + memcpy (saved_quit, quit_return, sizeof (SIGJMP_BUF)); quit_pre_print = errstring; } - if (setjmp (tmp_jmp) == 0) + if (SIGSETJMP (tmp_jmp) == 0) { if (mask & RETURN_MASK_ERROR) - memcpy (error_return, tmp_jmp, sizeof (jmp_buf)); + memcpy (error_return, tmp_jmp, sizeof (SIGJMP_BUF)); if (mask & RETURN_MASK_QUIT) - memcpy (quit_return, tmp_jmp, sizeof (jmp_buf)); + memcpy (quit_return, tmp_jmp, sizeof (SIGJMP_BUF)); val = (*func) (args); } else @@ -558,12 +558,12 @@ catch_errors (func, args, errstring, mask) if (mask & RETURN_MASK_ERROR) { - memcpy (error_return, saved_error, sizeof (jmp_buf)); + memcpy (error_return, saved_error, sizeof (SIGJMP_BUF)); error_pre_print = saved_error_pre_print; } if (mask & RETURN_MASK_QUIT) { - memcpy (quit_return, saved_quit, sizeof (jmp_buf)); + memcpy (quit_return, saved_quit, sizeof (SIGJMP_BUF)); quit_pre_print = saved_quit_pre_print; } return val; @@ -29,8 +29,18 @@ extern char gdbinit[]; /* Generally one should use catch_errors rather than manipulating these directly. The exception is main(). */ -extern jmp_buf error_return; -extern jmp_buf quit_return; +#if defined(HAVE_SIGSETJMP) +#define SIGJMP_BUF sigjmp_buf +#define SIGSETJMP(buf) sigsetjmp(buf, 1) +#define SIGLONGJMP(buf,val) siglongjmp(buf,val) +#else +#define SIGJMP_BUF jmp_buf +#define SIGSETJMP(buf) setjmp(buf) +#define SIGLONGJMP(buf,val) longjmp(buf,val) +#endif + +extern SIGJMP_BUF error_return; +extern SIGJMP_BUF quit_return; extern void print_gdb_version PARAMS ((GDB_FILE *)); |