* exceptions.c (exception_none): New variable.
	* Makefile.in: Update dependencies.
	* interps.c: Include "exceptions.h".
	(interpreter_exec_cmd, interp_exec): Update to return "struct
	exception"
	* exceptions.h (no_exception): Declare.
	* tui/tui-interp.c (tui_exec): Update to return "struct exception"
	* mi/mi-interp.c: Include "exceptions.h".
	(mi_cmd_interpreter_exec, mi_interpreter_exec): Update to return
	'struct exception".
	* cli/cli-interp.c (cli_interpreter_exec, safe_execute_command)
	(do_captured_execute_command): Update to use catch_exception.
	* interps.h: Include "exceptions.h".
	(interp_exec_ftype, interp_exec): Return "struct exception".
 2005-01-12  Andrew Cagney  <cagney@gnu.org>
 
+       * exceptions.c (exception_none): New variable.
+       * Makefile.in: Update dependencies.
+       * interps.c: Include "exceptions.h".
+       (interpreter_exec_cmd, interp_exec): Update to return "struct
+       exception"
+       * exceptions.h (no_exception): Declare.
+       * tui/tui-interp.c (tui_exec): Update to return "struct exception"
+       * mi/mi-interp.c: Include "exceptions.h".
+       (mi_cmd_interpreter_exec, mi_interpreter_exec): Update to return
+       'struct exception".
+       * cli/cli-interp.c (cli_interpreter_exec, safe_execute_command) 
+       (do_captured_execute_command): Update to use catch_exception.
+       * interps.h: Include "exceptions.h".
+       (interp_exec_ftype, interp_exec): Return "struct exception".
+
        * exceptions.h (throw_reason): Rename throw_exception.
        (enum errors, struct exception): Define.
        (catch_exception_ftype): Define.
 
 inflow_h = inflow.h $(terminal_h)
 inf_ptrace_h = inf-ptrace.h
 inf_ttrace_h = inf-ttrace.h
-interps_h = interps.h
+interps_h = interps.h $(exceptions_h)
 jv_lang_h = jv-lang.h
 kod_h = kod.h
 language_h = language.h
        $(objfiles_h) $(source_h) $(linespec_h) $(completer_h) $(gdb_h) \
        $(ui_out_h) $(cli_script_h) $(gdb_assert_h) $(block_h) $(solist_h) \
        $(observer_h) $(exceptions_h) $(gdb_events_h)
-bsd-uthread.o: bsd-uthread.c $(defs_h) $(gdb_core_h) $(gdbthread_h) \
-       $(inferior_h) $(objfiles_h) $(observer_h) $(regcache_h) \
-       $(solist_h) $(symfile_h) $(target_h) $(gdb_assert_h) \
-       $(gdb_obstack_h) $(bsd_uthread_h)
 bsd-kvm.o: bsd-kvm.c $(defs_h) $(cli_cmds_h) $(command_h) $(frame_h) \
        $(regcache_h) $(target_h) $(value_h) $(gdbcore_h) $(gdb_assert_h) \
        $(readline_h) $(bsd_kvm_h)
+bsd-uthread.o: bsd-uthread.c $(defs_h) $(gdbcore_h) $(gdbthread_h) \
+       $(inferior_h) $(objfiles_h) $(observer_h) $(regcache_h) $(solist_h) \
+       $(symfile_h) $(target_h) $(gdb_assert_h) $(gdb_obstack_h) \
+       $(bsd_uthread_h)
 buildsym.o: buildsym.c $(defs_h) $(bfd_h) $(gdb_obstack_h) $(symtab_h) \
        $(symfile_h) $(objfiles_h) $(gdbtypes_h) $(gdb_assert_h) \
        $(complaints_h) $(gdb_string_h) $(expression_h) $(bcache_h) \
 event-top.o: event-top.c $(defs_h) $(top_h) $(inferior_h) $(target_h) \
        $(terminal_h) $(event_loop_h) $(event_top_h) $(interps_h) \
        $(exceptions_h) $(gdbcmd_h) $(readline_h) $(readline_history_h)
-exceptions.o: exceptions.c
+exceptions.o: exceptions.c $(defs_h) $(exceptions_h) $(breakpoint_h) \
+       $(target_h) $(inferior_h) $(annotate_h) $(ui_out_h) $(gdb_assert_h) \
+       $(gdb_string_h)
 exec.o: exec.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) $(gdbcmd_h) \
        $(language_h) $(symfile_h) $(objfiles_h) $(completer_h) $(value_h) \
        $(exec_h) $(readline_h) $(gdb_string_h) $(gdbcore_h) $(gdb_stat_h) \
        $(gdb_assert_h) $(gdb_string_h) $(inf_child_h) $(inf_ttrace_h)
 interps.o: interps.c $(defs_h) $(gdbcmd_h) $(ui_out_h) $(event_loop_h) \
        $(event_top_h) $(interps_h) $(completer_h) $(gdb_string_h) \
-       $(gdb_events_h) $(gdb_assert_h) $(top_h)
+       $(gdb_events_h) $(gdb_assert_h) $(top_h) $(exceptions_h)
 irix5-nat.o: irix5-nat.c $(defs_h) $(inferior_h) $(gdbcore_h) $(target_h) \
        $(regcache_h) $(gdb_string_h) $(gregset_h) $(mips_tdep_h)
 jv-exp.o: jv-exp.c $(defs_h) $(gdb_string_h) $(expression_h) $(value_h) \
        $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-getopt.c
 mi-interp.o: $(srcdir)/mi/mi-interp.c $(defs_h) $(gdb_string_h) $(interps_h) \
        $(event_top_h) $(event_loop_h) $(inferior_h) $(ui_out_h) $(top_h) \
-       $(mi_main_h) $(mi_cmds_h) $(mi_out_h) $(mi_console_h)
+       $(exceptions_h) $(mi_main_h) $(mi_cmds_h) $(mi_out_h) \
+       $(mi_console_h)
        $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/mi/mi-interp.c
 mi-main.o: $(srcdir)/mi/mi-main.c $(defs_h) $(target_h) $(inferior_h) \
        $(gdb_string_h) $(exceptions_h) $(top_h) $(gdbthread_h) $(mi_cmds_h) \
 
 /* These are the ui_out and the interpreter for the console interpreter. */
 
 /* Longjmp-safe wrapper for "execute_command" */
-static int do_captured_execute_command (struct ui_out *uiout, void *data);
-static enum gdb_rc safe_execute_command (struct ui_out *uiout, char *command,
-                                        int from_tty);
+static struct exception safe_execute_command (struct ui_out *uiout,
+                                             char *command, int from_tty);
 struct captured_execute_command_args
 {
   char *command;
     return 1;
 }
 
-static int
+static struct exception
 cli_interpreter_exec (void *data, const char *command_str)
 {
-  int result;
   struct ui_file *old_stream;
+  struct exception result;
 
   /* FIXME: cagney/2003-02-01: Need to const char *propogate
      safe_execute_command.  */
   return result;
 }
 
-static int
+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);
-  return GDB_RC_OK;
 }
 
-static enum gdb_rc
+static struct exception
 safe_execute_command (struct ui_out *uiout, char *command, int from_tty)
 {
   struct captured_execute_command_args args;
   args.command = command;
   args.from_tty = from_tty;
-  return catch_exceptions (uiout, do_captured_execute_command, &args,
-                          NULL, RETURN_MASK_ALL);
+  return catch_exception (uiout, do_captured_execute_command, &args,
+                         RETURN_MASK_ALL);
 }
 
 
 
 #include "gdb_assert.h"
 #include "gdb_string.h"
 
+const struct exception exception_none = { 0, NO_ERROR, NULL };
+
 /* One should use catch_errors rather than manipulating these
    directly.  */
 #if defined(HAVE_SIGSETJMP)
 
   char *message;
 };
 
+/* A pre-defined non-exception.  */
+extern const struct exception exception_none;
+
 /* Throw an exception (as described by "struct exception").  Will
    execute a LONG JUMP to the inner most containing exception handler
    established using catch_exceptions() (or similar).
 
 #include "gdb-events.h"
 #include "gdb_assert.h"
 #include "top.h"               /* For command_loop.  */
+#include "exceptions.h"
 
 struct interp
 {
   return interp->procs->exec_proc != NULL;
 }
 
-int
+struct exception
 interp_exec (struct interp *interp, const char *command_str)
 {
   if (interp->procs->exec_proc != NULL)
     {
       return interp->procs->exec_proc (interp->data, command_str);
     }
-  return 0;
+  return exception_none;
 }
 
 /* A convenience routine that nulls out all the
 
   for (i = 1; i < nrules; i++)
     {
-      if (!interp_exec (interp_to_use, prules[i]))
+      struct exception e = interp_exec (interp_to_use, prules[i]);
+      if (!e.reason)
        {
          interp_set (old_interp);
          interp_set_quiet (interp_to_use, old_quiet);
 
 #ifndef INTERPS_H
 #define INTERPS_H
 
+#include "exceptions.h"
+
 struct ui_out;
 struct interp;
 
 extern int interp_suspend (struct interp *interp);
 extern int interp_prompt_p (struct interp *interp);
 extern int interp_exec_p (struct interp *interp);
-extern int interp_exec (struct interp *interp, const char *command);
+extern struct exception interp_exec (struct interp *interp,
+                                    const char *command);
 extern int interp_quiet_p (struct interp *interp);
 
 typedef void *(interp_init_ftype) (void);
 typedef int (interp_resume_ftype) (void *data);
 typedef int (interp_suspend_ftype) (void *data);
 typedef int (interp_prompt_p_ftype) (void *data);
-typedef int (interp_exec_ftype) (void *data, const char *command);
+typedef struct exception (interp_exec_ftype) (void *data, const char *command);
 typedef void (interp_command_loop_ftype) (void *data);
 
 struct interp_procs
 
 #include "inferior.h"
 #include "ui-out.h"
 #include "top.h"
-
+#include "exceptions.h"
 #include "mi-main.h"
 #include "mi-cmds.h"
 #include "mi-out.h"
   return 1;
 }
 
-static int
+static struct exception
 mi_interpreter_exec (void *data, const char *command)
 {
+  static struct exception ok;
   char *tmp = alloca (strlen (command) + 1);
   strcpy (tmp, command);
   mi_execute_command_wrapper (tmp);
-  return 1;
+  return exception_none;
 }
 
 /* Never display the default gdb prompt in mi case.  */
          since that is what the cli expects - before running the command,
          and then set it back to 0 when we are done. */
       sync_execution = 1;
-      if (interp_exec (interp_to_use, argv[i]) < 0)
-       {
-         mi_error_message = error_last_message ();
-         result = MI_CMD_ERROR;
-         break;
-       }
+      {
+       struct exception e = interp_exec (interp_to_use, argv[i]);
+       if (e.reason < 0)
+         {
+           mi_error_message = e.message;
+           result = MI_CMD_ERROR;
+           break;
+         }
+      }
       xfree (buff);
       do_exec_error_cleanups (ALL_CLEANUPS);
       sync_execution = 0;
 
     return 1;
 }
 
-static int
+static struct exception
 tui_exec (void *data, const char *command_str)
 {
   internal_error (__FILE__, __LINE__, "tui_exec called");