Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Make TUI borders respect "set style enabled"
@ 2020-01-04 21:37 Tom Tromey
  2020-01-04 21:45 ` Christian Biesinger via gdb-patches
  2020-01-12  0:03 ` Tom Tromey
  0 siblings, 2 replies; 4+ messages in thread
From: Tom Tromey @ 2020-01-04 21:37 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

When adding support for styling the TUI borders, I neglected to have
this code check cli_styling.  As a result, "set style enabled off"
does not affect the borders.

This patch fixes this oversight.  While doing this, I found that
running gdb without an executable, enabling the TUI, and then trying
"set style enabled off" would fail with the mysterious "No registers".
The fix for this is to use deprecated_safe_get_selected_frame in
tui_source_window_base::refill.

gdb/ChangeLog
2020-01-04  Tom Tromey  <tom@tromey.com>

	* tui/tui-wingeneral.c (box_win): Check cli_styling.
	* tui/tui-winsource.c (tui_source_window_base::refill): Use
	deprecated_safe_get_selected_frame.

Change-Id: I36acda25dd9014d994d366b4a0e8faee9d95d0f8
---
 gdb/ChangeLog            | 6 ++++++
 gdb/tui/tui-wingeneral.c | 7 ++++---
 gdb/tui/tui-winsource.c  | 6 +++++-
 3 files changed, 15 insertions(+), 4 deletions(-)

diff --git a/gdb/tui/tui-wingeneral.c b/gdb/tui/tui-wingeneral.c
index dae4255ada2..0a9fc5238d6 100644
--- a/gdb/tui/tui-wingeneral.c
+++ b/gdb/tui/tui-wingeneral.c
@@ -55,9 +55,10 @@ box_win (struct tui_win_info *win_info,
 
   /* tui_apply_style resets the style entirely, so be sure to call it
      before applying ATTRS.  */
-  tui_apply_style (win, (highlight_flag
-			 ? tui_active_border_style.style ()
-			 : tui_border_style.style ()));
+  if (cli_styling)
+    tui_apply_style (win, (highlight_flag
+			   ? tui_active_border_style.style ()
+			   : tui_border_style.style ()));
   wattron (win, attrs);
 #ifdef HAVE_WBORDER
   wborder (win, tui_border_vline, tui_border_vline,
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 69070115ec6..fbee2e3e181 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -352,7 +352,11 @@ tui_source_window_base::refill ()
     {
       sal = get_current_source_symtab_and_line ();
       if (sal.symtab == NULL)
-	sal = find_pc_line (get_frame_pc (get_selected_frame (NULL)), 0);
+	{
+	  struct frame_info *fi = deprecated_safe_get_selected_frame ();
+	  if (fi != nullptr)
+	    sal = find_pc_line (get_frame_pc (fi), 0);
+	}
     }
 
   if (sal.pspace == nullptr)
-- 
2.17.2


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

* Re: [PATCH] Make TUI borders respect "set style enabled"
  2020-01-04 21:37 [PATCH] Make TUI borders respect "set style enabled" Tom Tromey
@ 2020-01-04 21:45 ` Christian Biesinger via gdb-patches
  2020-01-06 14:55   ` Tom Tromey
  2020-01-12  0:03 ` Tom Tromey
  1 sibling, 1 reply; 4+ messages in thread
From: Christian Biesinger via gdb-patches @ 2020-01-04 21:45 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Sat, Jan 4, 2020 at 4:37 PM Tom Tromey <tom@tromey.com> wrote:
>
> When adding support for styling the TUI borders, I neglected to have
> this code check cli_styling.  As a result, "set style enabled off"
> does not affect the borders.
>
> This patch fixes this oversight.  While doing this, I found that
> running gdb without an executable, enabling the TUI, and then trying
> "set style enabled off" would fail with the mysterious "No registers".
> The fix for this is to use deprecated_safe_get_selected_frame in
> tui_source_window_base::refill.

So I don't know this code, but if you have to add a call to that
function maybe it shouldn't be deprecated?

Christian


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

* Re: [PATCH] Make TUI borders respect "set style enabled"
  2020-01-04 21:45 ` Christian Biesinger via gdb-patches
@ 2020-01-06 14:55   ` Tom Tromey
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2020-01-06 14:55 UTC (permalink / raw)
  To: Christian Biesinger; +Cc: Tom Tromey, gdb-patches

>>>>> "Christian" == Christian Biesinger <cbiesinger@google.com> writes:

Christian> So I don't know this code, but if you have to add a call to that
Christian> function maybe it shouldn't be deprecated?

I tend to think we should just un-deprecate this particular call.
It's useful to be able to see if there's a frame without having to
handle an exception.

Tom


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

* Re: [PATCH] Make TUI borders respect "set style enabled"
  2020-01-04 21:37 [PATCH] Make TUI borders respect "set style enabled" Tom Tromey
  2020-01-04 21:45 ` Christian Biesinger via gdb-patches
@ 2020-01-12  0:03 ` Tom Tromey
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Tromey @ 2020-01-12  0:03 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

Tom> gdb/ChangeLog
Tom> 2020-01-04  Tom Tromey  <tom@tromey.com>

Tom> 	* tui/tui-wingeneral.c (box_win): Check cli_styling.
Tom> 	* tui/tui-winsource.c (tui_source_window_base::refill): Use
Tom> 	deprecated_safe_get_selected_frame.

I'm checking this in now.

Tom


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

end of thread, other threads:[~2020-01-11 19:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-04 21:37 [PATCH] Make TUI borders respect "set style enabled" Tom Tromey
2020-01-04 21:45 ` Christian Biesinger via gdb-patches
2020-01-06 14:55   ` Tom Tromey
2020-01-12  0:03 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox