From f786f615100c8763f19ddec9943156cd2b94a763 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Fri, 8 Aug 2003 19:00:08 +0000 Subject: [PATCH] 2003-08-08 Andrew Cagney * interps.c (interp_set): Check for a NULL "old_interp". Index: mi/ChangeLog 2003-08-08 Andrew Cagney * mi-main.c (captured_mi_execute_command): Add "mi2" and "mi3" to interpreters that hack around CLI. * mi-interp.c (mi3_command_loop): New function. (mi_interpreter_resume): Check for "mi3", default to "mi2". --- gdb/ChangeLog | 4 ++++ gdb/interps.c | 2 +- gdb/mi/ChangeLog | 7 +++++++ gdb/mi/mi-interp.c | 13 +++++++++++-- gdb/mi/mi-main.c | 4 +++- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index c7685fba75..207eff5467 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,7 @@ +2003-08-08 Andrew Cagney + + * interps.c (interp_set): Check for a NULL "old_interp". + 2003-08-08 H.J. Lu * Makefile.in (FLAGS_TO_PASS): Add DESTDIR. diff --git a/gdb/interps.c b/gdb/interps.c index 6df1d4bf17..82e9af690b 100644 --- a/gdb/interps.c +++ b/gdb/interps.c @@ -183,7 +183,7 @@ interp_set (struct interp *interp) if (interp->procs->resume_proc != NULL && (!interp->procs->resume_proc (interp->data))) { - if (!interp_set (old_interp)) + if (old_interp == NULL || !interp_set (old_interp)) internal_error (__FILE__, __LINE__, "Failed to initialize new interp \"%s\" %s", interp->name, "and could not restore old interp!\n"); diff --git a/gdb/mi/ChangeLog b/gdb/mi/ChangeLog index 3122136357..520ad4d718 100644 --- a/gdb/mi/ChangeLog +++ b/gdb/mi/ChangeLog @@ -1,3 +1,10 @@ +2003-08-08 Andrew Cagney + + * mi-main.c (captured_mi_execute_command): Add "mi2" and "mi3" to + interpreters that hack around CLI. + * mi-interp.c (mi3_command_loop): New function. + (mi_interpreter_resume): Check for "mi3", default to "mi2". + 2003-08-07 Andrew Cagney * mi-interp.c (_initialize_mi_interp): Register "mi2" and "mi3". diff --git a/gdb/mi/mi-interp.c b/gdb/mi/mi-interp.c index e00e32989e..b72d7ef0bc 100644 --- a/gdb/mi/mi-interp.c +++ b/gdb/mi/mi-interp.c @@ -60,6 +60,7 @@ static int mi_interp_query_hook (const char *ctlstr, va_list ap); static char *mi_interp_read_one_line_hook (char *prompt, int repeat, char *anno); +static void mi3_command_loop (void); static void mi2_command_loop (void); static void mi1_command_loop (void); @@ -133,10 +134,12 @@ mi_interpreter_resume (void *data) /* If we're _the_ interpreter, take control. */ if (current_interp_named_p (INTERP_MI1)) command_loop_hook = mi1_command_loop; - else if (current_interp_named_p (INTERP_MI)) + else if (current_interp_named_p (INTERP_MI2)) command_loop_hook = mi2_command_loop; + else if (current_interp_named_p (INTERP_MI3)) + command_loop_hook = mi3_command_loop; else - return 0; + command_loop_hook = mi2_command_loop; return 1; } @@ -333,6 +336,12 @@ mi2_command_loop (void) mi_command_loop (2); } +static void +mi3_command_loop (void) +{ + mi_command_loop (3); +} + static void mi_command_loop (int mi_version) { diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index 29eccaca5f..40d3699dc7 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -1161,7 +1161,9 @@ captured_mi_execute_command (struct ui_out *uiout, void *data) /* If we changed interpreters, DON'T print out anything. */ if (current_interp_named_p (INTERP_MI) - || current_interp_named_p (INTERP_MI1)) + || current_interp_named_p (INTERP_MI1) + || current_interp_named_p (INTERP_MI2) + || current_interp_named_p (INTERP_MI3)) { /* print the result */ /* FIXME: Check for errors here. */