This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Delete interp_exec_p
- From: Doug Evans <dje at google dot com>
- To: gdb-patches at sourceware dot org
- Date: Tue, 12 Nov 2013 16:16:17 -0800
- Subject: [PATCH] Delete interp_exec_p
- Authentication-results: sourceware.org; auth=none
Hi.
I noticed this while working on some MI stuff.
AFAICT every interpreter defines exec_proc so interp_exec_p is
unnecessary.
Regression tested on amd64-linux.
Ok to check in?
2013-11-12 Doug Evans <dje@google.com>
* interps.h (interp_exec_p): Delete.
* interps.c (interp_exec_p): Delete.
(interp_exec): Update. Assert interp->procs->exec_proc != NULL.
* mi/mi-interp.c (mi_cmd_interpreter_exec): Update.
diff --git a/gdb/interps.c b/gdb/interps.c
index 7f19385..884e48f 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -347,20 +347,13 @@ interp_set_quiet (struct interp *interp, int quiet)
/* interp_exec - This executes COMMAND_STR in the current
interpreter. */
-int
-interp_exec_p (struct interp *interp)
-{
- return interp->procs->exec_proc != NULL;
-}
struct gdb_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 exception_none;
+ gdb_assert (interp->procs->exec_proc != NULL);
+
+ return interp->procs->exec_proc (interp->data, command_str);
}
/* A convenience routine that nulls out all the common command hooks.
diff --git a/gdb/interps.h b/gdb/interps.h
index 58ac6b2..2e6ed4d 100644
--- a/gdb/interps.h
+++ b/gdb/interps.h
@@ -30,7 +30,6 @@ struct interp;
extern int interp_resume (struct interp *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 struct gdb_exception interp_exec (struct interp *interp,
const char *command);
extern int interp_quiet_p (struct interp *interp);
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 44ebd21..c5b56d5 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -231,11 +231,6 @@ mi_cmd_interpreter_exec (char *command, char **argv, int argc)
error (_("-interpreter-exec: could not find interpreter \"%s\""),
argv[0]);
- if (!interp_exec_p (interp_to_use))
- error (_("-interpreter-exec: interpreter \"%s\" "
- "does not support command execution"),
- argv[0]);
-
/* Insert the MI out hooks, making sure to also call the
interpreter's hooks if it has any. */
/* KRS: We shouldn't need this... Events should be installed and