diff options
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-cmd-stack.c | 17 | ||||
-rw-r--r-- | gdb/mi/mi-interp.c | 24 | ||||
-rw-r--r-- | gdb/mi/mi-main.c | 15 |
3 files changed, 36 insertions, 20 deletions
diff --git a/gdb/mi/mi-cmd-stack.c b/gdb/mi/mi-cmd-stack.c index 18a357e..1b863eb 100644 --- a/gdb/mi/mi-cmd-stack.c +++ b/gdb/mi/mi-cmd-stack.c @@ -537,15 +537,13 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, if (arg->val || arg->error) { - volatile struct gdb_exception except; + const char *error_message = NULL; if (arg->error) - except.message = arg->error; + error_message = arg->error; else { - /* TRY_CATCH has two statements, wrap it in a block. */ - - TRY_CATCH (except, RETURN_MASK_ERROR) + TRY { struct value_print_options opts; @@ -554,10 +552,15 @@ list_arg_or_local (const struct frame_arg *arg, enum what_to_list what, common_val_print (arg->val, stb, 0, &opts, language_def (SYMBOL_LANGUAGE (arg->sym))); } + CATCH (except, RETURN_MASK_ERROR) + { + error_message = except.message; + } + END_CATCH } - if (except.message) + if (error_message != NULL) fprintf_filtered (stb, _("<error reading variable: %s>"), - except.message); + error_message); ui_out_field_stream (uiout, "value", stb); } diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index f10b0bb..99ce385 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -808,7 +808,6 @@ mi_breakpoint_created (struct breakpoint *b) { struct mi_interp *mi = top_level_interpreter_data (); struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ()); - volatile struct gdb_exception e; if (mi_suppress_notification.breakpoint) return; @@ -827,8 +826,15 @@ mi_breakpoint_created (struct breakpoint *b) breakpoint_created notifications. So, we use ui_out_redirect. */ ui_out_redirect (mi_uiout, mi->event_channel); - TRY_CATCH (e, RETURN_MASK_ERROR) - gdb_breakpoint_query (mi_uiout, b->number, NULL); + TRY + { + gdb_breakpoint_query (mi_uiout, b->number, NULL); + } + CATCH (e, RETURN_MASK_ERROR) + { + } + END_CATCH + ui_out_redirect (mi_uiout, NULL); gdb_flush (mi->event_channel); @@ -862,7 +868,6 @@ mi_breakpoint_modified (struct breakpoint *b) { struct mi_interp *mi = top_level_interpreter_data (); struct ui_out *mi_uiout = interp_ui_out (top_level_interpreter ()); - volatile struct gdb_exception e; if (mi_suppress_notification.breakpoint) return; @@ -881,8 +886,15 @@ mi_breakpoint_modified (struct breakpoint *b) breakpoint_created notifications. So, we use ui_out_redirect. */ ui_out_redirect (mi_uiout, mi->event_channel); - TRY_CATCH (e, RETURN_MASK_ERROR) - gdb_breakpoint_query (mi_uiout, b->number, NULL); + TRY + { + gdb_breakpoint_query (mi_uiout, b->number, NULL); + } + CATCH (e, RETURN_MASK_ERROR) + { + } + END_CATCH + ui_out_redirect (mi_uiout, NULL); gdb_flush (mi->event_channel); diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 7412f7d..acbdb55 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -2080,7 +2080,6 @@ mi_execute_command (const char *cmd, int from_tty) { char *token; struct mi_parse *command = NULL; - volatile struct gdb_exception exception; /* This is to handle EOF (^D). We just quit gdb. */ /* FIXME: we should call some API function here. */ @@ -2089,18 +2088,19 @@ mi_execute_command (const char *cmd, int from_tty) target_log_command (cmd); - TRY_CATCH (exception, RETURN_MASK_ALL) + TRY { command = mi_parse (cmd, &token); } - if (exception.reason < 0) + CATCH (exception, RETURN_MASK_ALL) { mi_print_exception (token, exception); xfree (token); } - else + END_CATCH + + if (command != NULL) { - volatile struct gdb_exception result; ptid_t previous_ptid = inferior_ptid; command->token = token; @@ -2112,17 +2112,18 @@ mi_execute_command (const char *cmd, int from_tty) timestamp (command->cmd_start); } - TRY_CATCH (result, RETURN_MASK_ALL) + TRY { captured_mi_execute_command (current_uiout, command); } - if (result.reason < 0) + CATCH (result, RETURN_MASK_ALL) { /* The command execution failed and error() was called somewhere. */ mi_print_exception (command->token, result); mi_out_rewind (current_uiout); } + END_CATCH bpstat_do_actions (); |