]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
2002-11-04 Elena Zannoni <ezannoni@redhat.com>
authorElena Zannoni <ezannoni@kwikemart.cygnus.com>
Mon, 4 Nov 2002 23:27:32 +0000 (23:27 +0000)
committerElena Zannoni <ezannoni@kwikemart.cygnus.com>
Mon, 4 Nov 2002 23:27:32 +0000 (23:27 +0000)
* 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.

gdb/ChangeLog
gdb/cli/cli-interp.c
gdb/interps.c
gdb/interps.h
gdb/mi/ChangeLog
gdb/mi/mi-cmd-break.c
gdb/mi/mi-events.c
gdb/mi/mi-interp.c
gdb/mi/mi-main.c
gdb/top.c

index f79f2d123704a235000b34b92331737be94dda5d..29e0fac07015c5a96a531ff567317668a64ac4ba 100644 (file)
@@ -1,3 +1,18 @@
+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
index 640e098629e592d0f425a19ad4225df054c90370..2bbf647243b5084c1a5ebbd83824f8fd66eb6a6b 100644 (file)
@@ -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);
 }
index d74730db1a5c6de141f42d27404ae659b0b41f88..187d8d98e586c1b0440b140c6e68e29bfed1f8a1 100644 (file)
@@ -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);
 }
index cb9ff6c8597653bcf9a483ba9e46d908e4901e52..4abc8d7a262f8543d5e2eedb9eab81327732b5e2 100644 (file)
@@ -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);
index d15ef620c7a58c3900a261ac70d2b80a6b366a94..79747a82bdc3f67cee50eca9b3d8a92cd8e47e75 100644 (file)
@@ -1,3 +1,18 @@
+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
index f578a67013d2e87fd34b80399e898e9ad84a8ee3..5f9d6aca756edc747aa94ff702f55bd8cc2a6f9f 100644 (file)
@@ -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;
index 5dc4b26dada7063882e38bff91310b88315be440..876bf8a3d57680a7c406af3e5e96c7000dd2ee37 100644 (file)
@@ -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);
index 1d1c5b96554f582b8faad80b45d00c290cbb9b40..ca8758d852d2c19c0cbfbcd16f3f907b9fc142f8 100644 (file)
@@ -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");
     }
 }
index f317910f02fb2a197876e55cdad2330f8fc42256..efbef6c7f6f2dcbe76141f0d99de56c031ab6e8a 100644 (file)
@@ -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;
index 9201e39f399a2f4ba4b9e11a00e5458c237e74fa..96b2dc096a8054d756c59e006624fa23782bd886 100644 (file)
--- 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);