aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-win.c
AgeCommit message (Collapse)AuthorFilesLines
2019-09-09Use ui_out for "info win"Tom Tromey1-6/+14
This changes the "info win" command to use ui-out. This yields somewhat nicer table output. gdb/ChangeLog 2019-09-09 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_all_windows_info): Use ui_out.
2019-08-30Remove tui_win_info::refresh_allTom Tromey1-6/+0
The TUI has two duplicate "re-render this window" methods, "rerender" and "refresh_all". They differ only slightly in semantics, so I wanted to see if they could be unified. After looking into this, I decided that refresh_all was not needed. There are 4 calls to tui_refresh_all_win (the only caller of this method): 1. tui_enable. This sets the layout, which renders the windows. 2. tui_cont_sig. Here, I think it's sufficient to simply redraw the current window contents from the curses backing store, because gdb state didn't change while it was suspended 3. tui_dispatch_ctrl_char. This is the C-l handler, and here it's explicitly enough to just refresh the screen (as above). 4. tui_refresh_all_command. This is the command equivalent of C-l. So, this patch removes this method entirely and simplifies tui_refresh_all_win. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <refresh_all>: Don't declare. * tui/tui-winsource.c (tui_source_window_base::refresh_all): Remove. * tui/tui-win.c (tui_refresh_all_win): Don't call refresh_all or tui_show_locator_content. * tui/tui-regs.h (struct tui_data_window) <refresh_all>: Don't declare. * tui/tui-regs.c (tui_data_window::refresh_all): Remove. * tui/tui-data.h (struct tui_win_info) <refresh_all>: Don't declare.
2019-08-16Remove separate visibility flagTom Tromey1-7/+7
TUI windows keep track of their visibility in a boolean field. However, this is not needed, because a window is visible if and only if it has an underlying curses handle. So, we can remove this separate field. gdb/ChangeLog 2019-08-16 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_is_window_visible): Update. * tui/tui-wingeneral.c (tui_make_window) (tui_gen_win_info::make_visible, tui_refresh_all): Update. * tui/tui-win.c (window_name_completer, tui_refresh_all_win) (tui_set_focus_command, tui_all_windows_info, update_tab_width) (tui_set_win_height_command, parse_scrolling_args): Update. * tui/tui-source.c (tui_source_window::style_changed): Update. * tui/tui-regs.c (tui_show_registers) (tui_data_window::first_data_item_displayed) (tui_data_window::delete_data_content_windows) (tui_check_register_values, tui_reg_command): Update. * tui/tui-disasm.c (tui_show_disassem): Update. * tui/tui-data.h (struct tui_gen_win_info) <is_visible>: New method. <is_visible>: Remove field. * tui/tui-data.c (tui_next_win, tui_prev_win) (tui_delete_invisible_windows): Update.
2019-08-15TUI resize unificationTom Tromey1-87/+52
The TUI currently has two different ways to resize a window: the resize method, and the methods make_invisible_and_set_new_height and make_visible_with_new_height. There's no deep reason to have two different ways to resize a window, so this patch unifies them, leaving just the "resize" method. This also changes the locator to be handled more like an ordinary window and less like an adjunct of the associated source window. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-io.c (tui_puts_internal): Check TUI_CMD_WIN before calling update_cmdwin_start_line. * tui/tui-winsource.h (struct tui_source_window_base) <do_make_visible_with_new_height, set_new_height>: Don't declare. <rerender>: Declare. * tui/tui-winsource.c (tui_source_window_base::update_tab_width): Call rerender. (tui_source_window_base::set_new_height): Remove. (tui_source_window_base::rerender): Rename from do_make_visible_with_new_height. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Use resize method. (tui_win_info::make_invisible_and_set_new_height) (tui_win_info::make_visible_with_new_height): Remove. * tui/tui-stack.h (struct tui_locator_window) <rerender>: Declare. * tui/tui-stack.c (tui_locator_window::rerender): New method. * tui/tui-regs.h (struct tui_data_window) <set_new_height, do_make_visible_with_new_height>: Don't declare. <rerender>: Declare. * tui/tui-regs.c (tui_data_window::rerender): Rename from set_new_height. (tui_data_window::do_make_visible_with_new_height): Remove. * tui/tui-layout.c (show_source_disasm_command, show_data): Don't call tui_show_locator_content. (tui_gen_win_info::resize): Call rerender. (show_source_or_disasm_and_command): Don't call tui_show_locator_content. * tui/tui-data.h (struct tui_gen_win_info) <rerender>: New method. (struct tui_win_info) <rerender>: Declare. <set_new_height, make_invisible_and_set_new_height, make_visible_with_new_height>: Don't declare. * tui/tui-data.c (tui_win_list::rerender): New method. * tui/tui-command.h (struct tui_cmd_window) <do_make_visible_with_new_height>: Don't declare. * tui/tui-command.c (tui_cmd_window::do_make_visible_with_new_height): Remove. gdb/testsuite/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * gdb.tui/empty.exp: Enable resizing tests.
2019-08-15Change TUI source window iterationTom Tromey1-7/+7
Currently the TUI does separate bookkeeping to track which source windows exist. It seems better to me to just refer to the list of windows for this, so this patch removes the special handling and instead adds a new iterator. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_iterator): New. (struct tui_source_windows): New. * tui/tui-winsource.c (tui_display_main): Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights) (new_height_ok, parse_scrolling_args): Update. * tui/tui-layout.c (show_layout, show_data): Update. * tui/tui-data.h (tui_source_windows, tui_clear_source_windows) (tui_add_to_source_windows): Don't declare. * tui/tui-data.c (source_windows, tui_source_windows) (tui_clear_source_windows, tui_add_to_source_windows): Remove.
2019-08-15Turn tui_erase_source_content into a methodTom Tromey1-5/+5
This changes tui_erase_source_content into a method on tui_source_window_base. The bulk of the work is moved into a helper method, so that the callers can each pass the string appropriate to the particular window class. gdb/ChangeLog 2019-08-15 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_base) <do_erase_source_content>: New method. <erase_source_content>: New method. (tui_erase_source_content): Don't declare. * tui/tui-winsource.c (tui_clear_source_content): Update. (tui_source_window_base::do_erase_source_content): Rename from tui_erase_source_content. (tui_source_window_base::show_source_content): Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update. * tui/tui-source.h (struct tui_source_window) <erase_source_content>: New method. * tui/tui-disasm.h (struct tui_disasm_window) <erase_source_content>: New method.
2019-08-13Change tui_check_and_display_highlight_if_needed to be a methodTom Tromey1-2/+2
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 Tromey1-13/+2
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-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-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-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 Tromey1-90/+0
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 Tromey1-43/+35
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 command window codeTom Tromey1-20/+1
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-17Rearrange TUI data window codeTom Tromey1-22/+0
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-17Remove has_locator methodTom Tromey1-2/+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 Tromey1-5/+5
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 TUI data window special caseTom Tromey1-2/+0
The TUI has a couple of special cases for updating the data window: one in tui_rl_other_windowand one in tui_set_focus_command. As part of the project to remove references to globals, I wanted to remove these calls; but when I did, some simple operations (like "C-x o") would cause the register window to blank. This fixes the underlying problem by arranging for the data window's refresh_window method to call the superclass method first, and then to refresh the child windows. Then the special cases can be removed. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_rl_other_window): Update. * tui/tui-wingeneral.c (tui_data_window::refresh_window): Call superclass method first. Always iterate over regs_content. (tui_unhighlight_win, tui_highlight_win): Use refresh_window method. * tui/tui-win.c (tui_set_focus_command): Update.
2019-07-17Remove tui_set_focusTom Tromey1-11/+3
tui_set_focus_command is a simple wrapper for tui_set_focus, so rename the latter and remove the wrapper function. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_set_focus_command): Rename from tui_set_focus. Call tui_enable. (tui_set_focus_command): Remove.
2019-07-17Remove unused parameter from two TUI functionsTom Tromey1-6/+5
The "display_prompt" parameter of tui_erase_source_content and tui_clear_source_content was never passed the NO_EMPTY_SOURCE_PROMPT value, so remove the parameter. Once this is done, the EMPTY_SOURCE_PROMPT and NO_EMPTY_SOURCE_PROMPT defines are unused, so remove those as well. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_erase_source_content) (tui_clear_source_content): Remove "display_prompt" parameter. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_update_source_windows_with_addr): Update. (tui_clear_source_content): Remove "display_prompt" parameter. (tui_erase_source_content): Likewise. Simplify. (tui_show_source_content): Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update. * tui/tui-stack.c (tui_show_frame_info): Update. * tui/tui-data.h (EMPTY_SOURCE_PROMPT, NO_EMPTY_SOURCE_PROMPT): Remove defines.
2019-07-17Remove tui_set_win_heightTom Tromey1-11/+1
tui_set_win_height_command is just a simple wrapper for tui_set_win_height, so rename the latter and remove the wrapper. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_set_win_height_command): Rename from tui_set_win_height. (tui_set_win_height_command): Remove.
2019-07-17Fix comment typosTom Tromey1-1/+1
This fixes a couple of comment typos that I noticed. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-data.c (tui_clear_source_windows_detail): Fix typo. * tui/tui-win.c (tui_resize_all): Fix typo.
2019-07-17Introduce TUI window iteratorTom Tromey1-28/+19
This introduces an iterator class and a range adapter to make it simpler to iterate over TUI windows. One explicit iteration remains, in tui-win.c, because that spot is deleting windows as well. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_refresh_all): Update. * tui/tui-wingeneral.c (make_all_visible): Use foreach. (tui_refresh_all): Remove "list" parameter. Use foreach. * tui/tui-win.c (window_name_completer): Use foreach. (tui_refresh_all_win, tui_rehighlight_all, tui_all_windows_info) (update_tab_width): Likewise. * tui/tui-layout.c (show_layout): Update. * tui/tui-data.h (class tui_window_iterator): New. (struct all_tui_windows): New. * tui/tui-data.c (tui_partial_win_by_name): Use foreach.
2019-07-17Introduce tui_data_window::display_all_data methodTom Tromey1-1/+1
This changes tui_display_all_data to be a method on tui_data_window. This helps cluster uses of the TUI_DATA_WIN global. gdb/ChangeLog 2019-07-17 Tom Tromey <tom@tromey.com> * tui/tui-windata.h (tui_display_all_data): Don't declare. * tui/tui-windata.c (tui_data_window::display_all_data): Rename from tui_display_all_data. * tui/tui-win.c (tui_data_window::do_make_visible_with_new_height): Update. * tui/tui-regs.c (tui_show_registers): Update. * tui/tui-layout.c (tui_set_layout): Update. * tui/tui-data.h (struct tui_data_window) <display_all_data>: New method.
2019-06-25Remove union tui_which_elementTom Tromey1-12/+13
This removes union tui_which_element, instead moving the content directly into tui_source_window_base. This allows for the deletion of a fair amount of code. Now the TUI window hierarchy is more type-safe. In particular, there is never any confusion now about which members are in use by which subtype. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_update_source_window_as_is) (tui_alloc_source_buffer, tui_line_is_displayed) (tui_addr_is_displayed): Change type of win_info. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_clear_source_content, tui_show_source_line) (tui_show_source_content, tui_source_window_base::refill) (tui_source_window_base::set_is_exec_point_at) (tui_source_window_base::set_is_exec_point_at) (tui_update_breakpoint_info, tui_set_exec_info_content): Update. (tui_alloc_source_buffer, tui_line_is_displayed) (tui_addr_is_displayed): Change type of win_info. Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights) (tui_source_window_base::do_make_visible_with_new_height): Update. * tui/tui-source.c (tui_set_source_content) (tui_set_source_content_nil) (tui_source_window::do_scroll_vertical): Update. * tui/tui-layout.c (show_layout): Update. * tui/tui-disasm.c (tui_set_disassem_content) (tui_disasm_window::do_scroll_vertical): Update. * tui/tui-data.h (tui_win_content): Remove. (struct tui_gen_win_info) <content, content_size>: Remove. (struct tui_source_element): Add initializers and destructor. (union tui_which_element, struct tui_win_element): Remove. (struct tui_source_window_base) <content>: New field. (struct tui_data_window): Remove destructor. (tui_alloc_content, tui_free_win_content) (tui_free_all_source_wins_content): Don't declare. * tui/tui-data.c (tui_initialize_static_data): Update. (init_content_element, tui_alloc_content): Remove. (~tui_gen_win_info): Update. (~tui_data_window, tui_free_all_source_wins_content) (tui_free_win_content, free_content, free_content_elements): Remove.
2019-06-25More type safety for TUI source window functionsTom Tromey1-15/+24
A few functions can only operate on a source or disassembly window. This patch adds a bit more type safety to a few of these functions. This simplifies a subsequent patch. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_clear_source_content) (tui_erase_source_content, tui_show_source_content): Change type of win_info. * tui/tui-winsource.c (tui_clear_source_content) (tui_erase_source_content, tui_show_source_content): Change type of win_info. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Update. * tui/tui-source.h (tui_set_source_content_nil): Change type of win_info. * tui/tui-source.c (tui_set_source_content_nil): Change type of win_info. * tui/tui-layout.c (show_source_or_disasm_and_command): Update.
2019-06-25Fix "auxiliary" typoTom Tromey1-2/+2
The TUI has a function called tui_win_is_auxillary, but the word should actually be spelled "auxiliary". This fixes the typo. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_gen_win_info::make_visible): Update. * tui/tui-win.c (make_invisible_and_set_new_height): Update. * tui/tui-layout.c (init_and_make_win): Update. * tui/tui.h (enum tui_win_type): Update. * tui/tui-data.h (tui_win_is_auxiliary): Rename from tui_win_is_auxillary. * tui/tui-data.c (tui_win_is_auxiliary): Rename from tui_win_is_auxillary.
2019-06-25Separate out data windowTom Tromey1-5/+3
This removes "data_window" from union tui_which_element and updates the uses. It also changes how tui_data_window refers to the register data, and changes it not to need the "content" field at all (though as this is in a base class, it can't yet be removed). gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_data_window::refresh_window): Update. * tui/tui-windata.c (tui_data_window::first_data_item_displayed) (tui_delete_data_content_windows, tui_display_all_data) (tui_data_window::do_scroll_vertical, tui_display_data_from): Update. * tui/tui-win.c (tui_data_window::set_new_height): Simplify. * tui/tui-regs.c (tui_last_regs_line_no) (tui_line_from_reg_element_no, tui_first_reg_element_no_inline) (tui_show_registers): Update. (tui_show_register_group): Return void. Update. (tui_display_registers_from, tui_display_reg_element_at_line) (tui_display_registers_from_line, tui_check_register_values): Update. * tui/tui-data.h (union tui_which_element) <data_window>: Remove member. (struct tui_data_window) <regs_content>: Now a std::vector. <regs_content_count>: Remove. (tui_add_content_elements, tui_free_data_content): Don't declare. * tui/tui-data.c (tui_data_window::clear_detail): Update. (init_content_element): Remove DATA_WIN case. Add assert. (tui_add_content_elements): Remove. (tui_data_window): Update. (tui_free_data_content): Remove. (free_content_elements): Remove DATA_WIN case.
2019-06-25Separate out locator windowTom Tromey1-3/+3
This introduces a new subclass of tui_gen_win_info for the locator, letting us remove another element from union tui_which_element. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_refresh_all): Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights) (tui_source_window_base::set_new_height): Update. * tui/tui-stack.c (tui_make_status_line): Change parameter type. Update. (tui_set_locator_fullname, tui_set_locator_info) (tui_show_frame_info): Update. * tui/tui-source.c (tui_set_source_content) (tui_source_is_displayed): Update. * tui/tui-layout.c (show_source_disasm_command, show_data) (show_source_or_disasm_and_command): Update. * tui/tui-disasm.c (tui_set_disassem_content) (tui_get_begin_asm_address): Update. * tui/tui-data.h (struct tui_locator_element): Remove. (union tui_which_element) <locator>: Remove. (struct tui_locator_window): New. (tui_locator_win_info_ptr): Change return type. * tui/tui-data.c (_locator): Change type. (tui_locator_win_info_ptr): Change return type. (init_content_element): Remove LOCATOR_WIN case. Add assert. (tui_alloc_content): Add assert.
2019-06-25Don't check window type in tui_set_win_focus_toTom Tromey1-5/+2
This changes tui_set_win_focus_to so that it no longer checks the window type. Instead, now tui_unhighlight_win also checks whether the window can be highlighted. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_set_win_focus_to): Don't check window type. * tui/tui-wingeneral.c (tui_unhighlight_win): Check can_highlight.
2019-06-25Introduce tui_win_info::make_visible_with_new_heightTom Tromey1-78/+76
This changes make_visible_with_new_height to be a method on tui_win_info, letting us remove a spot that checks the window type. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_source_window_base::update_tab_width): Call make_visible_with_new_height method. (tui_win_info::make_visible_with_new_height): New method. (tui_source_window_base::do_make_visible_with_new_height) (tui_data_window::do_make_visible_with_new_height) (tui_cmd_window::do_make_visible_with_new_height): New methods. (make_visible_with_new_height): Remove. (tui_resize_all, tui_adjust_win_heights): Use make_visible_with_new_height method. * tui/tui-data.h (struct tui_win_info) <do_make_visible_with_new_height, make_visible_with_new_height>: New methods. (struct tui_source_window_base, struct tui_data_window) (struct tui_cmd_window) <do_make_visible_with_new_height>: New methods.
2019-06-25Introduce tui_win_info::update_tab_widthTom Tromey1-16/+17
This introduces a new tui_win_info::update_tab_width method, and changes the TUI to call it. This fixes another spot that was checking the window type. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_source_window_base::update_tab_width): New method. (update_tab_width): Call update_tab_width method. * tui/tui-data.h (struct tui_win_info) (struct tui_source_window_base) <update_tab_width>: New methods.
2019-06-25Remove tui_scroll_direction enumTom Tromey1-4/+4
The tui_scroll_direction enum is not really needed, because it's simple to adapt the various scrolling methods to use the sign of their argument as the direction in which to scroll. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_source_window_base::do_scroll_horizontal): Remove direction parameter. * tui/tui-windata.c (tui_data_window::do_scroll_vertical): Remove direction parameter. * tui/tui-win.c (tui_win_info::forward_scroll) (tui_win_info::backward_scroll, tui_win_info::left_scroll) (tui_win_info::right_scroll): Update. * tui/tui-source.c (tui_source_window::do_scroll_vertical): Remove direction parameter. * tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Remove direction parameter. * tui/tui-data.h (enum tui_scroll_direction): Remove. (struct tui_win_info) <do_scroll_vertical, do_scroll_horizontal>: Remove direction parameter. (struct tui_source_window_base, struct tui_source_window) (struct tui_disasm_window, struct tui_data_window) (struct tui_cmd_window): Update.
2019-06-25Introduce tui_gen_win_info::name methodTom Tromey1-4/+4
This removes tui_win_name and replaces it with a method on tui_gen_win_info, removing another spot that switched on window type. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-win.c (window_name_completer, tui_set_focus) (tui_all_windows_info): Use name method. * tui/tui-data.h (struct tui_gen_win_info) (struct tui_source_window, struct tui_disasm_window) (struct tui_data_window, struct tui_cmd_window) <name>: New method. (tui_win_name): Don't declare. * tui/tui-data.c (tui_partial_win_by_name): Use name method. (tui_win_name): Remove.
2019-06-25Change tui_update_source_window for better type safetyTom Tromey1-2/+2
tui_update_source_window can only be called for source and disassembly windows, so change the argument type to enforce this at compile time. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_update_source_window) (tui_update_source_window_as_is): Change parameter type. * tui/tui-winsource.c (tui_update_source_window): Change win_info to be a tui_source_window_base. (tui_update_source_window_as_is): Likewise. * tui/tui-win.c (make_visible_with_new_height): Update.
2019-06-25Derive tui_win_info from tui_gen_win_infoTom Tromey1-119/+119
This changes tui_win_info to derive from tui_gen_win_info, rather than having a tui_gen_win_info as a member. This removes a layer of member access from the entire TUI, which is why this patch is so large. This change will enable further removal of switches based on window type. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_rl_other_window, tui_enable) (tui_is_window_visible, tui_get_command_dimension): Update. * tui/tui-winsource.c (tui_update_source_window_as_is) (tui_clear_source_content, tui_erase_source_content) (tui_show_source_line, tui_source_window_base::refill) (tui_source_window_base::do_scroll_horizontal) (tui_source_window_base::set_is_exec_point_at) (tui_update_breakpoint_info, tui_set_exec_info_content) (tui_alloc_source_buffer, tui_line_is_displayed) (tui_addr_is_displayed): Update. * tui/tui-wingeneral.c (tui_unhighlight_win, tui_highlight_win) (tui_check_and_display_highlight_if_needed) (tui_win_info::make_visible, tui_win_info::refresh) (tui_refresh_all): Update. * tui/tui-windata.c (tui_first_data_item_displayed) (tui_delete_data_content_windows, tui_erase_data_content) (tui_display_all_data, tui_data_window::refresh_all) (tui_check_data_values): Update. * tui/tui-win.c (window_name_completer, tui_update_gdb_sizes) (tui_set_win_focus_to, tui_win_info::forward_scroll) (tui_win_info::backward_scroll, tui_refresh_all_win) (tui_resize_all, tui_set_focus, tui_all_windows_info) (update_tab_width, tui_set_win_height, tui_adjust_win_heights) (tui_source_window_base::set_new_height) (tui_data_window::set_new_height) (make_invisible_and_set_new_height) (make_visible_with_new_height, new_height_ok) (parse_scrolling_args): Update. * tui/tui-stack.c (tui_show_frame_info): Update. * tui/tui-source.c (tui_set_source_content) (tui_set_source_content_nil, tui_source_is_displayed) (tui_source_window::do_scroll_vertical): Update. * tui/tui-regs.c (tui_show_registers, tui_show_register_group) (tui_display_registers_from, tui_display_reg_element_at_line) (tui_check_register_values, tui_reg_command): Update. * tui/tui-layout.c (tui_default_win_height) (show_source_disasm_command, show_data, init_and_make_win) (show_source_or_disasm_and_command): Update. * tui/tui-io.c (update_cmdwin_start_line, tui_putc, tui_puts) (tui_redisplay_readline, tui_mld_flush) (tui_mld_erase_entire_line, tui_mld_getc, tui_cont_sig) (tui_getc): Update. * tui/tui-disasm.c (tui_set_disassem_content) (tui_disasm_window::do_scroll_vertical): Update. * tui/tui-data.h (struct tui_gen_win_info) <~tui_gen_win_info>: Now virtual. (struct tui_win_info): Derive from tui_gen_win_info. <~tui_win_info>: Mark as override. <generic>: Remove member. * tui/tui-data.c (tui_cmd_window::clear_detail, tui_next_win) (tui_prev_win, tui_partial_win_by_name, tui_win_info) (~tui_data_window, ~tui_win_info) (tui_free_all_source_wins_content): Update. * tui/tui-command.c (tui_refresh_cmd_win): Update.
2019-06-25Change tui_which_element::data_window to be a pointerTom Tromey1-1/+1
A coming patch will add a constructor to tui_gen_win_info. However, because the tui_which_element union contains an object of this type, first something must be done here in order to avoid having a union with a member that has a constructor. This patch changes this element to be a pointer instead. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_refresh_win): Update. * tui/tui-windata.c (tui_first_data_item_displayed) (tui_delete_data_content_windows): Update. * tui/tui-win.c (tui_data_window::set_new_height): Update. * tui/tui-regs.c (tui_show_registers, tui_show_register_group) (tui_display_registers_from, tui_check_register_values): Update. * tui/tui-data.h (union tui_which_element) <data_window>: Now a pointer. * tui/tui-data.c (init_content_element): Update. Allocate the new window. (tui_free_data_content): Update. (free_content_elements) <case DATA_WIN>: Free the window.
2019-06-25Introduce max_height methodTom Tromey1-6/+18
This introduces the tui_win_info::max_height method and changes new_height_ok to use it, rather than checking the window type directly. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_win_info::max_height) (tui_cmd_window::max_height): New methods. (new_height_ok): Call max_height. * tui/tui-data.h (struct tui_win_info, struct tui_cmd_window) <max_height>: New method.
2019-06-25Introduce set_new_height methodTom Tromey1-40/+38
This introduces tui_win_info::set_new_height and implements it in the subclasses as appropriate. This removes another switch on the window type. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_source_window_base::set_new_height) (tui_data_window::set_new_height): New methods. (make_invisible_and_set_new_height): Call set_new_height method. * tui/tui-data.h (struct tui_win_info) (struct tui_source_window_base, struct tui_data_window) <set_new_height>: New method.
2019-06-25Introduce the refresh_all methodTom Tromey1-20/+14
This introduces the tui_win_info::refresh_all method and implements it as needed in subclasses. The name and comment are a bit of a guess on my part. The main benefit of this patch is removing another switch on the type of the window. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_rl_other_window): Call the refresh_all method. * tui/tui-windata.c (tui_data_window::refresh_all): Rename from tui_refresh_data_win. * tui/tui-win.c (tui_source_window_base::refresh_all): New method. (tui_refresh_all_win): Call the refresh_all method. (tui_set_focus): Likewise. * tui/tui-data.h (struct tui_win_info) <refresh_all>: New method. (struct tui_source_window_base, struct tui_data_window) <refresh>: Likewise.
2019-06-25Remove struct tui_source_infoTom Tromey1-5/+9
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.
2019-06-25Introduce has_locator methodTom Tromey1-2/+2
This changes tui_win_has_locator to be a method on tui_win_info, and changes the locator code to use bool rather than int. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-win.c (make_invisible_and_set_new_height) (make_visible_with_new_height): Call has_locator method. * tui/tui-layout.c (show_source_disasm_command, show_data) (show_source_or_disasm_and_command): Update for bool change. * tui/tui-data.h (struct tui_source_info) <has_locator>: Now bool. (tui_win_info) <has_locator>: New method. (struct tui_source_window_base) <has_locator>: New method. (tui_win_has_locator): Don't declare. * tui/tui-data.c (tui_source_window_base::has_locator): Rename from tui_win_has_locator. (tui_source_window_base): Use false, not FALSE.
2019-06-25Introduce methods for scrollingTom Tromey1-107/+23
This changes the TUI to use virtual methods on the various window types for scrolling. Window-specific functions for this purpose are renamed to be methods, and the generic tui_scroll function is removed as it is no longer called. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_horizontal_source_scroll): Don't declare. * tui/tui-winsource.c (tui_source_window_base::do_scroll_horizontal): Rename from tui_horizontal_source_scroll. * tui/tui-windata.h (tui_vertical_data_scroll): Don't declare. * tui/tui-windata.c (tui_data_window::do_scroll_vertical): Rename from tui_vertical_data_scroll. * tui/tui-win.h (tui_scroll): Don't declare. * tui/tui-win.c (tui_win_info::forward_scroll) (tui_win_info::backward_scroll, tui_win_info::left_scroll) (tui_win_info::right_scroll): Rename and update. (tui_scroll_forward_command, tui_scroll_backward_command) (tui_scroll_left_command, tui_scroll_right_command): Update. (tui_scroll): Remove. * tui/tui-source.h: Don't declare tui_vertical_source_scroll. * tui/tui-source.c (tui_source_window::do_scroll_vertical): Rename from tui_vertical_source_scroll. * tui/tui-disasm.h (tui_vertical_disassem_scroll): Don't declare. * tui/tui-disasm.c (tui_disasm_window::do_scroll_vertical): Rename from tui_vertical_disassem_scroll. * tui/tui-data.h (struct tui_win_info) <do_scroll_vertical, do_scroll_horizontal>: New methods. <forward_scroll, backward_scroll, left_scroll, right_scroll>: Likewise. (struct tui_source_window_base): Add do_scroll_horizontal. (struct tui_source_window, struct tui_disasm_window): Add do_scroll_vertical. (struct tui_data_window, struct tui_cmd_window): Add do_scroll_horizontal and do_scroll_vertical. * tui/tui-command.c (tui_dispatch_ctrl_char): Use method calls.
2019-06-25Remove tui_listTom Tromey1-7/+7
This removes the tui_list type in favor of a std::vector. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-winsource.c (tui_display_main) (tui_update_source_windows_with_addr) (tui_update_all_breakpoint_info): Update. * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights) (new_height_ok, parse_scrolling_args): Update. * tui/tui-stack.c (tui_show_frame_info): Update. * tui/tui-data.h (struct tui_list): Remove. (tui_source_windows): Return a reference to a std::vector. * tui/tui-data.c (source_windows): Now a std::vector. (tui_source_windows): Change return type. (tui_clear_source_windows): Rewrite. (tui_clear_source_windows_detail, tui_add_to_source_windows) (tui_free_all_source_wins_content): Rewrite.
2019-06-25Add destructor to tui_win_infoTom Tromey1-1/+1
This changes tui_free_window into a destructor for tui_free_window and then updates the users. gdb/ChangeLog 2019-06-25 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_resize_all): Use delete. * tui/tui-data.h (struct tui_win_info) <~tui_win_info>: Declare destructor. (tui_free_window): Don't declare. * tui/tui-data.c (~tui_win_info): Rename from tui_free_window. Update.
2019-06-16Remove unnecessary casts of NULLTom Tromey1-7/+5
I noticed some unnecessary casts of NULL. This removes all the unnecessary ones, leaving only ones where we must ensure that NULL has pointer type for passing through varargs. I removed a couple of useless casts of 0 that I noticed while writing this. Tested by rebuilding. gdb/ChangeLog 2019-06-16 Tom Tromey <tom@tromey.com> * valops.c (value_cast, value_slice): Remove unnecessary cast. * breakpoint.c (stopin_command, stopat_command) (until_break_command, decode_location_default): Remove unnecessary cast. * utils.c (subset_compare): Remove unnecessary cast. * ada-lang.c (ada_update_initial_language): Remove unnecessary cast. * linespec.c (decode_line_with_last_displayed): Remove unnecessary cast. * infcmd.c (path_command): Remove unnecessary cast. * coffread.c (decode_type): Remove unnecessary cast. * xcoffread.c (read_xcoff_symtab): Remove unnecessary cast. * mipsread.c (mipscoff_symfile_read): Remove unnecessary cast. * tui/tui-stack.c (tui_show_locator_content) (tui_show_frame_info): Remove unnecessary cast. * tui/tui-win.c (tui_scroll_forward_command) (tui_scroll_backward_command, tui_set_focus, tui_set_win_height) (parse_scrolling_args): Remove unnecessary cast. * tui/tui-data.c (init_win_info, tui_del_window) (tui_free_window, tui_del_data_windows, tui_free_data_content) (free_content_elements): Remove unnecessary cast. * tui/tui-windata.c (tui_first_data_item_displayed): Remove unnecessary cast. * tui/tui-source.c (tui_set_source_content) (tui_vertical_source_scroll): Remove unnecessary cast. * tui/tui-layout.c (tui_default_win_height): Remove unnecessary cast. * tui/tui-io.c (tui_initialize_io): Remove unnecessary cast. * tui/tui-regs.c (tui_display_registers_from) (tui_display_register): Remove unnecessary cast. * tui/tui-wingeneral.c (tui_refresh_win, tui_delete_win) (tui_unhighlight_win, tui_highlight_win, tui_make_window) (make_visible): Remove unnecessary cast. * tui/tui-winsource.c (tui_erase_source_content) (tui_update_breakpoint_info, tui_set_exec_info_content): Remove unnecessary cast. * ax-gdb.c (agent_command_1): Remove unnecessary cast. * cli/cli-setshow.c (cmd_show_list): Remove unnecessary cast. * stabsread.c (read_type, read_array_type, read_range_type): Remove unnecessary cast. * mdebugread.c (mdebug_build_psymtabs): Remove unnecessary cast. (parse_symbol, parse_type, upgrade_type, parse_external) (parse_partial_symbols, psymtab_to_symtab_1, cross_ref): Remove unnecessary cast. * gdb_bfd.c (gdb_bfd_map_section): Remove unnecessary cast.
2019-06-11Remove trailing newlines from help textTom Tromey1-32/+32
I noticed recently that some command had a trailing newline in its "help" output. So, I temporarily hacked cli-decode.c to print something when a new command was installed that had a trailing newline in its help message, and wrote this patch, which removes all the ones I could find this way. (There could still be a few more in *-nat files.) Tested on x86-64 Fedora 29. gdb/ChangeLog 2019-06-11 Tom Tromey <tromey@adacore.com> * infcall.c (_initialize_infcall): Remove trailing newline from help. * user-regs.c (_initialize_user_regs): Remove trailing newline from help. * typeprint.c (_initialize_typeprint): Remove trailing newline from help. * reverse.c (_initialize_reverse): Remove trailing newlines from help. * tracepoint.c (_initialize_tracepoint): Remove trailing newlines from help. * language.c (add_set_language_command): Remove trailing newline from help. * infcmd.c (_initialize_infcmd): Remove trailing newlines from help. * disasm.c (_initialize_disasm): Remove trailing newline from help. * top.c (init_main): Remove trailing newline from help. * interps.c (_initialize_interpreter): Remove trailing newline from help. * btrace.c (_initialize_btrace): Remove trailing newlines from help. * breakpoint.c (_initialize_breakpoint): Remove trailing newline from help. * python/python.c (_initialize_python): Remove trailing newline from help. * spu-tdep.c (_initialize_spu_tdep): Remove trailing newlines from help. * tui/tui-win.c (_initialize_tui_win): Remove trailing newlines from help. Reformat some text. * tui/tui-stack.c (_initialize_tui_stack): Remove trailing newline from help. * tui/tui-layout.c (_initialize_tui_layout): Remove trailing newline from help.
2019-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
This commit applies all changes made after running the gdb/copyright.py script. Note that one file was flagged by the script, due to an invalid copyright header (gdb/unittests/basic_string_view/element_access/char/empty.cc). As the file was copied from GCC's libstdc++-v3 testsuite, this commit leaves this file untouched for the time being; a patch to fix the header was sent to gcc-patches first. gdb/ChangeLog: Update copyright year range in all GDB files.
2018-10-19Deprecate and replace the "tabset" commandTom Tromey1-129/+184
The "tabset" command sets the tab width as used by the TUI for source and disassembly display. This command has long seemed to be misnamed to me. It is more in keeping with gdb design to call it "set tui tab-width". Also, making this change allows for the corresponding "show" command to work. gdb/ChangeLog 2018-10-19 Tom Tromey <tom@tromey.com> PR tui/18388: * NEWS: Mention tabset deprecation. * tui/tui-win.c (tui_tab_width, internal_tab_width): New globals. (update_tab_width): New function. (tui_set_tab_width, tui_show_tab_width): New functions. (tui_set_tab_width_command): Use update_tab_width. (_initialize_tui_win): Move to end of file. Deprecate "tabset". Add new "set tui tab-width" command. * tui/tui-source.c (tui_set_source_content): Update. * tui/tui-disasm.c (tui_set_disassem_content): Update. * tui/tui-data.h (tui_default_tab_len, tui_set_default_tab_len): Don't declare. (tui_tab_width): Declare. * tui/tui-data.c (default_tab_len, tui_default_tab_len) (tui_set_default_tab_len): Remove. gdb/doc/ChangeLog 2018-10-19 Tom Tromey <tom@tromey.com> PR tui/18388: * gdb.texinfo (TUI Commands): Remove tabset documentation. (TUI Configuration): Document "set tui tab-width".
2018-10-15Remove unnecessary casts from TUITom Tromey1-16/+14
This removes a number of unnecessary casts from the TUI. Some were found with -Wuseless-cast (which, I think, can't easily be enabled for gdb); and some were found by inspection. Tested by rebuilding on x86-64 Fedora 28. I'm checking this in. gdb/ChangeLog 2018-10-15 Tom Tromey <tom@tromey.com> * tui/tui.c (strcat_to_buf): Remove casts. * tui/tui-winsource.c (tui_show_source_line) (tui_set_is_exec_point_at, tui_line_is_displayed): Remove casts. * tui/tui-wingeneral.c (tui_refresh_win, box_win): Remove casts. * tui/tui-windata.c (tui_first_data_item_displayed) (tui_delete_data_content_windows, tui_erase_data_content) (tui_display_all_data, tui_display_data_from) (tui_refresh_data_win, tui_vertical_data_scroll): Remove casts. * tui/tui-win.c (tui_set_win_height) (make_invisible_and_set_new_height, parse_scrolling_args): Remove casts. * tui/tui-win.c (tui_resize_all): Remove casts. (tui_scroll_backward_command, tui_set_focus) (tui_set_tab_width_command): Likewise. * tui/tui-source.c (tui_vertical_source_scroll): Remove cast. * tui/tui-regs.c (tui_show_register_group): Remove cast. * tui/tui-layout.c (tui_set_layout_by_name): Remove cast. * tui/tui-disasm.c (tui_vertical_disassem_scroll): Remove cast. * tui/tui-data.c (tui_partial_win_by_name, tui_free_win_content): Remove casts.