aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui
AgeCommit message (Collapse)AuthorFilesLines
2019-08-15Simplify TUI boxingTom Tromey6-15/+23
In the TUI, whether or not a window can be boxed is a property of the window's type. This adds a can_box method to the window classes, and changes tui_make_window to defer to this, removing the "box_it" paramter. This also lets us remove "enum tui_box", as it is no longer used. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_make_window): Update. * tui/tui-wingeneral.c (tui_make_window): Remove "box_it" parameter. (tui_gen_win_info::make_visible): Update. * tui/tui-regs.c (tui_data_window::display_registers_from): Update. * tui/tui-layout.c (show_source_disasm_command) (show_source_or_disasm_and_command): Update. * tui/tui-data.h (struct tui_gen_win_info) <can_box>: New method. (enum tui_box): Remove. (struct tui_win_info) <can_box>: New method. * tui/tui-command.h (struct tui_cmd_window) <can_box>: New method.
2019-08-13Remove tui_gen_win_info::last_visible_lineTom Tromey2-4/+1
The last_visible_line field of tui_gen_win_info is not used, so remove it. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-data.h (struct tui_gen_win_info) <last_visible_line>: Remove. * tui/tui-data.c (tui_initialize_static_data): Update.
2019-08-13Don't track the contents of the execution info windowTom Tromey2-70/+8
The curses library keeps track of the contents of each window, and can redraw the screen as needed. This means that in most cases is no need for the TUI windows to also keep track of their contents. This patch removes content tracking from the execution window, leaving that to curses. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_exec_info_window) <~tui_exec_info_window, maybe_allocate_content, get_content, m_content>: Remove. (struct tui_source_window_base) <set_exec_info_content, show_exec_info_content>: Don't declare. * tui/tui-winsource.c (tui_exec_info_window::maybe_allocate_content): Remove. (tui_source_window_base::update_exec_info): Rename from set_exec_info_content. (tui_source_window_base::show_exec_info_content) (tui_source_window_base::update_exec_info): Remove.
2019-08-13Remove tui_clear_exec_info_contentTom Tromey2-18/+7
After the previous patch, all calls to tui_clear_exec_info_content come just after a call to tui_clear_source_content. Because these two windows are linked, I think it makes sense to have tui_clear_source_content simply do the work. So, this patch removes tui_clear_exec_info_content. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_clear_exec_info_content): Don't declare. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_update_source_windows_with_addr, tui_erase_source_content): Update. (tui_clear_exec_info_content): Remove.
2019-08-13Remove tui_erase_exec_info_contentTom Tromey2-9/+1
One call to tui_erase_exec_info_content can be removed. This call is not needed because the function in question then immediately sets the execution info window contents. Once this is done, tui_clear_exec_info_content is just a wrapper for the only call to tui_erase_exec_info_content, so tui_erase_exec_info_content can be renamed and the wrapper function removed. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_erase_exec_info_content): Don't declare. * tui/tui-winsource.c (tui_source_window_base::refresh_all): Don't call tui_erase_exec_info_content. (tui_clear_exec_info_content): Rename from tui_erase_exec_info_content. (tui_clear_exec_info_content): Delete.
2019-08-13Turn tui_show_exec_info_content into a methodTom Tromey2-7/+9
This changes tui_show_exec_info_content to be a method on tui_source_window_base. As it is only called by other methods on this class, it can be private. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <show_exec_info_content>: Declare. (tui_show_exec_info_content): Don't declare. * tui/tui-winsource.c (tui_source_window_base::show_exec_info_content): Rename from tui_show_exec_info_content. (tui_source_window_base::update_exec_info): Update.
2019-08-13Move code to tui-winsource.hTom Tromey2-41/+41
This moves code related to the execution info window from tui-data.h to tui-winsource.h. It fits better here because the execution info is conceptually part of the source and disassembly windows, and tui-winsource.h is where this common class lives. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-data.h (enum tui_bp_flag, tui_bp_flags, struct tui_source_element) (TUI_BP_HIT_POS, TUI_BP_BREAK_POS, TUI_EXEC_POS) (TUI_EXECINFO_SIZE, tui_exec_info_content): Move ... * tui/tui-winsource.h (enum tui_bp_flag, tui_bp_flags, struct tui_source_element, TUI_BP_HIT_POS, TUI_BP_BREAK_POS) (TUI_EXEC_POS, TUI_EXECINFO_SIZE, tui_exec_info_content): ... here.
2019-08-13Change tui_update_exec_info to be a methodTom Tromey3-9/+9
This changes tui_update_exec_info to be a method on tui_source_window_base. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <update_exec_info>: Declare. (tui_update_exec_info): Don't declare. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_source_window_base::refresh_all) (tui_update_all_breakpoint_info): Update. (tui_source_window_base::update_exec_info): Rename from tui_update_exec_info. * tui/tui-stack.c (tui_show_frame_info): Update.
2019-08-13Change tui_set_exec_info_content to be a methodTom Tromey2-9/+10
This changes tui_set_exec_info_content to bea method on tui_source_window_base. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <set_exec_info_content>: Declare. (tui_set_exec_info_content): Don't declare. * tui/tui-winsource.c (tui_source_window_base::set_exec_info_content): Rename from tui_set_exec_info_content. (tui_update_exec_info): Update.
2019-08-13Change tui_show_source_content to be a methodTom Tromey3-13/+14
This changes tui_show_source_content to be a method on tui_source_window_base. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <show_source_content>: Declare. (tui_show_source_content): Don't declare. * tui/tui-winsource.c (tui_update_source_window_as_is): Update. (tui_source_window_base::show_source_content): Rename from tui_show_source_content. (tui_source_window_base::refresh_all): Update. * tui/tui-layout.c (show_source_disasm_command) (show_source_or_disasm_and_command): Update.
2019-08-13Change tui_check_and_display_highlight_if_needed to be a methodTom Tromey6-15/+15
This changes tui_check_and_display_highlight_if_needed to be a method on tui_win_info. This makes it clear that the NULL check in that function is not needed, so it is removed here. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_erase_source_content) (tui_show_source_content, tui_source_window_base::refresh_all): Update. * tui/tui-wingeneral.h (tui_check_and_display_highlight_if_needed): Don't declare. * tui/tui-wingeneral.c (tui_win_info::check_and_display_highlight_if_needed): Rename from check_and_display_highlight_if_needed. * tui/tui-win.c (tui_rehighlight_all) (tui_win_info::make_visible_with_new_height): Update. * tui/tui-regs.c (tui_data_window::display_registers_from_line) (tui_data_window::erase_data_content) (tui_data_window::display_all_data): Update. * tui/tui-data.h (struct tui_win_info) <check_and_display_highlight_if_needed>: Declare.
2019-08-13Delete invisible TUI windowsTom Tromey4-13/+32
This changes the TUI so that when the layout changes, any windows that are invisible are now deleted. This makes it simpler to understand window lifetimes. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_resize_all): Call tui_delete_invisible_windows. * tui/tui-layout.c (show_layout): Call tui_delete_invisible_windows. * tui/tui-data.h (tui_delete_invisible_windows): Declare. * tui/tui-data.c (tui_delete_invisible_windows): New function.
2019-08-13Simplify tui_show_disassemTom Tromey1-1/+2
tui_show_disassem does not need to call tui_add_win_to_layout, because the callers that could change the layout have already ensured that it exists. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-disasm.c (tui_show_disassem): Add assertion. Don't call tui_add_win_to_layout.
2019-08-13Make tui_default_win_height staticTom Tromey2-3/+1
tui_default_win_height is only used in tui-layout.c, so make it static. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-layout.h (tui_default_win_height): Don't declare. * tui/tui-layout.c (tui_default_win_height): Now static.
2019-08-13Two simplifications in tui-layout.cTom Tromey1-119/+109
This patch simplifies some code in tui-layout.c. In show_layout, all the layout settings can be handled by a single switch statement. In show_source_disasm_command and show_source_or_disasm_and_command, there is no need to check the current layout, as the caller has already done so. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (show_layout): Unify all layout cases into a single switch. (show_source_disasm_command, show_source_or_disasm_and_command): Don't check current layout.
2019-08-13Simplify tui_make_all_invisibleTom Tromey3-16/+9
This simplifies the implementation of tui_make_all_invisible. Also, because show_data is only called by show_layout, this hoists the call to tui_make_all_invisible and removes the call from show_data. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (make_all_visible): Remove. (tui_make_all_invisible): Simplify. * tui/tui-layout.c (tui_make_all_invisible): Move from tui-wingeneral.c; simplify. (show_layout): Hoist call to tui_make_all_invisible. (show_data): Don't call tui_make_all_invisible.
2019-08-13Remove tui_make_all_visibleTom Tromey2-7/+0
The function tui_make_all_visible is not used, so remove it. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_make_all_visible): Don't declare. * tui/tui-wingeneral.c (tui_make_all_visible): Remove.
2019-08-13Move current_layout to tui-layout.cTom Tromey3-21/+12
This moves the current_layout global to tui-layout.c. This allows for the removal of an accessor function; but also it just seems clearer to have it here. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (current_layout, tui_current_layout): Move from tui-data.c. (show_source_disasm_command, show_data) (show_source_or_disasm_and_command): Don't use tui_set_current_layout_to. * tui/tui-data.h (tui_set_current_layout_to): Don't declare. * tui/tui-data.c (current_layout, tui_current_layout): Move to tui-layout.c. (tui_set_current_layout_to): Remove.
2019-08-13Remove struct tui_layout_defTom Tromey3-23/+0
"layout_def" isn't actually used in the TUI, so remove it. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (tui_set_layout): Update. * tui/tui-data.h (struct tui_layout_def): Remove. (tui_layout_def): Don't declare. * tui/tui-data.c (layout_def): Remove. (tui_layout_def): Remove.
2019-08-13clear_detail can only be called on TUI source windowsTom Tromey6-25/+1
The clear_detail method can only be called on source windows, so remove definitions from the base of the class hierarchy, leaving only a single non-virtual method. gdb/ChangeLog 2019-08-13 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <clear_detail>: No longer "override". * tui/tui-regs.h (struct tui_data_window) <clear_detail>: Remove. * tui/tui-regs.c (tui_data_window::clear_detail): Remove. * tui/tui-data.h (struct tui_win_info) <clear_detail>: Remove. * tui/tui-command.h (struct tui_cmd_window) <clear_detail>: Remove. * tui/tui-command.c (tui_cmd_window::clear_detail): Remove.
2019-08-07Make first and last lines of 'command help documentation' consistent.Philippe Waroquiers1-3/+3
With this patch, the help docs now respect 2 invariants: * The first line of a command help is terminated by a '.' character. * The last character of a command help is not a newline character. Note that the changes for the last invariant were done by Tom, as part of : [PATCH] Remove trailing newlines from help text https://sourceware.org/ml/gdb-patches/2019-06/msg00050.html but some occurrences have been re-introduced since then. Some help docs had to be rephrased/restructured to respect the above invariants. Before this patch, print_doc_line was printing the first line of a command help documentation, but stopping at the first '.' or ',' character. This was giving inconsistent results : * The first line of command helps was sometimes '.' terminated, sometimes not. * The first line of command helps was not always designed to be readable/understandable/unambiguous when stopping at the first '.' or ',' character. This e.g. created the following inconsistencies/problems: < catch exception -- Catch Ada exceptions < catch handlers -- Catch Ada exceptions < catch syscall -- Catch system calls by their names < down-silently -- Same as the `down' command while the new help is: > catch exception -- Catch Ada exceptions, when raised. > catch handlers -- Catch Ada exceptions, when handled. > catch syscall -- Catch system calls by their names, groups and/or numbers. > down-silently -- Same as the `down' command, but does not print anything. Also, the command help doc should not be terminated by a newline character, but this was not respected by all commands. The cli-option -OPT framework re-introduced some occurences. So, the -OPT build help framework was changed to not output newlines at the end of %OPTIONS% replacement. This patch changes the help documentations to ensure the 2 invariants given above. It implied to slightly rephrase or restructure some help docs. Based on the above invariants, print_doc_line (called by 'apropos' and 'help' commands to print the first line of a command help) now outputs the full first line of a command help. This all results in a lot of small changes in the produced help docs. There are less code changes than changes in the help docs, as a lot of docs are produced by some code (e.g. the remote packet usage settings). gdb/ChangeLog 2019-08-07 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-decode.h (print_doc_line): Add for_value_prefix argument. * cli/cli-decode.c (print_doc_line): Likewise. It now prints the full first line, except when FOR_VALUE_PREFIX. In this case, the trailing '.' is not output, and the first character is uppercased. (print_help_for_command): Update call to print_doc_line. (print_doc_of_command): Likewise. * cli/cli-setshow.c (deprecated_show_value_hack): Likewise. * cli/cli-option.c (append_indented_doc): Do not append newline. (build_help_option): Append newline after first appended_indented_doc only if a second call is done. (build_help): Append 2 new lines before each option, except the first one. * compile/compile.c (_initialize_compile): Add new lines after %OPTIONS%, when not at the end of the help. Change help doc or code producing the help doc to respect the invariants. * maint-test-options.c (_initialize_maint_test_options): Likewise. Also removed the new line after 'Options:', as all other commands do not put an empty line between 'Options:' and the first option. * printcmd.c (_initialize_printcmd): Likewise. * stack.c (_initialize_stack): Likewise. * interps.c (interpreter_exec_cmd): Fix "Usage:" line that was incorrectly telling COMMAND is optional. * ada-lang.c (_initialize_ada_language): Change help doc or code producing the help doc to respect the invariants. * ada-tasks.c (_initialize_ada_tasks): Likewise. * breakpoint.c (_initialize_breakpoint): Likewise. * cli/cli-cmds.c (_initialize_cli_cmds): Likewise. * cli/cli-logging.c (_initialize_cli_logging): Likewise. * cli/cli-setshow.c (_initialize_cli_setshow): Likewise. * cli/cli-style.c (cli_style_option::add_setshow_commands, _initialize_cli_style): Likewise. * corelow.c (core_target_info): Likewise. * dwarf-index-cache.c (_initialize_index_cache): Likewise. * dwarf2read.c (_initialize_dwarf2_read): Likewise. * filesystem.c (_initialize_filesystem): Likewise. * frame.c (_initialize_frame): Likewise. * gnu-nat.c (add_task_commands): Likewise. * infcall.c (_initialize_infcall): Likewise. * infcmd.c (_initialize_infcmd): Likewise. * interps.c (_initialize_interpreter): Likewise. * language.c (_initialize_language): Likewise. * linux-fork.c (_initialize_linux_fork): Likewise. * maint-test-settings.c (_initialize_maint_test_settings): Likewise. * maint.c (_initialize_maint_cmds): Likewise. * memattr.c (_initialize_mem): Likewise. * printcmd.c (_initialize_printcmd): Likewise. * python/lib/gdb/function/strfns.py (_MemEq, _StrLen, _StrEq, _RegEx): Likewise. * ravenscar-thread.c (_initialize_ravenscar): Likewise. * record-btrace.c (_initialize_record_btrace): Likewise. * record-full.c (_initialize_record_full): Likewise. * record.c (_initialize_record): Likewise. * regcache-dump.c (_initialize_regcache_dump): Likewise. * regcache.c (_initialize_regcache): Likewise. * remote.c (add_packet_config_cmd, init_remote_threadtests, _initialize_remote): Likewise. * ser-tcp.c (_initialize_ser_tcp): Likewise. * serial.c (_initialize_serial): Likewise. * skip.c (_initialize_step_skip): Likewise. * source.c (_initialize_source): Likewise. * stack.c (_initialize_stack): Likewise. * symfile.c (_initialize_symfile): Likewise. * symtab.c (_initialize_symtab): Likewise. * target-descriptions.c (_initialize_target_descriptions): Likewise. * top.c (init_main): Likewise. * tracefile-tfile.c (tfile_target_info): Likewise. * tracepoint.c (_initialize_tracepoint): Likewise. * tui/tui-win.c (_initialize_tui_win): Likewise. * utils.c (add_internal_problem_command): Likewise. * valprint.c (value_print_option_defs): Likewise. gdb/testsuite/ChangeLog 2019-08-07 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/style.exp: Update tests for help doc new invariants. * gdb.base/help.exp: Likewise.
2019-08-06Add file offsets to the source cacheTom Tromey1-1/+3
Currently, gdb stores the number of lines and an array of file offsets for the start of each line in struct symtab. This patch moves this information to the source cache. This has two benefits. First, it allows gdb to read a source file less frequently. Currently, a source file may be read multiple times: once when computing the file offsets, once when highlighting, and then pieces may be read again while printing source lines. With this change, the file is read once for its source text and file offsets; and then perhaps read again if it is evicted from the cache. Second, if multiple symtabs cover the same source file, then this will share the file offsets between them. I'm not sure whether this happens in practice. gdb/ChangeLog 2019-08-06 Tom Tromey <tromey@adacore.com> * annotate.c (annotate_source_line): Use g_source_cache. * source-cache.c (source_cache::get_plain_source_lines): Change parameters. Populate m_offset_cache. (source_cache::ensure): New method. (source_cache::get_line_charpos): New method. (extract_lines): Move lower. Change parameters. (source_cache::get_source_lines): Move lower. * source-cache.h (class source_cache): Update comment. <get_line_charpos>: New method. <get_source_lines>: Update comment. <clear>: Clear m_offset_cache. <get_plain_source_lines>: Change parameters. <ensure>: New method <m_offset_cache>: New member. * source.c (forget_cached_source_info_for_objfile): Update. (info_source_command): Use g_source_cache. (find_source_lines, open_source_file_with_line_charpos): Remove. (print_source_lines_base, search_command_helper): Use g_source_cache. * source.h (open_source_file_with_line_charpos): Don't declare. * symtab.h (struct symtab) <nlines, line_charpos>: Remove. * tui/tui-source.c (tui_source_window::do_scroll_vertical): Use g_source_cache.
2019-07-30Don't declare tui_copy_win or tui_box_winTom Tromey1-2/+0
tui_copy_win and tui_box_win are not implemented, so don't declare them. gdb/ChangeLog 2019-07-16 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_copy_win, tui_box_win): Don't declare.
2019-07-22Remove self-assign from make_invisible_and_set_new_heightTom Tromey1-2/+2
In https://sourceware.org/ml/gdb-patches/2019-07/msg00509.html, Jan pointed out that clang points out that make_invisible_and_set_new_height self-assigns "height". This patch fixes the bug by renaming the formal parameter. gdb/ChangeLog 2019-07-22 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_win_info::make_invisible_and_set_new_height): Don't self-assign.
2019-07-17Remove unnecessary "return"sTom Tromey4-14/+0
The TUI has some "return;" statements at the end of void-returning functions. There's no need for these, so this patch removes them. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_update_source_window) (tui_update_source_window_as_is) (tui_update_source_windows_with_line): Remove return. * tui/tui-disasm.c (tui_show_disassem) (tui_show_disassem_and_update_source): Remove return. * tui/tui.c (tui_reset): Remove return. * tui/tui-wingeneral.c (tui_check_and_display_highlight_if_needed): Remove return.
2019-07-17Fix an error in parse_scrolling_argsTom Tromey1-4/+4
parse_scrolling_args combines two errors into one message, which also happens to end with a newline. This separates the errors and fixes the message. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-win.c (parse_scrolling_args): Throw separate errors.
2019-07-17Move source window common to code to tui-winsource.[ch]Tom Tromey9-233/+231
Like the previous rearranging patches, this moves the source and disassembly window base class code to tui-winsource.[ch]. The execution info window is also moved, because it is associated with this base class. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_exec_info_window) (struct tui_source_window_base): Move from tui-data.h. * tui/tui-winsource.c: Move many method definitions from elsewhere. Remove "structuring" comments. * tui/tui-wingeneral.c (tui_source_window_base::make_visible) (tui_source_window_base::refresh_window): Move to tui-winsource.c. * tui/tui-win.c (tui_source_window_base::refresh_all) (tui_source_window_base::update_tab_width) (tui_source_window_base::set_new_height) (tui_source_window_base::do_make_visible_with_new_height): Move to tui-winsource.c. * tui/tui-source.h: Update. * tui/tui-source.c (tui_source_window_base::reset): Move to tui-winsource.c. * tui/tui-disasm.h: Update. * tui/tui-data.h (struct tui_exec_info_window): Move to tui-winsource.h. (struct tui_source_window_base): Likewise. * tui/tui-data.c (tui_source_window_base::clear_detail) (tui_source_window_base, ~tui_source_window_base): Move to tui-winsource.c.
2019-07-17Change make_invisible_and_set_new_height to be a methodTom Tromey2-43/+40
This changes make_invisible_and_set_new_height to be a method on tui_win_info. I felt that this was cleaner. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_resize_all) (tui_source_window_base::update_tab_width) (tui_adjust_win_heights): Update. (tui_win_info::make_invisible_and_set_new_height): Rename from make_invisible_and_set_new_height. * tui/tui-data.h (struct tui_win_info) <make_invisible_and_set_new_height>: New method.
2019-07-17Move tui_source_window to tui-source.hTom Tromey5-31/+34
This moves tui_source_window to tui-source.h. In this case there were no method definitions to be moved. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui.c: Update. * tui/tui-source.h (struct tui_source_window): Move from tui-data.h. * tui/tui-layout.c: Update. * tui/tui-disasm.c: Update. * tui/tui-data.h (struct tui_source_window): Move to tui-source.h.
2019-07-17Move tui_disasm_window to tui-disasm.hTom Tromey2-25/+25
This moves tui_disasm_window to tui-disasm.h. In this case there were no method definitions to be moved. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-disasm.h (struct tui_disasm_window): Move from tui-data.h. * tui/tui-data.h (struct tui_disasm_window): Move to tui-disasm.h.
2019-07-17Move TUI data item window to tui-regs.hTom Tromey4-30/+28
The TUI data item window is only used by the TUI register window. So, this patch moves the relevant code to tui-regs.[ch]. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_item_window): Move from tui-data.h. * tui/tui-regs.c (tui_data_item_window): Move from tui-data.c. * tui/tui-data.h (struct tui_data_item_window): Move to tui-regs.h. * tui/tui-data.c (~tui_data_item_window): Move to tui-regs.c.
2019-07-17Move TUI command window codeTom Tromey7-81/+80
Like the earlier change to the data window, this moves the TUI command window code to tui-command.[ch], and removes the old "structuring" comments from tui-command.c. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui.c: Update. * tui/tui-win.c (tui_cmd_window::do_make_visible_with_new_height) (tui_cmd_window::max_height): Move to tui-command.c. * tui/tui-layout.c: Update. * tui/tui-data.h (struct tui_cmd_window): Move to tui-command.h. * tui/tui-data.c (tui_cmd_window::clear_detail): Move to tui-command.c. * tui/tui-command.h (struct tui_cmd_window): Move from tui-data.h. * tui/tui-command.c: Remove "structuring" comments. (tui_cmd_window::clear_detail) (tui_cmd_window::do_make_visible_with_new_height) (tui_cmd_window::max_height): Move from elsewhere.
2019-07-17Move tui_dispatch_ctrl_char to tui-io.cTom Tromey3-53/+51
tui_dispatch_ctrl_char is only called from a single spot in tui-io.c, so move the function to that file and make it static. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-io.c (tui_dispatch_ctrl_char): Move from tui-command.c. Now static. * tui/tui-command.h (tui_dispatch_ctrl_char): Don't declare. * tui/tui-command.c (tui_dispatch_ctrl_char): Move to tui-io.c.
2019-07-17Rearrange TUI data window codeTom Tromey11-353/+262
An earlier patch caused tui-windata.h to be essentially empty. And, other earlier patches implemented TUI data window methods in any spot that happened to be convenient at the time. This patch rearranges all the data window code to be somewhat more organized. It moves tui_data_window to tui-regs.h, and moves the implementation of all methods to tui-regs.c. It then removes tui-windata.h and tui-windata.c. It also removes the "structuring" comments from tui-regs.c; these are not the usual gdb style, and were out of date anyhow. Finally, it moves _initialize_tui_regs to the end of the file, per the usual gdb convention. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui.c: Update. * tui/tui-wingeneral.c (tui_data_window::refresh_window): Move to tui-regs.c. * tui/tui-windata.h: Remove file. * tui/tui-windata.c: Remove file. * tui/tui-win.c (tui_data_window::set_new_height) (tui_data_window::do_make_visible_with_new_height): Move to tui-regs.c. * tui/tui-regs.h (struct tui_data_window): Move from tui-data.h. * tui/tui-regs.c: Remove "structuring" comments. (tui_data_window::first_data_item_displayed) (tui_data_window::delete_data_content_windows) (tui_data_window::erase_data_content) (tui_data_window::display_all_data) (tui_data_window::refresh_all) (tui_data_window::do_scroll_vertical) (tui_data_window::clear_detail, tui_data_window::set_new_height) (tui_data_window::do_make_visible_with_new_height) (tui_data_window::refresh_window): Move from elsewhere. (_initialize_tui_regs): Move to end of file. * tui/tui-layout.c: Update. * tui/tui-hooks.c: Update. * tui/tui-data.h (struct tui_data_window): Move to tui-regs.h. * tui/tui-data.c (tui_data_window::clear_detail): Move to tui-regs.c. * Makefile.in (SUBDIR_TUI_SRCS): Remove tui-windata.c.
2019-07-17Fix flushing bug in tui_puts_internalTom Tromey1-0/+6
A while back I changed gdb not to flush in some places. It turned out that this broke the TUI a little. An easy way to see it is to run "gdb -tui -nx", then "file gdb" at the gdb prompt. gdb will print the usual "Reading symbols..." message -- but it won't appear on-screen until the reading is complete. This patch changes the TUI to do the equivalent of line buffering in tui_puts_internal. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-io.c (tui_puts_internal): Call wrefresh if newline is seen.
2019-07-17Remove has_locator methodTom Tromey2-14/+2
Earlier changes made it obvious that the has_locator method can only be called for source/disassembly windows. Because the only reference to this now occurs in methods on this object, we can remove the has_locator method entirely, in favor of using the member directly. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_source_window_base::set_new_height) (tui_source_window_base::do_make_visible_with_new_height): Use m_has_locator field directly. * tui/tui-data.h (struct tui_win_info) <has_locator>: Remove method. (struct tui_source_window_base) <has_locator>: Likewise.
2019-07-17Remove tui_make_visible and tui_make_invisibleTom Tromey4-27/+13
tui_make_visible and tui_make_invisible are just wrappers for a method call, so remove them and have the callers simply make the method call themselves. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_make_visible, tui_make_invisible): Don't declare. * tui/tui-wingeneral.c (tui_make_visible, tui_make_invisible): Remove. * tui/tui-win.c (tui_source_window_base::set_new_height) (tui_source_window_base::set_new_height) (make_invisible_and_set_new_height) (tui_source_window_base::do_make_visible_with_new_height) (tui_source_window_base::do_make_visible_with_new_height): Update. * tui/tui-layout.c (show_source_disasm_command, show_data) (show_source_or_disasm_and_command): Update. * tui/tui-layout.c (show_layout): Update.
2019-07-17Remove make_data_windowTom Tromey1-15/+2
As with the previous patches, unifying the creation and re-initialization cases for the data window lets us remove make_data_window in favor of simply using "new". gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (make_data_window): Remove. (show_data): Unify creation and re-initialization cases.
2019-07-17Remove make_source_window and make_disasm_windowTom Tromey1-51/+15
This unifies the remaining creation and re-initialization cases for the source and disassembly windows. Once this is done, it's clear that make_source_window and make_disasm_window aren't needed any more, so remove them. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (make_source_window, make_disasm_window): Remove. (show_data): Unify creation and re-initialization cases.
2019-07-17Remove make_command_windowTom Tromey1-34/+16
This unifies the creation and re-initialization cases for the command window. When this is done, it becomes clear that make_command_window isn't needed -- it can be replaced with a simple "new", so this is removed as well. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (make_command_window): Remove. (show_source_disasm_command, show_source_or_disasm_and_command): Unify creation and re-initialization cases.
2019-07-17Simplify show_source_or_disasm_and_commandTom Tromey1-29/+20
This changes show_source_or_disasm_and_command to unify the creation and re-initialization cases. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (show_source_or_disasm_and_command): Unify creation and re-initialization cases.
2019-07-17Change tui_get_register to return voidTom Tromey1-9/+4
tui_get_register returns a tui_status, but nothing checks this, so it can return void instead. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_get_register): Return void.
2019-07-17Simplify tui_gen_win_info::make_visibleTom Tromey1-12/+7
I noticed that tui_gen_win_info::make_visible was much wordier than it needed to be. This simplifies it. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_gen_win_info::make_visible): Simplify.
2019-07-17Simplify show_source_disasm_commandTom Tromey1-31/+17
This is the first of a few patches to further simplify window (re-)initialization in tui-layout.c. When changing the layout, a window may be created or, if it already exists, simply resized. These two cases normally are identical, but this was obscured by the way the code was written. This patch changes show_source_disasm_command to unify the creation and re-initialization cases. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (show_source_disasm_command): Simplify window resetting.
2019-07-17Clean up tui_layout_commandTom Tromey3-64/+51
tui_layout_command is a simple wrapper for tui_set_layout_by_name. This removes the extra layer and cleans up the resulting function a bit -- changing it to call error rather than return a result. This necessitated a small change to tui-regs.c, to avoid calling the function that is being removed. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui.h (tui_set_layout_by_name): Don't declare. * tui/tui-regs.c (tui_reg_layout): New function. (tui_show_registers, tui_reg_command): Use it. * tui/tui-layout.c (LAYOUT_USAGE): Remove. (tui_layout_command): Rename from tui_set_layout_by_name. Change parameters. (tui_layout_command): Remove.
2019-07-17Change tui_set_layout to return voidTom Tromey2-88/+81
tui_set_layout can't meaningfully be called with UNDEFINED_LAYOUT; and instead of trying to handle this case, simply assert and have the function return void. No caller was checking the return value anyway. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-layout.h (tui/tui-layout): Return void. * tui/tui-layout.c (tui_set_layout): Return void. Add assert.
2019-07-17Remove reset_locatorTom Tromey1-27/+12
reset_locator was introduced just a few patches ago, but it's already time to remove it. It consists of a call to the locator's "reset" method, plus a call to tui_make_window; but the latter is redundant at all the places that call reset_locator. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (show_source_disasm_command, show_data): Update. (reset_locator): Remove. (show_source_or_disasm_and_command): Update.
2019-07-17Remove the win_type parameter from tui_gen_win_info::resetTom Tromey3-38/+22
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.
2019-07-17Introduce reset_locator function in tui-layout.cTom Tromey1-66/+23
init_and_make_win in tui-layout.c is now only called for the locator -- earlier changes have made most of the cases here obsolete. This patch removes init_and_make_win and introduces a reset_locator function. Window creation is now much simpler to follow, because it is no longer quite so dynamic. (Though it will become even simpler in coming patches.) gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (show_source_disasm_command): Use reset_locator. (reset_locator): New function. (init_and_make_win): Remove. (show_source_or_disasm_and_command): Use reset_locator.
2019-07-17Always create an execution info window for a source windowTom Tromey6-126/+83
A source or disassembly window will always have an "execution info" window (the window along the side that displays breakpoint info), but this isn't immediately clear from the source. As a result, some code has checks to see whether the execution_info is NULL. This changes the source window base class to always instantiate an execution_info window, then updates the rest of the code. It also simplifies window creation in tui-layout.c. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_set_exec_info_content): Remove condition. * tui/tui-wingeneral.c (tui_source_window_base::make_visible): Remove condition. * tui/tui-source.c (tui_source_window_base::reset): New method. * tui/tui-layout.c (make_command_window): Don't call init_and_make_win. (make_source_window, make_disasm_window): Don't call make_source_or_disasm_window. (make_data_window): Don't call init_and_make_win. Change calling convention. (show_source_disasm_command, show_data): Simplify. (make_source_or_disasm_window): Remove. (show_source_or_disasm_and_command): Simplify. * tui/tui-data.h (struct tui_gen_win_info) <reset>: Now virtual. (struct tui_source_window_base) <reset>: Likewise. <execution_info>: Remove initializer. * tui/tui-data.c (tui_source_window_base): Initialize execution_info.