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  <tom@tromey.com>

	* tui/tui-winsource.h (struct tui_source_window_base)
	<update_source_window_as_is>: 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.
This commit is contained in:
Tom Tromey 2019-07-11 18:22:06 -06:00
parent 20149b6b20
commit ed8358e949
5 changed files with 35 additions and 24 deletions

View File

@ -1,3 +1,16 @@
2019-08-16 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (struct tui_source_window_base)
<update_source_window_as_is>: 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.
2019-08-16 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (tui_update_source_window)

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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. */

View File

@ -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);