From 855f89b3da22a2673b177b2ab99f49974c1ed0e7 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Tue, 12 Nov 2019 17:19:59 -0700 Subject: [PATCH] Remove tui_show_disassem tui_show_disassem is just a wrapper for the update_source_window method, and it only has a single caller. This removes the function and inlines the logic into that caller. gdb/ChangeLog 2019-12-20 Tom Tromey * tui/tui-winsource.c (tui_update_source_windows_with_addr): Call update_source_window directly. * tui/tui-disasm.h (tui_show_disassem): Don't declare. * tui/tui-disasm.c (tui_show_disassem): Remove. Change-Id: I7ae7a3309f64a4a949c07a80c46e1664c7f12913 --- gdb/ChangeLog | 7 +++++++ gdb/tui/tui-disasm.c | 14 -------------- gdb/tui/tui-disasm.h | 1 - gdb/tui/tui-winsource.c | 13 +++++++++---- 4 files changed, 16 insertions(+), 19 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0ef7b0c63b0..15e88940152 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2019-12-20 Tom Tromey + + * tui/tui-winsource.c (tui_update_source_windows_with_addr): Call + update_source_window directly. + * tui/tui-disasm.h (tui_show_disassem): Don't declare. + * tui/tui-disasm.c (tui_show_disassem): Remove. + 2019-12-20 Tom Tromey * tui/tui-winsource.c diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index 11c8b30d615..c49369aa925 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -255,20 +255,6 @@ tui_disasm_window::set_contents (struct gdbarch *arch, } -/* Function to display the disassembly window with disassembled code. */ -void -tui_show_disassem (struct gdbarch *gdbarch, CORE_ADDR start_addr) -{ - struct symtab *s = find_pc_line_symtab (start_addr); - 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_DISASM_WIN->update_source_window (gdbarch, s, val); -} - 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 28f87c67eed..f5cc3737576 100644 --- a/gdb/tui/tui-disasm.h +++ b/gdb/tui/tui-disasm.h @@ -66,7 +66,6 @@ struct tui_disasm_window : public tui_source_window_base bool addr_is_displayed (CORE_ADDR addr) const; }; -extern void tui_show_disassem (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 72fbd46c7ef..b1499368f83 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -213,15 +213,18 @@ tui_update_source_windows_with_addr (struct gdbarch *gdbarch, CORE_ADDR addr) { if (addr != 0) { - struct symtab_and_line sal; + struct symtab_and_line sal = find_pc_line (addr, 0); struct tui_line_or_address l; if (TUI_DISASM_WIN != nullptr) - tui_show_disassem (gdbarch, addr); + { + l.loa = LOA_ADDRESS; + l.u.addr = addr; + TUI_DISASM_WIN->update_source_window (gdbarch, sal.symtab, l); + } if (TUI_SRC_WIN != nullptr) { - 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); @@ -262,7 +265,9 @@ tui_update_source_windows_with_line (struct symtab *s, int line) if (tui_current_layout () == SRC_DISASSEM_COMMAND) { find_line_pc (s, line, &pc); - tui_show_disassem (gdbarch, pc); + l.loa = LOA_ADDRESS; + l.u.addr = pc; + TUI_DISASM_WIN->update_source_window (gdbarch, s, l); } break; }