From 99eeeb0ff7898f8987188e510b2612de1fcfa454 Mon Sep 17 00:00:00 2001 From: Nicholas Duffek Date: Thu, 24 Feb 2000 00:04:03 +0000 Subject: * top.c (SIGJMP_BUF, SIGSETJMP, SIGLONGJMP): Update comments. (error_return, quit_return): Merge into catch_return pointer. (return_to_top_level): Update comment. Longjmp to *catch_errors, and communicate reason to catch_errors via setjmp return value. (catch_errors): Always catch both quit and error, and if a catch wasn't requested by caller, throw it to the next catch_error. Replace dual longjmp buffer memcpy with single pointer change. Add FIXME for possibly adding new interface to tell caller what event was caught. Add extensive comments. * defs.h (enum return_reason): Reserve 0 for use as initial setjmp() return value. (RETURN_MASK): New public macro to generate RETURN_MASK_* from enum return_reason. (RETURN_MASK_QUIT, RETURN_MASK_ERROR): Define using RETURN_MASK. --- gdb/defs.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'gdb/defs.h') diff --git a/gdb/defs.h b/gdb/defs.h index fa9f540..c4756f1 100644 --- a/gdb/defs.h +++ b/gdb/defs.h @@ -801,21 +801,24 @@ extern NORETURN void internal_error (char *, ...) ATTR_NORETURN; extern NORETURN void nomem (long) ATTR_NORETURN; -/* Reasons for calling return_to_top_level. */ +/* Reasons for calling return_to_top_level. Note: enum value 0 is + reserved for internal use as the return value from an initial + setjmp(). */ enum return_reason { /* User interrupt. */ - RETURN_QUIT, + RETURN_QUIT = 1, /* Any other error. */ RETURN_ERROR }; #define ALL_CLEANUPS ((struct cleanup *)0) -#define RETURN_MASK_QUIT (1 << (int)RETURN_QUIT) -#define RETURN_MASK_ERROR (1 << (int)RETURN_ERROR) -#define RETURN_MASK_ALL (RETURN_MASK_QUIT | RETURN_MASK_ERROR) +#define RETURN_MASK(reason) (1 << (int)(reason)) +#define RETURN_MASK_QUIT RETURN_MASK (RETURN_QUIT) +#define RETURN_MASK_ERROR RETURN_MASK (RETURN_ERROR) +#define RETURN_MASK_ALL (RETURN_MASK_QUIT | RETURN_MASK_ERROR) typedef int return_mask; extern NORETURN void return_to_top_level (enum return_reason) ATTR_NORETURN; -- cgit v1.1