From: Andrew Burgess <andrew.burgess@embecosm.com>
To: Tom Tromey <tom@tromey.com>
Cc: Hannes Domani <ssbssa@yahoo.de>, gdb-patches@sourceware.org
Subject: Re: [RFC][PATCH] Call tui_before_prompt in do_scroll_vertical
Date: Mon, 23 Dec 2019 01:23:00 -0000 [thread overview]
Message-ID: <20191223012329.GG3865@embecosm.com> (raw)
In-Reply-To: <874kxrc3ha.fsf@tromey.com>
* Tom Tromey <tom@tromey.com> [2019-12-22 17:03:45 -0700]:
> >>>>> "Andrew" == Andrew Burgess <andrew.burgess@embecosm.com> writes:
>
> >> 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).
>
> I wonder if we really need to change the current source symtab.
> If so, I guess the TUI could just call
> set_current_source_symtab_and_line directly.
>
> The patch below removes the call to print_source_lines -- this approach
> just seems too roundabout for my taste.
I started playing with similar solutions. I also started looking at
the role tui_refresh_frame_and_register_information plays in keeping
the source/asm windows up to date. My conclusion was it does nothing
but add more complication.
Tom, the patch below applies on top of yours, it removes all of the
source/asm updating from tui_refresh_frame_and_register_information.
There's some direct action taken in the symtab changed observer
hook.
I also now call update_source_window_as_is on all source windows after
the vertical scroll - this partly fixes the asm/source scroll
synchronisation issue Hannes pointed out. Calling the *_as_is version
has (I think) an added benefit - if you scroll horizontally, and then
scroll up/down, the horizontal scroll is maintained. This feels much
nicer to me, and is what caused me to remove the code from
tui_refresh_frame_and_register_information.
I said partly fixes the scroll synchronisation issue as scrolling the
asm window doesn't (and never has I think) caused the source window to
scroll - it kind of feels like it should though... this probably just
requires us to add something similar to the asm windows vert scroll
code.
There is one issue with this patch, but I've run out of time right now
to look at this any further, if you fire up gdb on gdb then do:
start
tui enable
# will be in main now.
break gdb_main
continue
The breakpoint line will be the first line in the console, rather than
being in the centre of the window.
I don't know if this is a worth while direction to go in or not, what
do you think?
Thanks,
Andrew
---
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 8576bb8fccd..a6fbd88e51b 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -110,18 +110,13 @@ tui_event_modify_breakpoint (struct breakpoint *b)
static bool from_stack;
-/* This is set to true if the next window refresh should come from the
- current source symtab. */
-
-static bool from_source_symtab;
-
/* Refresh TUI's frame and register information. This is a hook intended to be
used to update the screen after potential frame and register changes. */
static void
tui_refresh_frame_and_register_information ()
{
- if (!from_stack && !from_source_symtab)
+ if (!from_stack)
return;
target_terminal::scoped_restore_terminal_state term_state;
@@ -144,6 +139,7 @@ tui_refresh_frame_and_register_information ()
tui_refreshing_registers = 0;
}
}
+#if 0
else if (!from_stack)
{
/* Make sure that the source window is displayed. */
@@ -152,6 +148,7 @@ tui_refresh_frame_and_register_information ()
struct symtab_and_line sal = get_current_source_symtab_and_line ();
tui_update_source_windows_with_line (sal);
}
+#endif
}
/* Dummy callback for deprecated_print_frame_info_listing_hook which is called
@@ -184,7 +181,6 @@ tui_before_prompt (const char *current_gdb_prompt)
{
tui_refresh_frame_and_register_information ();
from_stack = false;
- from_source_symtab = false;
}
/* Observer for the normal_stop notification. */
@@ -208,7 +204,11 @@ tui_context_changed (user_selected_what ignore)
static void
tui_symtab_changed ()
{
- from_source_symtab = true;
+ /* Make sure that the source window is displayed. */
+ tui_add_win_to_layout (SRC_WIN);
+
+ struct symtab_and_line sal = get_current_source_symtab_and_line ();
+ tui_update_source_windows_with_line (sal);
}
/* Token associated with observers registered while TUI hooks are
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index bcba9e176f1..4846ddec0fc 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -145,6 +145,7 @@ tui_source_window::do_scroll_vertical (int num_to_scroll)
struct frame_info *fi = get_selected_frame (NULL);
s = find_pc_line_symtab (get_frame_pc (fi));
arch = get_frame_arch (fi);
+ cursal.symtab = s;
}
else
s = cursal.symtab;
@@ -158,7 +159,10 @@ tui_source_window::do_scroll_vertical (int num_to_scroll)
line_no = 1;
cursal.line = line_no;
- update_source_window (arch, cursal);
+ find_line_pc (cursal.symtab, cursal.line, &cursal.pc);
+
+ for (struct tui_source_window_base *win_info : tui_source_windows ())
+ win_info->update_source_window_as_is (arch, cursal);
}
}
next prev parent reply other threads:[~2019-12-23 1:23 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20191221153325.6961-1-ssbssa.ref@yahoo.de>
2019-12-21 15:34 ` Hannes Domani via gdb-patches
2019-12-22 0:58 ` Andrew Burgess
2019-12-22 1:25 ` Hannes Domani via gdb-patches
2019-12-23 0:03 ` Tom Tromey
2019-12-23 0:19 ` Hannes Domani via gdb-patches
2019-12-23 1:23 ` Andrew Burgess [this message]
2020-01-07 11:52 ` [PATCH 5/6] gdb: Fix scrolling in TUI Andrew Burgess
2020-01-07 19:36 ` Tom Tromey
2020-01-07 11:52 ` [PATCH 2/6] gdb/testsuite/tui: Split enter_tui into two procs Andrew Burgess
2020-01-07 19:19 ` Tom Tromey
2020-01-07 11:52 ` [PATCH 4/6] gdb/tui: Fix 'layout asm' before the inferior has started Andrew Burgess
2020-01-07 19:31 ` Tom Tromey
2020-01-07 11:52 ` [PATCH 1/6] gdb/testsuite/tui: Always dump_screen when asked Andrew Burgess
2020-01-07 18:54 ` Tom Tromey
2020-01-07 11:52 ` [PATCH 0/6] Vertical scrolling and another small bug fix Andrew Burgess
2020-01-07 19:38 ` Tom Tromey
2020-01-09 23:28 ` Andrew Burgess
2020-01-07 11:52 ` [PATCH 6/6] gdb/tui: Link source and assembler scrolling .... again Andrew Burgess
2020-01-07 19:37 ` Tom Tromey
2020-01-07 11:52 ` [PATCH 3/6] gdb/testsuite/tui: Introduce check_box_contents Andrew Burgess
2020-01-07 19:30 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191223012329.GG3865@embecosm.com \
--to=andrew.burgess@embecosm.com \
--cc=gdb-patches@sourceware.org \
--cc=ssbssa@yahoo.de \
--cc=tom@tromey.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox