Patchwork [08/19] Simplify tui_show_disassem

login
register
mail settings
Submitter Tom Tromey
Date Aug. 3, 2019, 1:29 p.m.
Message ID <20190803132925.25074-9-tom@tromey.com>
Download mbox | patch
Permalink /patch/33937/
State New
Headers show

Comments

Tom Tromey - Aug. 3, 2019, 1:29 p.m.
tui_show_disassem does not need to call tui_add_win_to_layout, because
the callers that could change the layout have already ensured that it
exists.

gdb/ChangeLog
2019-08-03  Tom Tromey  <tom@tromey.com>

	* tui/tui-disasm.c (tui_show_disassem): Add assertion.  Don't call
	tui_add_win_to_layout.
---
 gdb/ChangeLog        | 5 +++++
 gdb/tui/tui-disasm.c | 3 ++-
 2 files changed, 7 insertions(+), 1 deletion(-)

Patch

diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 80f8d47f0ac..a442a00019e 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -255,9 +255,10 @@  tui_show_disassem (struct gdbarch *gdbarch, CORE_ADDR start_addr)
   struct tui_win_info *win_with_focus = tui_win_with_focus ();
   struct tui_line_or_address val;
 
+  gdb_assert (TUI_DISASM_WIN != nullptr && TUI_DISASM_WIN->is_visible);
+
   val.loa = LOA_ADDRESS;
   val.u.addr = start_addr;
-  tui_add_win_to_layout (DISASSEM_WIN);
   tui_update_source_window (TUI_DISASM_WIN, gdbarch, s, val, FALSE);
 
   /* If the focus was in the src win, put it in the asm win, if the