aboutsummaryrefslogtreecommitdiff
path: root/gdb/tui/tui-layout.c
AgeCommit message (Collapse)AuthorFilesLines
2021-06-25gdb: add context getter/setter to cmd_list_elementSimon Marchi1-3/+2
Straightforward replacement of get_cmd_context / set_cmd_context with cmd_list_element methods. gdb/ChangeLog: * cli/cli-decode.h (struct cmd_list_element) <set_context, context>: New. <context>: Rename to... <m_context>: ... this. * cli/cli-decode.c (set_cmd_context, get_cmd_context): Remove. * command.h (set_cmd_context, get_cmd_context): Remove, use cmd_list_element::set_context and cmd_list_element::context everywhere instead. Change-Id: I5016b0079014e3f17d1aa449ada7954473bf2b5d
2021-05-12gdb: generate the prefix name for prefix commands on demandMarco Barisione1-1/+1
Previously, the prefixname field of struct cmd_list_element was manually set for prefix commands. This seems verbose and error prone as it required every single call to functions adding prefix commands to specify the prefix name while the same information can be easily generated. Historically, this was not possible as the prefix field was null for many commands, but this was fixed in commit 3f4d92ebdf7f848b5ccc9e8d8e8514c64fde1183 by Philippe Waroquiers, so we can rely on the prefix field being set when generating the prefix name. This commit also fixes a use after free in this scenario: * A command gets created via Python (using the gdb.Command class). The prefix name member is dynamically allocated. * An alias to the new command is created. The alias's prefixname is set to point to the prefixname for the original command with a direct assignment. * A new command with the same name as the Python command is created. * The object for the original Python command gets freed and its prefixname gets freed as well. * The alias is updated to point to the new command, but its prefixname is not updated so it keeps pointing to the freed one. gdb/ChangeLog: * command.h (add_prefix_cmd): Remove the prefixname argument as it can now be generated automatically. Update all callers. (add_basic_prefix_cmd): Ditto. (add_show_prefix_cmd): Ditto. (add_prefix_cmd_suppress_notification): Ditto. (add_abbrev_prefix_cmd): Ditto. * cli/cli-decode.c (add_prefix_cmd): Ditto. (add_basic_prefix_cmd): Ditto. (add_show_prefix_cmd): Ditto. (add_prefix_cmd_suppress_notification): Ditto. (add_prefix_cmd_suppress_notification): Ditto. (add_abbrev_prefix_cmd): Ditto. * cli/cli-decode.h (struct cmd_list_element): Replace the prefixname member variable with a method which generates the prefix name at runtime. Update all code reading the prefix name to use the method, and remove all code setting it. * python/py-cmd.c (cmdpy_destroyer): Remove code to free the prefixname member as it's now a method. (cmdpy_function): Determine if the command is a prefix by looking at prefixlist, not prefixname.
2021-02-08gdb: return true in TuiWindow.is_valid only if TUI is enabledAndrew Burgess1-0/+1
If the user implements a TUI window in Python, and this window responds to GDB events and then redraws its window contents then there is currently an edge case which can lead to problems. The Python API documentation suggests that calling methods like erase or write on a TUI window (from Python code) will raise an exception if the window is not valid. And the description for is_valid says: This method returns True when this window is valid. When the user changes the TUI layout, windows no longer visible in the new layout will be destroyed. At this point, the gdb.TuiWindow will no longer be valid, and methods (and attributes) other than is_valid will throw an exception. From this I, as a user, would expect that if I did 'tui disable' to switch back to CLI mode, then the window would no longer be valid. However, this is not the case. When the TUI is disabled the windows in the TUI are not deleted, they are simply hidden. As such, currently, the is_valid method continues to return true. This means that if the users Python code does something like: def event_handler (e): global tui_window_object if tui_window_object->is_valid (): tui_window_object->erase () tui_window_object->write ("Hello World") gdb.events.stop.connect (event_handler) Then when a stop event arrives GDB will try to draw the TUI window, even when the TUI is disabled. This exposes two bugs. First, is_valid should be returning false in this case, second, if the user forgot to add the is_valid call, then I believe the erase and write calls should be throwing an exception (when the TUI is disabled). The solution to both of these issues is I think bound together, as it depends on having a working 'is_valid' check. There's a rogue assert added into tui-layout.c as part of this commit. While working on this commit I managed to break GDB such that TUI_CMD_WIN was nullptr, this was causing GDB to abort. I'm leaving the assert in as it might help people catch issues in the future. This patch is inspired by the work done here: https://sourceware.org/pipermail/gdb-patches/2020-December/174338.html gdb/ChangeLog: * python/py-tui.c (gdbpy_tui_window) <is_valid>: New member function. (REQUIRE_WINDOW): Call is_valid member function. (REQUIRE_WINDOW_FOR_SETTER): New define. (gdbpy_tui_is_valid): Call is_valid member function. (gdbpy_tui_set_title): Call REQUIRE_WINDOW_FOR_SETTER instead. * tui/tui-data.h (struct tui_win_info) <is_visible>: Check tui_active too. * tui/tui-layout.c (tui_apply_current_layout): Add an assert. * tui/tui.c (tui_enable): Move setting of tui_active earlier in the function. gdb/doc/ChangeLog: * python.texinfo (TUI Windows In Python): Extend description of TuiWindow.is_valid. gdb/testsuite/ChangeLog: * gdb.python/tui-window-disabled.c: New file. * gdb.python/tui-window-disabled.exp: New file. * gdb.python/tui-window-disabled.py: New file.
2021-02-08gdb/tui: don't add windows to global list from tui_layout:window::applyAndrew Burgess1-15/+11
This commit was inspired by this mailing list patch: https://sourceware.org/pipermail/gdb-patches/2021-January/174713.html Currently, calling tui_layout_window::apply will add the window from the layout object to the global tui_windows list. Unfortunately, when the user runs the 'winheight' command, this calls tui_adjust_window_height, which calls the tui_layout_base::adjust_size function, which can then call tui_layout_base::apply. The consequence of this is that when the user does 'winheight' duplicate copies of a window can be added to the global tui_windows list. The original patch fixed this by changing the apply function to only update the global list some of the time. This patch takes a different approach. The apply function no longer updates the global tui_windows list. Instead a new virtual function is added to tui_layout_base which is used to gather all the currently applied windows into a vector. Finally tui_apply_current_layout is updated to make use of this new function to update the tui_windows list. The benefits I see in this approach are, (a) the apply function now no longer touches global state, this solves the immediate problem, and (b) now that tui_windows is updated directly in the function tui_apply_current_layout, we can drop the saved_tui_windows global. gdb/ChangeLog: * tui-layout.c (saved_tui_windows): Delete. (tui_apply_current_layout): Don't make use of saved_tui_windows, call new get_windows member function instead. (tui_get_window_by_name): Check in tui_windows. (tui_layout_window::apply): Don't add to tui_windows. * tui-layout.h (tui_layout_base::get_windows): New member function. (tui_layout_window::get_windows): Likewise. (tui_layout_split::get_windows): Likewise. gdb/testsuite/ChangeLog: * gdb.tui/winheight.exp: Add more tests.
2021-02-08gdb/tui: restore delete of window objectsAndrew Burgess1-0/+1
In commit: commit f237f998d1168139d599c550d54169cd8f94052d Date: Mon Jan 25 18:43:19 2021 +0000 gdb/tui: remove special handling of locator/status window I accidentally remove a call to delete the tui window objects. Now every time GDB changes tui layout it is leaking windows. gdb/ChangeLog: * tui/tui-layout.c (tui_apply_current_layout): Restore the delete of the window objects.
2021-01-28gdb/tui: remove special handling of locator/status windowAndrew Burgess1-13/+3
The locator window, or status window as it is sometimes called is handled differently to all the other windows. The reason for this is that the class representing this window (tui_locator_window) does two jobs, first this class represents a window just like any other that has space on the screen and fills the space with content. The second job is that this class serves as a storage area to hold information about the current location that the TUI windows represent, so the class has members like 'addr' and 'line_no', for example which are used within this class, and others when they want to know which line/address the TUI windows should be showing to the user. Because of this dual purpose we must always have an instance of the tui_locator_window so that there is somewhere to store this location information. The result of this is that the locator window must never be deleted like other windows, which results in some special case code. In this patch I propose splitting the two roles of the tui_locator_window class. The tui_locator_window class will retain just its window drawing parts, and will be treated just like any other window. This should allow all special case code for this window to be deleted. The other role, that of tracking the current tui location will be moved into a new class (tui_location_tracker), of which there will be a single global instance. All of the places where we previously use the locator window to get location information will now be updated to get this from the tui_location_tracker. There should be no user visible changes after this commit. gdb/ChangeLog: * Makefile.in (SUBDIR_TUI_SRCS): Add tui/tui-location.c. (HFILES_NO_SRCDIR): Add tui/tui-location.h. * tui/tui-data.h (TUI_STATUS_WIN): Define. (tui_locator_win_info_ptr): Delete declaration. * tui/tui-disasm.c: Add 'tui/tui-location.h' include. (tui_disasm_window::set_contents): Fetch state from tui_location global. (tui_get_begin_asm_address): Likewise. * tui/tui-layout.c (tui_apply_current_layout): Remove special case for locator window. (get_locator_window): Delete. (initialize_known_windows): Treat locator window just like all the rest. * tui/tui-source.c: Add 'tui/tui-location.h' include. (tui_source_window::set_contents): Fetch state from tui_location global. (tui_source_window::showing_source_p): Likewise. * tui/tui-stack.c: Add 'tui/tui-location.h' include. (_locator): Delete. (tui_locator_win_info_ptr): Delete. (tui_locator_window::make_status_line): Fetch state from tui_location global. (tui_locator_window::rerender): Remove check of 'handle', reindent function body. (tui_locator_window::set_locator_fullname): Delete. (tui_locator_window::set_locator_info): Delete. (tui_update_locator_fullname): Delete. (tui_show_frame_info): Likewise. (tui_show_locator_content): Access window through TUI_STATUS_WIN. * tui/tui-stack.h (tui_locator_window::set_locator_info): Moved to tui/tui-location.h and renamed to tui_location_tracker::set_location. (tui_locator_window::set_locator_fullname): Moved to tui/tui-location.h and renamed to tui_location_tracker::set_fullname. (tui_locator_window::full_name): Delete. (tui_locator_window::proc_name): Delete. (tui_locator_window::line_no): Delete. (tui_locator_window::addr): Delete. (tui_locator_window::gdbarch): Delete. (tui_update_locator_fullname): Delete declaration. * tui/tui-wingeneral.c (tui_refresh_all): Removed special handling for locator window. * tui/tui-winsource.c: Add 'tui/tui-location.h' include. (tui_display_main): Call function on tui_location directly. * tui/tui.h (enum tui_win_type): Add STATUS_WIN. * tui/tui-location.c: New file. * tui/tui-location.h: New file.
2021-01-01Update copyright year range in all GDB filesJoel Brobecker1-1/+1
This commits the result of running gdb/copyright.py as per our Start of New Year procedure... gdb/ChangeLog Update copyright year range in copyright header of all GDB files.
2020-11-29Don't delete the locator win infoHannes Domani1-1/+3
The locator win info is special because it is static, all the others are created dynamically. gdb/ChangeLog: 2020-11-29 Hannes Domani <ssbssa@yahoo.de> PR tui/26973 * tui/tui-layout.c (tui_apply_current_layout): Don't delete the static locator win info.
2020-07-01Remove tui_gen_win_infoTom Tromey1-8/+7
This merges the tui_gen_win_info base class with tui_win_info; renaming the resulting class to tui_win_info. gdb/ChangeLog 2020-07-01 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_win_info::refresh_window): Move from tui_gen_win_info. (tui_win_info::make_window): Merge with tui_gen_win_info::make_window. (tui_win_info::make_visible): Move from tui_gen_win_info. * tui/tui-win.c (tui_win_info::max_width): Move from tui_gen_win_info. * tui/tui-layout.h (class tui_layout_window) <m_window>: Change type. <window_factory>: Likewise. * tui/tui-layout.c (tui_win_info::resize): Move from tui_gen_win_info. (make_standard_window): Change return type. (get_locator_window, tui_get_window_by_name): Likewise. (tui_layout_window::apply): Remove a cast. * tui/tui-data.h (MIN_WIN_HEIGHT): Move earlier. (struct tui_win_info): Merge with tui_gen_win_info. (struct tui_gen_win_info): Remove.
2020-06-16Use macros for TUI window namesTom Tromey1-32/+32
Christian pointed out that tui-layout.c hard-codes various window names. This patch changes the code to use the macros from tui-data.h instead. For each window, I searched for uses of the name; but I only found any in tui-layout.c. This also adds a new macro to account for the "status" window. gdb/ChangeLog 2020-06-16 Tom Tromey <tom@tromey.com> * tui/tui-data.h (STATUS_NAME): New macro. * tui/tui-layout.c (tui_remove_some_windows) (initialize_known_windows, tui_register_window) (tui_layout_split::remove_windows, initialize_layouts) (tui_new_layout_command): Don't use hard-coded window names.
2020-06-16Fix C-x 1 from gdb promptTom Tromey1-5/+6
Pedro pointed out on irc that C-x 1 from the gdb prompt will cause a crash. This happened because of a bug in remove_windows -- it would always remove all the windows from the layout. This patch fixes this bug, and also arranges to have C-x 1 preserve the status window. gdb/ChangeLog 2020-06-16 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (tui_layout_split::remove_windows): Fix logic. Also preserve the status window.
2020-04-17Replace most calls to help_list and cmd_show_listTom Tromey1-11/+2
Currently there are many prefix commands that do nothing but call either help_list or cmd_show_list. I happened to notice that one such call, for "set print type", used the wrong command list parameter, causing incorrect output. Rather than fix this bug in isolation, I decided to eliminate this possibility by adding two new ways to add prefix commands, which simply route the call to help_list or cmd_show_list, as appropriate. This makes it impossible for a mismatch to occur. In some cases, a bit of output was removed; however, I don't think this output in general was very useful. It seemed redundant with what's already printed by help_list. A representative example is this hunk, removed from ada-lang.c: - printf_unfiltered (_(\ -"\"set ada\" must be followed by the name of a setting.\n")); This simplified the CLI style set/show commands quite a bit, and allowed the deletion of a macro. This also cleans up some unusual code in windows-tdep.c. Tested on x86-64 Fedora 30. Note that I have no way to build the go32-nat.c change. gdb/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * auto-load.c (show_auto_load_cmd): Remove. (auto_load_show_cmdlist_get): Use add_show_prefix_cmd. * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd. (maintenance_print_arc_command): Remove. * tui/tui-win.c (tui_command): Remove. (tui_get_cmd_list): Use add_basic_prefix_cmd. * tui/tui-layout.c (tui_layout_command): Remove. (_initialize_tui_layout): Use add_basic_prefix_cmd. * python/python.c (user_set_python, user_show_python): Remove. (_initialize_python): Use add_basic_prefix_cmd, add_show_prefix_cmd. * guile/guile.c (set_guile_command, show_guile_command): Remove. (install_gdb_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_guile_command): Remove. * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove. (_initialize_dwarf2_read): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Remove do_set and do_show parameters. * cli/cli-style.c (set_style, show_style): Remove. (_initialize_cli_style): Use add_basic_prefix_cmd, add_show_prefix_cmd. (cli_style_option::add_setshow_commands): Remove do_set and do_show parameters. (cli_style_option::add_setshow_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (STYLE_ADD_SETSHOW_COMMANDS): Remove macro. (set_style_name): Remove. * cli/cli-dump.c (dump_command, append_command): Remove. (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Remove. (_initialize_cli_dump): Use add_basic_prefix_cmd. * windows-tdep.c (w32_prefix_command_valid): Remove global. (init_w32_command_list): Remove; move into ... (_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Remove. (_initialize_valprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * typeprint.c (set_print_type, show_print_type): Remove. (_initialize_typeprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record.c (set_record_command, show_record_command): Remove. (_initialize_record): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_command, show_command, set_debug, show_debug): Remove. * top.h (set_history, show_history): Don't declare. * top.c (set_history, show_history): Remove. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Remove. (_initialize_target_descriptions): Use add_basic_prefix_cmd, add_show_prefix_cmd. * symtab.c (info_module_command): Remove. (_initialize_symtab): Use add_basic_prefix_cmd. * symfile.c (overlay_command): Remove. (_initialize_symfile): Use add_basic_prefix_cmd. * sparc64-tdep.c (info_adi_command): Remove. (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd. * sh-tdep.c (show_sh_command, set_sh_command): Remove. (_initialize_sh_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * serial.c (serial_set_cmd, serial_show_cmd): Remove. (_initialize_serial): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove. (_initialize_ser_tcp): Use add_basic_prefix_cmd, add_show_prefix_cmd. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command) (_initialize_rs6000_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * riscv-tdep.c (show_riscv_command, set_riscv_command) (show_debug_riscv_command, set_debug_riscv_command): Remove. (_initialize_riscv_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * remote.c (remote_command, set_remote_cmd): Remove. (_initialize_remote): Use add_basic_prefix_cmd. * record-full.c (set_record_full_command) (show_record_full_command): Remove. (_initialize_record_full): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record-btrace.c (cmd_set_record_btrace) (cmd_show_record_btrace, cmd_set_record_btrace_bts) (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt) (cmd_show_record_btrace_pt): Remove. (_initialize_record_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Remove. (_initialize_ravenscar): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (show_mips_command, set_mips_command) (_initialize_mips_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint.c (maintenance_command, maintenance_info_command) (maintenance_check_command, maintenance_print_command) (maintenance_set_cmd, maintenance_show_cmd): Remove. (_initialize_maint_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_per_command_cmd): Remove. * maint-test-settings.c (maintenance_set_test_settings_cmd): Remove. (maintenance_show_test_settings_cmd): Remove. (_initialize_maint_test_settings): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint-test-options.c (maintenance_test_options_command): Remove. (_initialize_maint_test_options): Use add_basic_prefix_cmd. * macrocmd.c (macro_command): Remove (_initialize_macrocmd): Use add_basic_prefix_cmd. * language.c (set_check, show_check): Remove. (_initialize_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * infcmd.c (unset_command): Remove. (_initialize_infcmd): Use add_basic_prefix_cmd. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove. (_initialize_i386_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * go32-nat.c (go32_info_dos_command): Remove. (_initialize_go32_nat): Use add_basic_prefix_cmd. * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd) (do_show_prefix_cmd, add_show_prefix_cmd): New functions. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove. (_initialize_frame): Use add_basic_prefix_cmd, add_show_prefix_cmd. * dcache.c (set_dcache_command, show_dcache_command): Remove. (_initialize_dcache): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cp-support.c (maint_cplus_command): Remove. (_initialize_cp_support): Use add_basic_prefix_cmd. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd, _initialize_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * breakpoint.c (save_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd. * arm-tdep.c (set_arm_command, show_arm_command): Remove. (_initialize_arm_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd) (set_ada_command, show_ada_command): Remove. (_initialize_ada_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare. gdb/testsuite/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * gdb.cp/maint.exp (test_help): Simplify multiple_help_body. Update tests. * gdb.btrace/cpu.exp: Update tests. * gdb.base/maint.exp: Update tests. * gdb.base/default.exp: Update tests. * gdb.base/completion.exp: Update tests.
2020-02-24[gdb/testsuite] Fix layout next/prev/regs help messageTom de Vries1-3/+3
With test-case gdb.gdb/unittest.exp, I run into: ... (gdb) maintenance selftest^M ... Running selftest help_doc_invariants.^M help doc broken invariant: command 'layout next' help doc first line is \ not terminated with a '.' character^M help doc broken invariant: command 'layout prev' help doc first line is \ not terminated with a '.' character^M help doc broken invariant: command 'layout regs' help doc first line is \ not terminated with a '.' character^M Self test failed: self-test failed at help-doc-selftests.c:95^M ... Fix this by adding the missing '.' character. Build and reg-tested on x86_64-linux. gdb/ChangeLog: 2020-02-24 Tom de Vries <tdevries@suse.de> * tui/tui-layout.c (_initialize_tui_layout): Fix help messages for commands layout next/prev/regs.
2020-02-22Make some tui_source_window_base members "protected"Tom Tromey1-17/+5
This renames a few members of tui_source_window_base, and makes them "protected". 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (extract_display_start_addr): Rewrite. * tui/tui-disasm.h (struct tui_disasm_window) <display_start_addr>: Declare. * tui/tui-source.h (struct tui_source_window) <display_start_addr>: Declare. * tui/tui-winsource.h (struct tui_source_window_base) <show_source_line, display_start_addr>: New methods. <m_horizontal_offset, m_start_line_or_addr, m_gdbarch, m_content>: Rename and move to protected section. * tui/tui-winsource.c (tui_source_window_base::update_source_window) (tui_source_window_base::do_erase_source_content): Update. (tui_source_window_base::show_source_line): Now a method. (tui_source_window_base::show_source_content) (tui_source_window_base::tui_source_window_base) (tui_source_window_base::rerender) (tui_source_window_base::refill) (tui_source_window_base::do_scroll_horizontal) (tui_source_window_base::set_is_exec_point_at) (tui_source_window_base::update_breakpoint_info) (tui_source_window_base::update_exec_info): Update. * tui/tui-source.c (tui_source_window::set_contents) (tui_source_window::showing_source_p) (tui_source_window::do_scroll_vertical) (tui_source_window::location_matches_p) (tui_source_window::line_is_displayed): Update. (tui_source_window::display_start_addr): New method. * tui/tui-disasm.c (tui_disasm_window::set_contents) (tui_disasm_window::do_scroll_vertical) (tui_disasm_window::location_matches_p): Update. (tui_disasm_window::display_start_addr): New method. Change-Id: I74d72b9da5f458664427db643a108634690c6e19
2020-02-22Allow TUI windows in PythonTom Tromey1-3/+25
This patch adds support for writing new TUI windows in Python. 2020-02-22 Tom Tromey <tom@tromey.com> * NEWS: Add entry for gdb.register_window_type. * tui/tui-layout.h (window_factory): New typedef. (tui_register_window): Declare. * tui/tui-layout.c (saved_tui_windows): New global. (tui_apply_current_layout): Use it. (tui_register_window): New function. * python/python.c (do_start_initialization): Call gdbpy_initialize_tui. (python_GdbMethods): Add "register_window_type" function. * python/python-internal.h (gdbpy_register_tui_window) (gdbpy_initialize_tui): Declare. * python/py-tui.c: New file. * Makefile.in (SUBDIR_PYTHON_SRCS): Add py-tui.c. gdb/doc/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * python.texi (Python API): Add menu item. (TUI Windows In Python): New node. gdb/testsuite/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * gdb.python/tui-window.exp: New file. * gdb.python/tui-window.py: New file. Change-Id: I85fbfb923a1840450a00a7dce113a05d7f048baa
2020-02-22Change how TUI windows are instantiatedTom Tromey1-32/+67
This adds a new global that maps from window names to window constructor functions, and then changes tui_get_window_by_name and validate_window_name to use it. This is another step toward user-defined window types. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (make_standard_window, get_locator_window): New functions. (known_window_types): New global. (tui_get_window_by_name): Reimplement. (initialize_known_windows): New function. (validate_window_name): Rewrite. (_initialize_tui_layout): Call initialize_known_windows. Change-Id: I9037aac550299b9d945899220a30c2d3af9dd0de
2020-02-22Remove tui_delete_invisible_windows and tui_make_all_invisibleTom Tromey1-11/+35
tui_delete_invisible_windows is only needed after applying a layout, and tui_make_all_invisible is only needed before applying a layout. This patch removes these functions, in favor of doing this management directly in tui_apply_current_layout. This is needed so that the lifetimes of non-built-in windows will be properly managed. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_make_all_invisible): Don't declare. * tui/tui-wingeneral.c (tui_make_all_invisible): Remove. * tui/tui-win.c (tui_resize_all): Don't call tui_delete_invisible_windows. * tui/tui-layout.c (tui_apply_current_layout): Delete windows when done. (tui_set_layout): Update. (tui_add_win_to_layout): Don't call tui_delete_invisible_windows. * tui/tui-data.h (tui_delete_invisible_windows): Don't declare. * tui/tui-data.c (tui_delete_invisible_windows): Remove. Change-Id: Ia3603b021dcb7ec31700a4a32640cd09b00b8f3b
2020-02-22Change TUI window iterationTom Tromey1-0/+6
This changes the TUI to track all the instantiated windows in a new global vector. After this, iteration over TUI windows is done by simply iterating over this vector. This approach makes it simpler to define new window types. In particular, a subsequent patch will add the ability to define a TUI window from Python. Note that this series will not remove tui_win_list. This will continue to exist in parallel, only because it was simpler to leave this alone. Perhaps it could still be removed in the future. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (struct tui_source_window_iterator) <inner_iterator>: New etytypedef. <tui_source_window_iterator>: Take "end" parameter. <tui_source_window_iterator>: Take iterator. <operator*, advance>: Update. <m_iter>: Change type. <m_end>: New field. (struct tui_source_windows) <begin, end>: Update. * tui/tui-layout.c (tui_windows): New global. (tui_apply_current_layout): Clear tui_windows. (tui_layout_window::apply): Update tui_windows. * tui/tui-data.h (tui_windows): Declare. (all_tui_windows): Now inline function. (class tui_window_iterator, struct all_tui_windows): Remove. Change-Id: I6ab77976d6326f427178f725434f8f82046e0bbf
2020-02-22Add horizontal splitting to TUI layoutTom Tromey1-53/+94
This changes the TUI layout engine to add horizontal splitting. Now, windows can be side-by-side. A horizontal split is defined using the "-horizontal" parameter to "tui new-layout". This also adds the first "winheight" test to the test suite. One open question is whether we want a new "winwidth" command, now that horizontal layouts are possible. This is easily done using the generic layout code. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> PR tui/17850: * tui/tui-win.c (tui_gen_win_info::max_width): New method. * tui/tui-layout.h (class tui_layout_base) <get_sizes>: Add "height" argument. (class tui_layout_window) <get_sizes>: Likewise. (class tui_layout_split) <tui_layout_split>: Add "vertical" argument. <get_sizes>: Add "height" argument. <m_vertical>: New field. * tui/tui-layout.c (tui_layout_split::clone): Update. (tui_layout_split::get_sizes): Add "height" argument. (tui_layout_split::adjust_size, tui_layout_split::apply): Update. (tui_new_layout_command): Parse "-horizontal". (_initialize_tui_layout): Update help string. (tui_layout_split::specification): Add "-horizontal" when needed. * tui/tui-layout.c (tui_layout_window::get_sizes): Add "height" argument. * tui/tui-data.h (struct tui_gen_win_info) <max_width, min_width>: New methods. gdb/doc/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> PR tui/17850: * gdb.texinfo (TUI Commands): Document horizontal layouts. gdb/testsuite/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> PR tui/17850: * gdb.tui/new-layout.exp: Add horizontal layout and winheight tests. Change-Id: I38b35e504f34698578af86686be03c0fefd954ae
2020-02-22Change return type of tui_layout_base::adjust_sizeTom Tromey1-8/+9
This changes tui_layout_base::adjust_size to return a new enum type. I broke this out into a separate patch because it simplifies a subsequent patch. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui-layout.h (enum tui_adjust_result): New. (class tui_layout_base) <adjust_size>: Return tui_adjust_result. (class tui_layout_window) <adjust_size>: Return tui_adjust_result. Rewrite. (class tui_layout_split) <adjust_size>: Return tui_adjust_result. * tui/tui-layout.c (tui_layout_split::adjust_size): Update. Change-Id: I821b48ab06a9b9485875e147bd08a3bc46b900a0
2020-02-22Allow TUI sub-layouts in "new-layout" commandTom Tromey1-19/+65
The new TUI layout engine has support for "sub-layouts" -- this is a layout that includes another layout as a child. A sub-layout is treated as a unit when allocating space. There's not a very strong reason to use sub-layouts currently. This patch exists to introduce the idea, and to simplify the subsequent patch that adds horizontal layouts -- where sub-layouts are needed. Because this patch won't go in on its own, I chose to defer documenting this change until the subsequent horizontal layout patch. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui-layout.h (class tui_layout_split) <add_split>: Change parameter and return types. (class tui_layout_base) <specification>: Add "depth". (class tui_layout_window) <specification>: Add "depth". (class tui_layout_split) <specification>: Add "depth". * tui/tui-layout.c (tui_layout_split::add_split): Change parameter and return types. (tui_new_layout_command): Parse sub-layouts. (_initialize_tui_layout): Update help string. (tui_layout_window::specification): Add "depth". (add_layout_command): Update. gdb/testsuite/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * gdb.tui/new-layout.exp: Add sub-layout tests. Change-Id: Iddf52d067a552c168b8a67f29caf7ac86404b10c
2020-02-22Add the "tui new-layout" commandTom Tromey1-3/+100
This adds a new command, "tui new-layout". This command can be used to define a new TUI window layout. The command is used like: (gdb) tui new-layout name src 1 regs 1 status 0 cmd 1 The first argument is the name of the layout. In this example, it is "name", so the new layout could be seen by "layout name". Subsequent arguments come in pairs, where the first item in a pair is the name of a window, and the second item in a pair is the window's weight. A weight is just an integer -- a window's allocated size is proportional to the total of the weights given. So, in the above example, all windows will have the same size (the status windows's weight does not matter, because it has fixed height). gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * NEWS: Add "tui new-layout" item. * tui/tui-layout.c (add_layout_command): Return cmd_list_element. Add new-layout command to help text. (validate_window_name): New function. (tui_new_layout_command): New function. (_initialize_tui_layout): Register "new-layout". (tui_layout_window::specification): New method. (tui_layout_window::specification): New method. * tui/tui-layout.h (class tui_layout_base) <specification>: New method. (class tui_layout_window) <specification>: New method. (class tui_layout_split) <specification>: New method. gdb/doc/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * gdb.texinfo (TUI Overview): Mention user layouts. (TUI Commands): Document "tui new-layout". gdb/testsuite/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * gdb.tui/new-layout.exp: New file. Change-Id: Id7c3ace20ab1e8924f8f4ad788f40210f58a5c05
2020-02-22Remove hard-coded TUI layoutsTom Tromey1-277/+222
This changes the TUI so that the available layouts are no longer completely hard-coded. "enum tui_layout_type" is removed, and then all the fallout from this is fixed up. This patch also reimplements the "layout" command to be a prefix command. The concrete layouts are simply sub-commands now. This provides completion and correct abbreviation behavior for free. Finally, this also changes the name of the locator window to "status". This matches the documentation and will be exposed to the user in a subsequent patch. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_enable): Call tui_set_initial_layout. * tui/tui-win.c (window_name_completer): Update comment. * tui/tui-layout.h (class tui_layout_base) <replace_window>: Declare method. (class tui_layout_window) <replace_window>: Likewise. (class tui_layout_split) <replace_window>: Likewise. (tui_set_layout): Don't declare. (tui_set_initial_layout): Declare function. * tui/tui-layout.c (layouts, applied_skeleton, src_regs_layout) (asm_regs_layout): New globals. (tui_current_layout, show_layout): Remove. (tui_set_layout, tui_add_win_to_layout): Rewrite. (find_layout, tui_apply_layout): New function. (layout_completer): Remove. (tui_next_layout): Reimplement. (tui_next_layout_command): New function. (tui_set_initial_layout, tui_prev_layout_command): New functions. (tui_regs_layout): Reimplement. (tui_regs_layout_command): New function. (extract_display_start_addr): Rewrite. (next_layout, prev_layout): Remove. (tui_layout_window::replace_window): New method. (tui_layout_split::replace_window): New method. (destroy_layout): New function. (layout_list): New global. (add_layout_command): New function. (initialize_layouts): Update. (tui_layout_command): New function. (_initialize_tui_layout): Install "layout" commands. * tui/tui-data.h (enum tui_layout_type): Remove. (tui_current_layout): Don't declare. Change-Id: I9b5f7ab3ce838d6b340b8c373ef649a8e0a74b73
2020-02-22Reimplement "tui reg" commandTom Tromey1-0/+8
This reimplements the low-level layout function that is used by the "tui reg" command. Now it simply calls into the existing "layout" command, though this will be changed again in a subsequent patch. The rationale for this patch is that it makes it simpler to remove "enum tui_layout_type". gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_reg_layout): Remove. (tui_reg_command): Use tui_regs_layout. * tui/tui-layout.h (tui_reg_command): Declare. * tui/tui-layout.c (tui_reg_command): New function. Change-Id: I0ca6884e2967005e7d3fbf5f13a0ac8f9c3298cf
2020-02-22Reimplement TUI "C-x 1" bindingTom Tromey1-0/+45
The TUI "C-x 1" key binding removes TUI windows, based on the current layout. With user-defined layouts, this is no longer easy to do. This patch changes "C-x 1" to simply delete windows, leaving just the focus window, the locator, and the command window. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_rl_delete_other_windows): Call tui_remove_some_windows. * tui/tui-layout.h (class tui_layout_base) <remove_windows>: Declare method. (class tui_layout_window) <remove_windows>: New method. (class tui_layout_split) <remove_windows>: Declare. (tui_remove_some_windows): Declare. * tui/tui-layout.c (tui_remove_some_windows): New function. (tui_layout_split::remove_windows): New method. Change-Id: If186f9c3f263913e963b965204481d1b4385c6d4
2020-02-22Simplify TUI C-x 2 bindingTom Tromey1-0/+7
The TUI "C-x 2" binding tries to switch to a different layout based on the current layout. Once user-defined layouts are available, this won't really make sense. I wasn't entirely sure how to handle this. This patch changes the binding to simply cycle through the existing layouts. I considered this a reasonable, though not ideal, compromise. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_rl_change_windows): Call tui_next_layout. * tui/tui-layout.h (tui_next_layout): Declare. * tui/tui-layout.c (tui_next_layout): New function. Change-Id: Ic101f0e3831a4235a048b3090ef60f025f7449bb
2020-02-22Simplify tui_add_win_to_layoutTom Tromey1-15/+4
tui_add_win_to_layout is only ever called for the source or assembly windows. This simplifies the function by removing the DATA_WIN case. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui-layout.h (tui_add_win_to_layout): Add comment. * tui/tui-layout.c (tui_add_win_to_layout): Add assert. Remove DATA_WIN case. Change-Id: Idfca902c6c90153acc5d19af4c33aa74bc3caf31
2020-01-19Remove flickering from the TUITom Tromey1-0/+2
In some cases, the TUI flickers when redrawing. This can be seen mostly easily when switching layouts. This patch fixes the problem by exploiting the double buffering that curses already does. In some spots, the TUI will now disable flushing the curses buffers to the screen; and then flush them all at once when the rendering is complete. gdb/ChangeLog 2020-01-19 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_show_assembly): Use tui_suppress_output. * tui/tui-wingeneral.h (class tui_suppress_output): New. (tui_wrefresh): Declare. * tui/tui-wingeneral.c (suppress_output): New global. (tui_suppress_output, ~tui_suppress_output): New constructor and destructor. (tui_wrefresh): New function. (tui_gen_win_info::refresh_window): Use tui_wrefresh. (tui_gen_win_info::make_window): Call wnoutrefresh when needed. * tui/tui-regs.h (struct tui_data_window) <no_refresh>: Declare method. * tui/tui-regs.c (tui_data_window::erase_data_content): Call tui_wrefresh. (tui_data_window::no_refresh): New method. (tui_data_item_window::refresh_window): Call tui_wrefresh. (tui_reg_command): Use tui_suppress_output * tui/tui-layout.c (tui_set_layout): Use tui_suppress_output. * tui/tui-data.h (struct tui_gen_win_info) <no_refresh>: New method. * tui/tui-command.c (tui_refresh_cmd_win): Call tui_wrefresh. Change-Id: Icb832ae100b861de3af3307488e636fa928d5c9f
2020-01-13gdb: add back declarations for _initialize functionsSimon Marchi1-1/+2
I'd like to enable the -Wmissing-declarations warning. However, it warns for every _initialize function, for example: CXX dcache.o /home/smarchi/src/binutils-gdb/gdb/dcache.c: In function ‘void _initialize_dcache()’: /home/smarchi/src/binutils-gdb/gdb/dcache.c:688:1: error: no previous declaration for ‘void _initialize_dcache()’ [-Werror=missing-declarations] _initialize_dcache (void) ^~~~~~~~~~~~~~~~~~ The only practical way forward I found is to add back the declarations, which were removed by this commit: commit 481695ed5f6e0a8a9c9c50bfac1cdd2b3151e6c9 Author: John Baldwin <jhb@FreeBSD.org> Date: Sat Sep 9 11:02:37 2017 -0700 Remove unnecessary function prototypes. I don't think it's a big problem to have the declarations for these functions, but if anybody has a better solution for this, I'll be happy to use it. gdb/ChangeLog: * aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Add declaration. * aarch64-fbsd-tdep.c (_initialize_aarch64_fbsd_tdep): Add declaration. * aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Add declaration. * aarch64-linux-tdep.c (_initialize_aarch64_linux_tdep): Add declaration. * aarch64-newlib-tdep.c (_initialize_aarch64_newlib_tdep): Add declaration. * aarch64-tdep.c (_initialize_aarch64_tdep): Add declaration. * ada-exp.y (_initialize_ada_exp): Add declaration. * ada-lang.c (_initialize_ada_language): Add declaration. * ada-tasks.c (_initialize_tasks): Add declaration. * agent.c (_initialize_agent): Add declaration. * aix-thread.c (_initialize_aix_thread): Add declaration. * alpha-bsd-nat.c (_initialize_alphabsd_nat): Add declaration. * alpha-linux-nat.c (_initialize_alpha_linux_nat): Add declaration. * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Add declaration. * alpha-nbsd-tdep.c (_initialize_alphanbsd_tdep): Add declaration. * alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Add declaration. * alpha-tdep.c (_initialize_alpha_tdep): Add declaration. * amd64-darwin-tdep.c (_initialize_amd64_darwin_tdep): Add declaration. * amd64-dicos-tdep.c (_initialize_amd64_dicos_tdep): Add declaration. * amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Add declaration. * amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Add declaration. * amd64-linux-nat.c (_initialize_amd64_linux_nat): Add declaration. * amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Add declaration. * amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Add declaration. * amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Add declaration. * amd64-obsd-nat.c (_initialize_amd64obsd_nat): Add declaration. * amd64-obsd-tdep.c (_initialize_amd64obsd_tdep): Add declaration. * amd64-sol2-tdep.c (_initialize_amd64_sol2_tdep): Add declaration. * amd64-tdep.c (_initialize_amd64_tdep): Add declaration. * amd64-windows-nat.c (_initialize_amd64_windows_nat): Add declaration. * amd64-windows-tdep.c (_initialize_amd64_windows_tdep): Add declaration. * annotate.c (_initialize_annotate): Add declaration. * arc-newlib-tdep.c (_initialize_arc_newlib_tdep): Add declaration. * arc-tdep.c (_initialize_arc_tdep): Add declaration. * arch-utils.c (_initialize_gdbarch_utils): Add declaration. * arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Add declaration. * arm-fbsd-tdep.c (_initialize_arm_fbsd_tdep): Add declaration. * arm-linux-nat.c (_initialize_arm_linux_nat): Add declaration. * arm-linux-tdep.c (_initialize_arm_linux_tdep): Add declaration. * arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Add declaration. * arm-nbsd-tdep.c (_initialize_arm_netbsd_tdep): Add declaration. * arm-obsd-tdep.c (_initialize_armobsd_tdep): Add declaration. * arm-pikeos-tdep.c (_initialize_arm_pikeos_tdep): Add declaration. * arm-symbian-tdep.c (_initialize_arm_symbian_tdep): Add declaration. * arm-tdep.c (_initialize_arm_tdep): Add declaration. * arm-wince-tdep.c (_initialize_arm_wince_tdep): Add declaration. * auto-load.c (_initialize_auto_load): Add declaration. * auxv.c (_initialize_auxv): Add declaration. * avr-tdep.c (_initialize_avr_tdep): Add declaration. * ax-gdb.c (_initialize_ax_gdb): Add declaration. * bfin-linux-tdep.c (_initialize_bfin_linux_tdep): Add declaration. * bfin-tdep.c (_initialize_bfin_tdep): Add declaration. * break-catch-sig.c (_initialize_break_catch_sig): Add declaration. * break-catch-syscall.c (_initialize_break_catch_syscall): Add declaration. * break-catch-throw.c (_initialize_break_catch_throw): Add declaration. * breakpoint.c (_initialize_breakpoint): Add declaration. * bsd-uthread.c (_initialize_bsd_uthread): Add declaration. * btrace.c (_initialize_btrace): Add declaration. * charset.c (_initialize_charset): Add declaration. * cli/cli-cmds.c (_initialize_cli_cmds): Add declaration. * cli/cli-dump.c (_initialize_cli_dump): Add declaration. * cli/cli-interp.c (_initialize_cli_interp): Add declaration. * cli/cli-logging.c (_initialize_cli_logging): Add declaration. * cli/cli-script.c (_initialize_cli_script): Add declaration. * cli/cli-style.c (_initialize_cli_style): Add declaration. * coff-pe-read.c (_initialize_coff_pe_read): Add declaration. * coffread.c (_initialize_coffread): Add declaration. * compile/compile-cplus-types.c (_initialize_compile_cplus_types): Add declaration. * compile/compile.c (_initialize_compile): Add declaration. * complaints.c (_initialize_complaints): Add declaration. * completer.c (_initialize_completer): Add declaration. * copying.c (_initialize_copying): Add declaration. * corefile.c (_initialize_core): Add declaration. * corelow.c (_initialize_corelow): Add declaration. * cp-abi.c (_initialize_cp_abi): Add declaration. * cp-namespace.c (_initialize_cp_namespace): Add declaration. * cp-support.c (_initialize_cp_support): Add declaration. * cp-valprint.c (_initialize_cp_valprint): Add declaration. * cris-linux-tdep.c (_initialize_cris_linux_tdep): Add declaration. * cris-tdep.c (_initialize_cris_tdep): Add declaration. * csky-linux-tdep.c (_initialize_csky_linux_tdep): Add declaration. * csky-tdep.c (_initialize_csky_tdep): Add declaration. * ctfread.c (_initialize_ctfread): Add declaration. * d-lang.c (_initialize_d_language): Add declaration. * darwin-nat-info.c (_initialize_darwin_info_commands): Add declaration. * darwin-nat.c (_initialize_darwin_nat): Add declaration. * dbxread.c (_initialize_dbxread): Add declaration. * dcache.c (_initialize_dcache): Add declaration. * disasm-selftests.c (_initialize_disasm_selftests): Add declaration. * disasm.c (_initialize_disasm): Add declaration. * dtrace-probe.c (_initialize_dtrace_probe): Add declaration. * dummy-frame.c (_initialize_dummy_frame): Add declaration. * dwarf-index-cache.c (_initialize_index_cache): Add declaration. * dwarf-index-write.c (_initialize_dwarf_index_write): Add declaration. * dwarf2-frame-tailcall.c (_initialize_tailcall_frame): Add declaration. * dwarf2-frame.c (_initialize_dwarf2_frame): Add declaration. * dwarf2expr.c (_initialize_dwarf2expr): Add declaration. * dwarf2loc.c (_initialize_dwarf2loc): Add declaration. * dwarf2read.c (_initialize_dwarf2_read): Add declaration. * elfread.c (_initialize_elfread): Add declaration. * exec.c (_initialize_exec): Add declaration. * extension.c (_initialize_extension): Add declaration. * f-lang.c (_initialize_f_language): Add declaration. * f-valprint.c (_initialize_f_valprint): Add declaration. * fbsd-nat.c (_initialize_fbsd_nat): Add declaration. * fbsd-tdep.c (_initialize_fbsd_tdep): Add declaration. * filesystem.c (_initialize_filesystem): Add declaration. * findcmd.c (_initialize_mem_search): Add declaration. * findvar.c (_initialize_findvar): Add declaration. * fork-child.c (_initialize_fork_child): Add declaration. * frame-base.c (_initialize_frame_base): Add declaration. * frame-unwind.c (_initialize_frame_unwind): Add declaration. * frame.c (_initialize_frame): Add declaration. * frv-linux-tdep.c (_initialize_frv_linux_tdep): Add declaration. * frv-tdep.c (_initialize_frv_tdep): Add declaration. * ft32-tdep.c (_initialize_ft32_tdep): Add declaration. * gcore.c (_initialize_gcore): Add declaration. * gdb-demangle.c (_initialize_gdb_demangle): Add declaration. * gdb_bfd.c (_initialize_gdb_bfd): Add declaration. * gdbarch-selftests.c (_initialize_gdbarch_selftests): Add declaration. * gdbarch.c (_initialize_gdbarch): Add declaration. * gdbtypes.c (_initialize_gdbtypes): Add declaration. * gnu-nat.c (_initialize_gnu_nat): Add declaration. * gnu-v2-abi.c (_initialize_gnu_v2_abi): Add declaration. * gnu-v3-abi.c (_initialize_gnu_v3_abi): Add declaration. * go-lang.c (_initialize_go_language): Add declaration. * go32-nat.c (_initialize_go32_nat): Add declaration. * guile/guile.c (_initialize_guile): Add declaration. * h8300-tdep.c (_initialize_h8300_tdep): Add declaration. * hppa-linux-nat.c (_initialize_hppa_linux_nat): Add declaration. * hppa-linux-tdep.c (_initialize_hppa_linux_tdep): Add declaration. * hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Add declaration. * hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Add declaration. * hppa-obsd-nat.c (_initialize_hppaobsd_nat): Add declaration. * hppa-obsd-tdep.c (_initialize_hppabsd_tdep): Add declaration. * hppa-tdep.c (_initialize_hppa_tdep): Add declaration. * i386-bsd-nat.c (_initialize_i386bsd_nat): Add declaration. * i386-cygwin-tdep.c (_initialize_i386_cygwin_tdep): Add declaration. * i386-darwin-nat.c (_initialize_i386_darwin_nat): Add declaration. * i386-darwin-tdep.c (_initialize_i386_darwin_tdep): Add declaration. * i386-dicos-tdep.c (_initialize_i386_dicos_tdep): Add declaration. * i386-fbsd-nat.c (_initialize_i386fbsd_nat): Add declaration. * i386-fbsd-tdep.c (_initialize_i386fbsd_tdep): Add declaration. * i386-gnu-nat.c (_initialize_i386gnu_nat): Add declaration. * i386-gnu-tdep.c (_initialize_i386gnu_tdep): Add declaration. * i386-go32-tdep.c (_initialize_i386_go32_tdep): Add declaration. * i386-linux-nat.c (_initialize_i386_linux_nat): Add declaration. * i386-linux-tdep.c (_initialize_i386_linux_tdep): Add declaration. * i386-nbsd-nat.c (_initialize_i386nbsd_nat): Add declaration. * i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Add declaration. * i386-nto-tdep.c (_initialize_i386nto_tdep): Add declaration. * i386-obsd-nat.c (_initialize_i386obsd_nat): Add declaration. * i386-obsd-tdep.c (_initialize_i386obsd_tdep): Add declaration. * i386-sol2-nat.c (_initialize_amd64_sol2_nat): Add declaration. * i386-sol2-tdep.c (_initialize_i386_sol2_tdep): Add declaration. * i386-tdep.c (_initialize_i386_tdep): Add declaration. * i386-windows-nat.c (_initialize_i386_windows_nat): Add declaration. * ia64-libunwind-tdep.c (_initialize_libunwind_frame): Add declaration. * ia64-linux-nat.c (_initialize_ia64_linux_nat): Add declaration. * ia64-linux-tdep.c (_initialize_ia64_linux_tdep): Add declaration. * ia64-tdep.c (_initialize_ia64_tdep): Add declaration. * ia64-vms-tdep.c (_initialize_ia64_vms_tdep): Add declaration. * infcall.c (_initialize_infcall): Add declaration. * infcmd.c (_initialize_infcmd): Add declaration. * inflow.c (_initialize_inflow): Add declaration. * infrun.c (_initialize_infrun): Add declaration. * interps.c (_initialize_interpreter): Add declaration. * iq2000-tdep.c (_initialize_iq2000_tdep): Add declaration. * jit.c (_initialize_jit): Add declaration. * language.c (_initialize_language): Add declaration. * linux-fork.c (_initialize_linux_fork): Add declaration. * linux-nat.c (_initialize_linux_nat): Add declaration. * linux-tdep.c (_initialize_linux_tdep): Add declaration. * linux-thread-db.c (_initialize_thread_db): Add declaration. * lm32-tdep.c (_initialize_lm32_tdep): Add declaration. * m2-lang.c (_initialize_m2_language): Add declaration. * m32c-tdep.c (_initialize_m32c_tdep): Add declaration. * m32r-linux-nat.c (_initialize_m32r_linux_nat): Add declaration. * m32r-linux-tdep.c (_initialize_m32r_linux_tdep): Add declaration. * m32r-tdep.c (_initialize_m32r_tdep): Add declaration. * m68hc11-tdep.c (_initialize_m68hc11_tdep): Add declaration. * m68k-bsd-nat.c (_initialize_m68kbsd_nat): Add declaration. * m68k-bsd-tdep.c (_initialize_m68kbsd_tdep): Add declaration. * m68k-linux-nat.c (_initialize_m68k_linux_nat): Add declaration. * m68k-linux-tdep.c (_initialize_m68k_linux_tdep): Add declaration. * m68k-tdep.c (_initialize_m68k_tdep): Add declaration. * machoread.c (_initialize_machoread): Add declaration. * macrocmd.c (_initialize_macrocmd): Add declaration. * macroscope.c (_initialize_macroscope): Add declaration. * maint-test-options.c (_initialize_maint_test_options): Add declaration. * maint-test-settings.c (_initialize_maint_test_settings): Add declaration. * maint.c (_initialize_maint_cmds): Add declaration. * mdebugread.c (_initialize_mdebugread): Add declaration. * memattr.c (_initialize_mem): Add declaration. * mep-tdep.c (_initialize_mep_tdep): Add declaration. * mi/mi-cmd-env.c (_initialize_mi_cmd_env): Add declaration. * mi/mi-cmds.c (_initialize_mi_cmds): Add declaration. * mi/mi-interp.c (_initialize_mi_interp): Add declaration. * mi/mi-main.c (_initialize_mi_main): Add declaration. * microblaze-linux-tdep.c (_initialize_microblaze_linux_tdep): Add declaration. * microblaze-tdep.c (_initialize_microblaze_tdep): Add declaration. * mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Add declaration. * mips-fbsd-tdep.c (_initialize_mips_fbsd_tdep): Add declaration. * mips-linux-nat.c (_initialize_mips_linux_nat): Add declaration. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Add declaration. * mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Add declaration. * mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Add declaration. * mips-sde-tdep.c (_initialize_mips_sde_tdep): Add declaration. * mips-tdep.c (_initialize_mips_tdep): Add declaration. * mips64-obsd-nat.c (_initialize_mips64obsd_nat): Add declaration. * mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Add declaration. * mipsread.c (_initialize_mipsread): Add declaration. * mn10300-linux-tdep.c (_initialize_mn10300_linux_tdep): Add declaration. * mn10300-tdep.c (_initialize_mn10300_tdep): Add declaration. * moxie-tdep.c (_initialize_moxie_tdep): Add declaration. * msp430-tdep.c (_initialize_msp430_tdep): Add declaration. * nds32-tdep.c (_initialize_nds32_tdep): Add declaration. * nios2-linux-tdep.c (_initialize_nios2_linux_tdep): Add declaration. * nios2-tdep.c (_initialize_nios2_tdep): Add declaration. * nto-procfs.c (_initialize_procfs): Add declaration. * objc-lang.c (_initialize_objc_language): Add declaration. * observable.c (_initialize_observer): Add declaration. * opencl-lang.c (_initialize_opencl_language): Add declaration. * or1k-linux-tdep.c (_initialize_or1k_linux_tdep): Add declaration. * or1k-tdep.c (_initialize_or1k_tdep): Add declaration. * osabi.c (_initialize_gdb_osabi): Add declaration. * osdata.c (_initialize_osdata): Add declaration. * p-valprint.c (_initialize_pascal_valprint): Add declaration. * parse.c (_initialize_parse): Add declaration. * ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Add declaration. * ppc-fbsd-tdep.c (_initialize_ppcfbsd_tdep): Add declaration. * ppc-linux-nat.c (_initialize_ppc_linux_nat): Add declaration. * ppc-linux-tdep.c (_initialize_ppc_linux_tdep): Add declaration. * ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Add declaration. * ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Add declaration. * ppc-obsd-nat.c (_initialize_ppcobsd_nat): Add declaration. * ppc-obsd-tdep.c (_initialize_ppcobsd_tdep): Add declaration. * printcmd.c (_initialize_printcmd): Add declaration. * probe.c (_initialize_probe): Add declaration. * proc-api.c (_initialize_proc_api): Add declaration. * proc-events.c (_initialize_proc_events): Add declaration. * proc-service.c (_initialize_proc_service): Add declaration. * procfs.c (_initialize_procfs): Add declaration. * producer.c (_initialize_producer): Add declaration. * psymtab.c (_initialize_psymtab): Add declaration. * python/python.c (_initialize_python): Add declaration. * ravenscar-thread.c (_initialize_ravenscar): Add declaration. * record-btrace.c (_initialize_record_btrace): Add declaration. * record-full.c (_initialize_record_full): Add declaration. * record.c (_initialize_record): Add declaration. * regcache-dump.c (_initialize_regcache_dump): Add declaration. * regcache.c (_initialize_regcache): Add declaration. * reggroups.c (_initialize_reggroup): Add declaration. * remote-notif.c (_initialize_notif): Add declaration. * remote-sim.c (_initialize_remote_sim): Add declaration. * remote.c (_initialize_remote): Add declaration. * reverse.c (_initialize_reverse): Add declaration. * riscv-fbsd-nat.c (_initialize_riscv_fbsd_nat): Add declaration. * riscv-fbsd-tdep.c (_initialize_riscv_fbsd_tdep): Add declaration. * riscv-linux-nat.c (_initialize_riscv_linux_nat): Add declaration. * riscv-linux-tdep.c (_initialize_riscv_linux_tdep): Add declaration. * riscv-tdep.c (_initialize_riscv_tdep): Add declaration. * rl78-tdep.c (_initialize_rl78_tdep): Add declaration. * rs6000-aix-tdep.c (_initialize_rs6000_aix_tdep): Add declaration. * rs6000-lynx178-tdep.c (_initialize_rs6000_lynx178_tdep): Add declaration. * rs6000-nat.c (_initialize_rs6000_nat): Add declaration. * rs6000-tdep.c (_initialize_rs6000_tdep): Add declaration. * run-on-main-thread.c (_initialize_run_on_main_thread): Add declaration. * rust-exp.y (_initialize_rust_exp): Add declaration. * rx-tdep.c (_initialize_rx_tdep): Add declaration. * s12z-tdep.c (_initialize_s12z_tdep): Add declaration. * s390-linux-nat.c (_initialize_s390_nat): Add declaration. * s390-linux-tdep.c (_initialize_s390_linux_tdep): Add declaration. * s390-tdep.c (_initialize_s390_tdep): Add declaration. * score-tdep.c (_initialize_score_tdep): Add declaration. * ser-go32.c (_initialize_ser_dos): Add declaration. * ser-mingw.c (_initialize_ser_windows): Add declaration. * ser-pipe.c (_initialize_ser_pipe): Add declaration. * ser-tcp.c (_initialize_ser_tcp): Add declaration. * ser-uds.c (_initialize_ser_socket): Add declaration. * ser-unix.c (_initialize_ser_hardwire): Add declaration. * serial.c (_initialize_serial): Add declaration. * sh-linux-tdep.c (_initialize_sh_linux_tdep): Add declaration. * sh-nbsd-nat.c (_initialize_shnbsd_nat): Add declaration. * sh-nbsd-tdep.c (_initialize_shnbsd_tdep): Add declaration. * sh-tdep.c (_initialize_sh_tdep): Add declaration. * skip.c (_initialize_step_skip): Add declaration. * sol-thread.c (_initialize_sol_thread): Add declaration. * solib-aix.c (_initialize_solib_aix): Add declaration. * solib-darwin.c (_initialize_darwin_solib): Add declaration. * solib-dsbt.c (_initialize_dsbt_solib): Add declaration. * solib-frv.c (_initialize_frv_solib): Add declaration. * solib-svr4.c (_initialize_svr4_solib): Add declaration. * solib-target.c (_initialize_solib_target): Add declaration. * solib.c (_initialize_solib): Add declaration. * source-cache.c (_initialize_source_cache): Add declaration. * source.c (_initialize_source): Add declaration. * sparc-linux-nat.c (_initialize_sparc_linux_nat): Add declaration. * sparc-linux-tdep.c (_initialize_sparc_linux_tdep): Add declaration. * sparc-nat.c (_initialize_sparc_nat): Add declaration. * sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Add declaration. * sparc-nbsd-tdep.c (_initialize_sparcnbsd_tdep): Add declaration. * sparc-obsd-tdep.c (_initialize_sparc32obsd_tdep): Add declaration. * sparc-sol2-tdep.c (_initialize_sparc_sol2_tdep): Add declaration. * sparc-tdep.c (_initialize_sparc_tdep): Add declaration. * sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Add declaration. * sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Add declaration. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Add declaration. * sparc64-linux-tdep.c (_initialize_sparc64_linux_tdep): Add declaration. * sparc64-nat.c (_initialize_sparc64_nat): Add declaration. * sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Add declaration. * sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Add declaration. * sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Add declaration. * sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Add declaration. * sparc64-sol2-tdep.c (_initialize_sparc64_sol2_tdep): Add declaration. * sparc64-tdep.c (_initialize_sparc64_adi_tdep): Add declaration. * stabsread.c (_initialize_stabsread): Add declaration. * stack.c (_initialize_stack): Add declaration. * stap-probe.c (_initialize_stap_probe): Add declaration. * std-regs.c (_initialize_frame_reg): Add declaration. * symfile-debug.c (_initialize_symfile_debug): Add declaration. * symfile-mem.c (_initialize_symfile_mem): Add declaration. * symfile.c (_initialize_symfile): Add declaration. * symmisc.c (_initialize_symmisc): Add declaration. * symtab.c (_initialize_symtab): Add declaration. * target.c (_initialize_target): Add declaration. * target-connection.c (_initialize_target_connection): Add declaration. * target-dcache.c (_initialize_target_dcache): Add declaration. * target-descriptions.c (_initialize_target_descriptions): Add declaration. * thread.c (_initialize_thread): Add declaration. * tic6x-linux-tdep.c (_initialize_tic6x_linux_tdep): Add declaration. * tic6x-tdep.c (_initialize_tic6x_tdep): Add declaration. * tilegx-linux-nat.c (_initialize_tile_linux_nat): Add declaration. * tilegx-linux-tdep.c (_initialize_tilegx_linux_tdep): Add declaration. * tilegx-tdep.c (_initialize_tilegx_tdep): Add declaration. * tracectf.c (_initialize_ctf): Add declaration. * tracefile-tfile.c (_initialize_tracefile_tfile): Add declaration. * tracefile.c (_initialize_tracefile): Add declaration. * tracepoint.c (_initialize_tracepoint): Add declaration. * tui/tui-hooks.c (_initialize_tui_hooks): Add declaration. * tui/tui-interp.c (_initialize_tui_interp): Add declaration. * tui/tui-layout.c (_initialize_tui_layout): Add declaration. * tui/tui-regs.c (_initialize_tui_regs): Add declaration. * tui/tui-stack.c (_initialize_tui_stack): Add declaration. * tui/tui-win.c (_initialize_tui_win): Add declaration. * tui/tui.c (_initialize_tui): Add declaration. * typeprint.c (_initialize_typeprint): Add declaration. * ui-style.c (_initialize_ui_style): Add declaration. * unittests/array-view-selftests.c (_initialize_array_view_selftests): Add declaration. * unittests/child-path-selftests.c (_initialize_child_path_selftests): Add declaration. * unittests/cli-utils-selftests.c (_initialize_cli_utils_selftests): Add declaration. * unittests/common-utils-selftests.c (_initialize_common_utils_selftests): Add declaration. * unittests/copy_bitwise-selftests.c (_initialize_copy_bitwise_utils_selftests): Add declaration. * unittests/environ-selftests.c (_initialize_environ_selftests): Add declaration. * unittests/filtered_iterator-selftests.c (_initialize_filtered_iterator_selftests): Add declaration. * unittests/format_pieces-selftests.c (_initialize_format_pieces_selftests): Add declaration. * unittests/function-view-selftests.c (_initialize_function_view_selftests): Add declaration. * unittests/help-doc-selftests.c (_initialize_help_doc_selftests): Add declaration. * unittests/lookup_name_info-selftests.c (_initialize_lookup_name_info_selftests): Add declaration. * unittests/main-thread-selftests.c (_initialize_main_thread_selftests): Add declaration. * unittests/memory-map-selftests.c (_initialize_memory_map_selftests): Add declaration. * unittests/memrange-selftests.c (_initialize_memrange_selftests): Add declaration. * unittests/mkdir-recursive-selftests.c (_initialize_mkdir_recursive_selftests): Add declaration. * unittests/observable-selftests.c (_initialize_observer_selftest): Add declaration. * unittests/offset-type-selftests.c (_initialize_offset_type_selftests): Add declaration. * unittests/optional-selftests.c (_initialize_optional_selftests): Add declaration. * unittests/parse-connection-spec-selftests.c (_initialize_parse_connection_spec_selftests): Add declaration. * unittests/rsp-low-selftests.c (_initialize_rsp_low_selftests): Add declaration. * unittests/scoped_fd-selftests.c (_initialize_scoped_fd_selftests): Add declaration. * unittests/scoped_mmap-selftests.c (_initialize_scoped_mmap_selftests): Add declaration. * unittests/scoped_restore-selftests.c (_initialize_scoped_restore_selftests): Add declaration. * unittests/string_view-selftests.c (_initialize_string_view_selftests): Add declaration. * unittests/style-selftests.c (_initialize_style_selftest): Add declaration. * unittests/tracepoint-selftests.c (_initialize_tracepoint_selftests): Add declaration. * unittests/tui-selftests.c (_initialize_tui_selftest): Add declaration. * unittests/unpack-selftests.c (_initialize_unpack_selftests): Add declaration. * unittests/utils-selftests.c (_initialize_utils_selftests): Add declaration. * unittests/vec-utils-selftests.c (_initialize_vec_utils_selftests): Add declaration. * unittests/xml-utils-selftests.c (_initialize_xml_utils): Add declaration. * user-regs.c (_initialize_user_regs): Add declaration. * utils.c (_initialize_utils): Add declaration. * v850-tdep.c (_initialize_v850_tdep): Add declaration. * valops.c (_initialize_valops): Add declaration. * valprint.c (_initialize_valprint): Add declaration. * value.c (_initialize_values): Add declaration. * varobj.c (_initialize_varobj): Add declaration. * vax-bsd-nat.c (_initialize_vaxbsd_nat): Add declaration. * vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Add declaration. * vax-tdep.c (_initialize_vax_tdep): Add declaration. * windows-nat.c (_initialize_windows_nat): Add declaration. (_initialize_check_for_gdb_ini): Add declaration. (_initialize_loadable): Add declaration. * windows-tdep.c (_initialize_windows_tdep): Add declaration. * x86-bsd-nat.c (_initialize_x86_bsd_nat): Add declaration. * x86-linux-nat.c (_initialize_x86_linux_nat): Add declaration. * xcoffread.c (_initialize_xcoffread): Add declaration. * xml-support.c (_initialize_xml_support): Add declaration. * xstormy16-tdep.c (_initialize_xstormy16_tdep): Add declaration. * xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Add declaration. * xtensa-linux-tdep.c (_initialize_xtensa_linux_tdep): Add declaration. * xtensa-tdep.c (_initialize_xtensa_tdep): Add declaration. Change-Id: I13eec7e0ed2b3c427377a7bdb055cf46da64def9
2020-01-05gdb: use tui_set_layout not show_layout to fix window focusAndrew Burgess1-6/+6
When calling tui_add_win_to_layout, use tui_set_layout not show_layout so that window focus is correctly updated. If the focus is not correctly maintained then GDB can be crashed like this: start tui enable layout asm list SOME_FUNCTION At this point GDB will have "popped up" the source window to display SOME_FUNCTION. Previously no window would have focus at this point, and so if the user now does 'focus next' or 'focus prev', then GDB would crash. Calling tui_set_layout ensures that focus is correctly calculated as the source window is "popped up", and this fixes the issue. gdb/ChangeLog: * tui/tui-layout.c (tui_add_win_to_layout): Use tui_set_layout not show_layout. gdb/testsuite/ChangeLog: * gdb.tui/list.exp: Test 'focus next' after 'list main'. Change-Id: Id0b13f99b0e889261efedfd0adabe82020202f44
2020-01-01Update copyright year range in all GDB files.Joel Brobecker1-1/+1
gdb/ChangeLog: Update copyright year range in all GDB files.
2019-12-27Remove tui_gen_win_info::viewport_heightTom Tromey1-4/+0
tui_gen_win_info::viewport_height is only used in a couple of spots, and is redundant with "height". This patch removes viewport_height. gdb/ChangeLog 2019-12-27 Tom Tromey <tom@tromey.com> * tui/tui-source.c (tui_source_window::maybe_update): Update. * tui/tui-regs.c (tui_data_window::display_registers_from): Update. * tui/tui-layout.c (tui_gen_win_info::resize): Update. * tui/tui-data.h (struct tui_gen_win_info) <viewport_height>: Remove. * tui/tui-command.c (tui_cmd_window::resize): Update. Change-Id: I020e026fbe289adda8e2fdfebca91bdbdbc312e8
2019-12-11Change "winheight" resizing to use new layout codeTom Tromey1-0/+8
The "winheight" command resizes a specified window, resizing the other windows in the layout to adapt. In the current code, this is done by examining each possible layout separately. The new layout code has a more general approach to handling this, and this patch simply removes the old code in favor of a call into the new layout engine. gdb/ChangeLog 2019-12-11 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_set_win_height_command): Call tui_adjust_window_height. (tui_adjust_win_heights, new_height_ok): Remove. * tui/tui-layout.h (tui_adjust_window_height): Declare. * tui/tui-layout.c (tui_adjust_window_height): New function. Change-Id: I6bb681375a46adc8d29fd06f581deed4e078e78a
2019-12-11First use of tui_layoutTom Tromey1-167/+49
This patch introduces the first use of tui_layout, by changing show_layout to clone and use the appropriate tui_layout. This resulted in one minor layout change, and also in the unintended -- but good -- side effect that the title of each boxed window is now visible. gdb/ChangeLog 2019-12-11 Tom Tromey <tom@tromey.com> * tui/tui-layout.h (tui_apply_current_layout): Declare. * tui/tui-layout.c (standard_layouts, applied_layout): New globals. (tui_apply_current_layout): New function. (show_layout): Set applied_layout. Call tui_apply_current_layout. (show_source_command, show_disasm_command) (show_source_disasm_command, show_data) (show_source_or_disasm_and_command): Remove. (initialize_layouts): New function. (_initialize_tui_layout): Call initialize_layouts. gdb/testsuite/ChangeLog 2019-12-11 Tom Tromey <tom@tromey.com> * gdb.tui/regs.exp: Update. * gdb.tui/empty.exp (layouts): Update. * gdb.tui/basic.exp: Update. * lib/tuiterm.exp (_check_box): Don't check bottom border. Change-Id: If1ee06ee58f4803e8c213f4ab0f5bb59f4650ec2
2019-12-11Introduce new layout codeTom Tromey1-0/+360
This introduces a new approach to window layout for the TUI. The idea behind this code is that a layout should be specified in a declarative way, and then be applied by generic code that does not need to know the specifics of every possible layout. This patch itself does not change any behavior, because the new layout engine isn't yet connected to anything. That is, this merely introduces the implementation. This generic approach makes the code more maintainable. It also enables some future changes: * New window types are simpler to add; * User-specified layouts are possible; and * Horizontal layouts are more attainable gdb/ChangeLog 2019-12-11 Tom Tromey <tom@tromey.com> * tui/tui-layout.h (class tui_layout_base) (class tui_layout_window, class tui_layout_split): New. * tui/tui-layout.c (tui_get_window_by_name) (tui_layout_window::clone, tui_layout_window::apply) (tui_layout_window::get_sizes, tui_layout_window::add_split) (tui_layout_split::add_window, tui_layout_split::clone) (tui_layout_split::get_sizes) (tui_layout_split::set_weights_from_heights) (tui_layout_split::adjust_size, tui_layout_split::apply): New functions. (tui_layout_split::add_split, tui_layout_split::add_split) (tui_layout_split::set_weights_from_heights) (tui_layout_split::set_weights_from_heights): New functions. Change-Id: I3a4cae666327b617d862aaa356f8179f945c6a4e
2019-12-11Remove struct tui_pointTom Tromey1-4/+4
struct tui_point does not help very much. It is only used for storage, and never passed between functions. I think it makes the code more verbose without any corresponding benefit, so this patch removes it. gdb/ChangeLog 2019-12-11 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.c (tui_gen_win_info::make_window): Update. * tui/tui-win.c (tui_adjust_win_heights, tui_resize_all): Update. * tui/tui-layout.c (tui_gen_win_info::resize): Update. * tui/tui-data.h (struct tui_point): Remove. (struct tui_gen_win_info) <origin>: Remove. <x, y>: New fields. * tui/tui-command.c (tui_cmd_window::resize): Update. Change-Id: I3f77920585b9ea9e2b4b189f3f3ae32d4da0c252
2019-11-12Consolidate setting of current_layoutTom Tromey1-4/+1
Currently several functions in tui-layout.c set current_layout after their work is done. This moves this assignment to show_layout, instead. gdb/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (show_layout): Set current_layout. (show_source_disasm_command, show_data) (show_source_or_disasm_and_command): Don't set current_layout. Change-Id: Id8b23797d68e607f0fcd6d29b8801869d40d1869
2019-11-12Move _initialize_tui_layout to end of fileTom Tromey1-25/+26
This moves _initialize_tui_layout to the end of the file, conforming to the typical gdb style. gdb/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (_initialize_tui_layout): Move to end. Change-Id: I667f741b44b2bc470878a36f093a96d89fa31893
2019-10-09Make TUI window handle a unique_ptrTom Tromey1-5/+4
This changes tui_gen_win_info::handle to be a specialization of unique_ptr. This is perhaps mildly uglier in some spots, due to the proliferation of "get"; but on the other hand it cleans up some manual management and it allows for the removal of tui_delete_win. gdb/ChangeLog 2019-10-09 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_delete_win): Don't declare. * tui/tui-stack.c (tui_locator_window::rerender): Update. * tui/tui-command.c (tui_cmd_window::resize) (tui_refresh_cmd_win): Update. * tui/tui-win.c (tui_resize_all, tui_set_focus_command): Update. * tui/tui.c (tui_rl_other_window, tui_enable): Update. * tui/tui-data.c (~tui_gen_win_info): Remove. * tui/tui-layout.c (tui_gen_win_info::resize): 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_getc): Update. * tui/tui-regs.c (tui_data_window::delete_data_content_windows) (tui_data_window::erase_data_content) (tui_data_item_window::rerender) (tui_data_item_window::refresh_window): Update. * tui/tui-wingeneral.c (tui_gen_win_info::refresh_window) (box_win, tui_gen_win_info::make_window) (tui_gen_win_info::make_visible): Update. (tui_delete_win): Remove. * tui/tui-winsource.c (tui_source_window_base::do_erase_source_content): Update. (tui_show_source_line, tui_source_window_base::update_tab_width) (tui_source_window_base::update_exec_info): Update. * tui/tui-data.h (struct curses_deleter): New. (struct tui_gen_win_info) <handle>: Now a unique_ptr. (struct tui_gen_win_info) <~tui_gen_win_info>: Define.
2019-10-09Remove tui_default_win_viewport_heightTom Tromey1-60/+0
tui_default_win_viewport_height was only called from a single spot, for a single type of window. This patch removes the function and moves the logic into the sole caller. gdb/ChangeLog 2019-10-09 Tom Tromey <tom@tromey.com> * tui/tui-disasm.c (tui_get_low_disassembly_address): Compute window height directly. * tui/tui-layout.h (tui_default_win_viewport_height): Don't declare. * tui/tui-layout.c (tui_default_win_height): Remove. (tui_default_win_viewport_height): Remove.
2019-09-20Change TUI window commands to be case-sensitiveTom Tromey1-14/+8
The TUI window-related commands like "focus" are case insensitive. This is not the norm in gdb, and I don't see a good reason to have it here. This patch changes the TUI to be case sensitive, like the rest of gdb. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * NEWS: Mention case-sensitivity of TUI commands. * tui/tui-win.c (tui_set_focus_command): Now case-sensitive. (tui_set_win_height_command, parse_scrolling_args): Likewise. * tui/tui-layout.c (tui_layout_command): Now case-sensitive.
2019-09-20Remove separator comments from TUITom Tromey1-11/+0
This removes various separator comments from the TUI. These aren't used elsewhere in gdb, and they were incorrect in some cases as well. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-data.c: Remove separator comments. * tui/tui-layout.c: Remove separator comments. * tui/tui-win.c: Remove separator comments. * tui/tui-wingeneral.c: Remove separator comments.
2019-09-20Set TUI locator height to 1Tom Tromey1-12/+6
The TUI has long had code to resize the locator, using 2 as the height. However the code has "1" in a comment, like: locator->resize (2 /* 1 */ , This patch fixes the resizing code to set the height to 1. Doing this revealed what was probably the reason for setting the height to 2 in the first place: this caused the locator window to scroll. However, this is easily handled by calling scrollok on the locator window. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-win.c (tui_resize_all, tui_adjust_win_heights): Use 1 as height for locator. * tui/tui-stack.c (tui_locator_window::rerender): Call scrollok. * tui/tui-layout.c (show_source_disasm_command, show_data) (show_source_or_disasm_and_command): Use 1 as height for locator.
2019-09-20Remove some explicit re-rendering from the TUITom Tromey1-4/+0
A couple of spots in tui-layout.c still call the show_source_content method. However, now that re-rendering is done by the resize method, these calls are no longer needed. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (show_source_disasm_command) (show_source_or_disasm_and_command): Don't call show_source_content.
2019-09-20Remove tui_clear_source_windows_detailTom Tromey1-2/+0
The calls to tui_clear_source_windows_detail in tui_add_win_to_layout aren't needed, because (after the resize unification) resizing will update the window contents. Removing these calls lets us remove several other things as well. gdb/ChangeLog 2019-09-20 Tom Tromey <tom@tromey.com> * tui/tui-data.h (tui_clear_source_windows_detail): Don't declare. * tui/tui-layout.c (tui_add_win_to_layout): Don't call tui_clear_source_windows_detail. * tui/tui-winsource.h (struct tui_source_window_base) <clear_detail>: Don't declare. * tui/tui-winsource.c (tui_source_window_base::clear_detail): Remove. * tui/tui-data.c (tui_clear_source_windows_detail): Remove.
2019-08-30Don't call tui_refresh_all from show_layoutTom Tromey1-1/+0
show_layout calls tui_refresh_all in one case. However, it doesn't need to any more, because the resize method on each window will also update the contents. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-layout.c (show_layout): Don't call tui_refresh_all.
2019-08-30Simplify register displayTom Tromey1-0/+5
This patch starts with the observation that the code in tui_data_window::display_registers_from can all be replaced with a call to resize. To make this work propertly, it also changes tui_display_register to be the "rerender" method on tui_data_item_window. The refresh_window method is needed due to the use of nested windows here. The ncurses man page makes it sound like this is not very well supported; and experience bears this out: negelecting the touchwin call in this path will cause the register window to blank when switching focus. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_item_window) <rerender, refresh_window>: Declare. * tui/tui-regs.c (tui_data_window::display_registers_from): Call resize. (tui_data_item_window::rerender): Rename from tui_display_register. (tui_data_item_window::refresh_window): New method. * tui/tui-layout.c (tui_gen_win_info::resize): Do nothing on no-op.
2019-08-30Private data members in tui_data_windowTom Tromey1-1/+1
This changes tui_data_window so that the data members are private. This required the addition of a simple accessor method in one case. gdb/ChangeLog 2019-08-30 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <regs_content, regs_column_count, current_group>: Move later. Now private. <get_current_group>: New method. * tui/tui-regs.c (tui_reg_command): Update. * tui/tui-layout.c (tui_set_layout): Update.
2019-08-20Change tui_make_window to be a methodTom Tromey1-1/+1
I combined several small changes into one patch here. I believe I started by noticing that the "title" is not needed by tui_gen_win_info and could be self-managing (i.e. std::string). Moving this revealed that "can_box" is also a property of tui_win_info and not tui_gen_win_info; and this in turn caused the changes to tui_make_window and box_win. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-wingeneral.h (tui_make_window): Don't declare. * tui/tui-wingeneral.c (box_win): Change type of win_info. (box_win): Update. (tui_gen_win_info::make_window): Rename from tui_make_window. (tui_win_info::make_window): New method. (tui_gen_win_info::make_visible): Update. * tui/tui-source.c (tui_source_window::set_contents): Update. * tui/tui-regs.c (tui_data_window::show_register_group): Update. (tui_data_window::display_registers_from): Update. * tui/tui-layout.c (tui_gen_win_info::resize): Update. * tui/tui-data.h (struct tui_gen_win_info) <make_window>: Declare. <can_box>: Remove. <title>: Remove. (struct tui_win_info) <make_window>: Declare. <can_box>: Now virtual. <title>: New member. * tui/tui-data.c (~tui_gen_win_info): Don't free title. * tui/tui-command.c (tui_cmd_window::resize): Update.
2019-08-20Add two methods to tui_data_windowTom Tromey1-1/+1
This changes tui_show_registers and tui_show_register_group to be methods on tui_data_window. 2019-08-20 Tom Tromey <tom@tromey.com> * tui/tui-regs.h (struct tui_data_window) <show_registers, show_register_group>: Declare. (tui_show_register_group): Don't declare. * tui/tui-regs.c (tui_data_window::show_registers): Rename from tui_show_registers. (tui_data_window::show_register_group): Rename from tui_show_register_group. (tui_data_window::check_register_values, tui_reg_command): Update. * tui/tui-layout.c (tui_set_layout): Update.