aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-winsource.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2019-06-25 14:42:49 -0600
committerTom Tromey <tom@tromey.com>2019-07-04 10:36:31 -0600
commit0598af4880f58af5ce7c15419551362646892c7f (patch)
tree86064bd52fa57b21c7b5a145b08c6cb2cd850a4b /gdb/tui/tui-winsource.c
parent213fd9faf563ce5726ce66c8104cbaba44ba9c09 (diff)
downloadfsf-binutils-gdb-0598af4880f58af5ce7c15419551362646892c7f.zip
fsf-binutils-gdb-0598af4880f58af5ce7c15419551362646892c7f.tar.gz
fsf-binutils-gdb-0598af4880f58af5ce7c15419551362646892c7f.tar.bz2
Fix TUI use of "has_break" field
The TUI uses the "has_break" in two different ways: sometimes as a boolean, and sometimes as flags. This patch changes the TUI to be more type-safe here, and fixes the code. I could not find a bug that this caused, so apparently this is just cosmetic. This deletes some code from tui_set_disassem_content. Whenver this is called, I believe the TUI updates the breakpoint information afterward, so this assignment is redundant; which is good because it is also incorrect. gdb/ChangeLog 2019-07-04 Tom Tromey <tom@tromey.com> PR tui/24724: * tui/tui-winsource.c (tui_clear_source_content): Update. (tui_source_window_base::set_is_exec_point_at): Fix comment. (tui_update_breakpoint_info): Update. (tui_set_exec_info_content): Update. * tui/tui-source.c (tui_set_source_content_nil): Update. * tui/tui-disasm.c (tui_set_disassem_content): Don't set has_break. * tui/tui-data.h (enum tui_bp_flag): New. (tui_bp_flags): New enum flags type. (struct tui_source_element) <break_mode>: Change type. Rename from has_break. (TUI_BP_ENABLED, TUI_BP_DISABLED, TUI_BP_HIT) (TUI_BP_CONDITIONAL, TUI_BP_HARDWARE): Don't define. Now enum constants. * tui/tui-winsource.h: Fix comment.
Diffstat (limited to 'gdb/tui/tui-winsource.c')
-rw-r--r--gdb/tui/tui-winsource.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/gdb/tui/tui-winsource.c b/gdb/tui/tui-winsource.c
index 6ec1f1b..dbede41 100644
--- a/gdb/tui/tui-winsource.c
+++ b/gdb/tui/tui-winsource.c
@@ -217,7 +217,7 @@ tui_clear_source_content (struct tui_source_window_base *win_info,
{
struct tui_source_element *element = &win_info->content[i];
- element->has_break = FALSE;
+ element->break_mode = 0;
element->is_exec_point = false;
}
}
@@ -344,7 +344,7 @@ tui_source_window_base::do_scroll_horizontal (int num_to_scroll)
}
-/* Set or clear the has_break flag in the line whose line is
+/* Set or clear the is_exec_point flag in the line whose line is
line_no. */
void
@@ -415,7 +415,6 @@ tui_update_breakpoint_info (struct tui_source_window_base *win,
{
struct breakpoint *bp;
extern struct breakpoint *breakpoint_chain;
- int mode;
struct tui_source_element *line;
line = &win->content[i];
@@ -425,7 +424,7 @@ tui_update_breakpoint_info (struct tui_source_window_base *win,
/* Scan each breakpoint to see if the current line has something to
do with it. Identify enable/disabled breakpoints as well as
those that we already hit. */
- mode = 0;
+ tui_bp_flags mode = 0;
for (bp = breakpoint_chain;
bp != NULL;
bp = bp->next)
@@ -460,10 +459,10 @@ tui_update_breakpoint_info (struct tui_source_window_base *win,
}
}
}
- if (line->has_break != mode)
+ if (line->break_mode != mode)
{
- line->has_break = mode;
- need_refresh = 1;
+ line->break_mode = mode;
+ need_refresh = true;
}
}
return need_refresh;
@@ -496,7 +495,7 @@ tui_set_exec_info_content (struct tui_source_window_base *win_info)
{
tui_exec_info_content &element = content[i];
struct tui_source_element *src_element;
- int mode;
+ tui_bp_flags mode;
src_element = &win_info->content[i];
@@ -505,7 +504,7 @@ tui_set_exec_info_content (struct tui_source_window_base *win_info)
/* Now update the exec info content based upon the state
of each line as indicated by the source content. */
- mode = src_element->has_break;
+ mode = src_element->break_mode;
if (mode & TUI_BP_HIT)
element[TUI_BP_HIT_POS] = (mode & TUI_BP_HARDWARE) ? 'H' : 'B';
else if (mode & (TUI_BP_ENABLED | TUI_BP_DISABLED))