This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[PATCH v2 21/25] Only send sync execution command output to the UI that ran the command
- From: Pedro Alves <palves at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Mon, 21 Mar 2016 15:21:11 +0000
- Subject: [PATCH v2 21/25] Only send sync execution command output to the UI that ran the command
- Authentication-results: sourceware.org; auth=none
- References: <1458573675-15478-1-git-send-email-palves at redhat dot com>
Currently when a "step", "next", etc. finishes, the current source
line is printed on all console UIs.
This patch makes the CLI and TUI interpreters reuse MI's logic to only
emit console output related to a synchronous command on the
console-like interpreter that started the command in the first place.
---
gdb/cli/cli-interp.c | 10 ++++++++--
gdb/tui/tui-interp.c | 11 +++++++++--
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/gdb/cli/cli-interp.c b/gdb/cli/cli-interp.c
index 15bba38..b2e0506 100644
--- a/gdb/cli/cli-interp.c
+++ b/gdb/cli/cli-interp.c
@@ -92,14 +92,20 @@ cli_on_normal_stop (struct bpstats *bs, int print_frame)
{
struct switch_thru_all_uis state;
+ if (!print_frame)
+ return;
+
SWITCH_THRU_ALL_UIS (state)
{
- struct cli_interp *cli = as_cli_interp (top_level_interpreter ());
+ struct interp *interp = top_level_interpreter ();
+ struct cli_interp *cli = as_cli_interp (interp);
+ struct thread_info *thread;
if (cli == NULL)
continue;
- if (print_frame)
+ thread = inferior_thread ();
+ if (should_print_stop_to_console (interp, thread))
print_stop_event (cli->cli_uiout);
}
}
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index ef46837..5e59c5a 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -32,6 +32,7 @@
#include "tui/tui-io.h"
#include "infrun.h"
#include "observer.h"
+#include "gdbthread.h"
static struct ui_out *tui_ui_out (struct interp *self);
@@ -68,14 +69,20 @@ tui_on_normal_stop (struct bpstats *bs, int print_frame)
{
struct switch_thru_all_uis state;
+ if (!print_frame)
+ return;
+
SWITCH_THRU_ALL_UIS (state)
{
- struct interp *tui = as_tui_interp (top_level_interpreter ());
+ struct interp *interp = top_level_interpreter ();
+ struct interp *tui = as_tui_interp (interp);
+ struct thread_info *thread;
if (tui == NULL)
continue;
- if (print_frame)
+ thread = inferior_thread ();
+ if (should_print_stop_to_console (interp, thread))
print_stop_event (tui_ui_out (tui));
}
}
--
2.5.0