diff options
author | Tom Tromey <tom@tromey.com> | 2019-06-16 13:46:18 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2019-06-25 07:48:30 -0600 |
commit | e6e4150110bcee66adfadb9f126eb3bb1fd7c054 (patch) | |
tree | 53ef1cbb7494fb2317a04d2da24cf5f185f0778c /gdb/tui/tui-layout.c | |
parent | 44f0e208eb32a7ac469cef2b6760f72534abac09 (diff) | |
download | gdb-e6e4150110bcee66adfadb9f126eb3bb1fd7c054.zip gdb-e6e4150110bcee66adfadb9f126eb3bb1fd7c054.tar.gz gdb-e6e4150110bcee66adfadb9f126eb3bb1fd7c054.tar.bz2 |
Remove struct tui_source_info
The tui_source_info struct is used as a member of the "detail" union
in tui_win_info, and this member of the union is only used by source
and disassembly windows. This patch removes tui_source_info and moves
its members directly to tui_source_window_base. This simplifies the
code by removing a layer of references from many places. In a few
spots, a new cast was needed, but most of these will be removed by the
end of the series.
gdb/ChangeLog
2019-06-25 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.c (tui_update_source_window)
(tui_refill_source_window)
(tui_source_window_base::do_scroll_horizontal)
(tui_update_breakpoint_info, tui_set_exec_info_content)
(tui_show_exec_info_content, tui_erase_exec_info_content)
(tui_clear_exec_info_content): Update.
* tui/tui-wingeneral.c (make_all_visible, tui_refresh_all):
Update.
* tui/tui-win.c (make_invisible_and_set_new_height)
(make_visible_with_new_height): Update.
* tui/tui-source.c (tui_set_source_content)
(tui_show_symtab_source): Update.
* tui/tui-layout.c (extract_display_start_addr)
(show_source_disasm_command, show_data)
(make_source_or_disasm_window)
(show_source_or_disasm_and_command): Update.
* tui/tui-disasm.c (tui_set_disassem_content): Simplify.
(tui_disasm_window::do_scroll_vertical): Remove shadowing
"gdbarch".
* tui/tui-data.h (struct tui_source_info): Remove. Move contents
to tui_source_window_base.
(struct tui_win_info) <detail>: Remove source_info member.
(struct tui_source_window_base) <has_locator>: Inline.
Move contents from tui_source_info; rename has_locator member to
m_has_locator.
(TUI_SRC_WIN, TUI_DISASM_WIN): Add casts.
* tui/tui-data.c (tui_source_window_base::has_locator): Move to
header file.
(tui_source_window_base::clear_detail, ~tui_source_window_base):
Simplify.
(tui_free_all_source_wins_content): Cast to
tui_source_window_base.
Diffstat (limited to 'gdb/tui/tui-layout.c')
-rw-r--r-- | gdb/tui/tui-layout.c | 70 |
1 files changed, 39 insertions, 31 deletions
diff --git a/gdb/tui/tui-layout.c b/gdb/tui/tui-layout.c index f4df492..55d737a 100644 --- a/gdb/tui/tui-layout.c +++ b/gdb/tui/tui-layout.c @@ -468,17 +468,17 @@ extract_display_start_addr (struct gdbarch **gdbarch_p, CORE_ADDR *addr_p) { case SRC_COMMAND: case SRC_DATA_COMMAND: - gdbarch = TUI_SRC_WIN->detail.source_info.gdbarch; + gdbarch = TUI_SRC_WIN->gdbarch; find_line_pc (cursal.symtab, - TUI_SRC_WIN->detail.source_info.start_line_or_addr.u.line_no, + TUI_SRC_WIN->start_line_or_addr.u.line_no, &pc); addr = pc; break; case DISASSEM_COMMAND: case SRC_DISASSEM_COMMAND: case DISASSEM_DATA_COMMAND: - gdbarch = TUI_DISASM_WIN->detail.source_info.gdbarch; - addr = TUI_DISASM_WIN->detail.source_info.start_line_or_addr.u.addr; + gdbarch = TUI_DISASM_WIN->gdbarch; + addr = TUI_DISASM_WIN->start_line_or_addr.u.addr; break; default: addr = 0; @@ -622,25 +622,25 @@ show_source_disasm_command (void) asm_height = tui_term_height () - (src_height + cmd_height); if (TUI_SRC_WIN == NULL) - TUI_SRC_WIN = make_source_window (src_height, 0); + tui_win_list[SRC_WIN] = make_source_window (src_height, 0); else { init_gen_win_info (&TUI_SRC_WIN->generic, TUI_SRC_WIN->generic.type, src_height, TUI_SRC_WIN->generic.width, - TUI_SRC_WIN->detail.source_info.execution_info->width, + TUI_SRC_WIN->execution_info->width, 0); TUI_SRC_WIN->can_highlight = TRUE; - init_gen_win_info (TUI_SRC_WIN->detail.source_info.execution_info, + init_gen_win_info (TUI_SRC_WIN->execution_info, EXEC_INFO_WIN, src_height, 3, 0, 0); tui_make_visible (&TUI_SRC_WIN->generic); - tui_make_visible (TUI_SRC_WIN->detail.source_info.execution_info); - TUI_SRC_WIN->detail.source_info.has_locator = false; + tui_make_visible (TUI_SRC_WIN->execution_info); + TUI_SRC_WIN->m_has_locator = false; } struct tui_gen_win_info *locator = tui_locator_win_info_ptr (); @@ -648,7 +648,8 @@ show_source_disasm_command (void) tui_show_source_content (TUI_SRC_WIN); if (TUI_DISASM_WIN == NULL) { - TUI_DISASM_WIN = make_disasm_window (asm_height, src_height - 1); + tui_win_list[DISASSEM_WIN] + = make_disasm_window (asm_height, src_height - 1); locator = ((struct tui_gen_win_info *) init_and_make_win (locator, @@ -667,14 +668,14 @@ show_source_disasm_command (void) tui_term_width (), 0, (src_height + asm_height) - 1); - TUI_DISASM_WIN->detail.source_info.has_locator = true; + TUI_DISASM_WIN->m_has_locator = true; init_gen_win_info (&TUI_DISASM_WIN->generic, TUI_DISASM_WIN->generic.type, asm_height, TUI_DISASM_WIN->generic.width, - TUI_DISASM_WIN->detail.source_info.execution_info->width, + TUI_DISASM_WIN->execution_info->width, src_height - 1); - init_gen_win_info (TUI_DISASM_WIN->detail.source_info.execution_info, + init_gen_win_info (TUI_DISASM_WIN->execution_info, EXEC_INFO_WIN, asm_height, 3, @@ -682,10 +683,10 @@ show_source_disasm_command (void) src_height - 1); TUI_DISASM_WIN->can_highlight = TRUE; tui_make_visible (&TUI_DISASM_WIN->generic); - tui_make_visible (TUI_DISASM_WIN->detail.source_info.execution_info); + tui_make_visible (TUI_DISASM_WIN->execution_info); } - TUI_SRC_WIN->detail.source_info.has_locator = false; - TUI_DISASM_WIN->detail.source_info.has_locator = true; + TUI_SRC_WIN->m_has_locator = false; + TUI_DISASM_WIN->m_has_locator = true; tui_make_visible (locator); tui_show_locator_content (); tui_show_source_content (TUI_DISASM_WIN); @@ -731,6 +732,8 @@ show_data (enum tui_layout_type new_layout) win_type = SRC_WIN; else win_type = DISASSEM_WIN; + + tui_source_window_base *base; if (tui_win_list[win_type] == NULL) { if (win_type == SRC_WIN) @@ -748,23 +751,25 @@ show_data (enum tui_layout_type new_layout) 0, total_height - 1, DONT_BOX_WINDOW)); + base = (tui_source_window_base *) tui_win_list[win_type]; } else { + base = (tui_source_window_base *) tui_win_list[win_type]; init_gen_win_info (&tui_win_list[win_type]->generic, tui_win_list[win_type]->generic.type, src_height, tui_win_list[win_type]->generic.width, - tui_win_list[win_type]->detail.source_info.execution_info->width, + base->execution_info->width, data_height - 1); - init_gen_win_info (tui_win_list[win_type]->detail.source_info.execution_info, + init_gen_win_info (base->execution_info, EXEC_INFO_WIN, src_height, 3, 0, data_height - 1); tui_make_visible (&tui_win_list[win_type]->generic); - tui_make_visible (tui_win_list[win_type]->detail.source_info.execution_info); + tui_make_visible (base->execution_info); init_gen_win_info (locator, LOCATOR_WIN, 2 /* 1 */ , @@ -772,7 +777,7 @@ show_data (enum tui_layout_type new_layout) 0, total_height - 1); } - tui_win_list[win_type]->detail.source_info.has_locator = true; + base->m_has_locator = true; tui_make_visible (locator); tui_show_locator_content (); tui_add_to_source_windows (tui_win_list[win_type]); @@ -865,8 +870,8 @@ make_source_or_disasm_window (enum tui_win_type type, DONT_BOX_WINDOW)); /* Now create the source window. */ - struct tui_win_info *result - = ((struct tui_win_info *) + struct tui_source_window_base *result + = ((struct tui_source_window_base *) init_and_make_win (NULL, type, height, @@ -874,7 +879,7 @@ make_source_or_disasm_window (enum tui_win_type type, execution_info->width, origin_y, BOX_WINDOW)); - result->detail.source_info.execution_info = execution_info; + result->execution_info = execution_info; return result; } @@ -896,10 +901,11 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type) src_height = tui_term_height () - cmd_height; if (layout_type == SRC_COMMAND) - win_info_ptr = &TUI_SRC_WIN; + win_info_ptr = &tui_win_list[SRC_WIN]; else - win_info_ptr = &TUI_DISASM_WIN; + win_info_ptr = &tui_win_list[DISASSEM_WIN]; + tui_source_window_base *base; if ((*win_info_ptr) == NULL) { if (layout_type == SRC_COMMAND) @@ -915,35 +921,37 @@ show_source_or_disasm_and_command (enum tui_layout_type layout_type) 0, src_height - 1, DONT_BOX_WINDOW)); + base = (tui_source_window_base *) *win_info_ptr; } else { + base = (tui_source_window_base *) *win_info_ptr; init_gen_win_info (locator, LOCATOR_WIN, 2 /* 1 */ , tui_term_width (), 0, src_height - 1); - (*win_info_ptr)->detail.source_info.has_locator = true; + base->m_has_locator = true; init_gen_win_info (&(*win_info_ptr)->generic, (*win_info_ptr)->generic.type, src_height - 1, (*win_info_ptr)->generic.width, - (*win_info_ptr)->detail.source_info.execution_info->width, + base->execution_info->width, 0); - init_gen_win_info ((*win_info_ptr)->detail.source_info.execution_info, + init_gen_win_info (base->execution_info, EXEC_INFO_WIN, src_height - 1, 3, 0, 0); - (*win_info_ptr)->can_highlight = TRUE; + base->can_highlight = TRUE; tui_make_visible (&(*win_info_ptr)->generic); - tui_make_visible ((*win_info_ptr)->detail.source_info.execution_info); + tui_make_visible (base->execution_info); } if ((*win_info_ptr) != NULL) { - (*win_info_ptr)->detail.source_info.has_locator = true; + base->m_has_locator = true; tui_make_visible (locator); tui_show_locator_content (); tui_show_source_content (*win_info_ptr); |