From ed8358e9491d5ae0a8ee021c162a85867af1146a Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 11 Jul 2019 18:22:06 -0600 Subject: Change tui_update_source_window_as_is to be a method This changes tui_update_source_window_as_is to be a method on tui_source_window_base. gdb/ChangeLog 2019-08-16 Tom Tromey * tui/tui-winsource.h (struct tui_source_window_base) : Declare. (tui_update_source_window_as_is): Don't declare. * tui/tui-winsource.c (tui_update_source_window): Update (tui_source_window_base::update_source_window_as_is): Rename from tui_update_source_window_as_is. (tui_source_window_base::refill): Update. * tui/tui-source.c (tui_show_symtab_source): Update. * tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Update. --- gdb/tui/tui-disasm.c | 3 +-- gdb/tui/tui-source.c | 2 +- gdb/tui/tui-winsource.c | 34 ++++++++++++++++------------------ gdb/tui/tui-winsource.h | 7 ++++--- 4 files changed, 22 insertions(+), 24 deletions(-) (limited to 'gdb/tui') diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c index 621832f..d47639c 100644 --- a/gdb/tui/tui-disasm.c +++ b/gdb/tui/tui-disasm.c @@ -367,8 +367,7 @@ tui_disasm_window::do_scroll_vertical (int num_to_scroll) val.loa = LOA_ADDRESS; val.u.addr = tui_find_disassembly_address (gdbarch, pc, num_to_scroll); - tui_update_source_window_as_is (this, gdbarch, - NULL, val); + update_source_window_as_is (gdbarch, NULL, val); } } diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index db83fb0..e62d999 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -205,7 +205,7 @@ tui_show_symtab_source (tui_source_window_base *win_info, struct tui_line_or_address line) { win_info->horizontal_offset = 0; - tui_update_source_window_as_is (win_info, gdbarch, s, line); + win_info->update_source_window_as_is (gdbarch, s, line); } diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c index 94ab8c0..2c747eb 100644 --- a/gdb/tui/tui-winsource.c +++ b/gdb/tui/tui-winsource.c @@ -76,38 +76,37 @@ tui_update_source_window (struct tui_source_window_base *win_info, struct tui_line_or_address line_or_addr) { win_info->horizontal_offset = 0; - tui_update_source_window_as_is (win_info, gdbarch, s, line_or_addr); + win_info->update_source_window_as_is (gdbarch, s, line_or_addr); } /* Function to display source in the source/asm window. This function shows the source as specified by the horizontal offset. */ void -tui_update_source_window_as_is (struct tui_source_window_base *win_info, - struct gdbarch *gdbarch, - struct symtab *s, - struct tui_line_or_address line_or_addr) +tui_source_window_base::update_source_window_as_is + (struct gdbarch *gdbarch, + struct symtab *s, + struct tui_line_or_address line_or_addr) { enum tui_status ret; - if (win_info->type == SRC_WIN) - ret = tui_set_source_content (win_info, s, line_or_addr.u.line_no); + if (type == SRC_WIN) + ret = tui_set_source_content (this, s, line_or_addr.u.line_no); else - ret = tui_set_disassem_content (win_info, gdbarch, line_or_addr.u.addr); + ret = tui_set_disassem_content (this, gdbarch, line_or_addr.u.addr); if (ret == TUI_FAILURE) - win_info->erase_source_content (); + erase_source_content (); else { - tui_update_breakpoint_info (win_info, nullptr, false); - win_info->show_source_content (); - win_info->update_exec_info (); - if (win_info->type == SRC_WIN) + tui_update_breakpoint_info (this, nullptr, false); + show_source_content (); + update_exec_info (); + if (type == SRC_WIN) { symtab_and_line sal; - sal.line = line_or_addr.u.line_no + - (win_info->content.size () - 2); + sal.line = line_or_addr.u.line_no + (content.size () - 2); sal.symtab = s; sal.pspace = SYMTAB_PSPACE (s); set_current_source_symtab_and_line (sal); @@ -115,7 +114,7 @@ tui_update_source_window_as_is (struct tui_source_window_base *win_info, we don't have a split layout. */ if (tui_win_with_focus () == TUI_DISASM_WIN && tui_current_layout () != SRC_DISASSEM_COMMAND) - tui_set_win_focus_to (win_info); + tui_set_win_focus_to (this); } } } @@ -387,8 +386,7 @@ tui_source_window_base::refill () : cursal.symtab); } - tui_update_source_window_as_is (this, gdbarch, s, - content[0].line_or_addr); + update_source_window_as_is (gdbarch, s, content[0].line_or_addr); } /* Scroll the source forward or backward horizontally. */ diff --git a/gdb/tui/tui-winsource.h b/gdb/tui/tui-winsource.h index dfd4a00..ebc50e7 100644 --- a/gdb/tui/tui-winsource.h +++ b/gdb/tui/tui-winsource.h @@ -135,6 +135,10 @@ public: virtual void maybe_update (struct frame_info *fi, symtab_and_line sal, int line_no, CORE_ADDR addr) = 0; + void update_source_window_as_is (struct gdbarch *gdbarch, + struct symtab *s, + struct tui_line_or_address line_or_addr); + /* Erase the source content. */ virtual void erase_source_content () = 0; @@ -246,9 +250,6 @@ extern void tui_display_main (void); extern void tui_update_source_window (struct tui_source_window_base *, struct gdbarch *, struct symtab *, struct tui_line_or_address); -extern void tui_update_source_window_as_is (struct tui_source_window_base *, - struct gdbarch *, struct symtab *, - struct tui_line_or_address); extern void tui_update_source_windows_with_addr (struct gdbarch *, CORE_ADDR); extern void tui_update_source_windows_with_line (struct symtab *, int); -- cgit v1.1