Remove.
(do_captured_execute_command): Remove.
(safe_execute_command): Use TRY_CATCH.
* cli/cli-script.c (struct wrapped_read_command_file_args):
Remove.
(wrapped_read_command_file): Remove.
(script_from_file): Use TRY_CATCH.
* exceptions.c (catch_exception): Remove.
* exceptions.h (catch_exception): Remove.
(deprecated_throw_reason): Update comment.
* mi/mi-main.c (captured_mi_execute_command): Change 'data'
argument to 'context'.
(mi_execute_command): Use TRY_CATCH.
* remote.c (struct start_remote_args): Remove.
(remote_start_remote): Update; change arguments.
(remote_open_1): Use TRY_CATCH.
+2011-04-04 Tom Tromey <tromey@redhat.com>
+
+ * cli/cli-interp.c (struct captured_execute_command_args):
+ Remove.
+ (do_captured_execute_command): Remove.
+ (safe_execute_command): Use TRY_CATCH.
+ * cli/cli-script.c (struct wrapped_read_command_file_args):
+ Remove.
+ (wrapped_read_command_file): Remove.
+ (script_from_file): Use TRY_CATCH.
+ * exceptions.c (catch_exception): Remove.
+ * exceptions.h (catch_exception): Remove.
+ (deprecated_throw_reason): Update comment.
+ * mi/mi-main.c (captured_mi_execute_command): Change 'data'
+ argument to 'context'.
+ (mi_execute_command): Use TRY_CATCH.
+ * remote.c (struct start_remote_args): Remove.
+ (remote_start_remote): Update; change arguments.
+ (remote_open_1): Use TRY_CATCH.
+
2011-04-04 Tom Tromey <tromey@redhat.com>
* tracepoint.c (scope_info): Update.
static struct gdb_exception safe_execute_command (struct ui_out *uiout,
char *command,
int from_tty);
-struct captured_execute_command_args
-{
- char *command;
- int from_tty;
-};
-
/* These implement the cli out interpreter: */
static void *
return result;
}
-static void
-do_captured_execute_command (struct ui_out *uiout, void *data)
-{
- struct captured_execute_command_args *args =
- (struct captured_execute_command_args *) data;
-
- execute_command (args->command, args->from_tty);
-}
-
static struct gdb_exception
safe_execute_command (struct ui_out *uiout, char *command, int from_tty)
{
- struct gdb_exception e;
- struct captured_execute_command_args args;
+ volatile struct gdb_exception e;
- args.command = command;
- args.from_tty = from_tty;
- e = catch_exception (uiout, do_captured_execute_command, &args,
- RETURN_MASK_ALL);
+ TRY_CATCH (e, RETURN_MASK_ALL)
+ {
+ execute_command (command, from_tty);
+ }
/* FIXME: cagney/2005-01-13: This shouldn't be needed. Instead the
caller should print the exception. */
exception_print (gdb_stderr, e);
source_file_name = p->old_file;
}
-struct wrapped_read_command_file_args
-{
- FILE *stream;
-};
-
-static void
-wrapped_read_command_file (struct ui_out *uiout, void *data)
-{
- struct wrapped_read_command_file_args *args = data;
-
- read_command_file (args->stream);
-}
-
/* Used to implement source_command. */
void
error_pre_print = "";
{
- struct gdb_exception e;
- struct wrapped_read_command_file_args args;
+ volatile struct gdb_exception e;
- args.stream = stream;
- e = catch_exception (uiout, wrapped_read_command_file, &args,
- RETURN_MASK_ERROR);
+ TRY_CATCH (e, RETURN_MASK_ERROR)
+ {
+ read_command_file (stream);
+ }
switch (e.reason)
{
case 0:
return catch_exceptions_with_msg (uiout, func, func_args, NULL, mask);
}
-struct gdb_exception
-catch_exception (struct ui_out *uiout,
- catch_exception_ftype *func,
- void *func_args,
- return_mask mask)
-{
- volatile struct gdb_exception exception;
-
- TRY_CATCH (exception, mask)
- {
- (*func) (uiout, func_args);
- }
- return exception;
-}
-
int
catch_exceptions_with_msg (struct ui_out *uiout,
catch_exceptions_ftype *func,
extern void throw_error (enum errors error, const char *fmt, ...)
ATTRIBUTE_NORETURN ATTRIBUTE_PRINTF (2, 3);
-/* Instead of deprecated_throw_reason, code should use catch_exception
- and throw_exception. */
+/* Instead of deprecated_throw_reason, code should use
+ throw_exception. */
extern void deprecated_throw_reason (enum return_reason reason)
ATTRIBUTE_NORETURN;
char **gdberrmsg,
return_mask mask);
-/* This function, in addition, suppresses the printing of the captured
- error message. It's up to the client to print it. */
-
-extern struct gdb_exception catch_exception (struct ui_out *uiout,
- catch_exception_ftype *func,
- void *func_args,
- return_mask mask);
-
/* If CATCH_ERRORS_FTYPE throws an error, catch_errors() returns zero
otherwize the result from CATCH_ERRORS_FTYPE is returned. It is
probably useful for CATCH_ERRORS_FTYPE to always return a non-zero
prompt, display error). */
static void
-captured_mi_execute_command (struct ui_out *uiout, void *data)
+captured_mi_execute_command (struct ui_out *uiout, struct mi_parse *context)
{
struct cleanup *cleanup;
- struct mi_parse *context = (struct mi_parse *) data;
if (do_timings)
current_command_ts = context->cmd_start;
}
else
{
- struct gdb_exception result;
+ volatile struct gdb_exception result;
ptid_t previous_ptid = inferior_ptid;
command->token = token;
timestamp (command->cmd_start);
}
- result = catch_exception (uiout, captured_mi_execute_command, command,
- RETURN_MASK_ALL);
+ TRY_CATCH (result, RETURN_MASK_ALL)
+ {
+ captured_mi_execute_command (uiout, command);
+ }
if (result.reason < 0)
{
/* The command execution failed and error() was called
return 0;
}
-/* Stub for catch_exception. */
-
-struct start_remote_args
-{
- int from_tty;
-
- /* The current target. */
- struct target_ops *target;
-
- /* Non-zero if this is an extended-remote target. */
- int extended_p;
-};
-
/* Send interrupt_sequence to remote target. */
static void
send_interrupt_sequence (void)
}
static void
-remote_start_remote (struct ui_out *uiout, void *opaque)
+remote_start_remote (int from_tty, struct target_ops *target, int extended_p)
{
- struct start_remote_args *args = opaque;
struct remote_state *rs = get_remote_state ();
struct packet_config *noack_config;
char *wait_status = NULL;
rs->noack_mode = 1;
}
- if (args->extended_p)
+ if (extended_p)
{
/* Tell the remote that we are using the extended protocol. */
putpkt ("!");
/* On OSs where the list of libraries is global to all
processes, we fetch them early. */
if (gdbarch_has_global_solist (target_gdbarch))
- solib_add (NULL, args->from_tty, args->target, auto_solib_add);
+ solib_add (NULL, from_tty, target, auto_solib_add);
if (non_stop)
{
controlling. We default to adding them in the running state.
The '?' query below will then tell us about which threads are
stopped. */
- remote_threads_info (args->target);
+ remote_threads_info (target);
}
else if (rs->non_stop_aware)
{
{
if (rs->buf[0] == 'W' || rs->buf[0] == 'X')
{
- if (!args->extended_p)
+ if (!extended_p)
error (_("The target is not running (try extended-remote?)"));
/* We're connected, but not running. Drop out before we
how to do it some other way, try again. This is not
supported for non-stop; it could be, but it is tricky if
there are no stopped threads when we connect. */
- if (remote_read_description_p (args->target)
+ if (remote_read_description_p (target)
&& gdbarch_target_desc (target_gdbarch) == NULL)
{
target_clear_description ();
rs->cached_wait_status = 1;
immediate_quit--;
- start_remote (args->from_tty); /* Initialize gdb process mechanisms. */
+ start_remote (from_tty); /* Initialize gdb process mechanisms. */
}
else
{
if (thread_count () == 0)
{
- if (!args->extended_p)
+ if (!extended_p)
error (_("The target is not running (try extended-remote?)"));
/* We're connected, but not running. Drop out before we
all the ``target ....'' commands to share a common callback
function. See cli-dump.c. */
{
- struct gdb_exception ex;
- struct start_remote_args args;
-
- args.from_tty = from_tty;
- args.target = target;
- args.extended_p = extended_p;
+ volatile struct gdb_exception ex;
- ex = catch_exception (uiout, remote_start_remote, &args, RETURN_MASK_ALL);
+ TRY_CATCH (ex, RETURN_MASK_ALL)
+ {
+ remote_start_remote (from_tty, target, extended_p);
+ }
if (ex.reason < 0)
{
/* Pop the partially set up target - unless something else did