diff options
author | Tom Tromey <tom@tromey.com> | 2019-06-29 07:32:47 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-07-17 12:19:13 -0600 |
commit | 1e0c09ba0bdd8b4dd1ab3a61b2ae2d326825bee1 (patch) | |
tree | 9a34c9f42f11b3eeaec53853a88ce82e2c87e85a /gdb | |
parent | 1bf605de8e9ae4fcf77c21067ddaf4a242a873f7 (diff) | |
download | gdb-1e0c09ba0bdd8b4dd1ab3a61b2ae2d326825bee1.zip gdb-1e0c09ba0bdd8b4dd1ab3a61b2ae2d326825bee1.tar.gz gdb-1e0c09ba0bdd8b4dd1ab3a61b2ae2d326825bee1.tar.bz2 |
Remove the win_type parameter from tui_gen_win_info::reset
tui_gen_win_info::reset has a window type parameter that is only used
for an assertion. This made sense as a defensive measure when window
creation was more dynamic -- it ensured that one did not make
mistakes. However, there's no need for it any more, so this removes
it.
gdb/ChangeLog
2019-07-17 Tom Tromey <tom@tromey.com>
* tui/tui-source.c (tui_source_window_base::reset): Remove
win_type parameter.
* tui/tui-layout.c (make_command_window, make_source_window)
(make_disasm_window, make_data_window)
(show_source_disasm_command, show_data, tui_gen_win_info::reset)
(reset_locator, show_source_or_disasm_and_command): Update.
* tui/tui-data.h (struct tui_gen_win_info) <reset>: Remove
win_type parameter.
(struct tui_source_window_base) <reset>: Likewise.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 12 | ||||
-rw-r--r-- | gdb/tui/tui-data.h | 11 | ||||
-rw-r--r-- | gdb/tui/tui-layout.c | 42 | ||||
-rw-r--r-- | gdb/tui/tui-source.c | 7 |
4 files changed, 34 insertions, 38 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 76549e0..3de96b0 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,17 @@ 2019-07-17 Tom Tromey <tom@tromey.com> + * tui/tui-source.c (tui_source_window_base::reset): Remove + win_type parameter. + * tui/tui-layout.c (make_command_window, make_source_window) + (make_disasm_window, make_data_window) + (show_source_disasm_command, show_data, tui_gen_win_info::reset) + (reset_locator, show_source_or_disasm_and_command): Update. + * tui/tui-data.h (struct tui_gen_win_info) <reset>: Remove + win_type parameter. + (struct tui_source_window_base) <reset>: Likewise. + +2019-07-17 Tom Tromey <tom@tromey.com> + * tui/tui-layout.c (show_source_disasm_command): Use reset_locator. (reset_locator): New function. diff --git a/gdb/tui/tui-data.h b/gdb/tui/tui-data.h index 9bcfe4c..e177300 100644 --- a/gdb/tui/tui-data.h +++ b/gdb/tui/tui-data.h @@ -58,11 +58,9 @@ public: return ""; } - /* Reset this window. WIN_TYPE must match the existing type of this - window (it is only passed for self-test purposes). The other - parameters are used to set the window's size and position. */ - virtual void reset (enum tui_win_type win_type, - int height, int width, + /* Reset this window. The parameters are used to set the window's + size and position. */ + virtual void reset (int height, int width, int origin_x, int origin_y); /* Window handle. */ @@ -395,8 +393,7 @@ public: LINE_NO in this source window; false otherwise. */ virtual bool location_matches_p (struct bp_location *loc, int line_no) = 0; - void reset (enum tui_win_type win_type, - int height, int width, + void reset (int height, int width, int origin_x, int origin_y) override; /* Does the locator belong to this window? */ diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index ab849a9..79c7996 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -518,7 +518,7 @@ static struct tui_win_info * make_command_window (int height, int origin_y) { struct tui_win_info *result = new tui_cmd_window (); - result->reset (CMD_WIN, height, tui_term_width (), 0, origin_y); + result->reset (height, tui_term_width (), 0, origin_y); tui_make_window (result, DONT_BOX_WINDOW); return result; } @@ -530,7 +530,7 @@ static struct tui_win_info * make_source_window (int height, int origin_y) { tui_win_info *result = new tui_source_window (); - result->reset (SRC_WIN, height, tui_term_width (), 0, origin_y); + result->reset (height, tui_term_width (), 0, origin_y); result->make_visible (true); return result; } @@ -542,7 +542,7 @@ static struct tui_win_info * make_disasm_window (int height, int origin_y) { tui_win_info *result = new tui_disasm_window (); - result->reset (SRC_WIN, height, tui_term_width (), 0, origin_y); + result->reset (height, tui_term_width (), 0, origin_y); result->make_visible (true); return result; } @@ -552,7 +552,7 @@ static tui_win_info * make_data_window (int height, int origin_y) { tui_win_info *result = new tui_data_window (); - result->reset (DATA_WIN, height, tui_term_width (), 0, origin_y); + result->reset (height, tui_term_width (), 0, origin_y); result->make_visible (true); return result; } @@ -595,8 +595,7 @@ show_source_disasm_command (void) tui_win_list[SRC_WIN] = make_source_window (src_height, 0); else { - TUI_SRC_WIN->reset (TUI_SRC_WIN->type, - src_height, + TUI_SRC_WIN->reset (src_height, tui_term_width (), 0, 0); @@ -620,14 +619,12 @@ show_source_disasm_command (void) } else { - locator->reset (LOCATOR_WIN, - 2 /* 1 */ , + locator->reset (2 /* 1 */ , tui_term_width (), 0, (src_height + asm_height) - 1); TUI_DISASM_WIN->m_has_locator = true; - TUI_DISASM_WIN->reset (TUI_DISASM_WIN->type, - asm_height, + TUI_DISASM_WIN->reset (asm_height, tui_term_width (), 0, src_height - 1); @@ -644,8 +641,7 @@ show_source_disasm_command (void) = make_command_window (cmd_height, tui_term_height () - cmd_height); else { - TUI_CMD_WIN->reset (TUI_CMD_WIN->type, - TUI_CMD_WIN->height, + TUI_CMD_WIN->reset (TUI_CMD_WIN->height, TUI_CMD_WIN->width, 0, TUI_CMD_WIN->origin.y); @@ -702,14 +698,12 @@ show_data (enum tui_layout_type new_layout) else { base = (tui_source_window_base *) tui_win_list[win_type]; - tui_win_list[win_type]->reset (tui_win_list[win_type]->type, - src_height, + tui_win_list[win_type]->reset (src_height, tui_term_width (), 0, data_height - 1); tui_make_visible (tui_win_list[win_type]); - locator->reset (LOCATOR_WIN, - 2 /* 1 */ , + locator->reset (2 /* 1 */ , tui_term_width (), 0, total_height - 1); @@ -723,14 +717,11 @@ show_data (enum tui_layout_type new_layout) } void -tui_gen_win_info::reset (enum tui_win_type win_type, - int height_, int width_, +tui_gen_win_info::reset (int height_, int width_, int origin_x_, int origin_y_) { int h = height_; - gdb_assert (type == win_type); - width = width_; height = h; if (h > 1) @@ -750,7 +741,7 @@ reset_locator (tui_gen_win_info *win_info, int height, int width, int origin_x, int origin_y) { - win_info->reset (LOCATOR_WIN, height, width, origin_x, origin_y); + win_info->reset (height, width, origin_x, origin_y); tui_make_window (win_info, DONT_BOX_WINDOW); } @@ -794,14 +785,12 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type) else { base = (tui_source_window_base *) *win_info_ptr; - locator->reset (LOCATOR_WIN, - 2 /* 1 */ , + locator->reset (2 /* 1 */ , tui_term_width (), 0, src_height - 1); base->m_has_locator = true; - (*win_info_ptr)->reset ((*win_info_ptr)->type, - src_height - 1, + (*win_info_ptr)->reset (src_height - 1, tui_term_width (), 0, 0); @@ -820,8 +809,7 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type) } else { - TUI_CMD_WIN->reset (TUI_CMD_WIN->type, - TUI_CMD_WIN->height, + TUI_CMD_WIN->reset (TUI_CMD_WIN->height, TUI_CMD_WIN->width, TUI_CMD_WIN->origin.x, TUI_CMD_WIN->origin.y); diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index 873612f..e171101 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -293,11 +293,10 @@ tui_source_window::location_matches_p (struct bp_location *loc, int line_no) } void -tui_source_window_base::reset (enum tui_win_type win_type, - int height, int width, +tui_source_window_base::reset (int height, int width, int origin_x, int origin_y) { - tui_gen_win_info::reset (win_type, height, width - 3, + tui_gen_win_info::reset (height, width - 3, origin_x + 3, origin_y); - execution_info->reset (EXEC_INFO_WIN, height, 3, origin_x, origin_y); + execution_info->reset (height, 3, origin_x, origin_y); } |