]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* interps.c (interpreter_exec_cmd): Remove mention of "mi" in
authorKeith Seitz <keiths@redhat.com>
Tue, 1 Oct 2002 16:19:08 +0000 (16:19 +0000)
committerKeith Seitz <keiths@redhat.com>
Tue, 1 Oct 2002 16:19:08 +0000 (16:19 +0000)
        error message.

        * cli/cli-interp.c (do_captured_execute_command): New function.
        (safe_execute_command): New function.
        * Makefile.in (cli-interp.c): Depend on top_h.
        * wrapper.c (do_captured_execute_command): Moved to cli/cli-interp.c.
        (gdb_execute_command): Removed.
        * wrapper.h (gdb_execute_command): Removed.

gdb/ChangeLog
gdb/Makefile.in
gdb/cli/cli-interp.c
gdb/interps.c
gdb/wrapper.c
gdb/wrapper.h

index cce4699d22014961906c2e25397139f087d835e4..7eede2c4084923bd6f0dfe2a6a5dd288e772ea4b 100644 (file)
@@ -1,3 +1,15 @@
+2002-10-01  Keith Seitz  <keiths@redhat.com>
+
+       * interps.c (interpreter_exec_cmd): Remove mention of "mi" in
+       error message.
+
+       * cli/cli-interp.c (do_captured_execute_command): New function.
+       (safe_execute_command): New function.
+       * Makefile.in (cli-interp.c): Depend on top_h.
+       * wrapper.c (do_captured_execute_command): Moved to cli/cli-interp.c.
+       (gdb_execute_command): Removed.
+       * wrapper.h (gdb_execute_command): Removed.
+
 2002-09-04  Keith Seitz  <keiths@redhat.com>
 
        * thread.c (do_captured_list_thread_ids): Call prune_threads
index 0248cdde0d395e746cd94db426f6b035b1720f4c..9eb2df530d833b425c3b2174cd6360bd3ef51dcc 100644 (file)
@@ -2318,7 +2318,7 @@ cli-dump.o: $(srcdir)/cli/cli-dump.c $(defs_h) $(gdb_string_h) \
        $(cli_dump_h) $(gdb_assert_h) $(target_h)
        $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-dump.c
 cli-interp.o: $(srcdir)/cli/cli-interp.c $(defs_h) $(value_h) \
-       $(wrapper_h) $(event_top_h) $(ui_out_h) $(cli_out_h)
+       $(wrapper_h) $(event_top_h) $(ui_out_h) $(cli_out_h) $(top_h)
        $(CC) -c $(INTERNAL_CFLAGS) $(srcdir)/cli/cli-interp.c
 cli-script.o: $(srcdir)/cli/cli-script.c $(defs_h) $(value_h) $(language_h) \
        $(ui_out_h) $(gdb_string_h) $(top_h) $(cli_cmds_h) $(cli_decode_h) \
index 0ce7aa157b7dcd4d01dc823a31a153b44a0b88d2..15cfb54099173ba6c4e7543b9737046dded0cb33 100644 (file)
 #include "event-top.h"
 #include "ui-out.h"
 #include "cli-out.h"
-
+#include "top.h"               /* for "execute_command" */
 /* Prototypes for the CLI Interpreter functions */
 
-int cli_interpreter_init (void *data);
-int cli_interpreter_resume (void *data);
-int cli_interpreter_do_one_event (void *data);
-int cli_interpreter_suspend (void *data);
-int cli_interpreter_delete (void *data);
-int cli_interpreter_exec (void *data, char *command_str);
-int cli_interpreter_display_prompt (void *data, char *new_prompt);
+static int cli_interpreter_init (void *data);
+static int cli_interpreter_resume (void *data);
+static int cli_interpreter_do_one_event (void *data);
+static int cli_interpreter_suspend (void *data);
+static int cli_interpreter_delete (void *data);
+static int cli_interpreter_exec (void *data, char *command_str);
+static int cli_interpreter_display_prompt (void *data, char *new_prompt);
 
 /* These are the ui_out and the interpreter for the console interpreter. */
 static struct ui_out *cli_uiout;
 static struct gdb_interpreter *cli_interp;
 
+/* 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);
+struct captured_execute_command_args
+{
+  char *command;
+  int from_tty;
+};
+
 /* These implement the cli out interpreter: */
 
-int
+static int
 cli_interpreter_init (void *data)
 {
   return 1;
 }
 
-int
+static int
 cli_interpreter_resume (void *data)
 {
   /*sync_execution = 1;*/
@@ -55,26 +65,26 @@ cli_interpreter_resume (void *data)
   return 1;
 }
 
-int
+static int
 cli_interpreter_do_one_event (void *data)
 {
   return 1;
 }
 
-int
+static int
 cli_interpreter_suspend (void *data)
 {
   gdb_disable_readline ();
   return 1;
 }
 
-int
+static int
 cli_interpreter_delete (void *data)
 {
   return 1;
 }
 
-int
+static int
 cli_interpreter_display_prompt (void *data, char *new_prompt)
 {
   if (gdb_interpreter_is_quiet (NULL))
@@ -87,7 +97,7 @@ cli_interpreter_display_prompt (void *data, char *new_prompt)
     }
 }
 
-int
+static int
 cli_interpreter_exec (void *data, char *command_str)
 {
   int result;
@@ -100,11 +110,30 @@ cli_interpreter_exec (void *data, char *command_str)
      It is important that it gets reset everytime, since the user could
      set gdb to use a different interpreter. */
   old_stream = cli_out_set_stream (cli_uiout, gdb_stdout);
-  result = gdb_execute_command (cli_uiout, command_str, 1);
+  result = safe_execute_command (cli_uiout, command_str, 1);
   cli_out_set_stream (cli_uiout, old_stream);
   return result;
 }
 
+static int
+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
+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);
+}
+
 /* standard gdb initialization hook */
 void
 _initialize_cli_interp (void)
index cee469e07f01b86784b3fd5c320faf58f0627da0..0b33e710c7ca598f2f8657f0302aa5847db30d90 100644 (file)
@@ -141,7 +141,9 @@ gdb_add_interpreter (struct gdb_interpreter *interp)
    runs the delete_proc, and if this is successful, the INTERP is deleted from
    the interpreter list and the function returns 1.  If the delete_proc fails, the
    function returns -1 and the interpreter is NOT removed from the list.  If the
-   interp is not found, 0 is returned. */
+   interp is not found, 0 is returned.
+
+   This isn't currently used by anything. */
 
 int
 gdb_delete_interpreter (struct gdb_interpreter *interp)
@@ -576,9 +578,7 @@ interpreter_exec_cmd (char *args, int from_tty)
        {
          gdb_set_interpreter (old_interp);
          gdb_interpreter_set_quiet (interp_to_use, old_quiet);
-         error
-           ("interpreter-exec: mi_interpreter_execute: error in command: \"%s\".",
-            prules[i]);
+         error ("error in command: \"%s\".", prules[i]);
          break;
        }
     }
index 4d3900880320267cb0dba302352cd378b5f209d7..e57f19a49cb28448f0d507330a6c893ee35bb19d 100644 (file)
@@ -19,7 +19,6 @@
 #include "defs.h"
 #include "value.h"
 #include "wrapper.h"
-#include "top.h"               /* for execute_command */
 
 /* use this struct to pass arguments to wrapper routines. We assume
    (arbitrarily) that no gdb function takes more than ten arguments. */
@@ -52,12 +51,6 @@ struct captured_value_struct_elt_args
   struct value **result_ptr;
 };
 
-struct captured_execute_command_args
-{
-  char *command;
-  int from_tty;
-};
-
 static int wrap_parse_exp_1 (char *);
 
 static int wrap_evaluate_expression (char *);
@@ -337,21 +330,3 @@ do_captured_value_struct_elt (struct ui_out *uiout, void *data)
                             cargs->static_memfuncp, cargs->err);
   return GDB_RC_OK;
 }
-
-static int
-do_captured_execute_command (struct ui_out *uiout, void *data)
-{
-  struct captured_execute_command_args *args = data;
-  execute_command (args->command, args->from_tty);
-  return GDB_RC_OK;
-}
-
-enum gdb_rc
-gdb_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);
-}
index 85072743f905f45715f7c5caa8172708b183fa8c..99c1e1672f7f11cfad918fffcddef1873d43bd4d 100644 (file)
@@ -49,7 +49,4 @@ extern enum gdb_rc gdb_value_struct_elt (struct ui_out *uiout, struct value **re
 extern int gdb_value_ind (struct value *val, struct value ** rval);
 
 extern int gdb_parse_and_eval_type (char *, int, struct type **);
-
-extern enum gdb_rc gdb_execute_command (struct ui_out *uiout, char *command,
-                                       int from_tty);
 #endif /* WRAPPER_H */