summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2002-10-01 16:19:08 +0000
committerKeith Seitz <keiths@redhat.com>2002-10-01 16:19:08 +0000
commit2b5a13e318e075221584fb893b35fc40188faa01 (patch)
tree07b044e1f01f14051ddf59d196d177e11cb3d907
parent24b8c9b305c0d4fdab9f54d39a20585c8bf84635 (diff)
downloadgdb-2b5a13e318e075221584fb893b35fc40188faa01.tar.gz
* 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.
-rw-r--r--gdb/ChangeLog12
-rw-r--r--gdb/Makefile.in2
-rw-r--r--gdb/cli/cli-interp.c61
-rw-r--r--gdb/interps.c8
-rw-r--r--gdb/wrapper.c25
-rw-r--r--gdb/wrapper.h3
6 files changed, 62 insertions, 49 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cce4699d220..7eede2c4084 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -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
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index 0248cdde0d3..9eb2df530d8 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -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) \
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 0ce7aa157b7..15cfb540991 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -24,30 +24,40 @@
#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)
diff --git a/gdb/interps.c b/gdb/interps.c
index cee469e07f0..0b33e710c7c 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -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;
}
}
diff --git a/gdb/wrapper.c b/gdb/wrapper.c
index 4d390088032..e57f19a49cb 100644
--- a/gdb/wrapper.c
+++ b/gdb/wrapper.c
@@ -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);
-}
diff --git a/gdb/wrapper.h b/gdb/wrapper.h
index 85072743f90..99c1e1672f7 100644
--- a/gdb/wrapper.h
+++ b/gdb/wrapper.h
@@ -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 */