aboutsummaryrefslogtreecommitdiff
path: root/gdb/guile
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-03-07 15:14:14 +0000
committerPedro Alves <palves@redhat.com>2015-03-07 15:14:14 +0000
commit492d29ea1c9a8b2c7d5193908119a4e27c045687 (patch)
treeea592a514ec482e6c57020670e9bc447f827e298 /gdb/guile
parentece957c859c00fbea7152a2275674d7061dc468a (diff)
downloadgdb-492d29ea1c9a8b2c7d5193908119a4e27c045687.zip
gdb-492d29ea1c9a8b2c7d5193908119a4e27c045687.tar.gz
gdb-492d29ea1c9a8b2c7d5193908119a4e27c045687.tar.bz2
Split TRY_CATCH into TRY + CATCH
This patch splits the TRY_CATCH macro into three, so that we go from this: ~~~ volatile gdb_exception ex; TRY_CATCH (ex, RETURN_MASK_ERROR) { } if (ex.reason < 0) { } ~~~ to this: ~~~ TRY { } CATCH (ex, RETURN_MASK_ERROR) { } END_CATCH ~~~ Thus, we'll be getting rid of the local volatile exception object, and declaring the caught exception in the catch block. This allows reimplementing TRY/CATCH in terms of C++ exceptions when building in C++ mode, while still allowing to build GDB in C mode (using setjmp/longjmp), as a transition step. TBC, after this patch, is it _not_ valid to have code between the TRY and the CATCH blocks, like: TRY { } // some code here. CATCH (ex, RETURN_MASK_ERROR) { } END_CATCH Just like it isn't valid to do that with C++'s native try/catch. By switching to creating the exception object inside the CATCH block scope, we can get rid of all the explicitly allocated volatile exception objects all over the tree, and map the CATCH block more directly to C++'s catch blocks. The majority of the TRY_CATCH -> TRY+CATCH+END_CATCH conversion was done with a script, rerun from scratch at every rebase, no manual editing involved. After the mechanical conversion, a few places needed manual intervention, to fix preexisting cases where we were using the exception object outside of the TRY_CATCH block, and cases where we were using "else" after a 'if (ex.reason) < 0)' [a CATCH after this patch]. The result was folded into this patch so that GDB still builds at each incremental step. END_CATCH is necessary for two reasons: First, because we name the exception object in the CATCH block, which requires creating a scope, which in turn must be closed somewhere. Declaring the exception variable in the initializer field of a for block, like: #define CATCH(EXCEPTION, mask) \ for (struct gdb_exception EXCEPTION; \ exceptions_state_mc_catch (&EXCEPTION, MASK); \ EXCEPTION = exception_none) would avoid needing END_CATCH, but alas, in C mode, we build with C90, which doesn't allow mixed declarations and code. Second, because when TRY/CATCH are wired to real C++ try/catch, as long as we need to handle cleanup chains, even if there's no CATCH block that wants to catch the exception, we need for stop at every frame in the unwind chain and run cleanups, then rethrow. That will be done in END_CATCH. After we require C++, we'll still need TRY/CATCH/END_CATCH until cleanups are completely phased out -- TRY/CATCH in C++ mode will save/restore the current cleanup chain, like in C mode, and END_CATCH catches otherwise uncaugh exceptions, runs cleanups and rethrows, so that C++ cleanups and exceptions can coexist. IMO, this still makes the TRY/CATCH code look a bit more like a newcomer would expect, so IMO worth it even if we weren't considering C++. gdb/ChangeLog. 2015-03-07 Pedro Alves <palves@redhat.com> * common/common-exceptions.c (struct catcher) <exception>: No longer a pointer to volatile exception. Now an exception value. <mask>: Delete field. (exceptions_state_mc_init): Remove all parameters. Adjust. (exceptions_state_mc): No longer pop the catcher here. (exceptions_state_mc_catch): New function. (throw_exception): Adjust. * common/common-exceptions.h (exceptions_state_mc_init): Remove all parameters. (exceptions_state_mc_catch): Declare. (TRY_CATCH): Rename to ... (TRY): ... this. Remove EXCEPTION and MASK parameters. (CATCH, END_CATCH): New. All callers adjusted. gdb/gdbserver/ChangeLog: 2015-03-07 Pedro Alves <palves@redhat.com> Adjust all callers of TRY_CATCH to use TRY/CATCH/END_CATCH instead.
Diffstat (limited to 'gdb/guile')
-rw-r--r--gdb/guile/guile.c10
-rw-r--r--gdb/guile/scm-block.c9
-rw-r--r--gdb/guile/scm-breakpoint.c79
-rw-r--r--gdb/guile/scm-cmd.c9
-rw-r--r--gdb/guile/scm-disasm.c9
-rw-r--r--gdb/guile/scm-frame.c170
-rw-r--r--gdb/guile/scm-lazy-string.c15
-rw-r--r--gdb/guile/scm-math.c38
-rw-r--r--gdb/guile/scm-param.c19
-rw-r--r--gdb/guile/scm-ports.c9
-rw-r--r--gdb/guile/scm-pretty-print.c7
-rw-r--r--gdb/guile/scm-symbol.c46
-rw-r--r--gdb/guile/scm-symtab.c9
-rw-r--r--gdb/guile/scm-type.c105
-rw-r--r--gdb/guile/scm-value.c244
15 files changed, 530 insertions, 248 deletions
diff --git a/gdb/guile/guile.c b/gdb/guile/guile.c
index 1895118..16d15b7 100644
--- a/gdb/guile/guile.c
+++ b/gdb/guile/guile.c
@@ -310,11 +310,11 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
{
int from_tty_arg_pos = -1, to_string_arg_pos = -1;
int from_tty = 0, to_string = 0;
- volatile struct gdb_exception except;
const SCM keywords[] = { from_tty_keyword, to_string_keyword, SCM_BOOL_F };
char *command;
char *result = NULL;
struct cleanup *cleanups;
+ struct gdb_exception except = exception_none;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#tt",
command_scm, &command, rest,
@@ -325,7 +325,7 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
executed. */
cleanups = make_cleanup (xfree, command);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *inner_cleanups;
@@ -346,6 +346,12 @@ gdbscm_execute_gdb_command (SCM command_scm, SCM rest)
do_cleanups (inner_cleanups);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
do_cleanups (cleanups);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
diff --git a/gdb/guile/scm-block.c b/gdb/guile/scm-block.c
index 36c14da..50dc6c7 100644
--- a/gdb/guile/scm-block.c
+++ b/gdb/guile/scm-block.c
@@ -678,18 +678,21 @@ gdbscm_lookup_block (SCM pc_scm)
CORE_ADDR pc;
const struct block *block = NULL;
struct compunit_symtab *cust = NULL;
- volatile struct gdb_exception except;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "U", pc_scm, &pc);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
cust = find_pc_compunit_symtab (pc);
if (cust != NULL && COMPUNIT_OBJFILE (cust) != NULL)
block = block_for_pc (pc);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (cust == NULL || COMPUNIT_OBJFILE (cust) == NULL)
{
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index c1f9f91..ad853ed 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -407,7 +407,7 @@ gdbscm_register_breakpoint_x (SCM self)
{
breakpoint_smob *bp_smob
= bpscm_get_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
/* We only support registering breakpoints created with make-breakpoint. */
if (!bp_smob->is_scheme_bkpt)
@@ -418,7 +418,7 @@ gdbscm_register_breakpoint_x (SCM self)
pending_breakpoint_scm = self;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
char *location = bp_smob->spec.location;
int internal = bp_smob->spec.is_internal;
@@ -455,6 +455,12 @@ gdbscm_register_breakpoint_x (SCM self)
gdb_assert_not_reached ("invalid breakpoint type");
}
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
/* Ensure this gets reset, even if there's an error. */
pending_breakpoint_scm = SCM_BOOL_F;
GDBSCM_HANDLE_GDB_EXCEPTION (except);
@@ -473,13 +479,16 @@ gdbscm_delete_breakpoint_x (SCM self)
{
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
delete_breakpoint (bp_smob->bp);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return SCM_UNSPECIFIED;
}
@@ -565,19 +574,22 @@ gdbscm_set_breakpoint_enabled_x (SCM self, SCM newvalue)
{
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- volatile struct gdb_exception except;
SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME,
_("boolean"));
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (gdbscm_is_true (newvalue))
enable_breakpoint (bp_smob->bp);
else
disable_breakpoint (bp_smob->bp);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return SCM_UNSPECIFIED;
}
@@ -600,16 +612,19 @@ gdbscm_set_breakpoint_silent_x (SCM self, SCM newvalue)
{
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- volatile struct gdb_exception except;
SCM_ASSERT_TYPE (gdbscm_is_bool (newvalue), newvalue, SCM_ARG2, FUNC_NAME,
_("boolean"));
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
breakpoint_set_silent (bp_smob->bp, gdbscm_is_true (newvalue));
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return SCM_UNSPECIFIED;
}
@@ -634,7 +649,6 @@ gdbscm_set_breakpoint_ignore_count_x (SCM self, SCM newvalue)
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
long value;
- volatile struct gdb_exception except;
SCM_ASSERT_TYPE (scm_is_signed_integer (newvalue, LONG_MIN, LONG_MAX),
newvalue, SCM_ARG2, FUNC_NAME, _("integer"));
@@ -643,11 +657,15 @@ gdbscm_set_breakpoint_ignore_count_x (SCM self, SCM newvalue)
if (value < 0)
value = 0;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
set_ignore_count (bp_smob->number, (int) value, 0);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return SCM_UNSPECIFIED;
}
@@ -755,17 +773,20 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue)
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
long id;
int valid_id = 0;
- volatile struct gdb_exception except;
if (scm_is_signed_integer (newvalue, LONG_MIN, LONG_MAX))
{
id = scm_to_long (newvalue);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
valid_id = valid_task_id (id);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (! valid_id)
{
@@ -778,11 +799,15 @@ gdbscm_set_breakpoint_task_x (SCM self, SCM newvalue)
else
SCM_ASSERT_TYPE (0, newvalue, SCM_ARG2, FUNC_NAME, _("integer or #f"));
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
breakpoint_set_task (bp_smob->bp, id);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return SCM_UNSPECIFIED;
}
@@ -855,7 +880,7 @@ gdbscm_set_breakpoint_condition_x (SCM self, SCM newvalue)
breakpoint_smob *bp_smob
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
char *exp;
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
SCM_ASSERT_TYPE (scm_is_string (newvalue) || gdbscm_is_false (newvalue),
newvalue, SCM_ARG2, FUNC_NAME,
@@ -866,10 +891,16 @@ gdbscm_set_breakpoint_condition_x (SCM self, SCM newvalue)
else
exp = gdbscm_scm_to_c_string (newvalue);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
set_breakpoint_condition (bp_smob->bp, exp ? exp : "", 0);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
xfree (exp);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
@@ -936,7 +967,6 @@ gdbscm_breakpoint_commands (SCM self)
= bpscm_get_valid_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct breakpoint *bp;
long length;
- volatile struct gdb_exception except;
struct ui_file *string_file;
struct cleanup *chain;
SCM result;
@@ -951,16 +981,17 @@ gdbscm_breakpoint_commands (SCM self)
chain = make_cleanup_ui_file_delete (string_file);
ui_out_redirect (current_uiout, string_file);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
print_command_lines (current_uiout, breakpoint_commands (bp), 0);
}
ui_out_redirect (current_uiout, NULL);
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
do_cleanups (chain);
gdbscm_throw_gdb_exception (except);
}
+ END_CATCH
cmdstr = ui_file_xstrdup (string_file, &length);
make_cleanup (xfree, cmdstr);
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 7c6d010..c870fcc 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -762,7 +762,6 @@ gdbscm_register_command_x (SCM self)
char *cmd_name, *pfx_name;
struct cmd_list_element **cmd_list;
struct cmd_list_element *cmd = NULL;
- volatile struct gdb_exception except;
if (cmdscm_is_valid (c_smob))
scm_misc_error (FUNC_NAME, _("command is already registered"), SCM_EOL);
@@ -772,7 +771,7 @@ gdbscm_register_command_x (SCM self)
c_smob->cmd_name = gdbscm_gc_xstrdup (cmd_name);
xfree (cmd_name);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (c_smob->is_prefix)
{
@@ -790,7 +789,11 @@ gdbscm_register_command_x (SCM self)
NULL, c_smob->doc, cmd_list);
}
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
/* Note: At this point the command exists in gdb.
So no more errors after this point. */
diff --git a/gdb/guile/scm-disasm.c b/gdb/guile/scm-disasm.c
index 5ae7075..782d915 100644
--- a/gdb/guile/scm-disasm.c
+++ b/gdb/guile/scm-disasm.c
@@ -283,9 +283,8 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
char *as = NULL;
struct ui_file *memfile = mem_fileopen ();
struct cleanup *cleanups = make_cleanup_ui_file_delete (memfile);
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (using_port)
{
@@ -295,7 +294,11 @@ gdbscm_arch_disassemble (SCM self, SCM start_scm, SCM rest)
else
insn_len = gdb_print_insn (gdbarch, pc, memfile, NULL);
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
as = ui_file_xstrdup (memfile, NULL);
diff --git a/gdb/guile/scm-frame.c b/gdb/guile/scm-frame.c
index a30c093..6189802 100644
--- a/gdb/guile/scm-frame.c
+++ b/gdb/guile/scm-frame.c
@@ -220,7 +220,6 @@ frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
SCM f_scm;
htab_t htab;
eqable_gdb_smob **slot;
- volatile struct gdb_exception except;
struct frame_id frame_id = null_frame_id;
struct gdbarch *gdbarch = NULL;
int frame_id_is_next = 0;
@@ -234,7 +233,7 @@ frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
if (*slot != NULL)
return (*slot)->containing_scm;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
/* Try to get the previous frame, to determine if this is the last frame
in a corrupt stack. If so, we need to store the frame_id of the next
@@ -253,8 +252,11 @@ frscm_scm_from_frame (struct frame_info *frame, struct inferior *inferior)
}
gdbarch = get_frame_arch (frame);
}
- if (except.reason < 0)
- return gdbscm_scm_from_gdb_exception (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ return gdbscm_scm_from_gdb_exception (except);
+ }
+ END_CATCH
f_scm = frscm_make_frame_smob ();
f_smob = (frame_smob *) SCM_SMOB_DATA (f_scm);
@@ -396,15 +398,18 @@ gdbscm_frame_valid_p (SCM self)
{
frame_smob *f_smob;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return scm_from_bool (frame != NULL);
}
@@ -421,18 +426,23 @@ gdbscm_frame_name (SCM self)
enum language lang = language_minimal;
struct frame_info *frame = NULL;
SCM result;
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
find_frame_funname (frame, &name, &lang, NULL);
}
- if (except.reason < 0)
- xfree (name);
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
+ xfree (name);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
if (frame == NULL)
@@ -461,17 +471,20 @@ gdbscm_frame_type (SCM self)
frame_smob *f_smob;
enum frame_type type = NORMAL_FRAME;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
type = get_frame_type (frame);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
@@ -490,15 +503,18 @@ gdbscm_frame_arch (SCM self)
{
frame_smob *f_smob;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
@@ -517,16 +533,19 @@ gdbscm_frame_unwind_stop_reason (SCM self)
{
frame_smob *f_smob;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
enum unwind_stop_reason stop_reason;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
@@ -548,17 +567,20 @@ gdbscm_frame_pc (SCM self)
frame_smob *f_smob;
CORE_ADDR pc = 0;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
pc = get_frame_pc (frame);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
@@ -578,17 +600,20 @@ gdbscm_frame_block (SCM self)
frame_smob *f_smob;
const struct block *block = NULL, *fn_block;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
block = get_frame_block (frame, NULL);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
@@ -626,17 +651,20 @@ gdbscm_frame_function (SCM self)
frame_smob *f_smob;
struct symbol *sym = NULL;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
sym = find_pc_function (get_frame_address_in_block (frame));
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
@@ -660,17 +688,20 @@ gdbscm_frame_older (SCM self)
frame_smob *f_smob;
struct frame_info *prev = NULL;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
prev = get_prev_frame (frame);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
@@ -694,17 +725,20 @@ gdbscm_frame_newer (SCM self)
frame_smob *f_smob;
struct frame_info *next = NULL;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
next = get_next_frame (frame);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
@@ -727,17 +761,20 @@ gdbscm_frame_sal (SCM self)
frame_smob *f_smob;
struct symtab_and_line sal;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
find_frame_sal (frame, &sal);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
@@ -767,15 +804,18 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
struct frame_info *frame = NULL;
struct symbol *var = NULL;
struct value *value = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
@@ -797,7 +837,7 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
char *var_name;
const struct block *block = NULL;
struct cleanup *cleanup;
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
if (! SCM_UNBNDP (block_scm))
{
@@ -815,14 +855,19 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
/* N.B. Between here and the call to do_cleanups, don't do anything
to cause a Scheme exception without performing the cleanup. */
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (block == NULL)
block = get_frame_block (frame, NULL);
var = lookup_symbol (var_name, block, VAR_DOMAIN, NULL);
}
- if (except.reason < 0)
- do_cleanups (cleanup);
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
+ do_cleanups (cleanup);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
if (var == NULL)
@@ -841,11 +886,15 @@ gdbscm_frame_read_var (SCM self, SCM symbol_scm, SCM rest)
_("gdb:symbol or string"));
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
value = read_var_value (var, frame);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return vlscm_scm_from_value (value);
}
@@ -858,17 +907,20 @@ gdbscm_frame_select (SCM self)
{
frame_smob *f_smob;
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
f_smob = frscm_get_frame_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = frscm_frame_smob_to_frame (f_smob);
if (frame != NULL)
select_frame (frame);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (frame == NULL)
{
@@ -886,13 +938,16 @@ static SCM
gdbscm_newest_frame (void)
{
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = get_current_frame ();
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return frscm_scm_from_frame_unsafe (frame, current_inferior ());
}
@@ -904,13 +959,16 @@ static SCM
gdbscm_selected_frame (void)
{
struct frame_info *frame = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
frame = get_selected_frame (_("No frame is currently selected"));
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return frscm_scm_from_frame_unsafe (frame, current_inferior ());
}
diff --git a/gdb/guile/scm-lazy-string.c b/gdb/guile/scm-lazy-string.c
index d9ca97e9..c84ead7 100644
--- a/gdb/guile/scm-lazy-string.c
+++ b/gdb/guile/scm-lazy-string.c
@@ -234,7 +234,6 @@ gdbscm_lazy_string_to_value (SCM self)
SCM ls_scm = lsscm_get_lazy_string_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
lazy_string_smob *ls_smob = (lazy_string_smob *) SCM_SMOB_DATA (ls_scm);
struct value *value = NULL;
- volatile struct gdb_exception except;
if (ls_smob->address == 0)
{
@@ -242,11 +241,15 @@ gdbscm_lazy_string_to_value (SCM self)
_("cannot create a value from NULL")));
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
value = value_at_lazy (ls_smob->type, ls_smob->address);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return vlscm_scm_from_value (value);
}
@@ -268,7 +271,6 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
{
lazy_string_smob *ls_smob;
struct value *value = NULL;
- volatile struct gdb_exception except;
gdb_assert (lsscm_is_lazy_string (string));
@@ -283,15 +285,16 @@ lsscm_safe_lazy_string_to_value (SCM string, int arg_pos,
return NULL;
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
value = value_at_lazy (ls_smob->type, ls_smob->address);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
*except_scmp = gdbscm_scm_from_gdb_exception (except);
return NULL;
}
+ END_CATCH
return value;
}
diff --git a/gdb/guile/scm-math.c b/gdb/guile/scm-math.c
index 7ff37ce..4b6bb5d 100644
--- a/gdb/guile/scm-math.c
+++ b/gdb/guile/scm-math.c
@@ -83,7 +83,6 @@ vlscm_unop (enum valscm_unary_opcode opcode, SCM x, const char *func_name)
struct value *res_val = NULL;
SCM except_scm;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
cleanups = make_cleanup_value_free_to_mark (value_mark ());
@@ -95,7 +94,7 @@ vlscm_unop (enum valscm_unary_opcode opcode, SCM x, const char *func_name)
gdbscm_throw (except_scm);
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
switch (opcode)
{
@@ -128,7 +127,11 @@ vlscm_unop (enum valscm_unary_opcode opcode, SCM x, const char *func_name)
gdb_assert_not_reached ("unsupported operation");
}
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
gdb_assert (res_val != NULL);
result = vlscm_scm_from_value (res_val);
@@ -156,7 +159,6 @@ vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y,
struct value *res_val = NULL;
SCM except_scm;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
cleanups = make_cleanup_value_free_to_mark (value_mark ());
@@ -175,7 +177,7 @@ vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y,
gdbscm_throw (except_scm);
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
switch (opcode)
{
@@ -264,7 +266,11 @@ vlscm_binop (enum valscm_binary_opcode opcode, SCM x, SCM y,
gdb_assert_not_reached ("unsupported operation");
}
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
gdb_assert (res_val != NULL);
result = vlscm_scm_from_value (res_val);
@@ -441,7 +447,7 @@ vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
int result = 0;
SCM except_scm;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
cleanups = make_cleanup_value_free_to_mark (value_mark ());
@@ -460,7 +466,7 @@ vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
gdbscm_throw (except_scm);
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
switch (op)
{
@@ -487,6 +493,12 @@ vlscm_rich_compare (int op, SCM x, SCM y, const char *func_name)
gdb_assert_not_reached ("invalid <gdb:value> comparison");
}
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
do_cleanups (cleanups);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
@@ -742,7 +754,6 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
{
struct value *value = NULL;
SCM except_scm = SCM_BOOL_F;
- volatile struct gdb_exception except;
if (type == NULL)
{
@@ -752,7 +763,7 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
*except_scmp = SCM_BOOL_F;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (vlscm_is_value (obj))
{
@@ -859,8 +870,11 @@ vlscm_convert_typed_value_from_scheme (const char *func_name,
value = NULL;
}
}
- if (except.reason < 0)
- except_scm = gdbscm_scm_from_gdb_exception (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ except_scm = gdbscm_scm_from_gdb_exception (except);
+ }
+ END_CATCH
if (gdbscm_is_true (except_scm))
{
diff --git a/gdb/guile/scm-param.c b/gdb/guile/scm-param.c
index 02b4f8a..508bcb9 100644
--- a/gdb/guile/scm-param.c
+++ b/gdb/guile/scm-param.c
@@ -990,7 +990,6 @@ gdbscm_register_parameter_x (SCM self)
= pascm_get_param_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
char *cmd_name;
struct cmd_list_element **set_list, **show_list;
- volatile struct gdb_exception except;
if (pascm_is_valid (p_smob))
scm_misc_error (FUNC_NAME, _("parameter is already registered"), SCM_EOL);
@@ -1014,7 +1013,7 @@ gdbscm_register_parameter_x (SCM self)
_("parameter exists, \"show\" command is already defined"));
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
add_setshow_generic (p_smob->type, p_smob->cmd_class,
p_smob->cmd_name, p_smob,
@@ -1026,7 +1025,11 @@ gdbscm_register_parameter_x (SCM self)
set_list, show_list,
&p_smob->set_command, &p_smob->show_command);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
/* Note: At this point the parameter exists in gdb.
So no more errors after this point. */
@@ -1063,16 +1066,22 @@ gdbscm_parameter_value (SCM self)
const char *arg;
char *newarg;
int found = -1;
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
name = gdbscm_scm_to_host_string (self, NULL, &except_scm);
if (name == NULL)
gdbscm_throw (except_scm);
newarg = concat ("show ", name, (char *) NULL);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
found = lookup_cmd_composition (newarg, &alias, &prefix, &cmd);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
xfree (name);
xfree (newarg);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
diff --git a/gdb/guile/scm-ports.c b/gdb/guile/scm-ports.c
index dcf7d2d..8967b92 100644
--- a/gdb/guile/scm-ports.c
+++ b/gdb/guile/scm-ports.c
@@ -263,20 +263,23 @@ fputsn_filtered (const char *s, size_t size, struct ui_file *stream)
static void
ioscm_write (SCM port, const void *data, size_t size)
{
- volatile struct gdb_exception except;
/* If we're called on stdin, punt. */
if (scm_is_eq (port, input_port_scm))
return;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (scm_is_eq (port, error_port_scm))
fputsn_filtered (data, size, gdb_stderr);
else
fputsn_filtered (data, size, gdb_stdout);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
}
/* Flush gdb's stdout or stderr. */
diff --git a/gdb/guile/scm-pretty-print.c b/gdb/guile/scm-pretty-print.c
index 82cf96c..860cf8e 100644
--- a/gdb/guile/scm-pretty-print.c
+++ b/gdb/guile/scm-pretty-print.c
@@ -529,11 +529,10 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
struct gdbarch *gdbarch,
const struct language_defn *language)
{
- volatile struct gdb_exception except;
SCM result = SCM_BOOL_F;
*out_value = NULL;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
int rc;
pretty_printer_worker_smob *w_smob
@@ -568,6 +567,10 @@ ppscm_pretty_print_one_value (SCM printer, struct value **out_value,
(_("invalid result from pretty-printer to-string"), result);
}
}
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
return result;
}
diff --git a/gdb/guile/scm-symbol.c b/gdb/guile/scm-symbol.c
index 1891237..99ef928 100644
--- a/gdb/guile/scm-symbol.c
+++ b/gdb/guile/scm-symbol.c
@@ -483,14 +483,17 @@ gdbscm_symbol_needs_frame_p (SCM self)
symbol_smob *s_smob
= syscm_get_valid_symbol_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct symbol *symbol = s_smob->symbol;
- volatile struct gdb_exception except;
int result = 0;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
result = symbol_read_needs_frame (symbol);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return scm_from_bool (result);
}
@@ -523,7 +526,6 @@ gdbscm_symbol_value (SCM self, SCM rest)
frame_smob *f_smob = NULL;
struct frame_info *frame_info = NULL;
struct value *value = NULL;
- volatile struct gdb_exception except;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG2, keywords, "#O",
rest, &frame_pos, &frame_scm);
@@ -536,7 +538,7 @@ gdbscm_symbol_value (SCM self, SCM rest)
_("cannot get the value of a typedef"));
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (f_smob != NULL)
{
@@ -550,7 +552,11 @@ gdbscm_symbol_value (SCM self, SCM rest)
value = read_var_value (symbol, frame_info);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return vlscm_scm_from_value (value);
}
@@ -571,8 +577,8 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
int block_arg_pos = -1, domain_arg_pos = -1;
struct field_of_this_result is_a_field_of_this;
struct symbol *symbol = NULL;
- volatile struct gdb_exception except;
struct cleanup *cleanups;
+ struct gdb_exception except = exception_none;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#Oi",
name_scm, &name, rest,
@@ -597,18 +603,28 @@ gdbscm_lookup_symbol (SCM name_scm, SCM rest)
{
struct frame_info *selected_frame;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
selected_frame = get_selected_frame (_("no frame selected"));
block = get_frame_block (selected_frame, NULL);
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
symbol = lookup_symbol (name, block, domain, &is_a_field_of_this);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
do_cleanups (cleanups);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
@@ -630,8 +646,8 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
int domain_arg_pos = -1;
int domain = VAR_DOMAIN;
struct symbol *symbol = NULL;
- volatile struct gdb_exception except;
struct cleanup *cleanups;
+ struct gdb_exception except = exception_none;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, keywords, "s#i",
name_scm, &name, rest,
@@ -639,10 +655,16 @@ gdbscm_lookup_global_symbol (SCM name_scm, SCM rest)
cleanups = make_cleanup (xfree, name);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
symbol = lookup_global_symbol (name, NULL, domain);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
do_cleanups (cleanups);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
diff --git a/gdb/guile/scm-symtab.c b/gdb/guile/scm-symtab.c
index 03f616d..009a2b4 100644
--- a/gdb/guile/scm-symtab.c
+++ b/gdb/guile/scm-symtab.c
@@ -590,19 +590,22 @@ gdbscm_find_pc_line (SCM pc_scm)
{
ULONGEST pc_ull;
struct symtab_and_line sal;
- volatile struct gdb_exception except;
init_sal (&sal); /* -Wall */
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "U", pc_scm, &pc_ull);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CORE_ADDR pc = (CORE_ADDR) pc_ull;
sal = find_pc_line (pc, 0);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return stscm_scm_from_sal (sal);
}
diff --git a/gdb/guile/scm-type.c b/gdb/guile/scm-type.c
index d21a7ae..fa0c213 100644
--- a/gdb/guile/scm-type.c
+++ b/gdb/guile/scm-type.c
@@ -108,9 +108,8 @@ static char *
tyscm_type_name (struct type *type, SCM *excp)
{
char *name = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *old_chain;
struct ui_file *stb;
@@ -123,11 +122,12 @@ tyscm_type_name (struct type *type, SCM *excp)
name = ui_file_xstrdup (stb, NULL);
do_cleanups (old_chain);
}
- if (except.reason < 0)
+ CATCH (except, RETURN_MASK_ALL)
{
*excp = gdbscm_scm_from_gdb_exception (except);
return NULL;
}
+ END_CATCH
return name;
}
@@ -239,7 +239,6 @@ tyscm_equal_p_type_smob (SCM type1_scm, SCM type2_scm)
type_smob *type1_smob, *type2_smob;
struct type *type1, *type2;
int result = 0;
- volatile struct gdb_exception except;
SCM_ASSERT_TYPE (tyscm_is_type (type1_scm), type1_scm, SCM_ARG1, FUNC_NAME,
type_smob_name);
@@ -250,11 +249,15 @@ tyscm_equal_p_type_smob (SCM type1_scm, SCM type2_scm)
type1 = type1_smob->type;
type2 = type2_smob->type;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
result = types_deeply_equal (type1, type2);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return scm_from_bool (result);
}
@@ -628,12 +631,16 @@ gdbscm_type_sizeof (SCM self)
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
check_typedef (type);
}
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ }
+ END_CATCH
+
/* Ignore exceptions. */
return scm_from_long (TYPE_LENGTH (type));
@@ -648,13 +655,16 @@ gdbscm_type_strip_typedefs (SCM self)
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = check_typedef (type);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return tyscm_scm_from_type (type);
}
@@ -665,15 +675,18 @@ gdbscm_type_strip_typedefs (SCM self)
static struct type *
tyscm_get_composite (struct type *type)
{
- volatile struct gdb_exception except;
for (;;)
{
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = check_typedef (type);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (TYPE_CODE (type) != TYPE_CODE_PTR
&& TYPE_CODE (type) != TYPE_CODE_REF)
@@ -702,7 +715,6 @@ tyscm_array_1 (SCM self, SCM n1_scm, SCM n2_scm, int is_vector,
struct type *type = t_smob->type;
long n1, n2 = 0;
struct type *array = NULL;
- volatile struct gdb_exception except;
gdbscm_parse_function_args (func_name, SCM_ARG2, NULL, "l|l",
n1_scm, &n1, n2_scm, &n2);
@@ -721,13 +733,17 @@ tyscm_array_1 (SCM self, SCM n1_scm, SCM n2_scm, int is_vector,
_("Array length must not be negative"));
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
array = lookup_array_range_type (type, n1, n2);
if (is_vector)
make_vector_type (array);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return tyscm_scm_from_type (array);
}
@@ -773,13 +789,16 @@ gdbscm_type_pointer (SCM self)
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = lookup_pointer_type (type);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return tyscm_scm_from_type (type);
}
@@ -832,13 +851,16 @@ gdbscm_type_reference (SCM self)
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = lookup_reference_type (type);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return tyscm_scm_from_type (type);
}
@@ -867,13 +889,16 @@ gdbscm_type_const (SCM self)
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = make_cv_type (1, 0, type, NULL);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return tyscm_scm_from_type (type);
}
@@ -887,13 +912,16 @@ gdbscm_type_volatile (SCM self)
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = make_cv_type (0, 1, type, NULL);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return tyscm_scm_from_type (type);
}
@@ -907,13 +935,16 @@ gdbscm_type_unqualified (SCM self)
type_smob *t_smob
= tyscm_get_type_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct type *type = t_smob->type;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
type = make_cv_type (0, 0, type, NULL);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return tyscm_scm_from_type (type);
}
@@ -1212,9 +1243,8 @@ static struct type *
tyscm_lookup_typename (const char *type_name, const struct block *block)
{
struct type *type = NULL;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (startswith (type_name, "struct "))
type = lookup_struct (type_name + 7, NULL);
@@ -1226,8 +1256,11 @@ tyscm_lookup_typename (const char *type_name, const struct block *block)
type = lookup_typename (current_language, get_current_arch (),
type_name, block, 0);
}
- if (except.reason < 0)
- return NULL;
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ return NULL;
+ }
+ END_CATCH
return type;
}
diff --git a/gdb/guile/scm-value.c b/gdb/guile/scm-value.c
index cacc55c..b10460d 100644
--- a/gdb/guile/scm-value.c
+++ b/gdb/guile/scm-value.c
@@ -143,7 +143,6 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
value_smob *v_smob = (value_smob *) SCM_SMOB_DATA (self);
char *s = NULL;
struct value_print_options opts;
- volatile struct gdb_exception except;
if (pstate->writingp)
gdbscm_printf (port, "#<%s ", value_smob_name);
@@ -157,7 +156,7 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
instead of writingp. */
opts.raw = !!pstate->writingp;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct ui_file *stb = mem_fileopen ();
struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
@@ -167,7 +166,11 @@ vlscm_print_value_smob (SCM self, SCM port, scm_print_state *pstate)
do_cleanups (old_chain);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (s != NULL)
{
@@ -192,13 +195,16 @@ vlscm_equal_p_value_smob (SCM v1, SCM v2)
const value_smob *v1_smob = (value_smob *) SCM_SMOB_DATA (v1);
const value_smob *v2_smob = (value_smob *) SCM_SMOB_DATA (v2);
int result = 0;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
result = value_equal (v1_smob->value, v2_smob->value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return scm_from_bool (result);
}
@@ -360,7 +366,6 @@ gdbscm_make_lazy_value (SCM type_scm, SCM address_scm)
struct value *value = NULL;
SCM result;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
t_smob = tyscm_get_type_smob_arg_unsafe (type_scm, SCM_ARG1, FUNC_NAME);
type = tyscm_type_smob_type (t_smob);
@@ -372,11 +377,15 @@ gdbscm_make_lazy_value (SCM type_scm, SCM address_scm)
/* There's no (current) need to wrap this in a TRY_CATCH, but for consistency
and future-proofing we do. */
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
value = value_from_contents_and_address (type, NULL, address);
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
result = vlscm_scm_from_value (value);
@@ -396,13 +405,16 @@ gdbscm_value_optimized_out_p (SCM self)
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct value *value = v_smob->value;
int opt = 0;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
opt = value_optimized_out (value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return scm_from_bool (opt);
}
@@ -423,15 +435,18 @@ gdbscm_value_address (SCM self)
struct cleanup *cleanup
= make_cleanup_value_free_to_mark (value_mark ());
SCM address;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
res_val = value_addr (value);
}
- if (except.reason < 0)
- address = SCM_BOOL_F;
- else
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ address = SCM_BOOL_F;
+ }
+ END_CATCH
+
+ if (res_val != NULL)
address = vlscm_scm_from_value (res_val);
do_cleanups (cleanup);
@@ -457,15 +472,18 @@ gdbscm_value_dereference (SCM self)
SCM result;
struct value *res_val = NULL;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
cleanups = make_cleanup_value_free_to_mark (value_mark ());
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
res_val = value_ind (value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
result = vlscm_scm_from_value (res_val);
@@ -495,11 +513,10 @@ gdbscm_value_referenced_value (SCM self)
SCM result;
struct value *res_val = NULL;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
cleanups = make_cleanup_value_free_to_mark (value_mark ());
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
switch (TYPE_CODE (check_typedef (value_type (value))))
{
@@ -514,7 +531,11 @@ gdbscm_value_referenced_value (SCM self)
" neither a pointer nor a reference"));
}
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
result = vlscm_scm_from_value (res_val);
@@ -550,12 +571,11 @@ gdbscm_value_dynamic_type (SCM self)
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct value *value = v_smob->value;
struct type *type = NULL;
- volatile struct gdb_exception except;
if (! SCM_UNBNDP (v_smob->type))
return v_smob->dynamic_type;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *cleanup
= make_cleanup_value_free_to_mark (value_mark ());
@@ -594,7 +614,11 @@ gdbscm_value_dynamic_type (SCM self)
do_cleanups (cleanup);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (type == NULL)
v_smob->dynamic_type = gdbscm_value_type (self);
@@ -619,11 +643,10 @@ vlscm_do_cast (SCM self, SCM type_scm, enum exp_opcode op,
SCM result;
struct value *res_val = NULL;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
cleanups = make_cleanup_value_free_to_mark (value_mark ());
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (op == UNOP_DYNAMIC_CAST)
res_val = value_dynamic_cast (type, value);
@@ -635,7 +658,11 @@ vlscm_do_cast (SCM self, SCM type_scm, enum exp_opcode op,
res_val = value_cast (type, value);
}
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
gdb_assert (res_val != NULL);
result = vlscm_scm_from_value (res_val);
@@ -686,7 +713,6 @@ gdbscm_value_field (SCM self, SCM field_scm)
struct value *res_val = NULL;
SCM result;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
SCM_ASSERT_TYPE (scm_is_string (field_scm), field_scm, SCM_ARG2, FUNC_NAME,
_("string"));
@@ -696,13 +722,17 @@ gdbscm_value_field (SCM self, SCM field_scm)
field = gdbscm_scm_to_c_string (field_scm);
make_cleanup (xfree, field);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *tmp = value;
res_val = value_struct_elt (&tmp, NULL, field, NULL, NULL);
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
gdb_assert (res_val != NULL);
result = vlscm_scm_from_value (res_val);
@@ -730,7 +760,6 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
struct gdbarch *gdbarch;
SCM result, except_scm;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
/* The sequencing here, as everywhere else, is important.
We can't have existing cleanups when a Scheme exception is thrown. */
@@ -749,7 +778,7 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
gdbscm_throw (except_scm);
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct value *tmp = value;
@@ -765,7 +794,11 @@ gdbscm_value_subscript (SCM self, SCM index_scm)
res_val = value_subscript (tmp, value_as_long (index));
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
gdb_assert (res_val != NULL);
result = vlscm_scm_from_value (res_val);
@@ -792,13 +825,16 @@ gdbscm_value_call (SCM self, SCM args)
long args_count;
struct value **vargs = NULL;
SCM result = SCM_BOOL_F;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
ftype = check_typedef (value_type (function));
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
SCM_ASSERT_TYPE (TYPE_CODE (ftype) == TYPE_CODE_FUNC, self,
SCM_ARG1, FUNC_NAME,
@@ -832,7 +868,7 @@ gdbscm_value_call (SCM self, SCM args)
gdb_assert (gdbscm_is_true (scm_null_p (args)));
}
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *cleanup = make_cleanup_value_free_to_mark (mark);
struct value *return_value;
@@ -841,7 +877,11 @@ gdbscm_value_call (SCM self, SCM args)
result = vlscm_scm_from_value (return_value);
do_cleanups (cleanup);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (gdbscm_is_exception (result))
gdbscm_throw (result);
@@ -861,17 +901,20 @@ gdbscm_value_to_bytevector (SCM self)
size_t length = 0;
const gdb_byte *contents = NULL;
SCM bv;
- volatile struct gdb_exception except;
type = value_type (value);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CHECK_TYPEDEF (type);
length = TYPE_LENGTH (type);
contents = value_contents (value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
bv = scm_c_make_bytevector (length);
memcpy (SCM_BYTEVECTOR_CONTENTS (bv), contents, length);
@@ -902,27 +945,34 @@ gdbscm_value_to_bool (SCM self)
struct value *value = v_smob->value;
struct type *type;
LONGEST l = 0;
- volatile struct gdb_exception except;
type = value_type (value);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CHECK_TYPEDEF (type);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME,
_("integer-like gdb value"));
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (TYPE_CODE (type) == TYPE_CODE_PTR)
l = value_as_address (value);
else
l = value_as_long (value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return scm_from_bool (l != 0);
}
@@ -938,27 +988,34 @@ gdbscm_value_to_integer (SCM self)
struct value *value = v_smob->value;
struct type *type;
LONGEST l = 0;
- volatile struct gdb_exception except;
type = value_type (value);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CHECK_TYPEDEF (type);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
SCM_ASSERT_TYPE (is_intlike (type, 1), self, SCM_ARG1, FUNC_NAME,
_("integer-like gdb value"));
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (TYPE_CODE (type) == TYPE_CODE_PTR)
l = value_as_address (value);
else
l = value_as_long (value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
if (TYPE_UNSIGNED (type))
return gdbscm_scm_from_ulongest (l);
@@ -977,24 +1034,31 @@ gdbscm_value_to_real (SCM self)
struct value *value = v_smob->value;
struct type *type;
DOUBLEST d = 0;
- volatile struct gdb_exception except;
type = value_type (value);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
CHECK_TYPEDEF (type);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
SCM_ASSERT_TYPE (is_intlike (type, 0) || TYPE_CODE (type) == TYPE_CODE_FLT,
self, SCM_ARG1, FUNC_NAME, _("number"));
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
d = value_as_double (value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
/* TODO: Is there a better way to check if the value fits? */
if (d != (double) d)
@@ -1045,7 +1109,6 @@ gdbscm_value_to_string (SCM self, SCM rest)
struct type *char_type = NULL;
SCM result;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
/* The sequencing here, as everywhere else, is important.
We can't have existing cleanups when a Scheme exception is thrown. */
@@ -1081,11 +1144,15 @@ gdbscm_value_to_string (SCM self, SCM rest)
/* We don't assume anything about the result of scm_port_conversion_strategy.
From this point on, if errors is not 'errors, use 'substitute. */
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
LA_GET_STRING (value, &buffer, &length, &char_type, &la_encoding);
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
/* If errors is "error" scm_from_stringn may throw a Scheme exception.
Make sure we don't leak. This is done via scm_dynwind_begin, et.al. */
@@ -1131,7 +1198,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
int length = -1;
SCM result = SCM_BOOL_F; /* -Wall */
struct cleanup *cleanups;
- volatile struct gdb_exception except;
+ struct gdb_exception except = exception_none;
/* The sequencing here, as everywhere else, is important.
We can't have existing cleanups when a Scheme exception is thrown. */
@@ -1142,7 +1209,7 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
cleanups = make_cleanup (xfree, encoding);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct cleanup *inner_cleanup
= make_cleanup_value_free_to_mark (value_mark ());
@@ -1155,6 +1222,12 @@ gdbscm_value_to_lazy_string (SCM self, SCM rest)
do_cleanups (inner_cleanup);
}
+ CATCH (ex, RETURN_MASK_ALL)
+ {
+ except = ex;
+ }
+ END_CATCH
+
do_cleanups (cleanups);
GDBSCM_HANDLE_GDB_EXCEPTION (except);
@@ -1184,14 +1257,17 @@ gdbscm_value_fetch_lazy_x (SCM self)
value_smob *v_smob
= vlscm_get_value_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
struct value *value = v_smob->value;
- volatile struct gdb_exception except;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
if (value_lazy (value))
value_fetch_lazy (value);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return SCM_UNSPECIFIED;
}
@@ -1207,12 +1283,11 @@ gdbscm_value_print (SCM self)
struct value_print_options opts;
char *s = NULL;
SCM result;
- volatile struct gdb_exception except;
get_user_print_options (&opts);
opts.deref_ref = 0;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
struct ui_file *stb = mem_fileopen ();
struct cleanup *old_chain = make_cleanup_ui_file_delete (stb);
@@ -1222,7 +1297,11 @@ gdbscm_value_print (SCM self)
do_cleanups (old_chain);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
/* Use SCM_FAILED_CONVERSION_QUESTION_MARK to ensure this doesn't
throw an error if the encoding fails.
@@ -1246,7 +1325,6 @@ gdbscm_parse_and_eval (SCM expr_scm)
struct value *res_val = NULL;
SCM result;
struct cleanup *cleanups;
- volatile struct gdb_exception except;
/* The sequencing here, as everywhere else, is important.
We can't have existing cleanups when a Scheme exception is thrown. */
@@ -1257,11 +1335,15 @@ gdbscm_parse_and_eval (SCM expr_scm)
cleanups = make_cleanup_value_free_to_mark (value_mark ());
make_cleanup (xfree, expr_str);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
res_val = parse_and_eval (expr_str);
}
- GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION_WITH_CLEANUPS (except, cleanups);
+ }
+ END_CATCH
gdb_assert (res_val != NULL);
result = vlscm_scm_from_value (res_val);
@@ -1282,15 +1364,18 @@ gdbscm_history_ref (SCM index)
{
int i;
struct value *res_val = NULL; /* Initialize to appease gcc warning. */
- volatile struct gdb_exception except;
gdbscm_parse_function_args (FUNC_NAME, SCM_ARG1, NULL, "i", index, &i);
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
res_val = access_value_history (i);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return vlscm_scm_from_value (res_val);
}
@@ -1304,16 +1389,19 @@ gdbscm_history_append_x (SCM value)
int res_index = -1;
struct value *v;
value_smob *v_smob;
- volatile struct gdb_exception except;
v_smob = vlscm_get_value_smob_arg_unsafe (value, SCM_ARG1, FUNC_NAME);
v = v_smob->value;
- TRY_CATCH (except, RETURN_MASK_ALL)
+ TRY
{
res_index = record_latest_value (v);
}
- GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ CATCH (except, RETURN_MASK_ALL)
+ {
+ GDBSCM_HANDLE_GDB_EXCEPTION (except);
+ }
+ END_CATCH
return scm_from_int (res_index);
}