summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>2002-11-04 23:27:32 +0000
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>2002-11-04 23:27:32 +0000
commitcccf1428c0e7eb0487beb4b6adbc4b8dbdddd445 (patch)
tree8352bba43a304c748fd7c98b6430cef0e80c598a
parent2bb26b414def478fbe43a639ae71ee6b6642bf05 (diff)
downloadgdb-cccf1428c0e7eb0487beb4b6adbc4b8dbdddd445.tar.gz
2002-11-04 Elena Zannoni <ezannoni@redhat.com>
* cli/cli-interp.c (_initialize_cli_interp): Call gdb_interpreter_new and gdb_interpreter_add. * top.c (gdb_init): Call gdb_interpreter_lookup. (gdb_init): Call gdb_interpreter_set. * interps.c (gdb_interpreter_new): Renamed from gdb_new_interpreter. (gdb_interpreter_add): Renamed from gdb_add_interpreter. (gdb_interpreter_set): Renamed from gdb_set_interpreter. (gdb_interpreter_lookup): Renamed from gdb_lookup_interpreter. (gdb_interpreter_current): Renamed from gdb_current_interpreter. Update all callers. * interps.h: Ditto. 2002-11-04 Elena Zannoni <ezannoni@redhat.com> * mi-interp.c (mi_interpreter_resume): Ditto. (mi_cmd_interpreter_exec): Use gdb_interpreter_lookup. (_initialize_mi_interp): Use gdb_interpreter_new, gdb_interpreter_add. * mi-cmd-break.c (mi_cmd_break_insert): Use gdb_interpreter_current_is_named_p. (mi_cmd_break_watch): Ditto. * mi-events.c (mi_interp_stack_changed_hook): Ditto. (event_notify): Ditto. * mi-main.c (captured_mi_execute_command): Use gdb_interpreter_current_is_named_p. (mi_load_progress): Ditto.
-rw-r--r--gdb/ChangeLog15
-rw-r--r--gdb/cli/cli-interp.c4
-rw-r--r--gdb/interps.c36
-rw-r--r--gdb/interps.h13
-rw-r--r--gdb/mi/ChangeLog15
-rw-r--r--gdb/mi/mi-cmd-break.c12
-rw-r--r--gdb/mi/mi-events.c6
-rw-r--r--gdb/mi/mi-interp.c24
-rw-r--r--gdb/mi/mi-main.c12
-rw-r--r--gdb/top.c8
10 files changed, 88 insertions, 57 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f79f2d12370..29e0fac0701 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,20 @@
2002-11-04 Elena Zannoni <ezannoni@redhat.com>
+ * cli/cli-interp.c (_initialize_cli_interp): Call
+ gdb_interpreter_new and gdb_interpreter_add.
+ * top.c (gdb_init): Call gdb_interpreter_lookup.
+ (gdb_init): Call gdb_interpreter_set.
+ * interps.c (gdb_interpreter_new): Renamed from
+ gdb_new_interpreter.
+ (gdb_interpreter_add): Renamed from gdb_add_interpreter.
+ (gdb_interpreter_set): Renamed from gdb_set_interpreter.
+ (gdb_interpreter_lookup): Renamed from gdb_lookup_interpreter.
+ (gdb_interpreter_current): Renamed from gdb_current_interpreter.
+ Update all callers.
+ * interps.h: Ditto.
+
+2002-11-04 Elena Zannoni <ezannoni@redhat.com>
+
* interps.h (gdb_interpreter_is_quiet_p): Rename from
gdb_interpreter_is_quiet.
* cli/cli-interp.c (cli_interpreter_display_prompt_p): Call
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 640e098629e..2bbf647243b 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -131,7 +131,7 @@ _initialize_cli_interp (void)
/* Create a default uiout builder for the CLI. */
cli_uiout = cli_out_new (gdb_stdout);
- cli_interp = gdb_new_interpreter (GDB_INTERPRETER_CONSOLE, NULL, cli_uiout,
+ cli_interp = gdb_interpreter_new (GDB_INTERPRETER_CONSOLE, NULL, cli_uiout,
&procs);
- gdb_add_interpreter (cli_interp);
+ gdb_interpreter_add (cli_interp);
}
diff --git a/gdb/interps.c b/gdb/interps.c
index d74730db1a5..187d8d98e58 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -79,11 +79,11 @@ static struct gdb_interpreter *current_interpreter = NULL;
static int interpreter_initialized = 0;
-/* gdb_new_interpreter - This allocates space for a new interpreter,
+/* gdb_interpreter_new - This allocates space for a new interpreter,
fills the fields from the inputs, and returns a pointer to the
interpreter. */
struct gdb_interpreter *
-gdb_new_interpreter (char *name,
+gdb_interpreter_new (char *name,
void *data,
struct ui_out *uiout,
struct gdb_interpreter_procs *procs)
@@ -112,12 +112,12 @@ gdb_new_interpreter (char *name,
the new one is NOT added, and the function returns 0. Otherwise
it returns 1. */
int
-gdb_add_interpreter (struct gdb_interpreter *interp)
+gdb_interpreter_add (struct gdb_interpreter *interp)
{
if (!interpreter_initialized)
initialize_interps ();
- if (gdb_lookup_interpreter (interp->name) != NULL)
+ if (gdb_interpreter_lookup (interp->name) != NULL)
return 0;
interp->next = interp_list;
@@ -133,7 +133,7 @@ gdb_add_interpreter (struct gdb_interpreter *interp)
old interpreter, then raise an internal error, since we are in
pretty bad shape at this point. */
int
-gdb_set_interpreter (struct gdb_interpreter *interp)
+gdb_interpreter_set (struct gdb_interpreter *interp)
{
struct gdb_interpreter *old_interp = current_interpreter;
int first_time = 0;
@@ -180,7 +180,7 @@ gdb_set_interpreter (struct gdb_interpreter *interp)
{
if (!interp->procs.init_proc (interp->data))
{
- if (!gdb_set_interpreter (old_interp))
+ if (!gdb_interpreter_set (old_interp))
internal_error (__FILE__, __LINE__,
"Failed to initialize new interp \"%s\" %s",
interp->name,
@@ -204,7 +204,7 @@ gdb_set_interpreter (struct gdb_interpreter *interp)
if (interp->procs.resume_proc != NULL
&& (!interp->procs.resume_proc (interp->data)))
{
- if (!gdb_set_interpreter (old_interp))
+ if (!gdb_interpreter_set (old_interp))
internal_error (__FILE__, __LINE__,
"Failed to initialize new interp \"%s\" %s",
interp->name, "and could not restore old interp!\n");
@@ -229,11 +229,11 @@ gdb_set_interpreter (struct gdb_interpreter *interp)
return 1;
}
-/* gdb_lookup_interpreter - Looks up the interpreter for NAME. If no
+/* gdb_interpreter_lookup - Looks up the interpreter for NAME. If no
such interpreter exists, return NULL, otherwise return a pointer to
the interpreter. */
struct gdb_interpreter *
-gdb_lookup_interpreter (char *name)
+gdb_interpreter_lookup (char *name)
{
struct gdb_interpreter *interp;
@@ -250,8 +250,8 @@ gdb_lookup_interpreter (char *name)
}
/* Returns the current interpreter. */
-struct gdb_interpreter *
-gdb_current_interpreter ()
+static struct gdb_interpreter *
+gdb_interpreter_current (void)
{
return current_interpreter;
}
@@ -267,9 +267,9 @@ gdb_interpreter_ui_out (struct gdb_interpreter *interp)
/* Returns true if the current interp is the passed in name. */
int
-gdb_current_interpreter_is_named (char *interp_name)
+gdb_interpreter_current_is_named_p (char *interp_name)
{
- struct gdb_interpreter *current_interp = gdb_current_interpreter ();
+ struct gdb_interpreter *current_interp = gdb_interpreter_current ();
if (current_interp)
return (strcmp (current_interp->name, interp_name) == 0);
@@ -408,9 +408,9 @@ interpreter_exec_cmd (char *args, int from_tty)
if (nrules < 2)
error ("usage: interpreter-exec <interpreter> [ <command> ... ]");
- old_interp = gdb_current_interpreter ();
+ old_interp = gdb_interpreter_current ();
- interp_to_use = gdb_lookup_interpreter (prules[0]);
+ interp_to_use = gdb_interpreter_lookup (prules[0]);
if (interp_to_use == NULL)
error ("Could not find interpreter \"%s\".", prules[0]);
@@ -418,21 +418,21 @@ interpreter_exec_cmd (char *args, int from_tty)
old_quiet = gdb_interpreter_set_quiet (old_interp, 1);
use_quiet = gdb_interpreter_set_quiet (interp_to_use, 1);
- if (!gdb_set_interpreter (interp_to_use))
+ if (!gdb_interpreter_set (interp_to_use))
error ("Could not switch to interpreter \"%s\".", prules[0]);
for (i = 1; i < nrules; i++)
{
if (!gdb_interpreter_exec (prules[i]))
{
- gdb_set_interpreter (old_interp);
+ gdb_interpreter_set (old_interp);
gdb_interpreter_set_quiet (interp_to_use, old_quiet);
error ("error in command: \"%s\".", prules[i]);
break;
}
}
- gdb_set_interpreter (old_interp);
+ gdb_interpreter_set (old_interp);
gdb_interpreter_set_quiet (interp_to_use, use_quiet);
gdb_interpreter_set_quiet (old_interp, old_quiet);
}
diff --git a/gdb/interps.h b/gdb/interps.h
index cb9ff6c8597..4abc8d7a262 100644
--- a/gdb/interps.h
+++ b/gdb/interps.h
@@ -41,20 +41,17 @@ struct gdb_interpreter_procs
};
extern struct gdb_interpreter
- *gdb_new_interpreter (char *name, void *data, struct ui_out *uiout,
+ *gdb_interpreter_new (char *name, void *data, struct ui_out *uiout,
struct gdb_interpreter_procs *procs);
-extern int gdb_add_interpreter (struct gdb_interpreter *interp);
-extern int gdb_set_interpreter (struct gdb_interpreter *interp);
-extern struct gdb_interpreter *gdb_lookup_interpreter (char *name);
-extern struct gdb_interpreter *gdb_current_interpreter ();
+extern int gdb_interpreter_set (struct gdb_interpreter *interp);
+extern struct gdb_interpreter *gdb_interpreter_lookup (char *name);
extern struct ui_out *gdb_interpreter_ui_out (struct gdb_interpreter *interp);
-extern int gdb_current_interpreter_is_named (char *interp_name);
+extern int gdb_interpreter_current_is_named_p (char *interp_name);
extern int gdb_interpreter_exec (char *command_str);
extern int gdb_interpreter_display_prompt_p (void);
-extern int gdb_interpreter_set_quiet (struct gdb_interpreter *interp,
- int quiet);
extern int gdb_interpreter_is_quiet_p (struct gdb_interpreter *interp);
+extern int gdb_interpreter_add (struct gdb_interpreter *interp);
extern struct gdb_interpreter_procs *gdb_interpreter_get_procs (struct
gdb_interpreter
*interp);
diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog
index d15ef620c7a..79747a82bdc 100644
--- a/gdb/mi/ChangeLog
+++ b/gdb/mi/ChangeLog
@@ -1,5 +1,20 @@
2002-11-04 Elena Zannoni <ezannoni@redhat.com>
+ * mi-interp.c (mi_interpreter_resume): Ditto.
+ (mi_cmd_interpreter_exec): Use gdb_interpreter_lookup.
+ (_initialize_mi_interp): Use gdb_interpreter_new,
+ gdb_interpreter_add.
+ * mi-cmd-break.c (mi_cmd_break_insert): Use
+ gdb_interpreter_current_is_named_p.
+ (mi_cmd_break_watch): Ditto.
+ * mi-events.c (mi_interp_stack_changed_hook): Ditto.
+ (event_notify): Ditto.
+ * mi-main.c (captured_mi_execute_command): Use
+ gdb_interpreter_current_is_named_p.
+ (mi_load_progress): Ditto.
+
+2002-11-04 Elena Zannoni <ezannoni@redhat.com>
+
* mi-interp.c (_initialize_mi_interp): Use mi_interpreter_prompt_p
instead of mi_interpreter_prompt.
(mi_interpreter_prompt_p): Rename from mi_interpreter_prompt and
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index f578a67013d..5f9d6aca756 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -141,8 +141,8 @@ mi_cmd_break_insert (char *command, char **argv, int argc)
handlers, so we won't get any event notifications sent out to the
client. MI3+ does NOT send breakpoint information with the -break-insert
command for this reason. */
- if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI2)
- || gdb_current_interpreter_is_named (GDB_INTERPRETER_MI1))
+ if (gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI2)
+ || gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI1))
old_hooks = set_gdb_event_hooks (&breakpoint_hooks);
/* Now we have what we need, let's insert the breakpoint! */
@@ -172,8 +172,8 @@ mi_cmd_break_insert (char *command, char **argv, int argc)
"mi_cmd_break_insert: Bad switch.");
}
- if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI2)
- || gdb_current_interpreter_is_named (GDB_INTERPRETER_MI1))
+ if (gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI2)
+ || gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI1))
set_gdb_event_hooks (old_hooks);
if (rc == GDB_RC_FAIL)
@@ -256,8 +256,8 @@ mi_cmd_break_watch (char *command, char **argv, int argc)
cannot use the same printing mechanisms. So for MI3+, we simply
rewind MI's uiout so that we can prevent GDB from printing
any information about the watchpoint we just inserted. */
- if (!gdb_current_interpreter_is_named (GDB_INTERPRETER_MI2)
- && !gdb_current_interpreter_is_named (GDB_INTERPRETER_MI1))
+ if (!gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI2)
+ && !gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI1))
mi_out_rewind (uiout);
return MI_CMD_DONE;
diff --git a/gdb/mi/mi-events.c b/gdb/mi/mi-events.c
index 5dc4b26dada..876bf8a3d57 100644
--- a/gdb/mi/mi-events.c
+++ b/gdb/mi/mi-events.c
@@ -32,7 +32,7 @@ mi_interp_stack_changed_hook (void)
struct ui_out *saved_ui_out = uiout;
struct mi_out *tmp_mi_out;
- if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI1))
+ if (gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI1))
uiout = gdb_interpreter_ui_out (mi1_interp);
else
uiout = gdb_interpreter_ui_out (mi_interp);
@@ -48,8 +48,8 @@ event_notify (const char *string, ...)
{
va_list args;
- if (!gdb_current_interpreter_is_named (GDB_INTERPRETER_MI1)
- && !gdb_current_interpreter_is_named (GDB_INTERPRETER_MI2))
+ if (!gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI1)
+ && !gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI2))
{
va_start (args, string);
vfprintf_unfiltered (mi_event_channel, string, args);
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index 1d1c5b96554..ca8758d852d 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -139,19 +139,19 @@ mi_interpreter_resume (void *data)
/* Route target output through the MI. */
gdb_stdtarg = mi_stdtarg;
- /* Replace all the hooks that we know about. There really needs to be a better way
- of doing this... */
+ /* Replace all the hooks that we know about. There really needs to
+ be a better way of doing this... */
clear_interpreter_hooks ();
set_gdb_event_hooks (&mi_event_handlers);
show_load_progress = mi_load_progress;
/* If we're _the_ interpreter, take control. */
- if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI2))
+ if (gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI2))
command_loop_hook = mi2_command_loop;
- else if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI1))
+ else if (gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI1))
command_loop_hook = mi1_command_loop;
- else if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI))
+ else if (gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI))
command_loop_hook = mi2_command_loop;
else
return 0;
@@ -214,7 +214,7 @@ mi_cmd_interpreter_exec (char *command, char **argv, int argc)
return MI_CMD_ERROR;
}
- interp_to_use = gdb_lookup_interpreter (argv[0]);
+ interp_to_use = gdb_interpreter_lookup (argv[0]);
if (interp_to_use == NULL)
{
xasprintf (&mi_error_message,
@@ -426,12 +426,12 @@ _initialize_mi_interp (void)
if (mi1_interp == NULL)
{
mi1_interp =
- gdb_new_interpreter (GDB_INTERPRETER_MI1, NULL, mi_out_new (1),
+ gdb_interpreter_new (GDB_INTERPRETER_MI1, NULL, mi_out_new (1),
&procs);
if (mi1_interp == NULL)
error
("Couldn't allocate a new interpreter for the mi1 interpreter\n");
- if (gdb_add_interpreter (mi1_interp) != 1)
+ if (gdb_interpreter_add (mi1_interp) != 1)
error ("Couldn't add the mi1 interpreter to gdb.\n");
}
@@ -439,12 +439,12 @@ _initialize_mi_interp (void)
if (mi2_interp == NULL)
{
mi2_interp =
- gdb_new_interpreter (GDB_INTERPRETER_MI2, NULL, mi_out_new (2),
+ gdb_interpreter_new (GDB_INTERPRETER_MI2, NULL, mi_out_new (2),
&procs);
if (mi2_interp == NULL)
error
("Couldn't allocate a new interpreter for the mi2 interpreter\n");
- if (gdb_add_interpreter (mi2_interp) != 1)
+ if (gdb_interpreter_add (mi2_interp) != 1)
error ("Couldn't add the mi2 interpreter to gdb.\n");
}
@@ -452,12 +452,12 @@ _initialize_mi_interp (void)
if (mi_interp == NULL)
{
mi_interp =
- gdb_new_interpreter (GDB_INTERPRETER_MI, NULL, mi_out_new (3),
+ gdb_interpreter_new (GDB_INTERPRETER_MI, NULL, mi_out_new (3),
&procs);
if (mi_interp == NULL)
error
("Couldn't allocate a new interpreter for the mi interpreter\n");
- if (gdb_add_interpreter (mi_interp) != 1)
+ if (gdb_interpreter_add (mi_interp) != 1)
error ("Couldn't add the mi interpreter to gdb.\n");
}
}
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c
index f317910f02f..efbef6c7f6f 100644
--- a/gdb/mi/mi-main.c
+++ b/gdb/mi/mi-main.c
@@ -1160,9 +1160,9 @@ captured_mi_execute_command (struct ui_out *uiout, void *data)
mi_execute_cli_command ("%s", context->command);
/* If we changed interpreters, DON'T print out anything. */
- if (gdb_current_interpreter_is_named (GDB_INTERPRETER_MI)
- || gdb_current_interpreter_is_named (GDB_INTERPRETER_MI1)
- || gdb_current_interpreter_is_named (GDB_INTERPRETER_MI2))
+ if (gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI)
+ || gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI2)
+ || gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI1))
{
/* print the result */
/* FIXME: Check for errors here. */
@@ -1410,9 +1410,9 @@ mi_load_progress (const char *section_name,
static char *previous_sect_name = NULL;
int new_section;
- if (!gdb_current_interpreter_is_named (GDB_INTERPRETER_MI)
- && !gdb_current_interpreter_is_named (GDB_INTERPRETER_MI1)
- && !gdb_current_interpreter_is_named (GDB_INTERPRETER_MI2))
+ if (!gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI)
+ && !gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI2)
+ && !gdb_interpreter_current_is_named_p (GDB_INTERPRETER_MI1))
return;
update_threshold.tv_sec = 0;
diff --git a/gdb/top.c b/gdb/top.c
index 9201e39f399..96b2dc096a8 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -2130,11 +2130,15 @@ gdb_init (char *argv0)
/* All the interpreters should have had a look at things by now.
Initialize the selected interpreter. */
{
+
+ /* There will always be an interpreter. Either the one specified
+ by the user at start up or the console. */
+
struct gdb_interpreter *interp;
if (interpreter_p == NULL)
interpreter_p = xstrdup (GDB_INTERPRETER_CONSOLE);
- interp = gdb_lookup_interpreter (interpreter_p);
+ interp = gdb_interpreter_lookup (interpreter_p);
if (interp == NULL)
{
@@ -2142,7 +2146,7 @@ gdb_init (char *argv0)
interpreter_p);
exit (1);
}
- if (!gdb_set_interpreter (interp))
+ if (!gdb_interpreter_set (interp))
{
fprintf_unfiltered (gdb_stderr, "Interpreter `%s' failed to initialize.\n",
interpreter_p);