[RFC][PATCH] Call tui_before_prompt in do_scroll_vertical

Hannes Domani via gdb-patches
2019-12-21T15:34:06Z

Without this call scrolling in the src window does not work at all.

First I tried it with tui_update_source_windows_with_line, but this didn't
reset from_source_symtab (which was set deep in print_source_lines),
which resulted in some weird behavior when switching from "layout split"
to "layout asm" after scrolling down in the src window (the asm window
was then overwritten by the src window).

gdb/ChangeLog:

2019-12-21 Hannes Domani <ssbssa@yahoo.de>

* tui/tui-hooks.c (tui_before_prompt): Remove static.
* tui/tui-source.c (tui_before_prompt): Add prototype.
(tui_source_window::do_scroll_vertical): Add tui_before_prompt call.
---
gdb/tui/tui-hooks.c | 2 +-
gdb/tui/tui-source.c | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 8576bb8fcc..8b9e70316f 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -179,7 +179,7 @@ tui_inferior_exit (struct inferior *inf)

/* Observer for the before_prompt notification. */

-static void
+void
tui_before_prompt (const char *current_gdb_prompt)
{
tui_refresh_frame_and_register_information ();
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 0728263b8c..dfe5721edf 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -39,6 +39,9 @@
#include "tui/tui-source.h"
#include "gdb_curses.h"

+void
+tui_before_prompt (const char *current_gdb_prompt);
+
/* Function to display source in the source window. */
bool
tui_source_window::set_contents (struct gdbarch *arch,
@@ -158,6 +161,8 @@ tui_source_window::do_scroll_vertical (int num_to_scroll)
l.u.line_no = 1;

print_source_lines (s, l.u.line_no, l.u.line_no + 1, 0);
+
+ tui_before_prompt ("");
}
}

--
2.24.1