\f
/* 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. */
break;
}
- (NORETURN void) longjmp
+ (NORETURN void) SIGLONGJMP
(reason == RETURN_ERROR ? error_return : quit_return, 1);
}
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;
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
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;
/* 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 *));