This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH] Remove deprecated_command_loop_hook
- From: "Andrew Burgess" <aburgess at broadcom dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Wed, 21 Aug 2013 19:09:14 +0100
- Subject: [PATCH] Remove deprecated_command_loop_hook
Small patch to remove deprecated_command_loop_hook.
OK to apply?
Thanks,
Andrew
gdb/ChangeLog
2013-08-21 Andrew Burgess <aburgess@broadcom.com>
* defs.h (deprecated_command_loop_hook): Remove, and remove
reference in comment.
* interps.c (current_interp_command_loop): Remove use of
deprecated_command_loop_hook.
(clear_interpreter_hooks): Same.
* mi/mi-common.h (struct mi_interp): Add mi version number.
* mi/mi-interp.c (mi_command_loop): Change signature, pull
version number from cookie.
(mi1_command_loop): Delete.
(mi2_command_loop): Delete.
(mi3_command_loop): Delete.
(mi_interpreter_init): Add the mi version to the data cookie.
(mi_interoreter_resume): Remove use of
deprecated_command_loop_hook.
(_initialize_mi_interp): Add mi_command_loop to interpreter procs.
* top.c (deprecated_command_loop_hook): Remove.
diff --git a/gdb/defs.h b/gdb/defs.h
index 014d7d4..6117b00 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -702,10 +702,8 @@ extern int watchdog;
extern char *interpreter_p;
/* If a given interpreter matches INTERPRETER_P then it should update
- deprecated_command_loop_hook and deprecated_init_ui_hook with the
- per-interpreter implementation. */
-/* FIXME: deprecated_command_loop_hook and deprecated_init_ui_hook
- should be moved here. */
+ deprecated_init_ui_hook with the per-interpreter implementation. */
+/* FIXME: deprecated_init_ui_hook should be moved here. */
struct target_waitstatus;
struct cmd_list_element;
@@ -715,7 +713,6 @@ extern void (*deprecated_post_add_symbol_hook) (void);
extern void (*selected_frame_level_changed_hook) (int);
extern int (*deprecated_ui_loop_hook) (int signo);
extern void (*deprecated_init_ui_hook) (char *argv0);
-extern void (*deprecated_command_loop_hook) (void);
extern void (*deprecated_show_load_progress) (const char *section,
unsigned long section_sent,
unsigned long section_size,
diff --git a/gdb/interps.c b/gdb/interps.c
index 25500d6..33e0f72 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -320,12 +320,9 @@ void
current_interp_command_loop (void)
{
/* Somewhat messy. For the moment prop up all the old ways of
- selecting the command loop. `deprecated_command_loop_hook'
- should be deprecated. */
- if (deprecated_command_loop_hook != NULL)
- deprecated_command_loop_hook ();
- else if (current_interpreter != NULL
- && current_interpreter->procs->command_loop_proc != NULL)
+ selecting the command loop. */
+ if (current_interpreter != NULL
+ && current_interpreter->procs->command_loop_proc != NULL)
current_interpreter->procs->command_loop_proc (current_interpreter->data);
else
cli_command_loop ();
@@ -386,7 +383,6 @@ clear_interpreter_hooks (void)
deprecated_target_wait_hook = 0;
deprecated_call_command_hook = 0;
deprecated_error_begin_hook = 0;
- deprecated_command_loop_hook = 0;
}
/* This is a lazy init routine, called the first time the interpreter
diff --git a/gdb/mi/mi-common.h b/gdb/mi/mi-common.h
index 3590897..a3b48bc 100644
--- a/gdb/mi/mi-common.h
+++ b/gdb/mi/mi-common.h
@@ -60,6 +60,9 @@ struct mi_interp
/* MI's builder. */
struct ui_out *uiout;
+ /* The version of the mi we're running. */
+ int version;
+
/* This is the interpreter for the mi... */
struct interp *mi2_interp;
struct interp *mi1_interp;
diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c
index e370a57..aaf2869 100644
--- a/gdb/mi/mi-interp.c
+++ b/gdb/mi/mi-interp.c
@@ -43,7 +43,7 @@
static void mi_execute_command_wrapper (const char *cmd);
static void mi_execute_command_input_handler (char *cmd);
-static void mi_command_loop (int mi_version);
+static void mi_command_loop (void *data);
/* These are hooks that we put in place while doing interpreter_exec
so we can report interesting things that happened "behind the MI's
@@ -52,10 +52,6 @@ static void mi_command_loop (int mi_version);
static int mi_interp_query_hook (const char *ctlstr, va_list ap)
ATTRIBUTE_PRINTF (1, 0);
-static void mi3_command_loop (void);
-static void mi2_command_loop (void);
-static void mi1_command_loop (void);
-
static void mi_insert_notify_hooks (void);
static void mi_remove_notify_hooks (void);
static void mi_on_normal_stop (struct bpstats *bs, int print_frame);
@@ -89,7 +85,6 @@ mi_interpreter_init (struct interp *interp, int top_level)
{
struct mi_interp *mi = XMALLOC (struct mi_interp);
const char *name;
- int mi_version;
/* Assign the output channel created at startup to its own global,
so that we can create a console channel that encapsulates and
@@ -110,17 +105,17 @@ mi_interpreter_init (struct interp *interp, int top_level)
/* INTERP_MI selects the most recent released version. "mi2" was
released as part of GDB 6.0. */
if (strcmp (name, INTERP_MI) == 0)
- mi_version = 2;
+ mi->version = 2;
else if (strcmp (name, INTERP_MI1) == 0)
- mi_version = 1;
+ mi->version = 1;
else if (strcmp (name, INTERP_MI2) == 0)
- mi_version = 2;
+ mi->version = 2;
else if (strcmp (name, INTERP_MI3) == 0)
- mi_version = 3;
+ mi->version = 3;
else
gdb_assert_not_reached ("unhandled MI version");
- mi->uiout = mi_out_new (mi_version);
+ mi->uiout = mi_out_new (mi->version);
if (top_level)
{
@@ -193,16 +188,6 @@ mi_interpreter_resume (void *data)
deprecated_show_load_progress = mi_load_progress;
- /* If we're _the_ interpreter, take control. */
- if (current_interp_named_p (INTERP_MI1))
- deprecated_command_loop_hook = mi1_command_loop;
- else if (current_interp_named_p (INTERP_MI2))
- deprecated_command_loop_hook = mi2_command_loop;
- else if (current_interp_named_p (INTERP_MI3))
- deprecated_command_loop_hook = mi3_command_loop;
- else
- deprecated_command_loop_hook = mi2_command_loop;
-
return 1;
}
@@ -322,26 +307,11 @@ mi_execute_command_input_handler (char *cmd)
}
static void
-mi1_command_loop (void)
-{
- mi_command_loop (1);
-}
-
-static void
-mi2_command_loop (void)
+mi_command_loop (void *data)
{
- mi_command_loop (2);
-}
-
-static void
-mi3_command_loop (void)
-{
- mi_command_loop (3);
-}
+ struct mi_interp *mi = data;
+ int mi_version = mi->version;
-static void
-mi_command_loop (int mi_version)
-{
/* Turn off 8 bit strings in quoted output. Any character with the
high bit set is printed using C's octal format. */
sevenbit_strings = 1;
@@ -996,7 +966,8 @@ _initialize_mi_interp (void)
mi_interpreter_exec, /* exec_proc */
mi_interpreter_prompt_p, /* prompt_proc_p */
mi_ui_out, /* ui_out_proc */
- mi_set_logging /* set_logging_proc */
+ mi_set_logging, /* set_logging_proc */
+ mi_command_loop /* command_loop_proc */
};
/* The various interpreter levels. */
diff --git a/gdb/top.c b/gdb/top.c
index 516ffb9..95ee462 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -199,12 +199,6 @@ void (*deprecated_init_ui_hook) (char *argv0);
int (*deprecated_ui_loop_hook) (int);
-/* Called instead of command_loop at top level. Can be invoked via
- throw_exception(). */
-
-void (*deprecated_command_loop_hook) (void);
-
-
/* Called from print_frame_info to list the line we stopped in. */
void (*deprecated_print_frame_info_listing_hook) (struct symtab * s,