fdb01f0ce4
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
145 lines
4.1 KiB
C++
145 lines
4.1 KiB
C++
/* TUI display registers in window.
|
|
|
|
Copyright (C) 1998-2020 Free Software Foundation, Inc.
|
|
|
|
Contributed by Hewlett-Packard Company.
|
|
|
|
This file is part of GDB.
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
|
|
|
#ifndef TUI_TUI_REGS_H
|
|
#define TUI_TUI_REGS_H
|
|
|
|
#include "tui/tui-data.h"
|
|
|
|
/* A data item window. */
|
|
|
|
struct tui_data_item_window : public tui_gen_win_info
|
|
{
|
|
tui_data_item_window () = default;
|
|
|
|
DISABLE_COPY_AND_ASSIGN (tui_data_item_window);
|
|
|
|
tui_data_item_window (tui_data_item_window &&) = default;
|
|
|
|
void rerender () override;
|
|
|
|
void refresh_window () override;
|
|
|
|
int max_height () const override
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
int min_height () const override
|
|
{
|
|
return 1;
|
|
}
|
|
|
|
const char *name = nullptr;
|
|
/* The register number, or data display number. */
|
|
int item_no = -1;
|
|
bool highlight = false;
|
|
gdb::unique_xmalloc_ptr<char> content;
|
|
};
|
|
|
|
/* The TUI registers window. */
|
|
struct tui_data_window : public tui_win_info
|
|
{
|
|
tui_data_window () = default;
|
|
|
|
DISABLE_COPY_AND_ASSIGN (tui_data_window);
|
|
|
|
void refresh_window () override;
|
|
|
|
void no_refresh () override;
|
|
|
|
const char *name () const override
|
|
{
|
|
return DATA_NAME;
|
|
}
|
|
|
|
void check_register_values (struct frame_info *frame);
|
|
|
|
void show_registers (struct reggroup *group);
|
|
|
|
struct reggroup *get_current_group () const
|
|
{
|
|
return m_current_group;
|
|
}
|
|
|
|
protected:
|
|
|
|
void do_scroll_vertical (int num_to_scroll) override;
|
|
void do_scroll_horizontal (int num_to_scroll) override
|
|
{
|
|
}
|
|
|
|
void rerender () override;
|
|
|
|
private:
|
|
|
|
/* Display the registers in the content from 'start_element_no'
|
|
until the end of the register content or the end of the display
|
|
height. No checking for displaying past the end of the registers
|
|
is done here. */
|
|
void display_registers_from (int start_element_no);
|
|
|
|
/* Display the registers starting at line line_no in the data
|
|
window. Answers the line number that the display actually
|
|
started from. If nothing is displayed (-1) is returned. */
|
|
int display_registers_from_line (int line_no);
|
|
|
|
/* Return the index of the first element displayed. If none are
|
|
displayed, then return -1. */
|
|
int first_data_item_displayed ();
|
|
|
|
/* Display the registers in the content from 'start_element_no' on
|
|
'start_line_no' until the end of the register content or the end
|
|
of the display height. This function checks that we won't
|
|
display off the end of the register display. */
|
|
void display_reg_element_at_line (int start_element_no, int start_line_no);
|
|
|
|
void show_register_group (struct reggroup *group,
|
|
struct frame_info *frame,
|
|
bool refresh_values_only);
|
|
|
|
/* Answer the number of the last line in the regs display. If there
|
|
are no registers (-1) is returned. */
|
|
int last_regs_line_no () const;
|
|
|
|
/* Answer the line number that the register element at element_no is
|
|
on. If element_no is greater than the number of register
|
|
elements there are, -1 is returned. */
|
|
int line_from_reg_element_no (int element_no) const;
|
|
|
|
/* Answer the index of the first element in line_no. If line_no is
|
|
past the register area (-1) is returned. */
|
|
int first_reg_element_no_inline (int line_no) const;
|
|
|
|
/* Delete all the item windows in the data window. This is usually
|
|
done when the data window is scrolled. */
|
|
void delete_data_content_windows ();
|
|
|
|
void erase_data_content (const char *prompt);
|
|
|
|
/* Windows that are used to display registers. */
|
|
std::vector<tui_data_item_window> m_regs_content;
|
|
int m_regs_column_count = 0;
|
|
struct reggroup *m_current_group = nullptr;
|
|
};
|
|
|
|
#endif /* TUI_TUI_REGS_H */
|