mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-27 12:03:41 +08:00
TUI windows do not need to store their type
TUI windows no longer need to store their type -- there's only a single spot that uses this information, and it can be changed to use dynamic_cast. (It could be cleaned up even more, by using a virtual method, but I haven't done so.) This patch removes the "type" field from tui_gen_win_info, and this in turn allows removing a couple of enumerator constants. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui.h (enum tui_win_type) <LOCATOR_WIN, DATA_ITEM_WIN>: Remove constants. * tui/tui-winsource.h (struct tui_source_window_base) <tui_source_window_base>: Remove parameter. * tui/tui-winsource.c (tui_source_window_base::tui_source_window_base): Remove parameter. (tui_source_window_base::refill): Update. * tui/tui-stack.h (struct tui_locator_window) <tui_locator_window>: Update. * tui/tui-source.h (struct tui_source_window) <tui_source_window>: Default the constructor. * tui/tui-regs.h (struct tui_data_item_window) <tui_data_item_window>: Default the constructor. (struct tui_data_window) <tui_data_window>: Likewise. * tui/tui-disasm.h (struct tui_disasm_window) <tui_disasm_window>: Default the constructor. * tui/tui-data.h (struct tui_gen_win_info) <tui_gen_win_info>: Default the constructor. <type>: Remove. (struct tui_win_info) <tui_win_info>: Default the constructor. * tui/tui-data.c (tui_win_info::tui_win_info): Remove. * tui/tui-command.h (struct tui_cmd_window) <tui_cmd_window>: Default the constructor. Change-Id: I594cd07d2e0bba71ad594a6fb263904ce2febcd6
This commit is contained in:
parent
865a5aec04
commit
fdb01f0ce4
@ -1,3 +1,30 @@
|
||||
2020-02-22 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* tui/tui.h (enum tui_win_type) <LOCATOR_WIN, DATA_ITEM_WIN>:
|
||||
Remove constants.
|
||||
* tui/tui-winsource.h (struct tui_source_window_base)
|
||||
<tui_source_window_base>: Remove parameter.
|
||||
* tui/tui-winsource.c
|
||||
(tui_source_window_base::tui_source_window_base): Remove
|
||||
parameter.
|
||||
(tui_source_window_base::refill): Update.
|
||||
* tui/tui-stack.h (struct tui_locator_window)
|
||||
<tui_locator_window>: Update.
|
||||
* tui/tui-source.h (struct tui_source_window) <tui_source_window>:
|
||||
Default the constructor.
|
||||
* tui/tui-regs.h (struct tui_data_item_window)
|
||||
<tui_data_item_window>: Default the constructor.
|
||||
(struct tui_data_window) <tui_data_window>: Likewise.
|
||||
* tui/tui-disasm.h (struct tui_disasm_window) <tui_disasm_window>:
|
||||
Default the constructor.
|
||||
* tui/tui-data.h (struct tui_gen_win_info) <tui_gen_win_info>:
|
||||
Default the constructor.
|
||||
<type>: Remove.
|
||||
(struct tui_win_info) <tui_win_info>: Default the constructor.
|
||||
* tui/tui-data.c (tui_win_info::tui_win_info): Remove.
|
||||
* tui/tui-command.h (struct tui_cmd_window) <tui_cmd_window>:
|
||||
Default the constructor.
|
||||
|
||||
2020-02-22 Tom Tromey <tom@tromey.com>
|
||||
|
||||
* tui/tui-wingeneral.h (tui_make_all_invisible): Don't declare.
|
||||
|
@ -27,10 +27,7 @@
|
||||
/* The TUI command window. */
|
||||
struct tui_cmd_window : public tui_win_info
|
||||
{
|
||||
tui_cmd_window ()
|
||||
: tui_win_info (CMD_WIN)
|
||||
{
|
||||
}
|
||||
tui_cmd_window () = default;
|
||||
|
||||
DISABLE_COPY_AND_ASSIGN (tui_cmd_window);
|
||||
|
||||
|
@ -129,11 +129,6 @@ tui_prev_win (struct tui_win_info *cur_win)
|
||||
}
|
||||
|
||||
|
||||
tui_win_info::tui_win_info (enum tui_win_type type)
|
||||
: tui_gen_win_info (type)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
tui_win_info::rerender ()
|
||||
{
|
||||
|
@ -22,7 +22,7 @@
|
||||
#ifndef TUI_TUI_DATA_H
|
||||
#define TUI_TUI_DATA_H
|
||||
|
||||
#include "tui/tui.h" /* For enum tui_win_type. */
|
||||
#include "tui/tui.h"
|
||||
#include "gdb_curses.h" /* For WINDOW. */
|
||||
#include "observable.h"
|
||||
|
||||
@ -44,10 +44,7 @@ struct tui_gen_win_info
|
||||
{
|
||||
protected:
|
||||
|
||||
explicit tui_gen_win_info (enum tui_win_type t)
|
||||
: type (t)
|
||||
{
|
||||
}
|
||||
tui_gen_win_info () = default;
|
||||
|
||||
/* This is called after the window is resized, and should update the
|
||||
window's contents. */
|
||||
@ -117,8 +114,6 @@ public:
|
||||
|
||||
/* Window handle. */
|
||||
std::unique_ptr<WINDOW, curses_deleter> handle;
|
||||
/* Type of window. */
|
||||
enum tui_win_type type;
|
||||
/* Window width. */
|
||||
int width = 0;
|
||||
/* Window height. */
|
||||
@ -162,7 +157,7 @@ struct tui_win_info : public tui_gen_win_info
|
||||
{
|
||||
protected:
|
||||
|
||||
explicit tui_win_info (enum tui_win_type type);
|
||||
tui_win_info () = default;
|
||||
DISABLE_COPY_AND_ASSIGN (tui_win_info);
|
||||
|
||||
/* Scroll the contents vertically. This is only called via
|
||||
|
@ -30,10 +30,7 @@
|
||||
|
||||
struct tui_disasm_window : public tui_source_window_base
|
||||
{
|
||||
tui_disasm_window ()
|
||||
: tui_source_window_base (DISASSEM_WIN)
|
||||
{
|
||||
}
|
||||
tui_disasm_window () = default;
|
||||
|
||||
DISABLE_COPY_AND_ASSIGN (tui_disasm_window);
|
||||
|
||||
|
@ -28,10 +28,7 @@
|
||||
|
||||
struct tui_data_item_window : public tui_gen_win_info
|
||||
{
|
||||
tui_data_item_window ()
|
||||
: tui_gen_win_info (DATA_ITEM_WIN)
|
||||
{
|
||||
}
|
||||
tui_data_item_window () = default;
|
||||
|
||||
DISABLE_COPY_AND_ASSIGN (tui_data_item_window);
|
||||
|
||||
@ -61,10 +58,7 @@ struct tui_data_item_window : public tui_gen_win_info
|
||||
/* The TUI registers window. */
|
||||
struct tui_data_window : public tui_win_info
|
||||
{
|
||||
tui_data_window ()
|
||||
: tui_win_info (DATA_WIN)
|
||||
{
|
||||
}
|
||||
tui_data_window () = default;
|
||||
|
||||
DISABLE_COPY_AND_ASSIGN (tui_data_window);
|
||||
|
||||
|
@ -31,10 +31,7 @@ struct symtab;
|
||||
|
||||
struct tui_source_window : public tui_source_window_base
|
||||
{
|
||||
tui_source_window ()
|
||||
: tui_source_window_base (SRC_WIN)
|
||||
{
|
||||
}
|
||||
tui_source_window () = default;
|
||||
|
||||
DISABLE_COPY_AND_ASSIGN (tui_source_window);
|
||||
|
||||
|
@ -31,7 +31,6 @@ struct frame_info;
|
||||
struct tui_locator_window : public tui_gen_win_info
|
||||
{
|
||||
tui_locator_window ()
|
||||
: tui_gen_win_info (LOCATOR_WIN)
|
||||
{
|
||||
full_name[0] = 0;
|
||||
proc_name[0] = 0;
|
||||
|
@ -286,10 +286,8 @@ tui_source_window_base::show_source_content ()
|
||||
refresh_window ();
|
||||
}
|
||||
|
||||
tui_source_window_base::tui_source_window_base (enum tui_win_type type)
|
||||
: tui_win_info (type)
|
||||
tui_source_window_base::tui_source_window_base ()
|
||||
{
|
||||
gdb_assert (type == SRC_WIN || type == DISASSEM_WIN);
|
||||
start_line_or_addr.loa = LOA_ADDRESS;
|
||||
start_line_or_addr.u.addr = 0;
|
||||
|
||||
@ -334,7 +332,7 @@ tui_source_window_base::rerender ()
|
||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||
|
||||
struct symtab *s = find_pc_line_symtab (get_frame_pc (frame));
|
||||
if (type != SRC_WIN)
|
||||
if (this != TUI_SRC_WIN)
|
||||
find_line_pc (s, cursal.line, &cursal.pc);
|
||||
update_source_window (gdbarch, cursal);
|
||||
}
|
||||
@ -349,7 +347,7 @@ tui_source_window_base::refill ()
|
||||
{
|
||||
symtab_and_line sal {};
|
||||
|
||||
if (type == SRC_WIN)
|
||||
if (this == TUI_SRC_WIN)
|
||||
{
|
||||
sal = get_current_source_symtab_and_line ();
|
||||
if (sal.symtab == NULL)
|
||||
|
@ -75,7 +75,7 @@ struct tui_source_element
|
||||
struct tui_source_window_base : public tui_win_info
|
||||
{
|
||||
protected:
|
||||
explicit tui_source_window_base (enum tui_win_type type);
|
||||
tui_source_window_base ();
|
||||
~tui_source_window_base ();
|
||||
|
||||
DISABLE_COPY_AND_ASSIGN (tui_source_window_base);
|
||||
|
@ -40,9 +40,6 @@ enum tui_win_type
|
||||
CMD_WIN,
|
||||
/* This must ALWAYS be AFTER the major windows last. */
|
||||
MAX_MAJOR_WINDOWS,
|
||||
/* Auxiliary windows. */
|
||||
LOCATOR_WIN,
|
||||
DATA_ITEM_WIN
|
||||
};
|
||||
|
||||
extern CORE_ADDR tui_get_low_disassembly_address (struct gdbarch *,
|
||||
|
Loading…
Reference in New Issue
Block a user