public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Fix TUI flicker resulting from frequent frame changes (PR tui/13378)
@ 2015-06-19  4:36 Patrick Palka
  2015-06-19 17:13 ` Patrick Palka
  2015-06-26 13:36 ` Pedro Alves
  0 siblings, 2 replies; 6+ messages in thread
From: Patrick Palka @ 2015-06-19  4:36 UTC (permalink / raw)
  To: gdb-patches; +Cc: Patrick Palka

This patch fixes the perceived flicker of the TUI screen (and subsequent
slowdown) that most apparent when running an inferior while a
conditional breakpoint is active.  The cause of the flicker is that each
internal event GDB responds to is accompanied by a multitude of calls to
select_frame() and each such call forces the TUI screen to be refreshed.
We would like to not update the TUI screen after each such frame change.

The fix for this issue is pretty straightforward: do not update the TUI
screen when select_frame() gets called while synchronous execution of
the inferior is enabled.  This works because synchronous execution
remains enabled during the processing of internal events.  And since
during synchronous execution the user has no control of the TUI anyway,
it does not hurt to avoid updating the screen then.

The select_frame hook is still undesirable and should be removed, but
in the meantime this fix is seemingly an effective approximation of a
more disciplined approach of updating the TUI screen.

[ When the inferior is running while sync_execution is disabled, e.g.
  via "continue&" it looks like GDB lacks access to frame information
  thorughout -- and the hook never gets called -- so seemingly no
  worries in that case.  ]

[ up/down etc still work properl of course  ]

[ I am not sure that the change in tui_on_sync_execution_done is
  necessary/desirable.  It seems normal_stop already calls
  select_frame (get_current_frame ()) after sync_execution is toggled
  off.  ]

gdb/ChangeLog:

	* tui/tui-hooks.c (tui_selected_frame_level_changed_hook): Don't
	update the screen while synchronous execution is active.
	* tui/tui-interp.c (tui_on_sync_execution_done): Make sure that
	TUI's frame information is refreshed.
---
 gdb/tui/tui-hooks.c  | 8 ++++++++
 gdb/tui/tui-interp.c | 5 +++++
 2 files changed, 13 insertions(+)

diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 8d84551..ca8358d 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -133,6 +133,14 @@ tui_selected_frame_level_changed_hook (int level)
   if (level < 0)
     return;
 
+  /* Do not respond to frame changes occurring while synchronous execution is
+     enabled.  Updating the screen in response to each such frame change just
+     results in pointless flicker and slowdown.  Once synchronous execution is
+     done this hook will get called again to ensure that our frame information
+     is refreshed.  */
+  if (sync_execution)
+    return;
+
   old_chain = make_cleanup_restore_target_terminal ();
   target_terminal_ours_for_output ();
 
diff --git a/gdb/tui/tui-interp.c b/gdb/tui/tui-interp.c
index 1a5639d..2477536 100644
--- a/gdb/tui/tui-interp.c
+++ b/gdb/tui/tui-interp.c
@@ -107,6 +107,11 @@ tui_on_sync_execution_done (void)
 {
   if (!interp_quiet_p (tui_interp))
     display_gdb_prompt (NULL);
+
+  /* Make sure our frame information is refreshed now that synchronous
+     execution is done.  */
+  if (tui_active)
+    deprecated_selected_frame_level_changed_hook (0);
 }
 
 /* Observer for the command_error notification.  */
-- 
2.4.4.410.g43ed522.dirty

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-06-26 14:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-19  4:36 [PATCH] Fix TUI flicker resulting from frequent frame changes (PR tui/13378) Patrick Palka
2015-06-19 17:13 ` Patrick Palka
2015-06-26  3:16   ` Patrick Palka
2015-06-26 13:36 ` Pedro Alves
2015-06-26 14:10   ` Patrick Palka
2015-06-26 14:39     ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).