From: Tom Tromey Date: Sun, 16 Jun 2019 17:08:43 +0000 (-0600) Subject: Create tui_disasm_window X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=5cf82909a7047cee471ee40cfe623250c258d76e;p=binutils-gdb.git Create tui_disasm_window This introduces the new tui_disasm_window class, which represents a disassembly window. It shares a lot of behavior with the source window, so a new tui_source_window_base class is also created. gdb/ChangeLog 2019-06-25 Tom Tromey * tui/tui-data.h (struct tui_source_window_base): New struct. (struct tui_source_window): Derive from tui_source_window_base. (struct tui_disasm_window): New struct. * tui/tui-data.c (tui_source_window_base::clear_detail): Rename from tui_source_window::clear_detail. (tui_source_window_base): Rename from tui_source_window. (~tui_source_window_base): Rename from ~tui_source_window. (tui_alloc_win_info): Create a tui_disasm_window. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 434d7dda79d..0525b03ddd9 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,14 @@ +2019-06-25 Tom Tromey + + * tui/tui-data.h (struct tui_source_window_base): New struct. + (struct tui_source_window): Derive from tui_source_window_base. + (struct tui_disasm_window): New struct. + * tui/tui-data.c (tui_source_window_base::clear_detail): Rename + from tui_source_window::clear_detail. + (tui_source_window_base): Rename from tui_source_window. + (~tui_source_window_base): Rename from ~tui_source_window. + (tui_alloc_win_info): Create a tui_disasm_window. + 2019-06-25 Tom Tromey * tui/tui-data.h (struct tui_source_window) diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c index d24941c10da..1edf40b71b3 100644 --- a/gdb/tui/tui-data.c +++ b/gdb/tui/tui-data.c @@ -176,7 +176,7 @@ tui_add_to_source_windows (struct tui_win_info *win_info) /* See tui-data.h. */ void -tui_source_window::clear_detail () +tui_source_window_base::clear_detail () { detail.source_info.gdbarch = NULL; detail.source_info.start_line_or_addr.loa = LOA_ADDRESS; @@ -503,7 +503,7 @@ tui_win_info::tui_win_info (enum tui_win_type type) tui_init_generic_part (&generic); } -tui_source_window::tui_source_window (enum tui_win_type type) +tui_source_window_base::tui_source_window_base (enum tui_win_type type) : tui_win_info (type) { gdb_assert (type == SRC_WIN || type == DISASSEM_WIN); @@ -539,8 +539,10 @@ tui_alloc_win_info (enum tui_win_type type) switch (type) { case SRC_WIN: + return new tui_source_window (); + case DISASSEM_WIN: - return new tui_source_window (type); + return new tui_disasm_window (); case DATA_WIN: return new tui_data_window (); @@ -617,7 +619,7 @@ tui_add_content_elements (struct tui_gen_win_info *win_info, return index_start; } -tui_source_window::~tui_source_window () +tui_source_window_base::~tui_source_window_base () { if (detail.source_info.fullname) { diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 7adeb5687c9..e09aad60b52 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -291,15 +291,45 @@ public: int is_highlighted = 0; }; -struct tui_source_window : public tui_win_info +/* The base class for all source-like windows, namely the source and + disassembly windows. */ + +struct tui_source_window_base : public tui_win_info { - explicit tui_source_window (enum tui_win_type type); - ~tui_source_window () override; - DISABLE_COPY_AND_ASSIGN (tui_source_window); +protected: + explicit tui_source_window_base (enum tui_win_type type); + ~tui_source_window_base () override; + DISABLE_COPY_AND_ASSIGN (tui_source_window_base); + +public: void clear_detail () override; }; +/* A TUI source window. */ + +struct tui_source_window : public tui_source_window_base +{ + tui_source_window () + : tui_source_window_base (SRC_WIN) + { + } + + DISABLE_COPY_AND_ASSIGN (tui_source_window); +}; + +/* A TUI disassembly window. */ + +struct tui_disasm_window : public tui_source_window_base +{ + tui_disasm_window () + : tui_source_window_base (DISASSEM_WIN) + { + } + + DISABLE_COPY_AND_ASSIGN (tui_disasm_window); +}; + struct tui_data_window : public tui_win_info { tui_data_window ();