Patchwork [review] Remove tui_show_disassem_and_update_source

login
register
mail settings
Submitter Simon Marchi (Code Review)
Date Nov. 14, 2019, 11:35 p.m.
Message ID <gerrit.1573774548000.I7554eca8e259f3539ea7710f2ff369b4a630dd9d@gnutoolchain-gerrit.osci.io>
Download mbox | patch
Permalink /patch/35906/
State New
Headers show

Comments

Simon Marchi (Code Review) - Nov. 14, 2019, 11:35 p.m.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/632
......................................................................

Remove tui_show_disassem_and_update_source

tui_show_disassem_and_update_source only has a single caller.  This
patch simplifies that caller, by having it call tui_show_disassem, and
then removes tui_show_disassem_and_update_source.

gdb/ChangeLog
2019-11-14  Tom Tromey  <tom@tromey.com>

	* tui/tui-winsource.c (tui_update_source_windows_with_addr): Call
	tui_show_disassem.
	* tui/tui-disasm.h (tui_show_disassem_and_update_source): Don't
	declare.
	* tui/tui-disasm.c (tui_show_disassem_and_update_source): Remove.

Change-Id: I7554eca8e259f3539ea7710f2ff369b4a630dd9d
---
M gdb/ChangeLog
M gdb/tui/tui-disasm.c
M gdb/tui/tui-disasm.h
M gdb/tui/tui-winsource.c
4 files changed, 12 insertions(+), 37 deletions(-)

Patch

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b2a7b24..2bd3534 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@ 
 2019-11-14  Tom Tromey  <tom@tromey.com>
 
+	* tui/tui-winsource.c (tui_update_source_windows_with_addr): Call
+	tui_show_disassem.
+	* tui/tui-disasm.h (tui_show_disassem_and_update_source): Don't
+	declare.
+	* tui/tui-disasm.c (tui_show_disassem_and_update_source): Remove.
+
+2019-11-14  Tom Tromey  <tom@tromey.com>
+
 	* tui/tui.h (tui_show_source): Remove parameters.
 	* tui/tui.c (tui_show_source): Remove parameters.
 	* tui/tui-out.c (tui_ui_out::do_field_string): Update.
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 74f2ca5..4d5e382 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -276,32 +276,6 @@ 
     tui_set_win_focus_to (TUI_DISASM_WIN);
 }
 
-
-/* Function to display the disassembly window.  */
-void
-tui_show_disassem_and_update_source (struct gdbarch *gdbarch,
-				     CORE_ADDR start_addr)
-{
-  struct symtab_and_line sal;
-
-  tui_show_disassem (gdbarch, start_addr);
-  if (tui_current_layout () == SRC_DISASSEM_COMMAND)
-    {
-      struct tui_line_or_address val;
-
-      /* Update what is in the source window if it is displayed too,
-         note that it follows what is in the disassembly window and
-         visa-versa.  */
-      sal = find_pc_line (start_addr, 0);
-      val.loa = LOA_LINE;
-      val.u.line_no = sal.line;
-      TUI_SRC_WIN->update_source_window (gdbarch, sal.symtab, val);
-      if (sal.symtab)
-	set_current_source_symtab_and_line (sal);
-      tui_update_locator_fullname (sal.symtab);
-    }
-}
-
 void
 tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
 {
diff --git a/gdb/tui/tui-disasm.h b/gdb/tui/tui-disasm.h
index bfddfa0..a4b04e4 100644
--- a/gdb/tui/tui-disasm.h
+++ b/gdb/tui/tui-disasm.h
@@ -69,7 +69,6 @@ 
 };
 
 extern void tui_show_disassem (struct gdbarch *, CORE_ADDR);
-extern void tui_show_disassem_and_update_source (struct gdbarch *, CORE_ADDR);
 extern void tui_get_begin_asm_address (struct gdbarch **, CORE_ADDR *);
 
 #endif /* TUI_TUI_DISASM_H */
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 6c9f62f..2cd4b65 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -214,21 +214,15 @@ 
       struct symtab_and_line sal;
       struct tui_line_or_address l;
       
-      switch (tui_current_layout ())
+      if (TUI_DISASM_WIN != nullptr)
+	tui_show_disassem (gdbarch, addr);
+
+      if (TUI_SRC_WIN != nullptr)
 	{
-	case DISASSEM_COMMAND:
-	case DISASSEM_DATA_COMMAND:
-	  tui_show_disassem (gdbarch, addr);
-	  break;
-	case SRC_DISASSEM_COMMAND:
-	  tui_show_disassem_and_update_source (gdbarch, addr);
-	  break;
-	default:
 	  sal = find_pc_line (addr, 0);
 	  l.loa = LOA_LINE;
 	  l.u.line_no = sal.line;
 	  TUI_SRC_WIN->show_symtab_source (gdbarch, sal.symtab, l);
-	  break;
 	}
     }
   else