+2019-06-25 Tom Tromey <tom@tromey.com>
+
+ * tui/tui-wingeneral.c (tui_refresh_all): Update.
+ * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights)
+ (tui_source_window_base::set_new_height): Update.
+ * tui/tui-stack.c (tui_make_status_line): Change parameter type.
+ Update.
+ (tui_set_locator_fullname, tui_set_locator_info)
+ (tui_show_frame_info): Update.
+ * tui/tui-source.c (tui_set_source_content)
+ (tui_source_is_displayed): Update.
+ * tui/tui-layout.c (show_source_disasm_command, show_data)
+ (show_source_or_disasm_and_command): Update.
+ * tui/tui-disasm.c (tui_set_disassem_content)
+ (tui_get_begin_asm_address): Update.
+ * tui/tui-data.h (struct tui_locator_element): Remove.
+ (union tui_which_element) <locator>: Remove.
+ (struct tui_locator_window): New.
+ (tui_locator_win_info_ptr): Change return type.
+ * tui/tui-data.c (_locator): Change type.
+ (tui_locator_win_info_ptr): Change return type.
+ (init_content_element): Remove LOCATOR_WIN case. Add assert.
+ (tui_alloc_content): Add assert.
+
2019-06-25 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c
****************************/
static enum tui_layout_type current_layout = UNDEFINED_LAYOUT;
static int term_height, term_width;
-static struct tui_gen_win_info _locator (LOCATOR_WIN);
+static struct tui_locator_window _locator;
static std::vector<tui_source_window_base *> source_windows;
static struct tui_win_info *win_with_focus = NULL;
static struct tui_layout_def layout_def = {
/* Accessor for the locator win info. Answers a pointer to the static
locator win info struct. */
-struct tui_gen_win_info *
+struct tui_locator_window *
tui_locator_win_info_ptr (void)
{
return &_locator;
enum tui_win_type type)
{
gdb_assert (type != EXEC_INFO_WIN);
+ gdb_assert (type != LOCATOR_WIN);
switch (type)
{
element->which_element.data.highlight = FALSE;
element->which_element.data.content = NULL;
break;
- case LOCATOR_WIN:
- element->which_element.locator.full_name[0] =
- element->which_element.locator.proc_name[0] = (char) 0;
- element->which_element.locator.line_no = 0;
- element->which_element.locator.addr = 0;
- break;
default:
break;
}
int i;
gdb_assert (type != EXEC_INFO_WIN);
+ gdb_assert (type != LOCATOR_WIN);
content = XNEWVEC (struct tui_win_element *, num_elements);
# define MAX_LOCATOR_ELEMENT_LEN 1024
#endif
-/* Elements in the locator window content. */
-struct tui_locator_element
-{
- /* Resolved absolute filename as returned by symtab_to_fullname. */
- char full_name[MAX_LOCATOR_ELEMENT_LEN];
- char proc_name[MAX_LOCATOR_ELEMENT_LEN];
- int line_no;
- CORE_ADDR addr;
- /* Architecture associated with code at this location. */
- struct gdbarch *gdbarch;
-};
-
/* Flags to tell what kind of breakpoint is at current line. */
#define TUI_BP_ENABLED 0x01
#define TUI_BP_DISABLED 0x02
struct tui_gen_win_info *data_window; /* Data display elements. */
struct tui_data_element data; /* Elements of data_window. */
struct tui_command_element command; /* Command elements. */
- struct tui_locator_element locator; /* Locator elements. */
};
struct tui_win_element
tui_exec_info_content *m_content = nullptr;
};
+/* Locator window class. */
+
+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;
+ }
+
+ char full_name[MAX_LOCATOR_ELEMENT_LEN];
+ char proc_name[MAX_LOCATOR_ELEMENT_LEN];
+ int line_no = 0;
+ CORE_ADDR addr = 0;
+ /* Architecture associated with code at this location. */
+ struct gdbarch *gdbarch = nullptr;
+};
+
/* This defines information about each logical window. */
struct tui_win_info : public tui_gen_win_info
{
extern void tui_set_term_height_to (int);
extern int tui_term_width (void);
extern void tui_set_term_width_to (int);
-extern struct tui_gen_win_info *tui_locator_win_info_ptr (void);
+extern struct tui_locator_window *tui_locator_win_info_ptr (void);
extern std::vector<tui_source_window_base *> &tui_source_windows ();
extern void tui_clear_source_windows (void);
extern void tui_clear_source_windows_detail (void);
int offset = TUI_DISASM_WIN->horizontal_offset;
int max_lines, line_width;
CORE_ADDR cur_pc;
- struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
+ struct tui_locator_window *locator = tui_locator_win_info_ptr ();
int tab_len = tui_tab_width;
struct tui_asm_line *asm_lines;
int insn_pos;
base->gdbarch = gdbarch;
base->start_line_or_addr.loa = LOA_ADDRESS;
base->start_line_or_addr.u.addr = pc;
- cur_pc = locator->content[0]->which_element.locator.addr;
+ cur_pc = locator->addr;
/* Window size, excluding highlight box. */
max_lines = TUI_DISASM_WIN->height - 2;
void
tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
{
- struct tui_gen_win_info *locator;
- struct tui_locator_element *element;
+ struct tui_locator_window *locator;
struct gdbarch *gdbarch = get_current_arch ();
CORE_ADDR addr;
locator = tui_locator_win_info_ptr ();
- element = &locator->content[0]->which_element.locator;
- if (element->addr == 0)
+ if (locator->addr == 0)
{
struct bound_minimal_symbol main_symbol;
}
else /* The target is executing. */
{
- gdbarch = element->gdbarch;
- addr = element->addr;
+ gdbarch = locator->gdbarch;
+ addr = locator->addr;
}
*gdbarch_p = gdbarch;
TUI_SRC_WIN->m_has_locator = false;
}
- struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
+ struct tui_locator_window *locator = tui_locator_win_info_ptr ();
+ gdb_assert (locator != nullptr);
tui_show_source_content (TUI_SRC_WIN);
if (TUI_DISASM_WIN == NULL)
{
tui_win_list[DISASSEM_WIN]
= make_disasm_window (asm_height, src_height - 1);
- locator
- = init_and_make_win (locator,
- LOCATOR_WIN,
- 2 /* 1 */ ,
- tui_term_width (),
- 0,
- (src_height + asm_height) - 1,
- DONT_BOX_WINDOW);
+ init_and_make_win (locator,
+ LOCATOR_WIN,
+ 2 /* 1 */ ,
+ tui_term_width (),
+ 0,
+ (src_height + asm_height) - 1,
+ DONT_BOX_WINDOW);
}
else
{
int total_height = (tui_term_height () - TUI_CMD_WIN->height);
int src_height, data_height;
enum tui_win_type win_type;
- struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
+ struct tui_locator_window *locator = tui_locator_win_info_ptr ();
+ gdb_assert (locator != nullptr);
data_height = total_height / 2;
src_height = total_height - data_height;
else
tui_win_list[win_type]
= make_disasm_window (src_height, data_height - 1);
- locator
- = init_and_make_win (locator,
+ init_and_make_win (locator,
LOCATOR_WIN,
2 /* 1 */ ,
tui_term_width (),
{
struct tui_win_info **win_info_ptr;
int src_height, cmd_height;
- struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
+ struct tui_locator_window *locator = tui_locator_win_info_ptr ();
+ gdb_assert (locator != nullptr);
if (TUI_CMD_WIN != NULL)
cmd_height = TUI_CMD_WIN->height;
*win_info_ptr = make_source_window (src_height - 1, 0);
else
*win_info_ptr = make_disasm_window (src_height - 1, 0);
- locator
- = init_and_make_win (locator,
- LOCATOR_WIN,
- 2 /* 1 */ ,
- tui_term_width (),
- 0,
- src_height - 1,
- DONT_BOX_WINDOW);
+ init_and_make_win (locator,
+ LOCATOR_WIN,
+ 2 /* 1 */ ,
+ tui_term_width (),
+ 0,
+ src_height - 1,
+ DONT_BOX_WINDOW);
base = (tui_source_window_base *) *win_info_ptr;
}
else
else
{
int cur_line_no, cur_line;
- struct tui_gen_win_info *locator
+ struct tui_locator_window *locator
= tui_locator_win_info_ptr ();
struct tui_source_window_base *src
= (struct tui_source_window_base *) TUI_SRC_WIN;
element->which_element.source.line_or_addr.u.line_no =
cur_line_no;
element->which_element.source.is_exec_point =
- (filename_cmp (locator->content[0]
- ->which_element.locator.full_name,
+ (filename_cmp (locator->full_name,
symtab_to_fullname (s)) == 0
- && cur_line_no
- == locator->content[0]
- ->which_element.locator.line_no);
+ && cur_line_no == locator->line_no);
xfree (TUI_SRC_WIN->content[cur_line]
->which_element.source.line);
{
return (TUI_SRC_WIN != NULL
&& TUI_SRC_WIN->content_in_use
- && (filename_cmp (tui_locator_win_info_ptr ()->content[0]
- ->which_element.locator.full_name,
+ && (filename_cmp (tui_locator_win_info_ptr ()->full_name,
fullname) == 0));
}
/* Create the status line to display as much information as we can on
this single line: target name, process number, current function,
current line, current PC, SingleKey mode. */
-static char*
-tui_make_status_line (struct tui_locator_element *loc)
+static char *
+tui_make_status_line (struct tui_locator_window *loc)
{
char *string;
char line_buf[50], *pname;
tui_show_locator_content (void)
{
char *string;
- struct tui_gen_win_info *locator;
+ struct tui_locator_window *locator;
locator = tui_locator_win_info_ptr ();
if (locator != NULL && locator->handle != NULL)
{
- struct tui_win_element *element;
-
- element = locator->content[0];
-
- string = tui_make_status_line (&element->which_element.locator);
+ string = tui_make_status_line (locator);
wmove (locator->handle, 0, 0);
/* We ignore the return value from wstandout and wstandend, casting
them to void in order to avoid a compiler warning. The warning
static void
tui_set_locator_fullname (const char *fullname)
{
- struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
- struct tui_locator_element *element;
-
- if (locator->content[0] == NULL)
- {
- tui_set_locator_info (NULL, fullname, NULL, 0, 0);
- return;
- }
+ struct tui_locator_window *locator = tui_locator_win_info_ptr ();
- element = &locator->content[0]->which_element.locator;
- element->full_name[0] = 0;
- strcat_to_buf (element->full_name, MAX_LOCATOR_ELEMENT_LEN, fullname);
+ locator->full_name[0] = 0;
+ strcat_to_buf (locator->full_name, MAX_LOCATOR_ELEMENT_LEN, fullname);
}
/* Update the locator, with the provided arguments.
int lineno,
CORE_ADDR addr)
{
- struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
- struct tui_locator_element *element;
+ struct tui_locator_window *locator = tui_locator_win_info_ptr ();
int locator_changed_p = 0;
- /* Allocate the locator content if necessary. */
- if (locator->content_size <= 0)
- {
- locator->content = tui_alloc_content (1, LOCATOR_WIN);
- locator->content_size = 1;
- locator_changed_p = 1;
- }
-
if (procname == NULL)
procname = "";
if (fullname == NULL)
fullname = "";
- element = &locator->content[0]->which_element.locator;
-
- locator_changed_p |= strncmp (element->proc_name, procname,
+ locator_changed_p |= strncmp (locator->proc_name, procname,
MAX_LOCATOR_ELEMENT_LEN) != 0;
- locator_changed_p |= lineno != element->line_no;
- locator_changed_p |= addr != element->addr;
- locator_changed_p |= gdbarch != element->gdbarch;
- locator_changed_p |= strncmp (element->full_name, fullname,
+ locator_changed_p |= lineno != locator->line_no;
+ locator_changed_p |= addr != locator->addr;
+ locator_changed_p |= gdbarch != locator->gdbarch;
+ locator_changed_p |= strncmp (locator->full_name, fullname,
MAX_LOCATOR_ELEMENT_LEN) != 0;
- element->proc_name[0] = (char) 0;
- strcat_to_buf (element->proc_name, MAX_LOCATOR_ELEMENT_LEN, procname);
- element->line_no = lineno;
- element->addr = addr;
- element->gdbarch = gdbarch;
+ locator->proc_name[0] = (char) 0;
+ strcat_to_buf (locator->proc_name, MAX_LOCATOR_ELEMENT_LEN, procname);
+ locator->line_no = lineno;
+ locator->addr = addr;
+ locator->gdbarch = gdbarch;
tui_set_locator_fullname (fullname);
return locator_changed_p;
{
int start_line;
CORE_ADDR low;
- struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
+ struct tui_locator_window *locator = tui_locator_win_info_ptr ();
int source_already_displayed;
CORE_ADDR pc;
start_line = 0;
for (struct tui_source_window_base *win_info : tui_source_windows ())
{
- union tui_which_element *item;
-
- item = &locator->content[0]->which_element;
if (win_info == TUI_SRC_WIN)
{
- start_line = (item->locator.line_no -
+ start_line = (locator->line_no -
(win_info->viewport_height / 2)) + 1;
if (start_line <= 0)
start_line = 1;
l.loa = LOA_LINE;
l.u.line_no = start_line;
if (!(source_already_displayed
- && tui_line_is_displayed (item->locator.line_no,
+ && tui_line_is_displayed (locator->line_no,
win_info, TRUE)))
tui_update_source_window (win_info, get_frame_arch (fi),
sal.symtab, l, TRUE);
else
{
- l.u.line_no = item->locator.line_no;
+ l.u.line_no = locator->line_no;
win_info->set_is_exec_point_at (l);
}
}
a.loa = LOA_ADDRESS;
a.u.addr = low;
- if (!tui_addr_is_displayed (item->locator.addr,
+ if (!tui_addr_is_displayed (locator->addr,
win_info, TRUE))
tui_update_source_window (win_info, get_frame_arch (fi),
sal.symtab, a, TRUE);
else
{
- a.u.addr = item->locator.addr;
+ a.u.addr = locator->addr;
win_info->set_is_exec_point_at (a);
}
}
struct tui_win_info *win_with_focus = tui_win_with_focus ();
struct tui_win_info *first_win;
struct tui_win_info *second_win;
- struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
+ struct tui_locator_window *locator = tui_locator_win_info_ptr ();
int win_type;
int new_height, split_diff, cmd_split_diff, num_wins_displayed = 2;
{
int diff;
struct tui_win_info *win_info;
- struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
+ struct tui_locator_window *locator = tui_locator_win_info_ptr ();
enum tui_layout_type cur_layout = tui_current_layout ();
diff = (new_height - primary_win_info->height) * (-1);
if (has_locator ())
{
- tui_gen_win_info *gen_win_info = tui_locator_win_info_ptr ();
+ tui_locator_window *gen_win_info = tui_locator_win_info_ptr ();
tui_make_invisible (gen_win_info);
gen_win_info->origin.y = origin.y + height;
}
tui_refresh_all (struct tui_win_info **list)
{
int type;
- struct tui_gen_win_info *locator = tui_locator_win_info_ptr ();
+ struct tui_locator_window *locator = tui_locator_win_info_ptr ();
for (type = SRC_WIN; (type < MAX_MAJOR_WINDOWS); type++)
{