aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog33
-rw-r--r--gdb/tui/tui-data.c11
-rw-r--r--gdb/tui/tui-data.h12
-rw-r--r--gdb/tui/tui-disasm.c8
-rw-r--r--gdb/tui/tui-regs.c14
-rw-r--r--gdb/tui/tui-source.c34
-rw-r--r--gdb/tui/tui-stack.c13
-rw-r--r--gdb/tui/tui-winsource.c54
8 files changed, 94 insertions, 85 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index f21b358..44af045 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,36 @@
+2015-04-28 Patrick Palka <patrick@parcs.ath.cx>
+
+ * tui/tui-data.h (struct tui_win_element): Forward-declare.
+ (tui_win_content): Move declaration.
+ (struct tui_gen_win_info): Give 'content' field the
+ type tui_win_content.
+ * tui/tui-data.c (init_content_element): Remove redundant and
+ erroneous casts.
+ (tui_add_content_elements): Remove erroneous cast.
+ * tui/tui-disasm.c (tui_set_disassem_content): Remove redundant
+ casts.
+ (tui_get_begin_asm_address): Likewise.
+ * tui/tui-regs.c (tui_show_registers): Likewise.
+ (tui_show_register_group): Likewise.
+ (tui_display_registers_from): Likewise.
+ (tui_check_register_values): Likewise.
+ * tui/tui-source.c (tui_set_source_content): Likewise.
+ (tui_set_source_content_nil): Likewise.
+ (tui_source_is_displayed): Likewise.
+ * tui/tui-stack.c (tui_show_locator_content): Likewise.
+ (tui_set_locator_fullname): Likewise.
+ (tui_set_locator_info): Likewise.
+ (tui_show_frame_info): Likewise.
+ * tui/tui-winsource.c (tui_clear_source_content): Likewise.
+ (tui_show_source_line): Likewise.
+ (tui_horizontal_source_scroll): Likewise.
+ (tui_update_breakpoint_info): Likewise.
+ (tui_set_exec_info_content): Likewise.
+ (tui_show_exec_info_content): Likewise.
+ (tui_alloc_source_buffer): Likewise.
+ (tui_line_is_displayed): Likewise.
+ (tui_addr_is_displayed): Likewise.
+
2015-04-27 John Baldwin <jhb@FreeBSD.org>
* fbsd-nat.c: (fbsd_wait) [PL_FLAG_EXEC]: Report TARGET_WAITKIND_EXECD
diff --git a/gdb/tui/tui-data.c b/gdb/tui/tui-data.c
index 43bcec2..44c1feb 100644
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -490,11 +490,9 @@ init_content_element (struct tui_win_element *element,
case DATA_WIN:
tui_init_generic_part (&element->which_element.data_window);
element->which_element.data_window.type = DATA_ITEM_WIN;
- ((struct tui_gen_win_info *)
- &element->which_element.data_window)->content =
- (void **) tui_alloc_content (1, DATA_ITEM_WIN);
- ((struct tui_gen_win_info *)
- & element->which_element.data_window)->content_size = 1;
+ element->which_element.data_window.content =
+ tui_alloc_content (1, DATA_ITEM_WIN);
+ element->which_element.data_window.content_size = 1;
break;
case CMD_WIN:
element->which_element.command.line = (char *) NULL;
@@ -635,8 +633,7 @@ tui_add_content_elements (struct tui_gen_win_info *win_info,
if (win_info->content == NULL)
{
- win_info->content = (void **) tui_alloc_content (num_elements,
- win_info->type);
+ win_info->content = tui_alloc_content (num_elements, win_info->type);
index_start = 0;
}
else
diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h
index f87c45d..7651efd 100644
--- a/gdb/tui/tui-data.h
+++ b/gdb/tui/tui-data.h
@@ -31,6 +31,11 @@ struct tui_point
int x, y;
};
+struct tui_win_element;
+
+/* This describes the content of the window. */
+typedef struct tui_win_element **tui_win_content;
+
/* Generic window information. */
struct tui_gen_win_info
{
@@ -39,7 +44,7 @@ struct tui_gen_win_info
int width; /* Window width. */
int height; /* Window height. */
struct tui_point origin; /* Origin of window. */
- void **content; /* Content of window. */
+ tui_win_content content; /* Content of window. */
int content_size; /* Size of content (# of elements). */
int content_in_use; /* Can it be used, or is it already used? */
int viewport_height; /* Viewport height. */
@@ -250,11 +255,6 @@ struct tui_win_element
union tui_which_element which_element;
};
-
-/* This describes the content of the window. */
-typedef struct tui_win_element **tui_win_content;
-
-
/* This struct defines the specific information about a data display
window. */
struct tui_data_info
diff --git a/gdb/tui/tui-disasm.c b/gdb/tui/tui-disasm.c
index 821a4f1..f86c216 100644
--- a/gdb/tui/tui-disasm.c
+++ b/gdb/tui/tui-disasm.c
@@ -192,8 +192,7 @@ tui_set_disassem_content (struct gdbarch *gdbarch, CORE_ADDR pc)
TUI_DISASM_WIN->detail.source_info.gdbarch = gdbarch;
TUI_DISASM_WIN->detail.source_info.start_line_or_addr.loa = LOA_ADDRESS;
TUI_DISASM_WIN->detail.source_info.start_line_or_addr.u.addr = pc;
- cur_pc = (CORE_ADDR) (((struct tui_win_element *)
- locator->content[0])->which_element.locator.addr);
+ cur_pc = locator->content[0]->which_element.locator.addr;
max_lines = TUI_DISASM_WIN->generic.height - 2; /* Account for
hilite. */
@@ -232,7 +231,7 @@ tui_set_disassem_content (struct gdbarch *gdbarch, CORE_ADDR pc)
struct tui_source_element *src;
int cur_len;
- element = (struct tui_win_element *) TUI_DISASM_WIN->generic.content[i];
+ element = TUI_DISASM_WIN->generic.content[i];
src = &element->which_element.source;
strcpy (line, asm_lines[i].addr_string);
cur_len = strlen (line);
@@ -334,8 +333,7 @@ tui_get_begin_asm_address (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p)
CORE_ADDR addr;
locator = tui_locator_win_info_ptr ();
- element = &((struct tui_win_element *)
- locator->content[0])->which_element.locator;
+ element = &locator->content[0]->which_element.locator;
if (element->addr == 0)
{
diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index feb11ba..61918f8 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -171,7 +171,7 @@ tui_show_registers (struct reggroup *group)
data_item_win = &display_info->regs_content[i]
->which_element.data_window;
- win = (struct tui_win_element *) data_item_win->content[0];
+ win = data_item_win->content[0];
win->which_element.data.highlight = FALSE;
}
display_info->current_group = group;
@@ -274,8 +274,7 @@ tui_show_register_group (struct reggroup *group,
data_item_win =
&display_info->regs_content[pos]->which_element.data_window;
- data = &((struct tui_win_element *)
- data_item_win->content[0])->which_element.data;
+ data = &data_item_win->content[0]->which_element.data;
if (data)
{
if (!refresh_values_only)
@@ -322,8 +321,7 @@ tui_display_registers_from (int start_element_no)
data_item_win
= &display_info->regs_content[i]->which_element.data_window;
- data = &((struct tui_win_element *)
- data_item_win->content[0])->which_element.data;
+ data = &data_item_win->content[0]->which_element.data;
len = 0;
p = data->content;
if (p != 0)
@@ -365,8 +363,7 @@ tui_display_registers_from (int start_element_no)
/* Create the window if necessary. */
data_item_win = &display_info->regs_content[i]
->which_element.data_window;
- data_element_ptr = &((struct tui_win_element *)
- data_item_win->content[0])->which_element.data;
+ data_element_ptr = &data_item_win->content[0]->which_element.data;
if (data_item_win->handle != (WINDOW*) NULL
&& (data_item_win->height != 1
|| data_item_win->width != item_win_width
@@ -508,8 +505,7 @@ tui_check_register_values (struct frame_info *frame)
data_item_win_ptr = &display_info->regs_content[i]->
which_element.data_window;
- data = &((struct tui_win_element *)
- data_item_win_ptr->content[0])->which_element.data;
+ data = &data_item_win_ptr->content[0]->which_element.data;
was_hilighted = data->highlight;
tui_get_register (frame, data,
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c
index 4070894..31df0c8 100644
--- a/gdb/tui/tui-source.c
+++ b/gdb/tui/tui-source.c
@@ -120,16 +120,14 @@ tui_set_source_content (struct symtab *s,
while (cur_line < nlines)
{
struct tui_win_element *element
- = (struct tui_win_element *)
- TUI_SRC_WIN->generic.content[cur_line];
+ = TUI_SRC_WIN->generic.content[cur_line];
/* Get the first character in the line. */
c = fgetc (stream);
if (offset == 0)
- src_line = ((struct tui_win_element *)
- TUI_SRC_WIN->generic.content[
- cur_line])->which_element.source.line;
+ src_line = TUI_SRC_WIN->generic.content[cur_line]
+ ->which_element.source.line;
/* Init the line with the line number. */
sprintf (src_line, "%-6d", cur_line_no);
cur_len = strlen (src_line);
@@ -150,11 +148,12 @@ tui_set_source_content (struct symtab *s,
element->which_element.source.line_or_addr.u.line_no =
cur_line_no;
element->which_element.source.is_exec_point =
- (filename_cmp (((struct tui_win_element *)
- locator->content[0])->which_element.locator.full_name,
+ (filename_cmp (locator->content[0]
+ ->which_element.locator.full_name,
symtab_to_fullname (s)) == 0
- && cur_line_no == ((struct tui_win_element *)
- locator->content[0])->which_element.locator.line_no);
+ && cur_line_no
+ == locator->content[0]
+ ->which_element.locator.line_no);
if (c != EOF)
{
i = strlen (src_line) - 1;
@@ -220,13 +219,12 @@ tui_set_source_content (struct symtab *s,
/* Now copy the line taking the offset into
account. */
if (strlen (src_line) > offset)
- strcpy (((struct tui_win_element *)
- TUI_SRC_WIN->generic.content[cur_line])->which_element.source.line,
+ strcpy (TUI_SRC_WIN->generic.content[cur_line]
+ ->which_element.source.line,
&src_line[offset]);
else
- ((struct tui_win_element *)
- TUI_SRC_WIN->generic.content[
- cur_line])->which_element.source.line[0] = (char) 0;
+ TUI_SRC_WIN->generic.content[cur_line]
+ ->which_element.source.line[0] = (char) 0;
cur_line++;
cur_line_no++;
}
@@ -268,8 +266,7 @@ tui_set_source_content_nil (struct tui_win_info *win_info,
i.e. the line number is 0, there is no bp, it is not where
the program is stopped. */
- struct tui_win_element *element =
- (struct tui_win_element *) win_info->generic.content[curr_line];
+ struct tui_win_element *element = win_info->generic.content[curr_line];
element->which_element.source.line_or_addr.loa = LOA_LINE;
element->which_element.source.line_or_addr.u.line_no = 0;
@@ -337,9 +334,8 @@ tui_source_is_displayed (const char *fullname)
{
return (TUI_SRC_WIN != NULL
&& TUI_SRC_WIN->generic.content_in_use
- && (filename_cmp (((struct tui_win_element *)
- (tui_locator_win_info_ptr ())->
- content[0])->which_element.locator.full_name,
+ && (filename_cmp (tui_locator_win_info_ptr ()->content[0]
+ ->which_element.locator.full_name,
fullname) == 0));
}
diff --git a/gdb/tui/tui-stack.c b/gdb/tui/tui-stack.c
index 13dd0b2..2870d70 100644
--- a/gdb/tui/tui-stack.c
+++ b/gdb/tui/tui-stack.c
@@ -253,7 +253,7 @@ tui_show_locator_content (void)
{
struct tui_win_element *element;
- element = (struct tui_win_element *) locator->content[0];
+ element = locator->content[0];
string = tui_make_status_line (&element->which_element.locator);
wmove (locator->handle, 0, 0);
@@ -287,8 +287,7 @@ tui_set_locator_fullname (const char *fullname)
return;
}
- element = &((struct tui_win_element *)
- locator->content[0])->which_element.locator;
+ element = &locator->content[0]->which_element.locator;
element->full_name[0] = 0;
strcat_to_buf (element->full_name, MAX_LOCATOR_ELEMENT_LEN, fullname);
}
@@ -307,12 +306,11 @@ tui_set_locator_info (struct gdbarch *gdbarch,
/* Allocate the locator content if necessary. */
if (locator->content_size <= 0)
{
- locator->content = (void **) tui_alloc_content (1, locator->type);
+ locator->content = tui_alloc_content (1, locator->type);
locator->content_size = 1;
}
- element = &((struct tui_win_element *)
- locator->content[0])->which_element.locator;
+ element = &locator->content[0]->which_element.locator;
element->proc_name[0] = (char) 0;
strcat_to_buf (element->proc_name, MAX_LOCATOR_ELEMENT_LEN, procname);
element->line_no = lineno;
@@ -369,8 +367,7 @@ tui_show_frame_info (struct frame_info *fi)
win_info = (tui_source_windows ())->list[i];
- item = &((struct tui_win_element *)
- locator->content[0])->which_element;
+ item = &locator->content[0]->which_element;
if (win_info == TUI_SRC_WIN)
{
start_line = (item->locator.line_no -
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 68eb4cf..63e0770 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -219,8 +219,7 @@ tui_clear_source_content (struct tui_win_info *win_info,
tui_erase_source_content (win_info, display_prompt);
for (i = 0; i < win_info->generic.content_size; i++)
{
- struct tui_win_element *element =
- (struct tui_win_element *) win_info->generic.content[i];
+ struct tui_win_element *element = win_info->generic.content[i];
element->which_element.source.has_break = FALSE;
element->which_element.source.is_exec_point = FALSE;
@@ -276,7 +275,7 @@ tui_show_source_line (struct tui_win_info *win_info, int lineno)
struct tui_win_element *line;
int x, y;
- line = (struct tui_win_element *) win_info->generic.content[lineno - 1];
+ line = win_info->generic.content[lineno - 1];
if (line->which_element.source.is_exec_point)
wattron (win_info->generic.handle, A_STANDOUT);
@@ -348,8 +347,8 @@ tui_horizontal_source_scroll (struct tui_win_info *win_info,
}
win_info->detail.source_info.horizontal_offset = offset;
tui_update_source_window_as_is (win_info, gdbarch, s,
- ((struct tui_win_element *)
- win_info->generic.content[0])->which_element.source.line_or_addr,
+ win_info->generic.content[0]
+ ->which_element.source.line_or_addr,
FALSE);
}
@@ -438,8 +437,7 @@ tui_update_breakpoint_info (struct tui_win_info *win,
int mode;
struct tui_source_element *line;
- line = &((struct tui_win_element *)
- win->generic.content[i])->which_element.source;
+ line = &win->generic.content[i]->which_element.source;
if (current_only && !line->is_exec_point)
continue;
@@ -507,8 +505,7 @@ tui_set_exec_info_content (struct tui_win_info *win_info)
if (exec_info_ptr->content == NULL)
exec_info_ptr->content =
- (void **) tui_alloc_content (win_info->generic.height,
- exec_info_ptr->type);
+ tui_alloc_content (win_info->generic.height, exec_info_ptr->type);
if (exec_info_ptr->content != NULL)
{
int i;
@@ -520,9 +517,8 @@ tui_set_exec_info_content (struct tui_win_info *win_info)
struct tui_win_element *src_element;
int mode;
- element = (struct tui_win_element *) exec_info_ptr->content[i];
- src_element = (struct tui_win_element *)
- win_info->generic.content[i];
+ element = exec_info_ptr->content[i];
+ src_element = win_info->generic.content[i];
memset(element->which_element.simple_string, ' ',
sizeof(element->which_element.simple_string));
@@ -569,8 +565,7 @@ tui_show_exec_info_content (struct tui_win_info *win_info)
mvwaddstr (exec_info->handle,
cur_line,
0,
- ((struct tui_win_element *)
- exec_info->content[cur_line - 1])->which_element.simple_string);
+ exec_info->content[cur_line - 1]->which_element.simple_string);
tui_refresh_win (exec_info);
exec_info->content_in_use = TRUE;
}
@@ -628,8 +623,8 @@ tui_alloc_source_buffer (struct tui_win_info *win_info)
return TUI_FAILURE;
}
/* Allocate the content list. */
- if ((win_info->generic.content =
- (void **) tui_alloc_content (max_lines, SRC_WIN)) == NULL)
+ win_info->generic.content = tui_alloc_content (max_lines, SRC_WIN);
+ if (win_info->generic.content == NULL)
{
xfree (src_line_buf);
fputs_unfiltered ("Unable to Allocate Memory for "
@@ -638,9 +633,8 @@ tui_alloc_source_buffer (struct tui_win_info *win_info)
return TUI_FAILURE;
}
for (i = 0; i < max_lines; i++)
- ((struct tui_win_element *)
- win_info->generic.content[i])->which_element.source.line =
- src_line_buf + (line_width * i);
+ win_info->generic.content[i]->which_element.source.line
+ = src_line_buf + (line_width * i);
}
return TUI_SUCCESS;
@@ -665,12 +659,11 @@ tui_line_is_displayed (int line,
while (i < win_info->generic.content_size - threshold
&& !is_displayed)
{
- is_displayed = (((struct tui_win_element *)
- win_info->generic.content[i])->which_element.source.line_or_addr.loa
- == LOA_LINE)
- && (((struct tui_win_element *)
- win_info->generic.content[i])->which_element.source.line_or_addr.u.line_no
- == (int) line);
+ is_displayed
+ = win_info->generic.content[i]
+ ->which_element.source.line_or_addr.loa == LOA_LINE
+ && win_info->generic.content[i]
+ ->which_element.source.line_or_addr.u.line_no == (int) line;
i++;
}
@@ -696,12 +689,11 @@ tui_addr_is_displayed (CORE_ADDR addr,
while (i < win_info->generic.content_size - threshold
&& !is_displayed)
{
- is_displayed = (((struct tui_win_element *)
- win_info->generic.content[i])->which_element.source.line_or_addr.loa
- == LOA_ADDRESS)
- && (((struct tui_win_element *)
- win_info->generic.content[i])->which_element.source.line_or_addr.u.addr
- == addr);
+ is_displayed
+ = win_info->generic.content[i]
+ ->which_element.source.line_or_addr.loa == LOA_ADDRESS
+ && win_info->generic.content[i]
+ ->which_element.source.line_or_addr.u.addr == addr;
i++;
}