binutils-gdb/gdb/tui/tui-win.c

1136 lines
30 KiB
C
Raw Normal View History

/* TUI window generic functions.
2002-03-01 07:19:28 +01:00
Copyright (C) 1998-2020 Free Software Foundation, Inc.
2002-03-01 07:19:28 +01:00
Contributed by Hewlett-Packard Company.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* This module contains procedures for handling tui window functions
like resize, scrolling, scrolling, changing focus, etc.
Author: Susan B. Macchia */
#include "defs.h"
#include "command.h"
#include "symtab.h"
#include "breakpoint.h"
#include "frame.h"
#include "cli/cli-cmds.h"
#include "cli/cli-style.h"
#include "top.h"
#include "source.h"
#include "gdbsupport/event-loop.h"
Make TUI resizing tests more robust As Sergio pointed out, the TUI resizing tests are flaky. Debugging this showed three main problems. 1. expect's "stty" command processes its arguments one-by-one. So, rather than requesting a single resize, it sends two separate resize requests (one for rows and one for columns). This means gdb sees two SIGWINCH signals and resizes the terminal twice. I consider this a bug in expect, but I couldn't readily see how to report a bug; and anyway the fix wouldn't propagate very quickly. This patch works around this problem by explicitly doing two separate resizes (so it will be robust if expect ever does change); and then by waiting for each resize to complete before continuing. 2. gdb uses curses to drive the console rendering. Currently the test suite looks for terminal text insertion sequences to decide when a command has completed. However, it turns out that, sometimes, curses can output things in non-obvious ways. I didn't debug into curses but I guess this can happen due to output optimizations. No matter the reason, sometimes the current approach of only tracking text insertions is not enough to detect that gdb has finished rendering. This patch fixes this problem by arranging to detect the termination output after any curses command, not just insertion. 3. Detecting when a resize has completed is tricky. In fact, I could not find a way to reliably do this. This patch fixes this problem by adding a special maint "tui-resize-message" setting to gdb. When this is enabled, gdb will print a message after each SIGWINCH has been fully processed. The test suite enables this mode and then waits for the message in order to know when control can be returned to the calling test. This patch also adds a timeout, to avoid the situation where the terminal code fails to notice a change for some reason. This lets the test at least try to continue. gdb/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * tui/tui-win.c (resize_message): New global. (show_tui_resize_message): New function. (tui_async_resize_screen): Print message if requested. (_initialize_tui_win): Add tui-resize-message setting. * NEWS: Add entry for new commands. gdb/doc/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * gdb.texinfo (Maintenance Commands): Document new command. gdb/testsuite/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * lib/tuiterm.exp (_accept): Add wait_for parameter. Check output after any command. Expect prompt after WAIT_FOR is seen. (enter_tui): Enable resize messages. (command): Expect command in output. (get_line): Avoid error when cursor appears to be off-screen. (dump_screen): Include screen size in title. (_do_resize): New proc, from "resize". (resize): Rewrite. Do resize in two steps. * gdb.tui/empty.exp (layouts): Fix entries. (check_boxes): Remove xfail. (check_text): Dump screen on failure. Change-Id: I420e0259cb99b21adcd28f671b99161eefa7a51d
2019-08-16 23:16:12 +02:00
#include "gdbcmd.h"
#include "async-event.h"
#include "tui/tui.h"
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
#include "tui/tui-io.h"
#include "tui/tui-command.h"
#include "tui/tui-data.h"
TUI resize unification 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-07-10 01:29:13 +02:00
#include "tui/tui-layout.h"
#include "tui/tui-wingeneral.h"
#include "tui/tui-stack.h"
#include "tui/tui-regs.h"
#include "tui/tui-disasm.h"
#include "tui/tui-source.h"
#include "tui/tui-winsource.h"
2008-02-21 Pedro Alves <pedro@codesorcery.com> Silence a few -Wmissing-prototypes warnings. PR build/9877: * amd64-nat.c: Include "amd64-nat.h". * fork-child.c (_initialize_fork_child): Ditto. * gcore.c (_initialize_gcore): Ditto. * inf-ptrace.c: Include "inf-ptrace.h". (inf_ptrace_store_registers): Make it static. * linux-nat.c (linux_nat_terminal_ours): Make it static. (_initialize_linux_nat): Declare before definition. * linux-tdep.c: Include "linux-tdep.h". * linux-thread-db.c (_initialize_thread_db): Declare before definition. * proc-service.c (_initialize_proc_service): Ditto. * remote.c (remote_send_printf): Make it static. * solib.c: Include "solib.h". * symfile-mem.c (_initialize_symfile_mem): Declare before definition. * ada-lang.c (ada_la_decode, ada_match_name) (ada_suppress_symbol_printing, ada_is_array_type) (ada_value_ptr_subscript, ada_array_length) (ada_to_static_fixed_value): Make them static. (_initialize_ada_language): Declare before definition. * ada-tasks.c (ada_get_task_number, ada_get_environment_task) (ada_task_list_changed, ada_new_objfile_observer): Make them static. (_initialize_tasks): Declare before definition. * addrmap.c (_initialize_addrmap): Declare before definition. * auxv.c (default_auxv_parse): Make it static. * bfd-target.c (target_bfd_xfer_partial, target_bfd_xclose): Make them static. * breakpoint.c (remove_sal): Add line break. (expand_line_sal_maybe): Make it static. * cp-name-parser.y: Include "cp-support.h". * cp-valprint.c (cp_find_class_member): Make it static. * eval.c (value_f90_subarray): Ditto. * exceptions.c (print_any_exception): Ditto. * findcmd.c (_initialize_mem_search): Declare before definition. * frame.c (frame_observer_target_changed): Make it static. * gnu-v3-abi.c (gnuv3_find_method_in): Make it static. * inf-child.c: Include "inf-child.h". * inferior.h (valid_inferior_id): Rename to ... (valid_gdb_inferior_id): ... this. * infrun.c (infrun_thread_stop_requested, siginfo_make_value): Make them static. * jv-lang.c (java_language_arch_info): Make it static. * m2-typeprint.c (m2_get_discrete_bounds): Ditto. * osdata.c (info_osdata_command): Make it static. * regcache.c (regcache_observer_target_changed): Make it static. * reverse.c (_initialize_reverse): Declare before definition. * stabsread.c (cleanup_undefined_types_noname) (cleanup_undefined_types_1): Make them static. * symfile.c (place_section): Make it static. * symtab.c (find_pc_sect_psymtab_closer): Make it static. * target-descriptions.c (_initialize_target_descriptions): Declare before definition. * target.c (default_get_ada_task_ptid, find_default_can_async_p) (find_default_is_async_p, find_default_supports_non_stop): Make them static. (target_supports_non_stop): Add prototype. (dummy_pid_to_str): Make it static. * utils.c (_initialize_utils): Declare before definition. * ada-exp.y (_initialize_ada_exp): Declare before definition. * solib-svr4.c (HAS_LM_DYNAMIC_FROM_LINK_MAP): Add a prototype. * target.h (struct target_ops): Add a prototype to the to_can_execute_reverse callback. * macroscope.c (_initialize_macroscope): Declare before definition. * cp-namespace.c (_initialize_cp_namespace): Declare before definition. * python/python.c (_initialize_python): Declare before definition. * tui/tui-command.c: Include "tui/tui-command.h". * tui/tui-data.c (init_content_element, init_win_info): Make them static. * tui/tui-disasm.c: Include "tui/tui-disasm.h". * tui/tui-interp.c (_initialize_tui_interp): Declare before definition. * tui/tui-layout.c: Include "tui/tui-layout.h". (_initialize_tui_layout): Declare before definition. * tui/tui-regs.c: Include "tui/tui-regs.h". (tui_display_reg_element_at_line): Make it static. (_initialize_tui_regs): Declare before definition. * tui/tui-stack.c (_initialize_tui_stack): Declare before definition. * tui/tui-win.c: Include "tui/tui-win.h". (_initialize_tui_win): Declare before definition. (tui_sigwinch_handler): Make it static. Wrap in ifdef SIGWINCH. * tui/tui-win.h (tui_sigwinch_handler): Delete declaration. (tui_get_cmd_list): Add a prototype. * tui/tui-windata.c: Include tui-windata.h. * tui/tui-wingeneral.c (box_win): Make it static. * cli/cli-logging.c (show_logging_command): Make it static. (_initialize_cli_logging): Declare before definition. * mi/mi-common.c (_initialize_gdb_mi_common): Declare before definition.
2009-02-21 17:14:50 +01:00
#include "tui/tui-win.h"
#include "gdb_curses.h"
#include <ctype.h>
#include "readline/readline.h"
#include "gdbsupport/gdb_string_view.h"
#include <signal.h>
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
static void tui_set_tab_width_command (const char *, int);
static void tui_refresh_all_command (const char *, int);
Constify add_info This patch constifies add_info and updates all the info commands. The bulk of this patch was written using a script; and then I did a manual pass to fix up the remaining compilation errors. I could not compile every changed file; in particular nto-procfs.c, gnu-nat.c, and darwin-nat-info.c; but I at least tried to check the correctness by inspection. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * frame.h (info_locals_command, info_args_command): Constify. * auto-load.h (auto_load_info_scripts): Constify. * inferior.h (registers_info): Constify. * copying.c: Rebuild. * copying.awk: Constify generated commands. * auto-load.c (auto_load_info_scripts) (info_auto_load_gdb_scripts): Constify. * cli/cli-decode.c (struct cmd_list_element): Take a cmd_const_cfunc_ftype. * command.h (add_info): Take a cmd_const_cfunc_ftype. * tui/tui-win.c (tui_all_windows_info): Constify. * python/py-auto-load.c (info_auto_load_python_scripts): Constify. * cli/cli-cmds.c (show_command): Remove non-const overload. * tracepoint.c (info_tvariables_command, info_scope_command): Constify. (info_static_tracepoint_markers_command): Constify. * thread.c (info_threads_command): Constify. (print_thread_info_1): Constify. * target.c (info_target_command): Constify. * symtab.c (info_sources_command, info_functions_command) (info_types_command): Constify. (info_variables_command): Remove non-const overload. * symfile.c (info_ext_lang_command): Constify. * stack.c (info_frame_command, info_locals_command) (info_args_command): Constify. (backtrace_command): Remove non-const overload. * source.c (info_source_command, info_line_command): Constify. * solib.c (info_sharedlibrary_command): Constify. * skip.c (info_skip_command): Constify. * ser-go32.c (info_serial_command): Constify. * reverse.c (info_bookmarks_command): Constify. * printcmd.c (info_symbol_command, info_address_command) (info_display_command): Constify. * osdata.c (info_osdata_command): Constify. * objc-lang.c (info_selectors_command, info_classes_command): Constify. * nto-procfs.c (procfs_pidlist, procfs_meminfo): Constify. * memattr.c (info_mem_command): Constify. * macrocmd.c (info_macro_command, info_macros_command): Constify. * linux-fork.c (info_checkpoints_command): Constify. * infrun.c (info_signals_command): Constify. * inflow.c (info_terminal_command): Constify. * inferior.c (info_inferiors_command): Constify. (print_inferior): Constify. * infcmd.c (info_program_command, info_all_registers_command) (info_registers_command, info_vector_command) (info_float_command): Constify. (registers_info): Constify. * gnu-nat.c (info_send_rights_cmd, info_recv_rights_cmd) (info_port_sets_cmd, info_dead_names_cmd, info_port_rights_cmd): Constify. * f-valprint.c (info_common_command): Constify. * dcache.c (info_dcache_command): Constify. (dcache_info_1): Constify. * darwin-nat-info.c (info_mach_tasks_command) (info_mach_task_command, info_mach_ports_command) (info_mach_port_command, info_mach_threads_command) (info_mach_thread_command, info_mach_regions_command) (info_mach_regions_recurse_command, info_mach_region_command) (info_mach_exceptions_command): Constify. (get_task_from_args): Constify. * cp-support.c (info_vtbl_command): Constify. * breakpoint.c (info_watchpoints_command) (info_tracepoints_command): Constify. (info_breakpoints_command): Remove non-const overload. * avr-tdep.c (avr_io_reg_read_command): Constify. * auxv.c (info_auxv_command): Constify. * ada-tasks.c (info_tasks_command): Constify. (info_task): Constify. * ada-lang.c (info_exceptions_command): Constify.
2017-10-14 06:07:26 +02:00
static void tui_all_windows_info (const char *, int);
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
static void tui_scroll_forward_command (const char *, int);
static void tui_scroll_backward_command (const char *, int);
static void tui_scroll_left_command (const char *, int);
static void tui_scroll_right_command (const char *, int);
static void parse_scrolling_args (const char *,
struct tui_win_info **,
int *);
#ifndef ACS_LRCORNER
# define ACS_LRCORNER '+'
#endif
#ifndef ACS_LLCORNER
# define ACS_LLCORNER '+'
#endif
#ifndef ACS_ULCORNER
# define ACS_ULCORNER '+'
#endif
#ifndef ACS_URCORNER
# define ACS_URCORNER '+'
#endif
#ifndef ACS_HLINE
# define ACS_HLINE '-'
#endif
#ifndef ACS_VLINE
# define ACS_VLINE '|'
#endif
/* Possible values for tui-border-kind variable. */
gdb/ Code cleanup: Make 1440 bytes of data segment read-only. * arch-utils.c (endian_enum): Make it const char *const []. * arm-tdep.c (fp_model_strings, arm_abi_strings, arm_mode_strings): Likewise. * breakpoint.c (always_inserted_enums): Likewise. * cli/cli-cmds.c (script_ext_enums): Likewise. * cli/cli-decode.c (add_setshow_enum_cmd, complete_on_enum): Make the enumlist parameter const char *const *. * cli/cli-decode.h (struct cmd_list_element): Make the enums field const char *const *. * command.h (complete_on_enum, add_setshow_enum_cmd): Make the enumlist parameter const char *const *. * cris-tdep.c (cris_modes): Make it const char *const []. * filesystem.c (target_file_system_kinds): Likewise. * i386-tdep.c (valid_flavors, valid_conventions): Likewise. * infrun.c (follow_fork_mode_kind_names, follow_exec_mode_names) (can_use_displaced_stepping_enum, scheduler_enums) (exec_direction_names): Likewise. * language.c (_initialize_language): Make the type_or_range_names and case_sensitive_names variables const char *const []. * mips-tdep.c (mips_abi_strings): Make it const char *const []. * python/python.c (python_excp_enums): Likewise. * remote.c (interrupt_sequence_modes): Likewise. * rs6000-tdep.c (powerpc_vector_strings): Likewise. * serial.c (logbase_enums): Likewise. * sh-tdep.c (sh_cc_enum): Likewise. * stack.c (print_frame_arguments_choices, print_entry_values_choices): Likewise. * symtab.c (multiple_symbols_modes): Likewise. * tui/tui-win.c (tui_border_kind_enums, tui_border_mode_enums): Likewise. * utils.c (internal_problem_modes): Likewise.
2012-01-28 19:08:22 +01:00
static const char *const tui_border_kind_enums[] = {
"space",
"ascii",
"acs",
NULL
};
/* Possible values for tui-border-mode and tui-active-border-mode. */
gdb/ Code cleanup: Make 1440 bytes of data segment read-only. * arch-utils.c (endian_enum): Make it const char *const []. * arm-tdep.c (fp_model_strings, arm_abi_strings, arm_mode_strings): Likewise. * breakpoint.c (always_inserted_enums): Likewise. * cli/cli-cmds.c (script_ext_enums): Likewise. * cli/cli-decode.c (add_setshow_enum_cmd, complete_on_enum): Make the enumlist parameter const char *const *. * cli/cli-decode.h (struct cmd_list_element): Make the enums field const char *const *. * command.h (complete_on_enum, add_setshow_enum_cmd): Make the enumlist parameter const char *const *. * cris-tdep.c (cris_modes): Make it const char *const []. * filesystem.c (target_file_system_kinds): Likewise. * i386-tdep.c (valid_flavors, valid_conventions): Likewise. * infrun.c (follow_fork_mode_kind_names, follow_exec_mode_names) (can_use_displaced_stepping_enum, scheduler_enums) (exec_direction_names): Likewise. * language.c (_initialize_language): Make the type_or_range_names and case_sensitive_names variables const char *const []. * mips-tdep.c (mips_abi_strings): Make it const char *const []. * python/python.c (python_excp_enums): Likewise. * remote.c (interrupt_sequence_modes): Likewise. * rs6000-tdep.c (powerpc_vector_strings): Likewise. * serial.c (logbase_enums): Likewise. * sh-tdep.c (sh_cc_enum): Likewise. * stack.c (print_frame_arguments_choices, print_entry_values_choices): Likewise. * symtab.c (multiple_symbols_modes): Likewise. * tui/tui-win.c (tui_border_kind_enums, tui_border_mode_enums): Likewise. * utils.c (internal_problem_modes): Likewise.
2012-01-28 19:08:22 +01:00
static const char *const tui_border_mode_enums[] = {
"normal",
"standout",
"reverse",
"half",
"half-standout",
"bold",
"bold-standout",
NULL
};
struct tui_translate
{
const char *name;
int value;
};
/* Translation table for border-mode variables.
The list of values must be terminated by a NULL.
After the NULL value, an entry defines the default. */
static struct tui_translate tui_border_mode_translate[] = {
{ "normal", A_NORMAL },
{ "standout", A_STANDOUT },
{ "reverse", A_REVERSE },
{ "half", A_DIM },
{ "half-standout", A_DIM | A_STANDOUT },
{ "bold", A_BOLD },
{ "bold-standout", A_BOLD | A_STANDOUT },
{ 0, 0 },
{ "normal", A_NORMAL }
};
/* Translation tables for border-kind, one for each border
character (see wborder, border curses operations).
-1 is used to indicate the ACS because ACS characters
are determined at run time by curses (depends on terminal). */
static struct tui_translate tui_border_kind_translate_vline[] = {
{ "space", ' ' },
{ "ascii", '|' },
{ "acs", -1 },
{ 0, 0 },
{ "ascii", '|' }
};
static struct tui_translate tui_border_kind_translate_hline[] = {
{ "space", ' ' },
{ "ascii", '-' },
{ "acs", -1 },
{ 0, 0 },
{ "ascii", '-' }
};
static struct tui_translate tui_border_kind_translate_ulcorner[] = {
{ "space", ' ' },
{ "ascii", '+' },
{ "acs", -1 },
{ 0, 0 },
{ "ascii", '+' }
};
static struct tui_translate tui_border_kind_translate_urcorner[] = {
{ "space", ' ' },
{ "ascii", '+' },
{ "acs", -1 },
{ 0, 0 },
{ "ascii", '+' }
};
static struct tui_translate tui_border_kind_translate_llcorner[] = {
{ "space", ' ' },
{ "ascii", '+' },
{ "acs", -1 },
{ 0, 0 },
{ "ascii", '+' }
};
static struct tui_translate tui_border_kind_translate_lrcorner[] = {
{ "space", ' ' },
{ "ascii", '+' },
{ "acs", -1 },
{ 0, 0 },
{ "ascii", '+' }
};
/* Tui configuration variables controlled with set/show command. */
static const char *tui_active_border_mode = "bold-standout";
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
static void
show_tui_active_border_mode (struct ui_file *file,
int from_tty,
struct cmd_list_element *c,
const char *value)
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
{
fprintf_filtered (file, _("\
The attribute mode to use for the active TUI window border is \"%s\".\n"),
value);
}
static const char *tui_border_mode = "normal";
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
static void
show_tui_border_mode (struct ui_file *file,
int from_tty,
struct cmd_list_element *c,
const char *value)
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
{
fprintf_filtered (file, _("\
The attribute mode to use for the TUI window borders is \"%s\".\n"),
value);
}
static const char *tui_border_kind = "acs";
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
static void
show_tui_border_kind (struct ui_file *file,
int from_tty,
struct cmd_list_element *c,
const char *value)
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
{
fprintf_filtered (file, _("The kind of border for TUI windows is \"%s\".\n"),
value);
}
/* Tui internal configuration variables. These variables are updated
by tui_update_variables to reflect the tui configuration
variables. */
chtype tui_border_vline;
chtype tui_border_hline;
chtype tui_border_ulcorner;
chtype tui_border_urcorner;
chtype tui_border_llcorner;
chtype tui_border_lrcorner;
int tui_border_attrs;
int tui_active_border_attrs;
/* Identify the item in the translation table.
When the item is not recognized, use the default entry. */
static struct tui_translate *
translate (const char *name, struct tui_translate *table)
{
while (table->name)
{
if (name && strcmp (table->name, name) == 0)
return table;
table++;
}
/* Not found, return default entry. */
table++;
return table;
}
/* Update the tui internal configuration according to gdb settings.
Returns 1 if the configuration has changed and the screen should
be redrawn. */
bool
tui_update_variables ()
{
bool need_redraw = false;
struct tui_translate *entry;
entry = translate (tui_border_mode, tui_border_mode_translate);
if (tui_border_attrs != entry->value)
{
tui_border_attrs = entry->value;
need_redraw = true;
}
entry = translate (tui_active_border_mode, tui_border_mode_translate);
if (tui_active_border_attrs != entry->value)
{
tui_active_border_attrs = entry->value;
need_redraw = true;
}
/* If one corner changes, all characters are changed.
Only check the first one. The ACS characters are determined at
run time by curses terminal management. */
entry = translate (tui_border_kind, tui_border_kind_translate_lrcorner);
if (tui_border_lrcorner != (chtype) entry->value)
{
tui_border_lrcorner = (entry->value < 0) ? ACS_LRCORNER : entry->value;
need_redraw = true;
}
entry = translate (tui_border_kind, tui_border_kind_translate_llcorner);
tui_border_llcorner = (entry->value < 0) ? ACS_LLCORNER : entry->value;
entry = translate (tui_border_kind, tui_border_kind_translate_ulcorner);
tui_border_ulcorner = (entry->value < 0) ? ACS_ULCORNER : entry->value;
entry = translate (tui_border_kind, tui_border_kind_translate_urcorner);
tui_border_urcorner = (entry->value < 0) ? ACS_URCORNER : entry->value;
entry = translate (tui_border_kind, tui_border_kind_translate_hline);
tui_border_hline = (entry->value < 0) ? ACS_HLINE : entry->value;
entry = translate (tui_border_kind, tui_border_kind_translate_vline);
tui_border_vline = (entry->value < 0) ? ACS_VLINE : entry->value;
return need_redraw;
}
static void
Constify add_prefix_cmd This changes add_prefix_cmd to accept a const-taking function as an argument; then fixes up all the callers. In a couple of spots I had to add a non-const overload of a function, because the function is passed to two different command-adding "constructors". These overloads are temporary; once constification is complete they can be removed. This patch also fixes a typo I happened to notice while constifying. Note that this touches a couple of files (gnu-nat.c and go32-nat.c) that I can't build. So, while I made a best-effort there, I am not certain they will still compile. Tested by rebuilding. gdb/ChangeLog 2017-10-11 Tom Tromey <tom@tromey.com> * gdbthread.h (thread_command): Constify. * inferior.h (detach_command): Constify. * top.h (set_history, show_history): Constify. * arm-tdep.c (set_arm_command, show_arm_command): Constify. * serial.c (serial_set_cmd, serial_show_cmd): Constify. * bsd-kvm.c (bsd_kvm_cmd): Constify. * printcmd.c (set_command): Constify. (non_const_set_command): New function. * dcache.c (set_dcache_command, show_dcache_command): Constify. * breakpoint.c (enable_command, disable_command, delete_command) (catch_command, tcatch_command, set_breakpoint_cmd) (show_breakpoint_cmd): Constify. * macrocmd.c (macro_command): Constify. * infcmd.c (unset_command, kill_command, detach_command) (info_proc_cmd): Constify. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify. * auto-load.c (show_auto_load_cmd, set_auto_load_cmd) (info_auto_load_cmd): Constify. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Constify. * ada-lang.c (set_ada_command, show_ada_command) (maint_set_ada_cmd, maint_show_ada_cmd): Constify. * guile/guile.c (set_guile_command, show_guile_command) (info_guile_command): Constify. * tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd): Constify. * skip.c (skip_command): Constify. * compile/compile.c (_initialize_compile): Constify. * dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd): Constify. * remote.c (set_remote_cmd, show_remote_cmd, remote_command): Constify. * python/python.c (user_show_python, user_set_python): Constify. * mips-tdep.c (set_mips_command, show_mips_command) (set_mipsfpu_command): Constify. * record-btrace.c (cmd_record_btrace_start) (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): Constify. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command): Constify. * symfile.c (overlay_command): Constify. * spu-tdep.c (set_spu_command, show_spu_command): Constify. * cli/cli-logging.c (set_logging_command, show_logging_command): Constify. * cli/cli-dump.c (dump_command, append_command) (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * cli/cli-cmds.c (info_command, show_command, set_debug) (show_debug): Constify. (show_command): Add non-const overload. * top.c (set_history, show_history): Constify. * sh-tdep.c (set_sh_command, show_sh_command): Constify. * command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype. * target.c (target_command): Constify. * sparc64-tdep.c (info_adi_command): Constify. * record-full.c (cmd_record_full_start): Constify. (set_record_full_command): Constify. Fix typo. (show_record_full_command): Constify. * thread.c (thread_command, thread_apply_command): Constify. * memattr.c (dummy_cmd): Constify. * value.c (function_command): Constify. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify. * probe.c (info_probes_command): Constify. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify. * gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd) (show_thread_cmd, set_thread_default_cmd) (show_thread_default_cmd): Constify. (check_empty): Constify. * tracepoint.c (tfind_command): Constify. * cp-support.c (maint_cplus_command): Constify. * windows-tdep.c (info_w32_command): Constify. * record.c (cmd_record_start, set_record_command) (show_record_command, info_record_command, cmd_record_goto): Constify. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Constify. * utils.c (set_internal_problem_cmd, show_internal_problem_cmd): Constify. (add_internal_problem_command): Remove casts. * arc-tdep.c (maintenance_print_arc_command): Constify. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Constify. * maint.c (maintenance_command, maintenance_info_command) (maintenance_print_command, maintenance_set_cmd) (maintenance_show_cmd, set_per_command_cmd) (show_per_command_cmd, maintenance_check_command): Constify. * language.c (set_check, show_check): Constify. * typeprint.c (show_print_type, set_print_type): Constify. * go32-nat.c (go32_info_dos_command): Constify.
2017-09-26 06:28:30 +02:00
set_tui_cmd (const char *args, int from_tty)
{
}
static void
Constify add_prefix_cmd This changes add_prefix_cmd to accept a const-taking function as an argument; then fixes up all the callers. In a couple of spots I had to add a non-const overload of a function, because the function is passed to two different command-adding "constructors". These overloads are temporary; once constification is complete they can be removed. This patch also fixes a typo I happened to notice while constifying. Note that this touches a couple of files (gnu-nat.c and go32-nat.c) that I can't build. So, while I made a best-effort there, I am not certain they will still compile. Tested by rebuilding. gdb/ChangeLog 2017-10-11 Tom Tromey <tom@tromey.com> * gdbthread.h (thread_command): Constify. * inferior.h (detach_command): Constify. * top.h (set_history, show_history): Constify. * arm-tdep.c (set_arm_command, show_arm_command): Constify. * serial.c (serial_set_cmd, serial_show_cmd): Constify. * bsd-kvm.c (bsd_kvm_cmd): Constify. * printcmd.c (set_command): Constify. (non_const_set_command): New function. * dcache.c (set_dcache_command, show_dcache_command): Constify. * breakpoint.c (enable_command, disable_command, delete_command) (catch_command, tcatch_command, set_breakpoint_cmd) (show_breakpoint_cmd): Constify. * macrocmd.c (macro_command): Constify. * infcmd.c (unset_command, kill_command, detach_command) (info_proc_cmd): Constify. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify. * auto-load.c (show_auto_load_cmd, set_auto_load_cmd) (info_auto_load_cmd): Constify. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Constify. * ada-lang.c (set_ada_command, show_ada_command) (maint_set_ada_cmd, maint_show_ada_cmd): Constify. * guile/guile.c (set_guile_command, show_guile_command) (info_guile_command): Constify. * tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd): Constify. * skip.c (skip_command): Constify. * compile/compile.c (_initialize_compile): Constify. * dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd): Constify. * remote.c (set_remote_cmd, show_remote_cmd, remote_command): Constify. * python/python.c (user_show_python, user_set_python): Constify. * mips-tdep.c (set_mips_command, show_mips_command) (set_mipsfpu_command): Constify. * record-btrace.c (cmd_record_btrace_start) (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): Constify. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command): Constify. * symfile.c (overlay_command): Constify. * spu-tdep.c (set_spu_command, show_spu_command): Constify. * cli/cli-logging.c (set_logging_command, show_logging_command): Constify. * cli/cli-dump.c (dump_command, append_command) (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * cli/cli-cmds.c (info_command, show_command, set_debug) (show_debug): Constify. (show_command): Add non-const overload. * top.c (set_history, show_history): Constify. * sh-tdep.c (set_sh_command, show_sh_command): Constify. * command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype. * target.c (target_command): Constify. * sparc64-tdep.c (info_adi_command): Constify. * record-full.c (cmd_record_full_start): Constify. (set_record_full_command): Constify. Fix typo. (show_record_full_command): Constify. * thread.c (thread_command, thread_apply_command): Constify. * memattr.c (dummy_cmd): Constify. * value.c (function_command): Constify. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify. * probe.c (info_probes_command): Constify. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify. * gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd) (show_thread_cmd, set_thread_default_cmd) (show_thread_default_cmd): Constify. (check_empty): Constify. * tracepoint.c (tfind_command): Constify. * cp-support.c (maint_cplus_command): Constify. * windows-tdep.c (info_w32_command): Constify. * record.c (cmd_record_start, set_record_command) (show_record_command, info_record_command, cmd_record_goto): Constify. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Constify. * utils.c (set_internal_problem_cmd, show_internal_problem_cmd): Constify. (add_internal_problem_command): Remove casts. * arc-tdep.c (maintenance_print_arc_command): Constify. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Constify. * maint.c (maintenance_command, maintenance_info_command) (maintenance_print_command, maintenance_set_cmd) (maintenance_show_cmd, set_per_command_cmd) (show_per_command_cmd, maintenance_check_command): Constify. * language.c (set_check, show_check): Constify. * typeprint.c (show_print_type, set_print_type): Constify. * go32-nat.c (go32_info_dos_command): Constify.
2017-09-26 06:28:30 +02:00
show_tui_cmd (const char *args, int from_tty)
{
}
* tui/tui-win.h (tui_get_cmd_list): Declare. * tui/tui-win.c (tui_command): New function. (tui_get_cmd_list): New function. (_initialize_tui_win): Moved initialization of tui command in tui_get_cmd_list. * tui/tui-data.c (init_content_element): Setup new data members. (init_win_info): Likewise. (free_content_elements): Free it. * tui/tui-data.h (struct tui_data_element): Store the register content to print. (struct tui_data_info): Keep the current register group. * tui/tui-layout.c (tui_set_layout): Update call to tui_show_registers. * tui/tui-regs.h (tui_show_registers): Update prototype. (tui_toggle_float_regs, tui_calculate_regs_column_count): Remove. (tui_resize_all): No need to calculate anything for register window. * tui/tui-regs.c (tui_calculate_regs_column_count): Remove. (tui_set_register_element, tui_set_general_regs_content): Remove. (tui_set_special_regs_content): Remove. (tui_set_general_and_special_regs_content): Remove. (tui_set_float_regs_content): Remove. (tui_reg_value_has_changed, tui_get_register_raw_value): Remove. (tui_set_regs_content): Remove. (tui_toggle_float_regs, _tui_toggle_float_regs_command): Remove. (tui_v_show_registers_command_support): Remove. (tui_show_registers): Use a reggroup to specify the registers to show. (tui_show_register_group): New function. (tui_display_registers_from): Compute the layout of register window and refresh with new API; be sure to delete old register windows. (tui_check_register_values): Update to use tui_get_register and tui_display_data. (tui_display_register): Just refresh the register window part. (tui_register_format): Format registers and save in tui_data_element. (tui_get_register): New to combine tui_reg_value_has_changed and tui_get_register_raw_value; fix to use the new gdb API. (tui_show_float_command): Renamed tui_reg_float_command. (tui_show_general_command): Renamed tui_reg_general_command. (tui_show_special_command): Renamed tui_reg_system_command. (_initialize_tui_regs): Remove unused commands.
2004-03-13 15:14:01 +01:00
static struct cmd_list_element *tuilist;
struct cmd_list_element **
tui_get_cmd_list (void)
* tui/tui-win.h (tui_get_cmd_list): Declare. * tui/tui-win.c (tui_command): New function. (tui_get_cmd_list): New function. (_initialize_tui_win): Moved initialization of tui command in tui_get_cmd_list. * tui/tui-data.c (init_content_element): Setup new data members. (init_win_info): Likewise. (free_content_elements): Free it. * tui/tui-data.h (struct tui_data_element): Store the register content to print. (struct tui_data_info): Keep the current register group. * tui/tui-layout.c (tui_set_layout): Update call to tui_show_registers. * tui/tui-regs.h (tui_show_registers): Update prototype. (tui_toggle_float_regs, tui_calculate_regs_column_count): Remove. (tui_resize_all): No need to calculate anything for register window. * tui/tui-regs.c (tui_calculate_regs_column_count): Remove. (tui_set_register_element, tui_set_general_regs_content): Remove. (tui_set_special_regs_content): Remove. (tui_set_general_and_special_regs_content): Remove. (tui_set_float_regs_content): Remove. (tui_reg_value_has_changed, tui_get_register_raw_value): Remove. (tui_set_regs_content): Remove. (tui_toggle_float_regs, _tui_toggle_float_regs_command): Remove. (tui_v_show_registers_command_support): Remove. (tui_show_registers): Use a reggroup to specify the registers to show. (tui_show_register_group): New function. (tui_display_registers_from): Compute the layout of register window and refresh with new API; be sure to delete old register windows. (tui_check_register_values): Update to use tui_get_register and tui_display_data. (tui_display_register): Just refresh the register window part. (tui_register_format): Format registers and save in tui_data_element. (tui_get_register): New to combine tui_reg_value_has_changed and tui_get_register_raw_value; fix to use the new gdb API. (tui_show_float_command): Renamed tui_reg_float_command. (tui_show_general_command): Renamed tui_reg_general_command. (tui_show_special_command): Renamed tui_reg_system_command. (_initialize_tui_regs): Remove unused commands.
2004-03-13 15:14:01 +01:00
{
if (tuilist == 0)
Replace most calls to help_list and cmd_show_list 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-04-17 15:27:14 +02:00
add_basic_prefix_cmd ("tui", class_tui,
_("Text User Interface commands."),
&tuilist, "tui ", 0, &cmdlist);
* tui/tui-win.h (tui_get_cmd_list): Declare. * tui/tui-win.c (tui_command): New function. (tui_get_cmd_list): New function. (_initialize_tui_win): Moved initialization of tui command in tui_get_cmd_list. * tui/tui-data.c (init_content_element): Setup new data members. (init_win_info): Likewise. (free_content_elements): Free it. * tui/tui-data.h (struct tui_data_element): Store the register content to print. (struct tui_data_info): Keep the current register group. * tui/tui-layout.c (tui_set_layout): Update call to tui_show_registers. * tui/tui-regs.h (tui_show_registers): Update prototype. (tui_toggle_float_regs, tui_calculate_regs_column_count): Remove. (tui_resize_all): No need to calculate anything for register window. * tui/tui-regs.c (tui_calculate_regs_column_count): Remove. (tui_set_register_element, tui_set_general_regs_content): Remove. (tui_set_special_regs_content): Remove. (tui_set_general_and_special_regs_content): Remove. (tui_set_float_regs_content): Remove. (tui_reg_value_has_changed, tui_get_register_raw_value): Remove. (tui_set_regs_content): Remove. (tui_toggle_float_regs, _tui_toggle_float_regs_command): Remove. (tui_v_show_registers_command_support): Remove. (tui_show_registers): Use a reggroup to specify the registers to show. (tui_show_register_group): New function. (tui_display_registers_from): Compute the layout of register window and refresh with new API; be sure to delete old register windows. (tui_check_register_values): Update to use tui_get_register and tui_display_data. (tui_display_register): Just refresh the register window part. (tui_register_format): Format registers and save in tui_data_element. (tui_get_register): New to combine tui_reg_value_has_changed and tui_get_register_raw_value; fix to use the new gdb API. (tui_show_float_command): Renamed tui_reg_float_command. (tui_show_general_command): Renamed tui_reg_general_command. (tui_show_special_command): Renamed tui_reg_system_command. (_initialize_tui_regs): Remove unused commands.
2004-03-13 15:14:01 +01:00
return &tuilist;
}
/* The set_func hook of "set tui ..." commands that affect the window
borders on the TUI display. */
static void
Constify add_setshow_* This constifies the add_setshow_* family of functions, and then fixes up the fallout. The bulk of this patch was written by script. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * ada-lang.c (catch_ada_exception_command): Constify. (catch_assert_command): Constify. * break-catch-throw.c (catch_catch_command, catch_throw_command) (catch_rethrow_command): Constify. (catch_exception_command_1): Constify. * breakpoint.h (add_catch_command): Constify. * break-catch-syscall.c (catch_syscall_command_1): Constify. (catch_syscall_split_args): Constify. * break-catch-sig.c (catch_signal_command): Constify. (catch_signal_split_args): Constify. * cli/cli-decode.h (struct cmd_list_element) <function>: Use cmd_const_sfunc_ftype. * cli/cli-decode.c (add_setshow_cmd_full): Constify. (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, struct cmd_list_element) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd): Constify. (set_cmd_sfunc): Constify. (empty_sfunc): Constify. * command.h (add_setshow_enum_cmd, add_setshow_auto_boolean_cmd) (add_setshow_boolean_cmd, add_setshow_filename_cmd) (add_setshow_string_cmd, add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd): Constify. (set_cmd_sfunc): Constify. (cmd_sfunc_ftype): Remove. * compile/compile.c (set_compile_args): Constify. * infrun.c (set_disable_randomization): Constify. * infcmd.c (set_args_command, set_cwd_command): Constify. * breakpoint.c (set_condition_evaluation_mode): Constify. (add_catch_command): Constify. (catch_fork_command_1, catch_exec_command_1) (catch_load_command_1, catch_unload_command_1): Constify. (catch_load_or_unload): Constify. * guile/scm-param.c (pascm_set_func): Constify. (add_setshow_generic): Constify. * python/py-param.c (get_set_value): Constify. * top.h (set_verbose): Constify. * tui/tui-win.c (tui_set_var_cmd): Constify. * mi/mi-main.c (set_mi_async_command): Constify. * cli/cli-logging.c (set_logging_overwrite) (set_logging_redirect): Constify. * value.c (set_max_value_size): Constify. * valprint.c (set_input_radix, set_output_radix): Constify. * utils.c (set_width_command, set_height_command): Constify. * typeprint.c (set_print_type_methods, set_print_type_typedefs): Constify. * tracepoint.c (set_disconnected_tracing) (set_circular_trace_buffer, set_trace_buffer_size) (set_trace_user, set_trace_notes, set_trace_stop_notes): Constify. * top.c (set_history_size_command, set_verbose, set_editing) (set_gdb_datadir, set_history_filename): Constify. * target.c (set_targetdebug, maint_set_target_async_command) (maint_set_target_non_stop_command, set_target_permissions) (set_write_memory_permission): Constify. (open_target): Constify. * target-descriptions.c (set_tdesc_filename_cmd): Constify. * target-dcache.c (set_stack_cache, set_code_cache): Constify. * symtab.c (set_symbol_cache_size_handler): Constify. * symfile.c (set_ext_lang_command): Constify. * symfile-debug.c (set_debug_symfile): Constify. * source.c (set_directories_command): Constify. * solib.c (reload_shared_libraries, gdb_sysroot_changed): Constify. * serial.c (set_parity): Constify. * rs6000-tdep.c (powerpc_set_soft_float, powerpc_set_vector_abi): Constify. * remote.c (set_remote_exec_file, set_remotebreak) (set_remote_protocol_Z_packet_cmd, set_range_stepping): Constify. * record.c (set_record_insn_history_size) (set_record_call_history_size): Constify. * record-full.c (set_record_full_insn_max_num): Constify. * proc-api.c (set_procfs_trace_cmd, set_procfs_file_cmd): Constify. * osabi.c (set_osabi): Constify. * mips-tdep.c (set_mips64_transfers_32bit_regs) (reinit_frame_cache_sfunc, mips_abi_update): Constify. * maint.c (maintenance_set_profile_cmd): Constify. * linux-thread-db.c (set_libthread_db_search_path): Constify. * language.c (set_language_command, set_range_command) (set_case_command): Constify. * infrun.c (set_non_stop, set_observer_mode) (set_stop_on_solib_events, set_schedlock_func) (set_exec_direction_func): Constify. * infcmd.c (set_inferior_tty_command): Constify. * disasm.c (set_disassembler_options_sfunc): Constify. * demangle.c (set_demangling_command): Constify. * dcache.c (set_dcache_size, set_dcache_line_size): Constify. * cris-tdep.c (set_cris_version, set_cris_mode) (set_cris_dwarf2_cfi): Constify. * corefile.c (set_gnutarget_command): Constify. * charset.c (set_host_charset_sfunc, set_target_charset_sfunc) (set_target_wide_charset_sfunc): Constify. * breakpoint.c (update_dprintf_commands): Constify. * auto-load.c (set_auto_load_dir, set_auto_load_safe_path): Constify. * arm-tdep.c (set_fp_model_sfunc, arm_set_abi) (set_disassembly_style_sfunc): Constify. * arch-utils.c (set_endian, set_architecture): Constify. * alpha-tdep.c (reinit_frame_cache_sfunc): Constify. * agent.c (set_can_use_agent): Constify.
2017-10-14 17:07:00 +02:00
tui_set_var_cmd (const char *null_args,
int from_tty, struct cmd_list_element *c)
{
if (tui_update_variables () && tui_active)
tui_rehighlight_all ();
}
Make TUI resizing tests more robust As Sergio pointed out, the TUI resizing tests are flaky. Debugging this showed three main problems. 1. expect's "stty" command processes its arguments one-by-one. So, rather than requesting a single resize, it sends two separate resize requests (one for rows and one for columns). This means gdb sees two SIGWINCH signals and resizes the terminal twice. I consider this a bug in expect, but I couldn't readily see how to report a bug; and anyway the fix wouldn't propagate very quickly. This patch works around this problem by explicitly doing two separate resizes (so it will be robust if expect ever does change); and then by waiting for each resize to complete before continuing. 2. gdb uses curses to drive the console rendering. Currently the test suite looks for terminal text insertion sequences to decide when a command has completed. However, it turns out that, sometimes, curses can output things in non-obvious ways. I didn't debug into curses but I guess this can happen due to output optimizations. No matter the reason, sometimes the current approach of only tracking text insertions is not enough to detect that gdb has finished rendering. This patch fixes this problem by arranging to detect the termination output after any curses command, not just insertion. 3. Detecting when a resize has completed is tricky. In fact, I could not find a way to reliably do this. This patch fixes this problem by adding a special maint "tui-resize-message" setting to gdb. When this is enabled, gdb will print a message after each SIGWINCH has been fully processed. The test suite enables this mode and then waits for the message in order to know when control can be returned to the calling test. This patch also adds a timeout, to avoid the situation where the terminal code fails to notice a change for some reason. This lets the test at least try to continue. gdb/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * tui/tui-win.c (resize_message): New global. (show_tui_resize_message): New function. (tui_async_resize_screen): Print message if requested. (_initialize_tui_win): Add tui-resize-message setting. * NEWS: Add entry for new commands. gdb/doc/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * gdb.texinfo (Maintenance Commands): Document new command. gdb/testsuite/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * lib/tuiterm.exp (_accept): Add wait_for parameter. Check output after any command. Expect prompt after WAIT_FOR is seen. (enter_tui): Enable resize messages. (command): Expect command in output. (get_line): Avoid error when cursor appears to be off-screen. (dump_screen): Include screen size in title. (_do_resize): New proc, from "resize". (resize): Rewrite. Do resize in two steps. * gdb.tui/empty.exp (layouts): Fix entries. (check_boxes): Remove xfail. (check_text): Dump screen on failure. Change-Id: I420e0259cb99b21adcd28f671b99161eefa7a51d
2019-08-16 23:16:12 +02:00
/* True if TUI resizes should print a message. This is used by the
test suite. */
static bool resize_message;
static void
show_tui_resize_message (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("TUI resize messaging is %s.\n"), value);
}
/* Generic window name completion function. Complete window name pointed
to by TEXT and WORD. If INCLUDE_NEXT_PREV_P is true then the special
window names 'next' and 'prev' will also be considered as possible
completions of the window name. */
Introduce class completion_tracker & rewrite completion<->readline interaction This patch reworks the whole completion machinery, and prepares it for later enhancements. Adds a new "completion_tracker" class that is meant to hold everything about the state of the current completion operation. This class now has the responsibility of tracking the list of completion matches, and checking whether the max completions limit has been reached. You can look at this as this patch starting out by C++fying the existing "completion_tracker" in symtab.c (it's just an htab_t typedef currently), moving it to completer.h/c, and then making it a class/generalizing/enhancing it. Unlike with the current tracking, completion_tracker now checks whether the limit has been reached on each completion match list insertion. This both simplifies the max-completions handling code (maybe_add_completion_enum is gone, for example), and is a prerequisite for follow up patches. The current completion_tracker is only used for symbol completions, and the symbol code gets at the current instance via globals. This patch cleans that up by adding a completion_tracker reference to the signature of the completion functions, and passing the tracker around everywhere necessary. Then, the patch changes how the completion match list is handed over to readline. Currently, we're using the rl_completion_entry_function readline entry point, and the patch switches to rl_attempted_completion_function. A following patch will want to let GDB itself decide the common completion prefix between all matches (what readline calls the "lowest common denominator"), instead of having readline compute it, and that's not possible with the rl_completion_entry_function entry point. Also, rl_attempted_completion_function lets GDB hand over the match list to readline as an array in one go instead of passing down matches one by one, so from that angle it's a nicer entry point anyway. Lastly, the patch catches exceptions around the readline entry points, because we can't let C++ exceptions cross readline. We handle that in the readline input entry point, but the completion entry point isn't guarded, so GDB can abort if completion throws. E.g., in current master: (gdb) b -function "fun<tab> terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR' Aborted (core dumped) This patch fixes that. This will be exercised in the new tests added later on in the series. gdb/ChangeLog: 2017-07-17 Pedro Alves <palves@redhat.com> * ada-lang.c (symbol_completion_match): Adjust comments. (symbol_completion_add): Replace vector parameter with completion_tracker parameter. Use it. (ada_make_symbol_completion_list): Rename to... (ada_collect_symbol_completion_matches): ... this. Add completion_tracker parameter and use it. (ada_language_defn): Adjust. * break-catch-syscall.c (catch_syscall_completer): Adjust prototype and work with completion_tracker instead of VEC. * breakpoint.c (condition_completer): Adjust prototype and work with completion_tracker instead of VEC. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Adjust to renames. * cli/cli-cmds.c (complete_command): Rework using completion_tracker. Catch exceptions when completing. * cli/cli-decode.c (integer_unlimited_completer) (complete_on_cmdlist, complete_on_enum): Adjust prototype and work with completion_tracker instead of VEC. * command.h (struct completion_tracker): Forward declare. (completer_ftype, completer_handle_brkchars_ftype): Change types. (complete_on_cmdlist, complete_on_enum): Adjust. * completer.c: Include <algorithm>. (struct gdb_completer_state): New. (current_completion): New global. (readline_line_completion_function): Delete. (noop_completer, filename_completer) (filename_completer_handle_brkchars, complete_files_symbols) (linespec_location_completer): Adjust to work with a completion_tracker instead of a VEC. (string_or_empty): New. (collect_explicit_location_matches): Adjust to work with a completion_tracker instead of a VEC. (explicit_location_completer): Rename to ... (complete_explicit_location): ... this and adjust to work with a completion_tracker instead of a VEC. (location_completer): Adjust to work with a completion_tracker instead of a VEC. (add_struct_fields): Adjust to work with a completion_list instead of VEC. (expression_completer): Rename to ... (complete_expression): ... this and adjust to work with a completion_tracker instead of a VEC. Use complete_files_symbols. (expression_completer): Reimplement on top of complete_expression. (symbol_completer): Adjust to work with a completion_tracker instead of a VEC. (enum complete_line_internal_reason): Add describing comments. (complete_line_internal_normal_command): Adjust to work with a completion_tracker instead of a VEC. (complete_line_internal): Rename to ... (complete_line_internal_1): ... this and adjust to work with a completion_tracker instead of a VEC. Assert TEXT is NULL in the handle_brkchars phase. (new_completion_tracker): Delete. (complete_line_internal): Reimplement as TRY/CATCH wrapper around complete_line_internal_1. (free_completion_tracker): Delete. (INITIAL_COMPLETION_HTAB_SIZE): New. (completion_tracker::completion_tracker) (completion_tracker::~completion_tracker): New. (maybe_add_completion): Delete. (completion_tracker::maybe_add_completion) (completion_tracker::add_completion) (completion_tracker::add_completions): New. (throw_max_completions_reached_error): Delete. (complete_line): Adjust to work with a completion_tracker instead of a VEC. Don't create a completion_tracker_t or check for max completions here. (command_completer, command_completer_handle_brkchars) (signal_completer, reg_or_group_completer_1) (reg_or_group_completer, default_completer_handle_brkchars): Adjust to work with a completion_tracker. (gdb_completion_word_break_characters_throw): New. (gdb_completion_word_break_characters): Reimplement. (line_completion_function): Delete. (completion_tracker::recompute_lowest_common_denominator) (expand_preserving_ws) (completion_tracker::build_completion_result) (completion_result::completion_result) (completion_result::completion_result) (completion_result::~completion_result) (completion_result::completion_result) (completion_result::release_match_list, compare_cstrings) (completion_result::sort_match_list) (completion_result::reset_match_list) (gdb_rl_attempted_completion_function_throw) (gdb_rl_attempted_completion_function): New. * completer.h (completion_list, struct completion_result) (class completion_tracker): New. (complete_line): Add completion_tracker parameter. (readline_line_completion_function): Delete. (gdb_rl_attempted_completion_function): New. (noop_completer, filename_completer, expression_completer) (location_completer, symbol_completer, command_completer) (signal_completer, reg_or_group_completer): Update prototypes. (completion_tracker_t, new_completion_tracker) (make_cleanup_free_completion_tracker): Delete. (enum maybe_add_completion_enum): Delete. (maybe_add_completion): Delete. (throw_max_completions_reached_error): Delete. * corefile.c (complete_set_gnutarget): Adjust to work with a completion_tracker instead of a VEC. * cp-abi.c (cp_abi_completer): Adjust to work with a completion_tracker instead of a VEC. * d-lang.c (d_language_defn): Adjust. * disasm.c (disassembler_options_completer): Adjust to work with a completion_tracker instead of a VEC. * f-lang.c (f_make_symbol_completion_list): Rename to ... (f_collect_symbol_completion_matches): ... this. Adjust to work with a completion_tracker instead of a VEC. (f_language_defn): Adjust. * go-lang.c (go_language_defn): Adjust. * guile/scm-cmd.c (cmdscm_add_completion, cmdscm_completer): Adjust to work with a completion_tracker instead of a VEC. * infrun.c (handle_completer): Likewise. * interps.c (interpreter_completer): Likewise. * interps.h (interpreter_completer): Likewise. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Adjust. * language.h (language_defn::la_make_symbol_completion_list): Rename to ... (language_defn::la_collect_symbol_completion_matches): ... this and adjust to work with a completion_tracker instead of a VEC. * m2-lang.c (m2_language_defn): Adjust. * objc-lang.c (objc_language_defn): Adjust. * opencl-lang.c (opencl_language_defn): Adjust. * p-lang.c (pascal_language_defn): Adjust. * python/py-cmd.c (cmdpy_completer_helper): Handle NULL word. (cmdpy_completer_handle_brkchars, cmdpy_completer): Adjust to work with a completion_tracker. * rust-lang.c (rust_language_defn): Adjust. * symtab.c (free_completion_list, do_free_completion_list) (return_val, completion_tracker): Delete. (completion_list_add_name, completion_list_add_symbol) (completion_list_add_msymbol, completion_list_objc_symbol) (completion_list_add_fields, add_symtab_completions): Add completion_tracker parameter and use it. (default_make_symbol_completion_list_break_on_1): Rename to... (default_collect_symbol_completion_matches_break_on): ... this. Add completion_tracker parameter and use it instead of allocating a completion tracker here. (default_make_symbol_completion_list_break_on): Delete old implementation. (default_make_symbol_completion_list): Delete. (default_collect_symbol_completion_matches): New. (make_symbol_completion_list): Delete. (collect_symbol_completion_matches): New. (make_symbol_completion_type): Rename to ... (collect_symbol_completion_matches_type): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list_1): Rename to... (collect_file_symbol_completion_matches): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list): Delete. (add_filename_to_list): Use completion_list instead of a VEC. (add_partial_filename_data::list): Now a completion_list. (make_source_files_completion_list): Work with a completion_list instead of a VEC. * symtab.h: Include "completer.h". (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_type, make_file_symbol_completion_list) (make_source_files_completion_list): Delete. (default_collect_symbol_completion_matches_break_on) (default_collect_symbol_completion_matches) (collect_symbol_completion_matches) (collect_symbol_completion_matches_type) (collect_file_symbol_completion_matches) (make_source_files_completion_list): New. * top.c (init_main): Don't install a rl_completion_entry_function hook. Install a rl_attempted_completion_function hook instead. * tui/tui-layout.c (layout_completer): Adjust to work with a completion_tracker. * tui/tui-regs.c (tui_reggroup_completer): * tui/tui-win.c (window_name_completer, focus_completer) (winheight_completer): Adjust to work with a completion_tracker. * value.c: Include "completer.h". (complete_internalvar): Adjust to work with a completion_tracker. * value.h (complete_internalvar): Likewise.
2017-07-17 15:45:59 +02:00
static void
window_name_completer (completion_tracker &tracker,
int include_next_prev_p,
const char *text, const char *word)
{
std::vector<const char *> completion_name_vec;
for (tui_win_info *win_info : all_tui_windows ())
{
const char *completion_name = NULL;
/* We can't focus on an invisible window. */
if (!win_info->is_visible ())
continue;
completion_name = win_info->name ();
gdb_assert (completion_name != NULL);
completion_name_vec.push_back (completion_name);
}
/* If no windows are considered visible then the TUI has not yet been
initialized. But still "focus src" and "focus cmd" will work because
invoking the focus command will entail initializing the TUI which sets the
Remove hard-coded TUI layouts 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-22 19:48:26 +01:00
default layout to "src". */
if (completion_name_vec.empty ())
{
completion_name_vec.push_back (SRC_NAME);
completion_name_vec.push_back (CMD_NAME);
}
if (include_next_prev_p)
{
completion_name_vec.push_back ("next");
completion_name_vec.push_back ("prev");
}
completion_name_vec.push_back (NULL);
complete_on_enum (tracker, completion_name_vec.data (), text, word);
}
/* Complete possible window names to focus on. TEXT is the complete text
entered so far, WORD is the word currently being completed. */
Introduce class completion_tracker & rewrite completion<->readline interaction This patch reworks the whole completion machinery, and prepares it for later enhancements. Adds a new "completion_tracker" class that is meant to hold everything about the state of the current completion operation. This class now has the responsibility of tracking the list of completion matches, and checking whether the max completions limit has been reached. You can look at this as this patch starting out by C++fying the existing "completion_tracker" in symtab.c (it's just an htab_t typedef currently), moving it to completer.h/c, and then making it a class/generalizing/enhancing it. Unlike with the current tracking, completion_tracker now checks whether the limit has been reached on each completion match list insertion. This both simplifies the max-completions handling code (maybe_add_completion_enum is gone, for example), and is a prerequisite for follow up patches. The current completion_tracker is only used for symbol completions, and the symbol code gets at the current instance via globals. This patch cleans that up by adding a completion_tracker reference to the signature of the completion functions, and passing the tracker around everywhere necessary. Then, the patch changes how the completion match list is handed over to readline. Currently, we're using the rl_completion_entry_function readline entry point, and the patch switches to rl_attempted_completion_function. A following patch will want to let GDB itself decide the common completion prefix between all matches (what readline calls the "lowest common denominator"), instead of having readline compute it, and that's not possible with the rl_completion_entry_function entry point. Also, rl_attempted_completion_function lets GDB hand over the match list to readline as an array in one go instead of passing down matches one by one, so from that angle it's a nicer entry point anyway. Lastly, the patch catches exceptions around the readline entry points, because we can't let C++ exceptions cross readline. We handle that in the readline input entry point, but the completion entry point isn't guarded, so GDB can abort if completion throws. E.g., in current master: (gdb) b -function "fun<tab> terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR' Aborted (core dumped) This patch fixes that. This will be exercised in the new tests added later on in the series. gdb/ChangeLog: 2017-07-17 Pedro Alves <palves@redhat.com> * ada-lang.c (symbol_completion_match): Adjust comments. (symbol_completion_add): Replace vector parameter with completion_tracker parameter. Use it. (ada_make_symbol_completion_list): Rename to... (ada_collect_symbol_completion_matches): ... this. Add completion_tracker parameter and use it. (ada_language_defn): Adjust. * break-catch-syscall.c (catch_syscall_completer): Adjust prototype and work with completion_tracker instead of VEC. * breakpoint.c (condition_completer): Adjust prototype and work with completion_tracker instead of VEC. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Adjust to renames. * cli/cli-cmds.c (complete_command): Rework using completion_tracker. Catch exceptions when completing. * cli/cli-decode.c (integer_unlimited_completer) (complete_on_cmdlist, complete_on_enum): Adjust prototype and work with completion_tracker instead of VEC. * command.h (struct completion_tracker): Forward declare. (completer_ftype, completer_handle_brkchars_ftype): Change types. (complete_on_cmdlist, complete_on_enum): Adjust. * completer.c: Include <algorithm>. (struct gdb_completer_state): New. (current_completion): New global. (readline_line_completion_function): Delete. (noop_completer, filename_completer) (filename_completer_handle_brkchars, complete_files_symbols) (linespec_location_completer): Adjust to work with a completion_tracker instead of a VEC. (string_or_empty): New. (collect_explicit_location_matches): Adjust to work with a completion_tracker instead of a VEC. (explicit_location_completer): Rename to ... (complete_explicit_location): ... this and adjust to work with a completion_tracker instead of a VEC. (location_completer): Adjust to work with a completion_tracker instead of a VEC. (add_struct_fields): Adjust to work with a completion_list instead of VEC. (expression_completer): Rename to ... (complete_expression): ... this and adjust to work with a completion_tracker instead of a VEC. Use complete_files_symbols. (expression_completer): Reimplement on top of complete_expression. (symbol_completer): Adjust to work with a completion_tracker instead of a VEC. (enum complete_line_internal_reason): Add describing comments. (complete_line_internal_normal_command): Adjust to work with a completion_tracker instead of a VEC. (complete_line_internal): Rename to ... (complete_line_internal_1): ... this and adjust to work with a completion_tracker instead of a VEC. Assert TEXT is NULL in the handle_brkchars phase. (new_completion_tracker): Delete. (complete_line_internal): Reimplement as TRY/CATCH wrapper around complete_line_internal_1. (free_completion_tracker): Delete. (INITIAL_COMPLETION_HTAB_SIZE): New. (completion_tracker::completion_tracker) (completion_tracker::~completion_tracker): New. (maybe_add_completion): Delete. (completion_tracker::maybe_add_completion) (completion_tracker::add_completion) (completion_tracker::add_completions): New. (throw_max_completions_reached_error): Delete. (complete_line): Adjust to work with a completion_tracker instead of a VEC. Don't create a completion_tracker_t or check for max completions here. (command_completer, command_completer_handle_brkchars) (signal_completer, reg_or_group_completer_1) (reg_or_group_completer, default_completer_handle_brkchars): Adjust to work with a completion_tracker. (gdb_completion_word_break_characters_throw): New. (gdb_completion_word_break_characters): Reimplement. (line_completion_function): Delete. (completion_tracker::recompute_lowest_common_denominator) (expand_preserving_ws) (completion_tracker::build_completion_result) (completion_result::completion_result) (completion_result::completion_result) (completion_result::~completion_result) (completion_result::completion_result) (completion_result::release_match_list, compare_cstrings) (completion_result::sort_match_list) (completion_result::reset_match_list) (gdb_rl_attempted_completion_function_throw) (gdb_rl_attempted_completion_function): New. * completer.h (completion_list, struct completion_result) (class completion_tracker): New. (complete_line): Add completion_tracker parameter. (readline_line_completion_function): Delete. (gdb_rl_attempted_completion_function): New. (noop_completer, filename_completer, expression_completer) (location_completer, symbol_completer, command_completer) (signal_completer, reg_or_group_completer): Update prototypes. (completion_tracker_t, new_completion_tracker) (make_cleanup_free_completion_tracker): Delete. (enum maybe_add_completion_enum): Delete. (maybe_add_completion): Delete. (throw_max_completions_reached_error): Delete. * corefile.c (complete_set_gnutarget): Adjust to work with a completion_tracker instead of a VEC. * cp-abi.c (cp_abi_completer): Adjust to work with a completion_tracker instead of a VEC. * d-lang.c (d_language_defn): Adjust. * disasm.c (disassembler_options_completer): Adjust to work with a completion_tracker instead of a VEC. * f-lang.c (f_make_symbol_completion_list): Rename to ... (f_collect_symbol_completion_matches): ... this. Adjust to work with a completion_tracker instead of a VEC. (f_language_defn): Adjust. * go-lang.c (go_language_defn): Adjust. * guile/scm-cmd.c (cmdscm_add_completion, cmdscm_completer): Adjust to work with a completion_tracker instead of a VEC. * infrun.c (handle_completer): Likewise. * interps.c (interpreter_completer): Likewise. * interps.h (interpreter_completer): Likewise. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Adjust. * language.h (language_defn::la_make_symbol_completion_list): Rename to ... (language_defn::la_collect_symbol_completion_matches): ... this and adjust to work with a completion_tracker instead of a VEC. * m2-lang.c (m2_language_defn): Adjust. * objc-lang.c (objc_language_defn): Adjust. * opencl-lang.c (opencl_language_defn): Adjust. * p-lang.c (pascal_language_defn): Adjust. * python/py-cmd.c (cmdpy_completer_helper): Handle NULL word. (cmdpy_completer_handle_brkchars, cmdpy_completer): Adjust to work with a completion_tracker. * rust-lang.c (rust_language_defn): Adjust. * symtab.c (free_completion_list, do_free_completion_list) (return_val, completion_tracker): Delete. (completion_list_add_name, completion_list_add_symbol) (completion_list_add_msymbol, completion_list_objc_symbol) (completion_list_add_fields, add_symtab_completions): Add completion_tracker parameter and use it. (default_make_symbol_completion_list_break_on_1): Rename to... (default_collect_symbol_completion_matches_break_on): ... this. Add completion_tracker parameter and use it instead of allocating a completion tracker here. (default_make_symbol_completion_list_break_on): Delete old implementation. (default_make_symbol_completion_list): Delete. (default_collect_symbol_completion_matches): New. (make_symbol_completion_list): Delete. (collect_symbol_completion_matches): New. (make_symbol_completion_type): Rename to ... (collect_symbol_completion_matches_type): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list_1): Rename to... (collect_file_symbol_completion_matches): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list): Delete. (add_filename_to_list): Use completion_list instead of a VEC. (add_partial_filename_data::list): Now a completion_list. (make_source_files_completion_list): Work with a completion_list instead of a VEC. * symtab.h: Include "completer.h". (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_type, make_file_symbol_completion_list) (make_source_files_completion_list): Delete. (default_collect_symbol_completion_matches_break_on) (default_collect_symbol_completion_matches) (collect_symbol_completion_matches) (collect_symbol_completion_matches_type) (collect_file_symbol_completion_matches) (make_source_files_completion_list): New. * top.c (init_main): Don't install a rl_completion_entry_function hook. Install a rl_attempted_completion_function hook instead. * tui/tui-layout.c (layout_completer): Adjust to work with a completion_tracker. * tui/tui-regs.c (tui_reggroup_completer): * tui/tui-win.c (window_name_completer, focus_completer) (winheight_completer): Adjust to work with a completion_tracker. * value.c: Include "completer.h". (complete_internalvar): Adjust to work with a completion_tracker. * value.h (complete_internalvar): Likewise.
2017-07-17 15:45:59 +02:00
static void
focus_completer (struct cmd_list_element *ignore,
Introduce class completion_tracker & rewrite completion<->readline interaction This patch reworks the whole completion machinery, and prepares it for later enhancements. Adds a new "completion_tracker" class that is meant to hold everything about the state of the current completion operation. This class now has the responsibility of tracking the list of completion matches, and checking whether the max completions limit has been reached. You can look at this as this patch starting out by C++fying the existing "completion_tracker" in symtab.c (it's just an htab_t typedef currently), moving it to completer.h/c, and then making it a class/generalizing/enhancing it. Unlike with the current tracking, completion_tracker now checks whether the limit has been reached on each completion match list insertion. This both simplifies the max-completions handling code (maybe_add_completion_enum is gone, for example), and is a prerequisite for follow up patches. The current completion_tracker is only used for symbol completions, and the symbol code gets at the current instance via globals. This patch cleans that up by adding a completion_tracker reference to the signature of the completion functions, and passing the tracker around everywhere necessary. Then, the patch changes how the completion match list is handed over to readline. Currently, we're using the rl_completion_entry_function readline entry point, and the patch switches to rl_attempted_completion_function. A following patch will want to let GDB itself decide the common completion prefix between all matches (what readline calls the "lowest common denominator"), instead of having readline compute it, and that's not possible with the rl_completion_entry_function entry point. Also, rl_attempted_completion_function lets GDB hand over the match list to readline as an array in one go instead of passing down matches one by one, so from that angle it's a nicer entry point anyway. Lastly, the patch catches exceptions around the readline entry points, because we can't let C++ exceptions cross readline. We handle that in the readline input entry point, but the completion entry point isn't guarded, so GDB can abort if completion throws. E.g., in current master: (gdb) b -function "fun<tab> terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR' Aborted (core dumped) This patch fixes that. This will be exercised in the new tests added later on in the series. gdb/ChangeLog: 2017-07-17 Pedro Alves <palves@redhat.com> * ada-lang.c (symbol_completion_match): Adjust comments. (symbol_completion_add): Replace vector parameter with completion_tracker parameter. Use it. (ada_make_symbol_completion_list): Rename to... (ada_collect_symbol_completion_matches): ... this. Add completion_tracker parameter and use it. (ada_language_defn): Adjust. * break-catch-syscall.c (catch_syscall_completer): Adjust prototype and work with completion_tracker instead of VEC. * breakpoint.c (condition_completer): Adjust prototype and work with completion_tracker instead of VEC. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Adjust to renames. * cli/cli-cmds.c (complete_command): Rework using completion_tracker. Catch exceptions when completing. * cli/cli-decode.c (integer_unlimited_completer) (complete_on_cmdlist, complete_on_enum): Adjust prototype and work with completion_tracker instead of VEC. * command.h (struct completion_tracker): Forward declare. (completer_ftype, completer_handle_brkchars_ftype): Change types. (complete_on_cmdlist, complete_on_enum): Adjust. * completer.c: Include <algorithm>. (struct gdb_completer_state): New. (current_completion): New global. (readline_line_completion_function): Delete. (noop_completer, filename_completer) (filename_completer_handle_brkchars, complete_files_symbols) (linespec_location_completer): Adjust to work with a completion_tracker instead of a VEC. (string_or_empty): New. (collect_explicit_location_matches): Adjust to work with a completion_tracker instead of a VEC. (explicit_location_completer): Rename to ... (complete_explicit_location): ... this and adjust to work with a completion_tracker instead of a VEC. (location_completer): Adjust to work with a completion_tracker instead of a VEC. (add_struct_fields): Adjust to work with a completion_list instead of VEC. (expression_completer): Rename to ... (complete_expression): ... this and adjust to work with a completion_tracker instead of a VEC. Use complete_files_symbols. (expression_completer): Reimplement on top of complete_expression. (symbol_completer): Adjust to work with a completion_tracker instead of a VEC. (enum complete_line_internal_reason): Add describing comments. (complete_line_internal_normal_command): Adjust to work with a completion_tracker instead of a VEC. (complete_line_internal): Rename to ... (complete_line_internal_1): ... this and adjust to work with a completion_tracker instead of a VEC. Assert TEXT is NULL in the handle_brkchars phase. (new_completion_tracker): Delete. (complete_line_internal): Reimplement as TRY/CATCH wrapper around complete_line_internal_1. (free_completion_tracker): Delete. (INITIAL_COMPLETION_HTAB_SIZE): New. (completion_tracker::completion_tracker) (completion_tracker::~completion_tracker): New. (maybe_add_completion): Delete. (completion_tracker::maybe_add_completion) (completion_tracker::add_completion) (completion_tracker::add_completions): New. (throw_max_completions_reached_error): Delete. (complete_line): Adjust to work with a completion_tracker instead of a VEC. Don't create a completion_tracker_t or check for max completions here. (command_completer, command_completer_handle_brkchars) (signal_completer, reg_or_group_completer_1) (reg_or_group_completer, default_completer_handle_brkchars): Adjust to work with a completion_tracker. (gdb_completion_word_break_characters_throw): New. (gdb_completion_word_break_characters): Reimplement. (line_completion_function): Delete. (completion_tracker::recompute_lowest_common_denominator) (expand_preserving_ws) (completion_tracker::build_completion_result) (completion_result::completion_result) (completion_result::completion_result) (completion_result::~completion_result) (completion_result::completion_result) (completion_result::release_match_list, compare_cstrings) (completion_result::sort_match_list) (completion_result::reset_match_list) (gdb_rl_attempted_completion_function_throw) (gdb_rl_attempted_completion_function): New. * completer.h (completion_list, struct completion_result) (class completion_tracker): New. (complete_line): Add completion_tracker parameter. (readline_line_completion_function): Delete. (gdb_rl_attempted_completion_function): New. (noop_completer, filename_completer, expression_completer) (location_completer, symbol_completer, command_completer) (signal_completer, reg_or_group_completer): Update prototypes. (completion_tracker_t, new_completion_tracker) (make_cleanup_free_completion_tracker): Delete. (enum maybe_add_completion_enum): Delete. (maybe_add_completion): Delete. (throw_max_completions_reached_error): Delete. * corefile.c (complete_set_gnutarget): Adjust to work with a completion_tracker instead of a VEC. * cp-abi.c (cp_abi_completer): Adjust to work with a completion_tracker instead of a VEC. * d-lang.c (d_language_defn): Adjust. * disasm.c (disassembler_options_completer): Adjust to work with a completion_tracker instead of a VEC. * f-lang.c (f_make_symbol_completion_list): Rename to ... (f_collect_symbol_completion_matches): ... this. Adjust to work with a completion_tracker instead of a VEC. (f_language_defn): Adjust. * go-lang.c (go_language_defn): Adjust. * guile/scm-cmd.c (cmdscm_add_completion, cmdscm_completer): Adjust to work with a completion_tracker instead of a VEC. * infrun.c (handle_completer): Likewise. * interps.c (interpreter_completer): Likewise. * interps.h (interpreter_completer): Likewise. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Adjust. * language.h (language_defn::la_make_symbol_completion_list): Rename to ... (language_defn::la_collect_symbol_completion_matches): ... this and adjust to work with a completion_tracker instead of a VEC. * m2-lang.c (m2_language_defn): Adjust. * objc-lang.c (objc_language_defn): Adjust. * opencl-lang.c (opencl_language_defn): Adjust. * p-lang.c (pascal_language_defn): Adjust. * python/py-cmd.c (cmdpy_completer_helper): Handle NULL word. (cmdpy_completer_handle_brkchars, cmdpy_completer): Adjust to work with a completion_tracker. * rust-lang.c (rust_language_defn): Adjust. * symtab.c (free_completion_list, do_free_completion_list) (return_val, completion_tracker): Delete. (completion_list_add_name, completion_list_add_symbol) (completion_list_add_msymbol, completion_list_objc_symbol) (completion_list_add_fields, add_symtab_completions): Add completion_tracker parameter and use it. (default_make_symbol_completion_list_break_on_1): Rename to... (default_collect_symbol_completion_matches_break_on): ... this. Add completion_tracker parameter and use it instead of allocating a completion tracker here. (default_make_symbol_completion_list_break_on): Delete old implementation. (default_make_symbol_completion_list): Delete. (default_collect_symbol_completion_matches): New. (make_symbol_completion_list): Delete. (collect_symbol_completion_matches): New. (make_symbol_completion_type): Rename to ... (collect_symbol_completion_matches_type): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list_1): Rename to... (collect_file_symbol_completion_matches): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list): Delete. (add_filename_to_list): Use completion_list instead of a VEC. (add_partial_filename_data::list): Now a completion_list. (make_source_files_completion_list): Work with a completion_list instead of a VEC. * symtab.h: Include "completer.h". (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_type, make_file_symbol_completion_list) (make_source_files_completion_list): Delete. (default_collect_symbol_completion_matches_break_on) (default_collect_symbol_completion_matches) (collect_symbol_completion_matches) (collect_symbol_completion_matches_type) (collect_file_symbol_completion_matches) (make_source_files_completion_list): New. * top.c (init_main): Don't install a rl_completion_entry_function hook. Install a rl_attempted_completion_function hook instead. * tui/tui-layout.c (layout_completer): Adjust to work with a completion_tracker. * tui/tui-regs.c (tui_reggroup_completer): * tui/tui-win.c (window_name_completer, focus_completer) (winheight_completer): Adjust to work with a completion_tracker. * value.c: Include "completer.h". (complete_internalvar): Adjust to work with a completion_tracker. * value.h (complete_internalvar): Likewise.
2017-07-17 15:45:59 +02:00
completion_tracker &tracker,
const char *text, const char *word)
{
Introduce class completion_tracker & rewrite completion<->readline interaction This patch reworks the whole completion machinery, and prepares it for later enhancements. Adds a new "completion_tracker" class that is meant to hold everything about the state of the current completion operation. This class now has the responsibility of tracking the list of completion matches, and checking whether the max completions limit has been reached. You can look at this as this patch starting out by C++fying the existing "completion_tracker" in symtab.c (it's just an htab_t typedef currently), moving it to completer.h/c, and then making it a class/generalizing/enhancing it. Unlike with the current tracking, completion_tracker now checks whether the limit has been reached on each completion match list insertion. This both simplifies the max-completions handling code (maybe_add_completion_enum is gone, for example), and is a prerequisite for follow up patches. The current completion_tracker is only used for symbol completions, and the symbol code gets at the current instance via globals. This patch cleans that up by adding a completion_tracker reference to the signature of the completion functions, and passing the tracker around everywhere necessary. Then, the patch changes how the completion match list is handed over to readline. Currently, we're using the rl_completion_entry_function readline entry point, and the patch switches to rl_attempted_completion_function. A following patch will want to let GDB itself decide the common completion prefix between all matches (what readline calls the "lowest common denominator"), instead of having readline compute it, and that's not possible with the rl_completion_entry_function entry point. Also, rl_attempted_completion_function lets GDB hand over the match list to readline as an array in one go instead of passing down matches one by one, so from that angle it's a nicer entry point anyway. Lastly, the patch catches exceptions around the readline entry points, because we can't let C++ exceptions cross readline. We handle that in the readline input entry point, but the completion entry point isn't guarded, so GDB can abort if completion throws. E.g., in current master: (gdb) b -function "fun<tab> terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR' Aborted (core dumped) This patch fixes that. This will be exercised in the new tests added later on in the series. gdb/ChangeLog: 2017-07-17 Pedro Alves <palves@redhat.com> * ada-lang.c (symbol_completion_match): Adjust comments. (symbol_completion_add): Replace vector parameter with completion_tracker parameter. Use it. (ada_make_symbol_completion_list): Rename to... (ada_collect_symbol_completion_matches): ... this. Add completion_tracker parameter and use it. (ada_language_defn): Adjust. * break-catch-syscall.c (catch_syscall_completer): Adjust prototype and work with completion_tracker instead of VEC. * breakpoint.c (condition_completer): Adjust prototype and work with completion_tracker instead of VEC. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Adjust to renames. * cli/cli-cmds.c (complete_command): Rework using completion_tracker. Catch exceptions when completing. * cli/cli-decode.c (integer_unlimited_completer) (complete_on_cmdlist, complete_on_enum): Adjust prototype and work with completion_tracker instead of VEC. * command.h (struct completion_tracker): Forward declare. (completer_ftype, completer_handle_brkchars_ftype): Change types. (complete_on_cmdlist, complete_on_enum): Adjust. * completer.c: Include <algorithm>. (struct gdb_completer_state): New. (current_completion): New global. (readline_line_completion_function): Delete. (noop_completer, filename_completer) (filename_completer_handle_brkchars, complete_files_symbols) (linespec_location_completer): Adjust to work with a completion_tracker instead of a VEC. (string_or_empty): New. (collect_explicit_location_matches): Adjust to work with a completion_tracker instead of a VEC. (explicit_location_completer): Rename to ... (complete_explicit_location): ... this and adjust to work with a completion_tracker instead of a VEC. (location_completer): Adjust to work with a completion_tracker instead of a VEC. (add_struct_fields): Adjust to work with a completion_list instead of VEC. (expression_completer): Rename to ... (complete_expression): ... this and adjust to work with a completion_tracker instead of a VEC. Use complete_files_symbols. (expression_completer): Reimplement on top of complete_expression. (symbol_completer): Adjust to work with a completion_tracker instead of a VEC. (enum complete_line_internal_reason): Add describing comments. (complete_line_internal_normal_command): Adjust to work with a completion_tracker instead of a VEC. (complete_line_internal): Rename to ... (complete_line_internal_1): ... this and adjust to work with a completion_tracker instead of a VEC. Assert TEXT is NULL in the handle_brkchars phase. (new_completion_tracker): Delete. (complete_line_internal): Reimplement as TRY/CATCH wrapper around complete_line_internal_1. (free_completion_tracker): Delete. (INITIAL_COMPLETION_HTAB_SIZE): New. (completion_tracker::completion_tracker) (completion_tracker::~completion_tracker): New. (maybe_add_completion): Delete. (completion_tracker::maybe_add_completion) (completion_tracker::add_completion) (completion_tracker::add_completions): New. (throw_max_completions_reached_error): Delete. (complete_line): Adjust to work with a completion_tracker instead of a VEC. Don't create a completion_tracker_t or check for max completions here. (command_completer, command_completer_handle_brkchars) (signal_completer, reg_or_group_completer_1) (reg_or_group_completer, default_completer_handle_brkchars): Adjust to work with a completion_tracker. (gdb_completion_word_break_characters_throw): New. (gdb_completion_word_break_characters): Reimplement. (line_completion_function): Delete. (completion_tracker::recompute_lowest_common_denominator) (expand_preserving_ws) (completion_tracker::build_completion_result) (completion_result::completion_result) (completion_result::completion_result) (completion_result::~completion_result) (completion_result::completion_result) (completion_result::release_match_list, compare_cstrings) (completion_result::sort_match_list) (completion_result::reset_match_list) (gdb_rl_attempted_completion_function_throw) (gdb_rl_attempted_completion_function): New. * completer.h (completion_list, struct completion_result) (class completion_tracker): New. (complete_line): Add completion_tracker parameter. (readline_line_completion_function): Delete. (gdb_rl_attempted_completion_function): New. (noop_completer, filename_completer, expression_completer) (location_completer, symbol_completer, command_completer) (signal_completer, reg_or_group_completer): Update prototypes. (completion_tracker_t, new_completion_tracker) (make_cleanup_free_completion_tracker): Delete. (enum maybe_add_completion_enum): Delete. (maybe_add_completion): Delete. (throw_max_completions_reached_error): Delete. * corefile.c (complete_set_gnutarget): Adjust to work with a completion_tracker instead of a VEC. * cp-abi.c (cp_abi_completer): Adjust to work with a completion_tracker instead of a VEC. * d-lang.c (d_language_defn): Adjust. * disasm.c (disassembler_options_completer): Adjust to work with a completion_tracker instead of a VEC. * f-lang.c (f_make_symbol_completion_list): Rename to ... (f_collect_symbol_completion_matches): ... this. Adjust to work with a completion_tracker instead of a VEC. (f_language_defn): Adjust. * go-lang.c (go_language_defn): Adjust. * guile/scm-cmd.c (cmdscm_add_completion, cmdscm_completer): Adjust to work with a completion_tracker instead of a VEC. * infrun.c (handle_completer): Likewise. * interps.c (interpreter_completer): Likewise. * interps.h (interpreter_completer): Likewise. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Adjust. * language.h (language_defn::la_make_symbol_completion_list): Rename to ... (language_defn::la_collect_symbol_completion_matches): ... this and adjust to work with a completion_tracker instead of a VEC. * m2-lang.c (m2_language_defn): Adjust. * objc-lang.c (objc_language_defn): Adjust. * opencl-lang.c (opencl_language_defn): Adjust. * p-lang.c (pascal_language_defn): Adjust. * python/py-cmd.c (cmdpy_completer_helper): Handle NULL word. (cmdpy_completer_handle_brkchars, cmdpy_completer): Adjust to work with a completion_tracker. * rust-lang.c (rust_language_defn): Adjust. * symtab.c (free_completion_list, do_free_completion_list) (return_val, completion_tracker): Delete. (completion_list_add_name, completion_list_add_symbol) (completion_list_add_msymbol, completion_list_objc_symbol) (completion_list_add_fields, add_symtab_completions): Add completion_tracker parameter and use it. (default_make_symbol_completion_list_break_on_1): Rename to... (default_collect_symbol_completion_matches_break_on): ... this. Add completion_tracker parameter and use it instead of allocating a completion tracker here. (default_make_symbol_completion_list_break_on): Delete old implementation. (default_make_symbol_completion_list): Delete. (default_collect_symbol_completion_matches): New. (make_symbol_completion_list): Delete. (collect_symbol_completion_matches): New. (make_symbol_completion_type): Rename to ... (collect_symbol_completion_matches_type): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list_1): Rename to... (collect_file_symbol_completion_matches): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list): Delete. (add_filename_to_list): Use completion_list instead of a VEC. (add_partial_filename_data::list): Now a completion_list. (make_source_files_completion_list): Work with a completion_list instead of a VEC. * symtab.h: Include "completer.h". (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_type, make_file_symbol_completion_list) (make_source_files_completion_list): Delete. (default_collect_symbol_completion_matches_break_on) (default_collect_symbol_completion_matches) (collect_symbol_completion_matches) (collect_symbol_completion_matches_type) (collect_file_symbol_completion_matches) (make_source_files_completion_list): New. * top.c (init_main): Don't install a rl_completion_entry_function hook. Install a rl_attempted_completion_function hook instead. * tui/tui-layout.c (layout_completer): Adjust to work with a completion_tracker. * tui/tui-regs.c (tui_reggroup_completer): * tui/tui-win.c (window_name_completer, focus_completer) (winheight_completer): Adjust to work with a completion_tracker. * value.c: Include "completer.h". (complete_internalvar): Adjust to work with a completion_tracker. * value.h (complete_internalvar): Likewise.
2017-07-17 15:45:59 +02:00
window_name_completer (tracker, 1, text, word);
}
/* Complete possible window names for winheight command. TEXT is the
complete text entered so far, WORD is the word currently being
completed. */
Introduce class completion_tracker & rewrite completion<->readline interaction This patch reworks the whole completion machinery, and prepares it for later enhancements. Adds a new "completion_tracker" class that is meant to hold everything about the state of the current completion operation. This class now has the responsibility of tracking the list of completion matches, and checking whether the max completions limit has been reached. You can look at this as this patch starting out by C++fying the existing "completion_tracker" in symtab.c (it's just an htab_t typedef currently), moving it to completer.h/c, and then making it a class/generalizing/enhancing it. Unlike with the current tracking, completion_tracker now checks whether the limit has been reached on each completion match list insertion. This both simplifies the max-completions handling code (maybe_add_completion_enum is gone, for example), and is a prerequisite for follow up patches. The current completion_tracker is only used for symbol completions, and the symbol code gets at the current instance via globals. This patch cleans that up by adding a completion_tracker reference to the signature of the completion functions, and passing the tracker around everywhere necessary. Then, the patch changes how the completion match list is handed over to readline. Currently, we're using the rl_completion_entry_function readline entry point, and the patch switches to rl_attempted_completion_function. A following patch will want to let GDB itself decide the common completion prefix between all matches (what readline calls the "lowest common denominator"), instead of having readline compute it, and that's not possible with the rl_completion_entry_function entry point. Also, rl_attempted_completion_function lets GDB hand over the match list to readline as an array in one go instead of passing down matches one by one, so from that angle it's a nicer entry point anyway. Lastly, the patch catches exceptions around the readline entry points, because we can't let C++ exceptions cross readline. We handle that in the readline input entry point, but the completion entry point isn't guarded, so GDB can abort if completion throws. E.g., in current master: (gdb) b -function "fun<tab> terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR' Aborted (core dumped) This patch fixes that. This will be exercised in the new tests added later on in the series. gdb/ChangeLog: 2017-07-17 Pedro Alves <palves@redhat.com> * ada-lang.c (symbol_completion_match): Adjust comments. (symbol_completion_add): Replace vector parameter with completion_tracker parameter. Use it. (ada_make_symbol_completion_list): Rename to... (ada_collect_symbol_completion_matches): ... this. Add completion_tracker parameter and use it. (ada_language_defn): Adjust. * break-catch-syscall.c (catch_syscall_completer): Adjust prototype and work with completion_tracker instead of VEC. * breakpoint.c (condition_completer): Adjust prototype and work with completion_tracker instead of VEC. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Adjust to renames. * cli/cli-cmds.c (complete_command): Rework using completion_tracker. Catch exceptions when completing. * cli/cli-decode.c (integer_unlimited_completer) (complete_on_cmdlist, complete_on_enum): Adjust prototype and work with completion_tracker instead of VEC. * command.h (struct completion_tracker): Forward declare. (completer_ftype, completer_handle_brkchars_ftype): Change types. (complete_on_cmdlist, complete_on_enum): Adjust. * completer.c: Include <algorithm>. (struct gdb_completer_state): New. (current_completion): New global. (readline_line_completion_function): Delete. (noop_completer, filename_completer) (filename_completer_handle_brkchars, complete_files_symbols) (linespec_location_completer): Adjust to work with a completion_tracker instead of a VEC. (string_or_empty): New. (collect_explicit_location_matches): Adjust to work with a completion_tracker instead of a VEC. (explicit_location_completer): Rename to ... (complete_explicit_location): ... this and adjust to work with a completion_tracker instead of a VEC. (location_completer): Adjust to work with a completion_tracker instead of a VEC. (add_struct_fields): Adjust to work with a completion_list instead of VEC. (expression_completer): Rename to ... (complete_expression): ... this and adjust to work with a completion_tracker instead of a VEC. Use complete_files_symbols. (expression_completer): Reimplement on top of complete_expression. (symbol_completer): Adjust to work with a completion_tracker instead of a VEC. (enum complete_line_internal_reason): Add describing comments. (complete_line_internal_normal_command): Adjust to work with a completion_tracker instead of a VEC. (complete_line_internal): Rename to ... (complete_line_internal_1): ... this and adjust to work with a completion_tracker instead of a VEC. Assert TEXT is NULL in the handle_brkchars phase. (new_completion_tracker): Delete. (complete_line_internal): Reimplement as TRY/CATCH wrapper around complete_line_internal_1. (free_completion_tracker): Delete. (INITIAL_COMPLETION_HTAB_SIZE): New. (completion_tracker::completion_tracker) (completion_tracker::~completion_tracker): New. (maybe_add_completion): Delete. (completion_tracker::maybe_add_completion) (completion_tracker::add_completion) (completion_tracker::add_completions): New. (throw_max_completions_reached_error): Delete. (complete_line): Adjust to work with a completion_tracker instead of a VEC. Don't create a completion_tracker_t or check for max completions here. (command_completer, command_completer_handle_brkchars) (signal_completer, reg_or_group_completer_1) (reg_or_group_completer, default_completer_handle_brkchars): Adjust to work with a completion_tracker. (gdb_completion_word_break_characters_throw): New. (gdb_completion_word_break_characters): Reimplement. (line_completion_function): Delete. (completion_tracker::recompute_lowest_common_denominator) (expand_preserving_ws) (completion_tracker::build_completion_result) (completion_result::completion_result) (completion_result::completion_result) (completion_result::~completion_result) (completion_result::completion_result) (completion_result::release_match_list, compare_cstrings) (completion_result::sort_match_list) (completion_result::reset_match_list) (gdb_rl_attempted_completion_function_throw) (gdb_rl_attempted_completion_function): New. * completer.h (completion_list, struct completion_result) (class completion_tracker): New. (complete_line): Add completion_tracker parameter. (readline_line_completion_function): Delete. (gdb_rl_attempted_completion_function): New. (noop_completer, filename_completer, expression_completer) (location_completer, symbol_completer, command_completer) (signal_completer, reg_or_group_completer): Update prototypes. (completion_tracker_t, new_completion_tracker) (make_cleanup_free_completion_tracker): Delete. (enum maybe_add_completion_enum): Delete. (maybe_add_completion): Delete. (throw_max_completions_reached_error): Delete. * corefile.c (complete_set_gnutarget): Adjust to work with a completion_tracker instead of a VEC. * cp-abi.c (cp_abi_completer): Adjust to work with a completion_tracker instead of a VEC. * d-lang.c (d_language_defn): Adjust. * disasm.c (disassembler_options_completer): Adjust to work with a completion_tracker instead of a VEC. * f-lang.c (f_make_symbol_completion_list): Rename to ... (f_collect_symbol_completion_matches): ... this. Adjust to work with a completion_tracker instead of a VEC. (f_language_defn): Adjust. * go-lang.c (go_language_defn): Adjust. * guile/scm-cmd.c (cmdscm_add_completion, cmdscm_completer): Adjust to work with a completion_tracker instead of a VEC. * infrun.c (handle_completer): Likewise. * interps.c (interpreter_completer): Likewise. * interps.h (interpreter_completer): Likewise. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Adjust. * language.h (language_defn::la_make_symbol_completion_list): Rename to ... (language_defn::la_collect_symbol_completion_matches): ... this and adjust to work with a completion_tracker instead of a VEC. * m2-lang.c (m2_language_defn): Adjust. * objc-lang.c (objc_language_defn): Adjust. * opencl-lang.c (opencl_language_defn): Adjust. * p-lang.c (pascal_language_defn): Adjust. * python/py-cmd.c (cmdpy_completer_helper): Handle NULL word. (cmdpy_completer_handle_brkchars, cmdpy_completer): Adjust to work with a completion_tracker. * rust-lang.c (rust_language_defn): Adjust. * symtab.c (free_completion_list, do_free_completion_list) (return_val, completion_tracker): Delete. (completion_list_add_name, completion_list_add_symbol) (completion_list_add_msymbol, completion_list_objc_symbol) (completion_list_add_fields, add_symtab_completions): Add completion_tracker parameter and use it. (default_make_symbol_completion_list_break_on_1): Rename to... (default_collect_symbol_completion_matches_break_on): ... this. Add completion_tracker parameter and use it instead of allocating a completion tracker here. (default_make_symbol_completion_list_break_on): Delete old implementation. (default_make_symbol_completion_list): Delete. (default_collect_symbol_completion_matches): New. (make_symbol_completion_list): Delete. (collect_symbol_completion_matches): New. (make_symbol_completion_type): Rename to ... (collect_symbol_completion_matches_type): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list_1): Rename to... (collect_file_symbol_completion_matches): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list): Delete. (add_filename_to_list): Use completion_list instead of a VEC. (add_partial_filename_data::list): Now a completion_list. (make_source_files_completion_list): Work with a completion_list instead of a VEC. * symtab.h: Include "completer.h". (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_type, make_file_symbol_completion_list) (make_source_files_completion_list): Delete. (default_collect_symbol_completion_matches_break_on) (default_collect_symbol_completion_matches) (collect_symbol_completion_matches) (collect_symbol_completion_matches_type) (collect_file_symbol_completion_matches) (make_source_files_completion_list): New. * top.c (init_main): Don't install a rl_completion_entry_function hook. Install a rl_attempted_completion_function hook instead. * tui/tui-layout.c (layout_completer): Adjust to work with a completion_tracker. * tui/tui-regs.c (tui_reggroup_completer): * tui/tui-win.c (window_name_completer, focus_completer) (winheight_completer): Adjust to work with a completion_tracker. * value.c: Include "completer.h". (complete_internalvar): Adjust to work with a completion_tracker. * value.h (complete_internalvar): Likewise.
2017-07-17 15:45:59 +02:00
static void
winheight_completer (struct cmd_list_element *ignore,
Introduce class completion_tracker & rewrite completion<->readline interaction This patch reworks the whole completion machinery, and prepares it for later enhancements. Adds a new "completion_tracker" class that is meant to hold everything about the state of the current completion operation. This class now has the responsibility of tracking the list of completion matches, and checking whether the max completions limit has been reached. You can look at this as this patch starting out by C++fying the existing "completion_tracker" in symtab.c (it's just an htab_t typedef currently), moving it to completer.h/c, and then making it a class/generalizing/enhancing it. Unlike with the current tracking, completion_tracker now checks whether the limit has been reached on each completion match list insertion. This both simplifies the max-completions handling code (maybe_add_completion_enum is gone, for example), and is a prerequisite for follow up patches. The current completion_tracker is only used for symbol completions, and the symbol code gets at the current instance via globals. This patch cleans that up by adding a completion_tracker reference to the signature of the completion functions, and passing the tracker around everywhere necessary. Then, the patch changes how the completion match list is handed over to readline. Currently, we're using the rl_completion_entry_function readline entry point, and the patch switches to rl_attempted_completion_function. A following patch will want to let GDB itself decide the common completion prefix between all matches (what readline calls the "lowest common denominator"), instead of having readline compute it, and that's not possible with the rl_completion_entry_function entry point. Also, rl_attempted_completion_function lets GDB hand over the match list to readline as an array in one go instead of passing down matches one by one, so from that angle it's a nicer entry point anyway. Lastly, the patch catches exceptions around the readline entry points, because we can't let C++ exceptions cross readline. We handle that in the readline input entry point, but the completion entry point isn't guarded, so GDB can abort if completion throws. E.g., in current master: (gdb) b -function "fun<tab> terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR' Aborted (core dumped) This patch fixes that. This will be exercised in the new tests added later on in the series. gdb/ChangeLog: 2017-07-17 Pedro Alves <palves@redhat.com> * ada-lang.c (symbol_completion_match): Adjust comments. (symbol_completion_add): Replace vector parameter with completion_tracker parameter. Use it. (ada_make_symbol_completion_list): Rename to... (ada_collect_symbol_completion_matches): ... this. Add completion_tracker parameter and use it. (ada_language_defn): Adjust. * break-catch-syscall.c (catch_syscall_completer): Adjust prototype and work with completion_tracker instead of VEC. * breakpoint.c (condition_completer): Adjust prototype and work with completion_tracker instead of VEC. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Adjust to renames. * cli/cli-cmds.c (complete_command): Rework using completion_tracker. Catch exceptions when completing. * cli/cli-decode.c (integer_unlimited_completer) (complete_on_cmdlist, complete_on_enum): Adjust prototype and work with completion_tracker instead of VEC. * command.h (struct completion_tracker): Forward declare. (completer_ftype, completer_handle_brkchars_ftype): Change types. (complete_on_cmdlist, complete_on_enum): Adjust. * completer.c: Include <algorithm>. (struct gdb_completer_state): New. (current_completion): New global. (readline_line_completion_function): Delete. (noop_completer, filename_completer) (filename_completer_handle_brkchars, complete_files_symbols) (linespec_location_completer): Adjust to work with a completion_tracker instead of a VEC. (string_or_empty): New. (collect_explicit_location_matches): Adjust to work with a completion_tracker instead of a VEC. (explicit_location_completer): Rename to ... (complete_explicit_location): ... this and adjust to work with a completion_tracker instead of a VEC. (location_completer): Adjust to work with a completion_tracker instead of a VEC. (add_struct_fields): Adjust to work with a completion_list instead of VEC. (expression_completer): Rename to ... (complete_expression): ... this and adjust to work with a completion_tracker instead of a VEC. Use complete_files_symbols. (expression_completer): Reimplement on top of complete_expression. (symbol_completer): Adjust to work with a completion_tracker instead of a VEC. (enum complete_line_internal_reason): Add describing comments. (complete_line_internal_normal_command): Adjust to work with a completion_tracker instead of a VEC. (complete_line_internal): Rename to ... (complete_line_internal_1): ... this and adjust to work with a completion_tracker instead of a VEC. Assert TEXT is NULL in the handle_brkchars phase. (new_completion_tracker): Delete. (complete_line_internal): Reimplement as TRY/CATCH wrapper around complete_line_internal_1. (free_completion_tracker): Delete. (INITIAL_COMPLETION_HTAB_SIZE): New. (completion_tracker::completion_tracker) (completion_tracker::~completion_tracker): New. (maybe_add_completion): Delete. (completion_tracker::maybe_add_completion) (completion_tracker::add_completion) (completion_tracker::add_completions): New. (throw_max_completions_reached_error): Delete. (complete_line): Adjust to work with a completion_tracker instead of a VEC. Don't create a completion_tracker_t or check for max completions here. (command_completer, command_completer_handle_brkchars) (signal_completer, reg_or_group_completer_1) (reg_or_group_completer, default_completer_handle_brkchars): Adjust to work with a completion_tracker. (gdb_completion_word_break_characters_throw): New. (gdb_completion_word_break_characters): Reimplement. (line_completion_function): Delete. (completion_tracker::recompute_lowest_common_denominator) (expand_preserving_ws) (completion_tracker::build_completion_result) (completion_result::completion_result) (completion_result::completion_result) (completion_result::~completion_result) (completion_result::completion_result) (completion_result::release_match_list, compare_cstrings) (completion_result::sort_match_list) (completion_result::reset_match_list) (gdb_rl_attempted_completion_function_throw) (gdb_rl_attempted_completion_function): New. * completer.h (completion_list, struct completion_result) (class completion_tracker): New. (complete_line): Add completion_tracker parameter. (readline_line_completion_function): Delete. (gdb_rl_attempted_completion_function): New. (noop_completer, filename_completer, expression_completer) (location_completer, symbol_completer, command_completer) (signal_completer, reg_or_group_completer): Update prototypes. (completion_tracker_t, new_completion_tracker) (make_cleanup_free_completion_tracker): Delete. (enum maybe_add_completion_enum): Delete. (maybe_add_completion): Delete. (throw_max_completions_reached_error): Delete. * corefile.c (complete_set_gnutarget): Adjust to work with a completion_tracker instead of a VEC. * cp-abi.c (cp_abi_completer): Adjust to work with a completion_tracker instead of a VEC. * d-lang.c (d_language_defn): Adjust. * disasm.c (disassembler_options_completer): Adjust to work with a completion_tracker instead of a VEC. * f-lang.c (f_make_symbol_completion_list): Rename to ... (f_collect_symbol_completion_matches): ... this. Adjust to work with a completion_tracker instead of a VEC. (f_language_defn): Adjust. * go-lang.c (go_language_defn): Adjust. * guile/scm-cmd.c (cmdscm_add_completion, cmdscm_completer): Adjust to work with a completion_tracker instead of a VEC. * infrun.c (handle_completer): Likewise. * interps.c (interpreter_completer): Likewise. * interps.h (interpreter_completer): Likewise. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Adjust. * language.h (language_defn::la_make_symbol_completion_list): Rename to ... (language_defn::la_collect_symbol_completion_matches): ... this and adjust to work with a completion_tracker instead of a VEC. * m2-lang.c (m2_language_defn): Adjust. * objc-lang.c (objc_language_defn): Adjust. * opencl-lang.c (opencl_language_defn): Adjust. * p-lang.c (pascal_language_defn): Adjust. * python/py-cmd.c (cmdpy_completer_helper): Handle NULL word. (cmdpy_completer_handle_brkchars, cmdpy_completer): Adjust to work with a completion_tracker. * rust-lang.c (rust_language_defn): Adjust. * symtab.c (free_completion_list, do_free_completion_list) (return_val, completion_tracker): Delete. (completion_list_add_name, completion_list_add_symbol) (completion_list_add_msymbol, completion_list_objc_symbol) (completion_list_add_fields, add_symtab_completions): Add completion_tracker parameter and use it. (default_make_symbol_completion_list_break_on_1): Rename to... (default_collect_symbol_completion_matches_break_on): ... this. Add completion_tracker parameter and use it instead of allocating a completion tracker here. (default_make_symbol_completion_list_break_on): Delete old implementation. (default_make_symbol_completion_list): Delete. (default_collect_symbol_completion_matches): New. (make_symbol_completion_list): Delete. (collect_symbol_completion_matches): New. (make_symbol_completion_type): Rename to ... (collect_symbol_completion_matches_type): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list_1): Rename to... (collect_file_symbol_completion_matches): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list): Delete. (add_filename_to_list): Use completion_list instead of a VEC. (add_partial_filename_data::list): Now a completion_list. (make_source_files_completion_list): Work with a completion_list instead of a VEC. * symtab.h: Include "completer.h". (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_type, make_file_symbol_completion_list) (make_source_files_completion_list): Delete. (default_collect_symbol_completion_matches_break_on) (default_collect_symbol_completion_matches) (collect_symbol_completion_matches) (collect_symbol_completion_matches_type) (collect_file_symbol_completion_matches) (make_source_files_completion_list): New. * top.c (init_main): Don't install a rl_completion_entry_function hook. Install a rl_attempted_completion_function hook instead. * tui/tui-layout.c (layout_completer): Adjust to work with a completion_tracker. * tui/tui-regs.c (tui_reggroup_completer): * tui/tui-win.c (window_name_completer, focus_completer) (winheight_completer): Adjust to work with a completion_tracker. * value.c: Include "completer.h". (complete_internalvar): Adjust to work with a completion_tracker. * value.h (complete_internalvar): Likewise.
2017-07-17 15:45:59 +02:00
completion_tracker &tracker,
const char *text, const char *word)
{
/* The first word is the window name. That we can complete. Subsequent
words can't be completed. */
if (word != text)
Introduce class completion_tracker & rewrite completion<->readline interaction This patch reworks the whole completion machinery, and prepares it for later enhancements. Adds a new "completion_tracker" class that is meant to hold everything about the state of the current completion operation. This class now has the responsibility of tracking the list of completion matches, and checking whether the max completions limit has been reached. You can look at this as this patch starting out by C++fying the existing "completion_tracker" in symtab.c (it's just an htab_t typedef currently), moving it to completer.h/c, and then making it a class/generalizing/enhancing it. Unlike with the current tracking, completion_tracker now checks whether the limit has been reached on each completion match list insertion. This both simplifies the max-completions handling code (maybe_add_completion_enum is gone, for example), and is a prerequisite for follow up patches. The current completion_tracker is only used for symbol completions, and the symbol code gets at the current instance via globals. This patch cleans that up by adding a completion_tracker reference to the signature of the completion functions, and passing the tracker around everywhere necessary. Then, the patch changes how the completion match list is handed over to readline. Currently, we're using the rl_completion_entry_function readline entry point, and the patch switches to rl_attempted_completion_function. A following patch will want to let GDB itself decide the common completion prefix between all matches (what readline calls the "lowest common denominator"), instead of having readline compute it, and that's not possible with the rl_completion_entry_function entry point. Also, rl_attempted_completion_function lets GDB hand over the match list to readline as an array in one go instead of passing down matches one by one, so from that angle it's a nicer entry point anyway. Lastly, the patch catches exceptions around the readline entry points, because we can't let C++ exceptions cross readline. We handle that in the readline input entry point, but the completion entry point isn't guarded, so GDB can abort if completion throws. E.g., in current master: (gdb) b -function "fun<tab> terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR' Aborted (core dumped) This patch fixes that. This will be exercised in the new tests added later on in the series. gdb/ChangeLog: 2017-07-17 Pedro Alves <palves@redhat.com> * ada-lang.c (symbol_completion_match): Adjust comments. (symbol_completion_add): Replace vector parameter with completion_tracker parameter. Use it. (ada_make_symbol_completion_list): Rename to... (ada_collect_symbol_completion_matches): ... this. Add completion_tracker parameter and use it. (ada_language_defn): Adjust. * break-catch-syscall.c (catch_syscall_completer): Adjust prototype and work with completion_tracker instead of VEC. * breakpoint.c (condition_completer): Adjust prototype and work with completion_tracker instead of VEC. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Adjust to renames. * cli/cli-cmds.c (complete_command): Rework using completion_tracker. Catch exceptions when completing. * cli/cli-decode.c (integer_unlimited_completer) (complete_on_cmdlist, complete_on_enum): Adjust prototype and work with completion_tracker instead of VEC. * command.h (struct completion_tracker): Forward declare. (completer_ftype, completer_handle_brkchars_ftype): Change types. (complete_on_cmdlist, complete_on_enum): Adjust. * completer.c: Include <algorithm>. (struct gdb_completer_state): New. (current_completion): New global. (readline_line_completion_function): Delete. (noop_completer, filename_completer) (filename_completer_handle_brkchars, complete_files_symbols) (linespec_location_completer): Adjust to work with a completion_tracker instead of a VEC. (string_or_empty): New. (collect_explicit_location_matches): Adjust to work with a completion_tracker instead of a VEC. (explicit_location_completer): Rename to ... (complete_explicit_location): ... this and adjust to work with a completion_tracker instead of a VEC. (location_completer): Adjust to work with a completion_tracker instead of a VEC. (add_struct_fields): Adjust to work with a completion_list instead of VEC. (expression_completer): Rename to ... (complete_expression): ... this and adjust to work with a completion_tracker instead of a VEC. Use complete_files_symbols. (expression_completer): Reimplement on top of complete_expression. (symbol_completer): Adjust to work with a completion_tracker instead of a VEC. (enum complete_line_internal_reason): Add describing comments. (complete_line_internal_normal_command): Adjust to work with a completion_tracker instead of a VEC. (complete_line_internal): Rename to ... (complete_line_internal_1): ... this and adjust to work with a completion_tracker instead of a VEC. Assert TEXT is NULL in the handle_brkchars phase. (new_completion_tracker): Delete. (complete_line_internal): Reimplement as TRY/CATCH wrapper around complete_line_internal_1. (free_completion_tracker): Delete. (INITIAL_COMPLETION_HTAB_SIZE): New. (completion_tracker::completion_tracker) (completion_tracker::~completion_tracker): New. (maybe_add_completion): Delete. (completion_tracker::maybe_add_completion) (completion_tracker::add_completion) (completion_tracker::add_completions): New. (throw_max_completions_reached_error): Delete. (complete_line): Adjust to work with a completion_tracker instead of a VEC. Don't create a completion_tracker_t or check for max completions here. (command_completer, command_completer_handle_brkchars) (signal_completer, reg_or_group_completer_1) (reg_or_group_completer, default_completer_handle_brkchars): Adjust to work with a completion_tracker. (gdb_completion_word_break_characters_throw): New. (gdb_completion_word_break_characters): Reimplement. (line_completion_function): Delete. (completion_tracker::recompute_lowest_common_denominator) (expand_preserving_ws) (completion_tracker::build_completion_result) (completion_result::completion_result) (completion_result::completion_result) (completion_result::~completion_result) (completion_result::completion_result) (completion_result::release_match_list, compare_cstrings) (completion_result::sort_match_list) (completion_result::reset_match_list) (gdb_rl_attempted_completion_function_throw) (gdb_rl_attempted_completion_function): New. * completer.h (completion_list, struct completion_result) (class completion_tracker): New. (complete_line): Add completion_tracker parameter. (readline_line_completion_function): Delete. (gdb_rl_attempted_completion_function): New. (noop_completer, filename_completer, expression_completer) (location_completer, symbol_completer, command_completer) (signal_completer, reg_or_group_completer): Update prototypes. (completion_tracker_t, new_completion_tracker) (make_cleanup_free_completion_tracker): Delete. (enum maybe_add_completion_enum): Delete. (maybe_add_completion): Delete. (throw_max_completions_reached_error): Delete. * corefile.c (complete_set_gnutarget): Adjust to work with a completion_tracker instead of a VEC. * cp-abi.c (cp_abi_completer): Adjust to work with a completion_tracker instead of a VEC. * d-lang.c (d_language_defn): Adjust. * disasm.c (disassembler_options_completer): Adjust to work with a completion_tracker instead of a VEC. * f-lang.c (f_make_symbol_completion_list): Rename to ... (f_collect_symbol_completion_matches): ... this. Adjust to work with a completion_tracker instead of a VEC. (f_language_defn): Adjust. * go-lang.c (go_language_defn): Adjust. * guile/scm-cmd.c (cmdscm_add_completion, cmdscm_completer): Adjust to work with a completion_tracker instead of a VEC. * infrun.c (handle_completer): Likewise. * interps.c (interpreter_completer): Likewise. * interps.h (interpreter_completer): Likewise. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Adjust. * language.h (language_defn::la_make_symbol_completion_list): Rename to ... (language_defn::la_collect_symbol_completion_matches): ... this and adjust to work with a completion_tracker instead of a VEC. * m2-lang.c (m2_language_defn): Adjust. * objc-lang.c (objc_language_defn): Adjust. * opencl-lang.c (opencl_language_defn): Adjust. * p-lang.c (pascal_language_defn): Adjust. * python/py-cmd.c (cmdpy_completer_helper): Handle NULL word. (cmdpy_completer_handle_brkchars, cmdpy_completer): Adjust to work with a completion_tracker. * rust-lang.c (rust_language_defn): Adjust. * symtab.c (free_completion_list, do_free_completion_list) (return_val, completion_tracker): Delete. (completion_list_add_name, completion_list_add_symbol) (completion_list_add_msymbol, completion_list_objc_symbol) (completion_list_add_fields, add_symtab_completions): Add completion_tracker parameter and use it. (default_make_symbol_completion_list_break_on_1): Rename to... (default_collect_symbol_completion_matches_break_on): ... this. Add completion_tracker parameter and use it instead of allocating a completion tracker here. (default_make_symbol_completion_list_break_on): Delete old implementation. (default_make_symbol_completion_list): Delete. (default_collect_symbol_completion_matches): New. (make_symbol_completion_list): Delete. (collect_symbol_completion_matches): New. (make_symbol_completion_type): Rename to ... (collect_symbol_completion_matches_type): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list_1): Rename to... (collect_file_symbol_completion_matches): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list): Delete. (add_filename_to_list): Use completion_list instead of a VEC. (add_partial_filename_data::list): Now a completion_list. (make_source_files_completion_list): Work with a completion_list instead of a VEC. * symtab.h: Include "completer.h". (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_type, make_file_symbol_completion_list) (make_source_files_completion_list): Delete. (default_collect_symbol_completion_matches_break_on) (default_collect_symbol_completion_matches) (collect_symbol_completion_matches) (collect_symbol_completion_matches_type) (collect_file_symbol_completion_matches) (make_source_files_completion_list): New. * top.c (init_main): Don't install a rl_completion_entry_function hook. Install a rl_attempted_completion_function hook instead. * tui/tui-layout.c (layout_completer): Adjust to work with a completion_tracker. * tui/tui-regs.c (tui_reggroup_completer): * tui/tui-win.c (window_name_completer, focus_completer) (winheight_completer): Adjust to work with a completion_tracker. * value.c: Include "completer.h". (complete_internalvar): Adjust to work with a completion_tracker. * value.h (complete_internalvar): Likewise.
2017-07-17 15:45:59 +02:00
return;
Introduce class completion_tracker & rewrite completion<->readline interaction This patch reworks the whole completion machinery, and prepares it for later enhancements. Adds a new "completion_tracker" class that is meant to hold everything about the state of the current completion operation. This class now has the responsibility of tracking the list of completion matches, and checking whether the max completions limit has been reached. You can look at this as this patch starting out by C++fying the existing "completion_tracker" in symtab.c (it's just an htab_t typedef currently), moving it to completer.h/c, and then making it a class/generalizing/enhancing it. Unlike with the current tracking, completion_tracker now checks whether the limit has been reached on each completion match list insertion. This both simplifies the max-completions handling code (maybe_add_completion_enum is gone, for example), and is a prerequisite for follow up patches. The current completion_tracker is only used for symbol completions, and the symbol code gets at the current instance via globals. This patch cleans that up by adding a completion_tracker reference to the signature of the completion functions, and passing the tracker around everywhere necessary. Then, the patch changes how the completion match list is handed over to readline. Currently, we're using the rl_completion_entry_function readline entry point, and the patch switches to rl_attempted_completion_function. A following patch will want to let GDB itself decide the common completion prefix between all matches (what readline calls the "lowest common denominator"), instead of having readline compute it, and that's not possible with the rl_completion_entry_function entry point. Also, rl_attempted_completion_function lets GDB hand over the match list to readline as an array in one go instead of passing down matches one by one, so from that angle it's a nicer entry point anyway. Lastly, the patch catches exceptions around the readline entry points, because we can't let C++ exceptions cross readline. We handle that in the readline input entry point, but the completion entry point isn't guarded, so GDB can abort if completion throws. E.g., in current master: (gdb) b -function "fun<tab> terminate called after throwing an instance of 'gdb_exception_RETURN_MASK_ERROR' Aborted (core dumped) This patch fixes that. This will be exercised in the new tests added later on in the series. gdb/ChangeLog: 2017-07-17 Pedro Alves <palves@redhat.com> * ada-lang.c (symbol_completion_match): Adjust comments. (symbol_completion_add): Replace vector parameter with completion_tracker parameter. Use it. (ada_make_symbol_completion_list): Rename to... (ada_collect_symbol_completion_matches): ... this. Add completion_tracker parameter and use it. (ada_language_defn): Adjust. * break-catch-syscall.c (catch_syscall_completer): Adjust prototype and work with completion_tracker instead of VEC. * breakpoint.c (condition_completer): Adjust prototype and work with completion_tracker instead of VEC. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Adjust to renames. * cli/cli-cmds.c (complete_command): Rework using completion_tracker. Catch exceptions when completing. * cli/cli-decode.c (integer_unlimited_completer) (complete_on_cmdlist, complete_on_enum): Adjust prototype and work with completion_tracker instead of VEC. * command.h (struct completion_tracker): Forward declare. (completer_ftype, completer_handle_brkchars_ftype): Change types. (complete_on_cmdlist, complete_on_enum): Adjust. * completer.c: Include <algorithm>. (struct gdb_completer_state): New. (current_completion): New global. (readline_line_completion_function): Delete. (noop_completer, filename_completer) (filename_completer_handle_brkchars, complete_files_symbols) (linespec_location_completer): Adjust to work with a completion_tracker instead of a VEC. (string_or_empty): New. (collect_explicit_location_matches): Adjust to work with a completion_tracker instead of a VEC. (explicit_location_completer): Rename to ... (complete_explicit_location): ... this and adjust to work with a completion_tracker instead of a VEC. (location_completer): Adjust to work with a completion_tracker instead of a VEC. (add_struct_fields): Adjust to work with a completion_list instead of VEC. (expression_completer): Rename to ... (complete_expression): ... this and adjust to work with a completion_tracker instead of a VEC. Use complete_files_symbols. (expression_completer): Reimplement on top of complete_expression. (symbol_completer): Adjust to work with a completion_tracker instead of a VEC. (enum complete_line_internal_reason): Add describing comments. (complete_line_internal_normal_command): Adjust to work with a completion_tracker instead of a VEC. (complete_line_internal): Rename to ... (complete_line_internal_1): ... this and adjust to work with a completion_tracker instead of a VEC. Assert TEXT is NULL in the handle_brkchars phase. (new_completion_tracker): Delete. (complete_line_internal): Reimplement as TRY/CATCH wrapper around complete_line_internal_1. (free_completion_tracker): Delete. (INITIAL_COMPLETION_HTAB_SIZE): New. (completion_tracker::completion_tracker) (completion_tracker::~completion_tracker): New. (maybe_add_completion): Delete. (completion_tracker::maybe_add_completion) (completion_tracker::add_completion) (completion_tracker::add_completions): New. (throw_max_completions_reached_error): Delete. (complete_line): Adjust to work with a completion_tracker instead of a VEC. Don't create a completion_tracker_t or check for max completions here. (command_completer, command_completer_handle_brkchars) (signal_completer, reg_or_group_completer_1) (reg_or_group_completer, default_completer_handle_brkchars): Adjust to work with a completion_tracker. (gdb_completion_word_break_characters_throw): New. (gdb_completion_word_break_characters): Reimplement. (line_completion_function): Delete. (completion_tracker::recompute_lowest_common_denominator) (expand_preserving_ws) (completion_tracker::build_completion_result) (completion_result::completion_result) (completion_result::completion_result) (completion_result::~completion_result) (completion_result::completion_result) (completion_result::release_match_list, compare_cstrings) (completion_result::sort_match_list) (completion_result::reset_match_list) (gdb_rl_attempted_completion_function_throw) (gdb_rl_attempted_completion_function): New. * completer.h (completion_list, struct completion_result) (class completion_tracker): New. (complete_line): Add completion_tracker parameter. (readline_line_completion_function): Delete. (gdb_rl_attempted_completion_function): New. (noop_completer, filename_completer, expression_completer) (location_completer, symbol_completer, command_completer) (signal_completer, reg_or_group_completer): Update prototypes. (completion_tracker_t, new_completion_tracker) (make_cleanup_free_completion_tracker): Delete. (enum maybe_add_completion_enum): Delete. (maybe_add_completion): Delete. (throw_max_completions_reached_error): Delete. * corefile.c (complete_set_gnutarget): Adjust to work with a completion_tracker instead of a VEC. * cp-abi.c (cp_abi_completer): Adjust to work with a completion_tracker instead of a VEC. * d-lang.c (d_language_defn): Adjust. * disasm.c (disassembler_options_completer): Adjust to work with a completion_tracker instead of a VEC. * f-lang.c (f_make_symbol_completion_list): Rename to ... (f_collect_symbol_completion_matches): ... this. Adjust to work with a completion_tracker instead of a VEC. (f_language_defn): Adjust. * go-lang.c (go_language_defn): Adjust. * guile/scm-cmd.c (cmdscm_add_completion, cmdscm_completer): Adjust to work with a completion_tracker instead of a VEC. * infrun.c (handle_completer): Likewise. * interps.c (interpreter_completer): Likewise. * interps.h (interpreter_completer): Likewise. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Adjust. * language.h (language_defn::la_make_symbol_completion_list): Rename to ... (language_defn::la_collect_symbol_completion_matches): ... this and adjust to work with a completion_tracker instead of a VEC. * m2-lang.c (m2_language_defn): Adjust. * objc-lang.c (objc_language_defn): Adjust. * opencl-lang.c (opencl_language_defn): Adjust. * p-lang.c (pascal_language_defn): Adjust. * python/py-cmd.c (cmdpy_completer_helper): Handle NULL word. (cmdpy_completer_handle_brkchars, cmdpy_completer): Adjust to work with a completion_tracker. * rust-lang.c (rust_language_defn): Adjust. * symtab.c (free_completion_list, do_free_completion_list) (return_val, completion_tracker): Delete. (completion_list_add_name, completion_list_add_symbol) (completion_list_add_msymbol, completion_list_objc_symbol) (completion_list_add_fields, add_symtab_completions): Add completion_tracker parameter and use it. (default_make_symbol_completion_list_break_on_1): Rename to... (default_collect_symbol_completion_matches_break_on): ... this. Add completion_tracker parameter and use it instead of allocating a completion tracker here. (default_make_symbol_completion_list_break_on): Delete old implementation. (default_make_symbol_completion_list): Delete. (default_collect_symbol_completion_matches): New. (make_symbol_completion_list): Delete. (collect_symbol_completion_matches): New. (make_symbol_completion_type): Rename to ... (collect_symbol_completion_matches_type): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list_1): Rename to... (collect_file_symbol_completion_matches): ... this. Add completion_tracker parameter and use it instead of VEC. (make_file_symbol_completion_list): Delete. (add_filename_to_list): Use completion_list instead of a VEC. (add_partial_filename_data::list): Now a completion_list. (make_source_files_completion_list): Work with a completion_list instead of a VEC. * symtab.h: Include "completer.h". (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_type, make_file_symbol_completion_list) (make_source_files_completion_list): Delete. (default_collect_symbol_completion_matches_break_on) (default_collect_symbol_completion_matches) (collect_symbol_completion_matches) (collect_symbol_completion_matches_type) (collect_file_symbol_completion_matches) (make_source_files_completion_list): New. * top.c (init_main): Don't install a rl_completion_entry_function hook. Install a rl_attempted_completion_function hook instead. * tui/tui-layout.c (layout_completer): Adjust to work with a completion_tracker. * tui/tui-regs.c (tui_reggroup_completer): * tui/tui-win.c (window_name_completer, focus_completer) (winheight_completer): Adjust to work with a completion_tracker. * value.c: Include "completer.h". (complete_internalvar): Adjust to work with a completion_tracker. * value.h (complete_internalvar): Likewise.
2017-07-17 15:45:59 +02:00
window_name_completer (tracker, 0, text, word);
}
/* Update gdb's knowledge of the terminal size. */
void
tui_update_gdb_sizes (void)
{
int width, height;
if (tui_active)
{
Derive tui_win_info from tui_gen_win_info 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-17 00:03:54 +02:00
width = TUI_CMD_WIN->width;
height = TUI_CMD_WIN->height;
}
else
{
width = tui_term_width ();
height = tui_term_height ();
}
set_screen_width_and_height (width, height);
}
void
Introduce methods for scrolling 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-16 19:22:38 +02:00
tui_win_info::forward_scroll (int num_to_scroll)
{
Introduce methods for scrolling 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-16 19:22:38 +02:00
if (num_to_scroll == 0)
Derive tui_win_info from tui_gen_win_info 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-17 00:03:54 +02:00
num_to_scroll = height - 3;
do_scroll_vertical (num_to_scroll);
}
void
Introduce methods for scrolling 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-16 19:22:38 +02:00
tui_win_info::backward_scroll (int num_to_scroll)
{
Introduce methods for scrolling 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-16 19:22:38 +02:00
if (num_to_scroll == 0)
Derive tui_win_info from tui_gen_win_info 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-17 00:03:54 +02:00
num_to_scroll = height - 3;
Introduce methods for scrolling 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-16 19:22:38 +02:00
do_scroll_vertical (-num_to_scroll);
}
void
Introduce methods for scrolling 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-16 19:22:38 +02:00
tui_win_info::left_scroll (int num_to_scroll)
{
Introduce methods for scrolling 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-16 19:22:38 +02:00
if (num_to_scroll == 0)
num_to_scroll = 1;
do_scroll_horizontal (num_to_scroll);
}
void
Introduce methods for scrolling 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-16 19:22:38 +02:00
tui_win_info::right_scroll (int num_to_scroll)
{
Introduce methods for scrolling 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-16 19:22:38 +02:00
if (num_to_scroll == 0)
num_to_scroll = 1;
do_scroll_horizontal (-num_to_scroll);
}
void
tui_refresh_all_win (void)
{
clearok (curscr, TRUE);
tui_refresh_all ();
}
void
tui_rehighlight_all (void)
{
for (tui_win_info *win_info : all_tui_windows ())
win_info->check_and_display_highlight_if_needed ();
}
/* Resize all the windows based on the terminal size. This function
gets called from within the readline SIGWINCH handler. */
void
tui_resize_all (void)
{
int height_diff, width_diff;
2002-12-08 23:31:39 +01:00
int screenheight, screenwidth;
2002-12-08 23:31:39 +01:00
rl_get_screen_size (&screenheight, &screenwidth);
width_diff = screenwidth - tui_term_width ();
height_diff = screenheight - tui_term_height ();
if (height_diff || width_diff)
{
struct tui_win_info *win_with_focus = tui_win_with_focus ();
* tui/tui-win.h (tui_get_cmd_list): Declare. * tui/tui-win.c (tui_command): New function. (tui_get_cmd_list): New function. (_initialize_tui_win): Moved initialization of tui command in tui_get_cmd_list. * tui/tui-data.c (init_content_element): Setup new data members. (init_win_info): Likewise. (free_content_elements): Free it. * tui/tui-data.h (struct tui_data_element): Store the register content to print. (struct tui_data_info): Keep the current register group. * tui/tui-layout.c (tui_set_layout): Update call to tui_show_registers. * tui/tui-regs.h (tui_show_registers): Update prototype. (tui_toggle_float_regs, tui_calculate_regs_column_count): Remove. (tui_resize_all): No need to calculate anything for register window. * tui/tui-regs.c (tui_calculate_regs_column_count): Remove. (tui_set_register_element, tui_set_general_regs_content): Remove. (tui_set_special_regs_content): Remove. (tui_set_general_and_special_regs_content): Remove. (tui_set_float_regs_content): Remove. (tui_reg_value_has_changed, tui_get_register_raw_value): Remove. (tui_set_regs_content): Remove. (tui_toggle_float_regs, _tui_toggle_float_regs_command): Remove. (tui_v_show_registers_command_support): Remove. (tui_show_registers): Use a reggroup to specify the registers to show. (tui_show_register_group): New function. (tui_display_registers_from): Compute the layout of register window and refresh with new API; be sure to delete old register windows. (tui_check_register_values): Update to use tui_get_register and tui_display_data. (tui_display_register): Just refresh the register window part. (tui_register_format): Format registers and save in tui_data_element. (tui_get_register): New to combine tui_reg_value_has_changed and tui_get_register_raw_value; fix to use the new gdb API. (tui_show_float_command): Renamed tui_reg_float_command. (tui_show_general_command): Renamed tui_reg_general_command. (tui_show_special_command): Renamed tui_reg_system_command. (_initialize_tui_regs): Remove unused commands.
2004-03-13 15:14:01 +01:00
#ifdef HAVE_RESIZE_TERM
resize_term (screenheight, screenwidth);
#endif
/* Turn keypad off while we resize. */
if (win_with_focus != TUI_CMD_WIN)
Make TUI window handle a unique_ptr 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-02 01:29:49 +02:00
keypad (TUI_CMD_WIN->handle.get (), FALSE);
tui_update_gdb_sizes ();
2004-02-06 Andrew Cagney <cagney@redhat.com> * tui/tui-data.h (struct tui_list): Rename _TuiList. (enum tui_data_type): Rename _TuiDataType. (struct tui_layout_def): Rename _TuiLayoutDef. (struct tui_source_element): Rename _TuiSourceElement. (struct tui_data_element): Rename _TuiDataElement. (struct tui_command_element): Rename _TuiCommandElement. (struct tui_locator_element): Rename _TuiLocatorElement. (union tui_which_element): Define. (struct tui_win_element): Rename _TuiWinElement. (struct tui_data_info): Rename _TuiDataInfo. (struct tui_source_info): Rename _TuiSourceInfo. (struct tui_command_info): Rename _TuiCommandInfo. (tui_initialize_static_data): Rename initializeStaticData. (tui_alloc_generic_win_info): Rename allocGenericWinInfo. (tui_alloc_win_info): Rename allocWinInfo. (tui_init_generic_part): Rename initGenericPart. (tui_init_win_info): Rename initWinInfo. (tui_alloc_content): Rename allocContent. (tui_add_content_elements): Rename addContentElements. (tui_init_content_element): Rename initContentElement. (tui_free_window): Rename freeWindow. (tui_free_win_content): Rename freeWinContent. (tui_free_data_content): Rename freeDataContent. (tui_free_all_source_wins_content): Rename freeAllSourceWinsContent. (tui_del_window): Rename tuiDelWindow. (tui_del_data_windows): Rename tuiDelDataWindows. (tui_partial_win_by_name): Rename partialWinByName. (tui_win_name): Rename winName. (tui_current_layout): Rename currentLayout. (tui_set_current_layout_to): Rename setCurrentLayoutTo. (tui_term_height): Rename termHeight. (tui_set_term_height_to): Rename setTermHeightTo. (tui_term_width): Rename termWidth. (tui_set_term_width_to): Rename setTermWidthTo. (tui_set_gen_win_origin): Rename setGenWinOrigin. (tui_locator_win_info_ptr): Rename locatorWinInfoPtr. (tui_source_exec_info_win_ptr): Rename tui_gen_win_info. (tui_disassem_exec_info_win_ptr): Rename disassemExecInfoWinPtr. (tui_source_windows): Rename sourceWindows. (tui_clear_source_windows): Rename clearSourceWindows. (tui_clear_source_windows_detail): Rename clearSourceWindowsDetail. (tui_clear_win_detail): Rename clearWinDetail. (tui_add_to_source_windows): Rename tuiAddToSourceWindows. (tui_default_tab_len): Rename tuiDefaultTabLen. (tui_set_default_tab_len): Rename tuiSetDefaultTabLen. (tui_win_with_focus): Rename tuiWinWithFocus. (tui_set_win_with_focus): Rename tuiSetWinWithFocus. (tui_layout_def): Rename tuiLayoutDef. (tui_win_resized): Rename tuiWinResized. (tui_set_win_resized_to): Rename tuiSetWinResizedTo. (tui_next_win): Rename tuiNextWin. (tui_prev_win): Rename tuiPrevWin. (tui_add_to_source_windows): Rename addToSourceWindows. * tui/tui-winsource.c, tui/tui-win.c: Update references. * tui/tui-layout.c, tui/tui-source.c: Ditto. * tui/tui-stack.c, tui/tui-io.c: Ditto. * tui/tui.c, tui/tui-data.c: Ditto. * tui/tui-interp.c, tui/tui-data.c: Ditto. * tui/tui-disasm.c, tui/tui-command.c: Ditto.
2004-02-07 05:40:36 +01:00
tui_set_term_height_to (screenheight);
tui_set_term_width_to (screenwidth);
/* erase + clearok are used instead of a straightforward clear as
AIX 5.3 does not define clear. */
erase ();
clearok (curscr, TRUE);
tui_apply_current_layout ();
/* Turn keypad back on, unless focus is in the command
window. */
if (win_with_focus != TUI_CMD_WIN)
Make TUI window handle a unique_ptr 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-02 01:29:49 +02:00
keypad (TUI_CMD_WIN->handle.get (), TRUE);
}
}
2008-02-21 Pedro Alves <pedro@codesorcery.com> Silence a few -Wmissing-prototypes warnings. PR build/9877: * amd64-nat.c: Include "amd64-nat.h". * fork-child.c (_initialize_fork_child): Ditto. * gcore.c (_initialize_gcore): Ditto. * inf-ptrace.c: Include "inf-ptrace.h". (inf_ptrace_store_registers): Make it static. * linux-nat.c (linux_nat_terminal_ours): Make it static. (_initialize_linux_nat): Declare before definition. * linux-tdep.c: Include "linux-tdep.h". * linux-thread-db.c (_initialize_thread_db): Declare before definition. * proc-service.c (_initialize_proc_service): Ditto. * remote.c (remote_send_printf): Make it static. * solib.c: Include "solib.h". * symfile-mem.c (_initialize_symfile_mem): Declare before definition. * ada-lang.c (ada_la_decode, ada_match_name) (ada_suppress_symbol_printing, ada_is_array_type) (ada_value_ptr_subscript, ada_array_length) (ada_to_static_fixed_value): Make them static. (_initialize_ada_language): Declare before definition. * ada-tasks.c (ada_get_task_number, ada_get_environment_task) (ada_task_list_changed, ada_new_objfile_observer): Make them static. (_initialize_tasks): Declare before definition. * addrmap.c (_initialize_addrmap): Declare before definition. * auxv.c (default_auxv_parse): Make it static. * bfd-target.c (target_bfd_xfer_partial, target_bfd_xclose): Make them static. * breakpoint.c (remove_sal): Add line break. (expand_line_sal_maybe): Make it static. * cp-name-parser.y: Include "cp-support.h". * cp-valprint.c (cp_find_class_member): Make it static. * eval.c (value_f90_subarray): Ditto. * exceptions.c (print_any_exception): Ditto. * findcmd.c (_initialize_mem_search): Declare before definition. * frame.c (frame_observer_target_changed): Make it static. * gnu-v3-abi.c (gnuv3_find_method_in): Make it static. * inf-child.c: Include "inf-child.h". * inferior.h (valid_inferior_id): Rename to ... (valid_gdb_inferior_id): ... this. * infrun.c (infrun_thread_stop_requested, siginfo_make_value): Make them static. * jv-lang.c (java_language_arch_info): Make it static. * m2-typeprint.c (m2_get_discrete_bounds): Ditto. * osdata.c (info_osdata_command): Make it static. * regcache.c (regcache_observer_target_changed): Make it static. * reverse.c (_initialize_reverse): Declare before definition. * stabsread.c (cleanup_undefined_types_noname) (cleanup_undefined_types_1): Make them static. * symfile.c (place_section): Make it static. * symtab.c (find_pc_sect_psymtab_closer): Make it static. * target-descriptions.c (_initialize_target_descriptions): Declare before definition. * target.c (default_get_ada_task_ptid, find_default_can_async_p) (find_default_is_async_p, find_default_supports_non_stop): Make them static. (target_supports_non_stop): Add prototype. (dummy_pid_to_str): Make it static. * utils.c (_initialize_utils): Declare before definition. * ada-exp.y (_initialize_ada_exp): Declare before definition. * solib-svr4.c (HAS_LM_DYNAMIC_FROM_LINK_MAP): Add a prototype. * target.h (struct target_ops): Add a prototype to the to_can_execute_reverse callback. * macroscope.c (_initialize_macroscope): Declare before definition. * cp-namespace.c (_initialize_cp_namespace): Declare before definition. * python/python.c (_initialize_python): Declare before definition. * tui/tui-command.c: Include "tui/tui-command.h". * tui/tui-data.c (init_content_element, init_win_info): Make them static. * tui/tui-disasm.c: Include "tui/tui-disasm.h". * tui/tui-interp.c (_initialize_tui_interp): Declare before definition. * tui/tui-layout.c: Include "tui/tui-layout.h". (_initialize_tui_layout): Declare before definition. * tui/tui-regs.c: Include "tui/tui-regs.h". (tui_display_reg_element_at_line): Make it static. (_initialize_tui_regs): Declare before definition. * tui/tui-stack.c (_initialize_tui_stack): Declare before definition. * tui/tui-win.c: Include "tui/tui-win.h". (_initialize_tui_win): Declare before definition. (tui_sigwinch_handler): Make it static. Wrap in ifdef SIGWINCH. * tui/tui-win.h (tui_sigwinch_handler): Delete declaration. (tui_get_cmd_list): Add a prototype. * tui/tui-windata.c: Include tui-windata.h. * tui/tui-wingeneral.c (box_win): Make it static. * cli/cli-logging.c (show_logging_command): Make it static. (_initialize_cli_logging): Declare before definition. * mi/mi-common.c (_initialize_gdb_mi_common): Declare before definition.
2009-02-21 17:14:50 +01:00
#ifdef SIGWINCH
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
/* Token for use by TUI's asynchronous SIGWINCH handler. */
static struct async_signal_handler *tui_sigwinch_token;
/* TUI's SIGWINCH signal handler. */
2008-02-21 Pedro Alves <pedro@codesorcery.com> Silence a few -Wmissing-prototypes warnings. PR build/9877: * amd64-nat.c: Include "amd64-nat.h". * fork-child.c (_initialize_fork_child): Ditto. * gcore.c (_initialize_gcore): Ditto. * inf-ptrace.c: Include "inf-ptrace.h". (inf_ptrace_store_registers): Make it static. * linux-nat.c (linux_nat_terminal_ours): Make it static. (_initialize_linux_nat): Declare before definition. * linux-tdep.c: Include "linux-tdep.h". * linux-thread-db.c (_initialize_thread_db): Declare before definition. * proc-service.c (_initialize_proc_service): Ditto. * remote.c (remote_send_printf): Make it static. * solib.c: Include "solib.h". * symfile-mem.c (_initialize_symfile_mem): Declare before definition. * ada-lang.c (ada_la_decode, ada_match_name) (ada_suppress_symbol_printing, ada_is_array_type) (ada_value_ptr_subscript, ada_array_length) (ada_to_static_fixed_value): Make them static. (_initialize_ada_language): Declare before definition. * ada-tasks.c (ada_get_task_number, ada_get_environment_task) (ada_task_list_changed, ada_new_objfile_observer): Make them static. (_initialize_tasks): Declare before definition. * addrmap.c (_initialize_addrmap): Declare before definition. * auxv.c (default_auxv_parse): Make it static. * bfd-target.c (target_bfd_xfer_partial, target_bfd_xclose): Make them static. * breakpoint.c (remove_sal): Add line break. (expand_line_sal_maybe): Make it static. * cp-name-parser.y: Include "cp-support.h". * cp-valprint.c (cp_find_class_member): Make it static. * eval.c (value_f90_subarray): Ditto. * exceptions.c (print_any_exception): Ditto. * findcmd.c (_initialize_mem_search): Declare before definition. * frame.c (frame_observer_target_changed): Make it static. * gnu-v3-abi.c (gnuv3_find_method_in): Make it static. * inf-child.c: Include "inf-child.h". * inferior.h (valid_inferior_id): Rename to ... (valid_gdb_inferior_id): ... this. * infrun.c (infrun_thread_stop_requested, siginfo_make_value): Make them static. * jv-lang.c (java_language_arch_info): Make it static. * m2-typeprint.c (m2_get_discrete_bounds): Ditto. * osdata.c (info_osdata_command): Make it static. * regcache.c (regcache_observer_target_changed): Make it static. * reverse.c (_initialize_reverse): Declare before definition. * stabsread.c (cleanup_undefined_types_noname) (cleanup_undefined_types_1): Make them static. * symfile.c (place_section): Make it static. * symtab.c (find_pc_sect_psymtab_closer): Make it static. * target-descriptions.c (_initialize_target_descriptions): Declare before definition. * target.c (default_get_ada_task_ptid, find_default_can_async_p) (find_default_is_async_p, find_default_supports_non_stop): Make them static. (target_supports_non_stop): Add prototype. (dummy_pid_to_str): Make it static. * utils.c (_initialize_utils): Declare before definition. * ada-exp.y (_initialize_ada_exp): Declare before definition. * solib-svr4.c (HAS_LM_DYNAMIC_FROM_LINK_MAP): Add a prototype. * target.h (struct target_ops): Add a prototype to the to_can_execute_reverse callback. * macroscope.c (_initialize_macroscope): Declare before definition. * cp-namespace.c (_initialize_cp_namespace): Declare before definition. * python/python.c (_initialize_python): Declare before definition. * tui/tui-command.c: Include "tui/tui-command.h". * tui/tui-data.c (init_content_element, init_win_info): Make them static. * tui/tui-disasm.c: Include "tui/tui-disasm.h". * tui/tui-interp.c (_initialize_tui_interp): Declare before definition. * tui/tui-layout.c: Include "tui/tui-layout.h". (_initialize_tui_layout): Declare before definition. * tui/tui-regs.c: Include "tui/tui-regs.h". (tui_display_reg_element_at_line): Make it static. (_initialize_tui_regs): Declare before definition. * tui/tui-stack.c (_initialize_tui_stack): Declare before definition. * tui/tui-win.c: Include "tui/tui-win.h". (_initialize_tui_win): Declare before definition. (tui_sigwinch_handler): Make it static. Wrap in ifdef SIGWINCH. * tui/tui-win.h (tui_sigwinch_handler): Delete declaration. (tui_get_cmd_list): Add a prototype. * tui/tui-windata.c: Include tui-windata.h. * tui/tui-wingeneral.c (box_win): Make it static. * cli/cli-logging.c (show_logging_command): Make it static. (_initialize_cli_logging): Declare before definition. * mi/mi-common.c (_initialize_gdb_mi_common): Declare before definition.
2009-02-21 17:14:50 +01:00
static void
tui_sigwinch_handler (int signal)
{
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
mark_async_signal_handler (tui_sigwinch_token);
tui_set_win_resized_to (true);
}
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
/* Callback for asynchronously resizing TUI following a SIGWINCH signal. */
static void
tui_async_resize_screen (gdb_client_data arg)
{
rl_resize_terminal ();
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
if (!tui_active)
{
int screen_height, screen_width;
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
rl_get_screen_size (&screen_height, &screen_width);
set_screen_width_and_height (screen_width, screen_height);
/* win_resized is left set so that the next call to tui_enable()
resizes the TUI windows. */
}
else
{
tui_set_win_resized_to (false);
tui_resize_all ();
tui_refresh_all_win ();
tui_update_gdb_sizes ();
Make TUI resizing tests more robust As Sergio pointed out, the TUI resizing tests are flaky. Debugging this showed three main problems. 1. expect's "stty" command processes its arguments one-by-one. So, rather than requesting a single resize, it sends two separate resize requests (one for rows and one for columns). This means gdb sees two SIGWINCH signals and resizes the terminal twice. I consider this a bug in expect, but I couldn't readily see how to report a bug; and anyway the fix wouldn't propagate very quickly. This patch works around this problem by explicitly doing two separate resizes (so it will be robust if expect ever does change); and then by waiting for each resize to complete before continuing. 2. gdb uses curses to drive the console rendering. Currently the test suite looks for terminal text insertion sequences to decide when a command has completed. However, it turns out that, sometimes, curses can output things in non-obvious ways. I didn't debug into curses but I guess this can happen due to output optimizations. No matter the reason, sometimes the current approach of only tracking text insertions is not enough to detect that gdb has finished rendering. This patch fixes this problem by arranging to detect the termination output after any curses command, not just insertion. 3. Detecting when a resize has completed is tricky. In fact, I could not find a way to reliably do this. This patch fixes this problem by adding a special maint "tui-resize-message" setting to gdb. When this is enabled, gdb will print a message after each SIGWINCH has been fully processed. The test suite enables this mode and then waits for the message in order to know when control can be returned to the calling test. This patch also adds a timeout, to avoid the situation where the terminal code fails to notice a change for some reason. This lets the test at least try to continue. gdb/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * tui/tui-win.c (resize_message): New global. (show_tui_resize_message): New function. (tui_async_resize_screen): Print message if requested. (_initialize_tui_win): Add tui-resize-message setting. * NEWS: Add entry for new commands. gdb/doc/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * gdb.texinfo (Maintenance Commands): Document new command. gdb/testsuite/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * lib/tuiterm.exp (_accept): Add wait_for parameter. Check output after any command. Expect prompt after WAIT_FOR is seen. (enter_tui): Enable resize messages. (command): Expect command in output. (get_line): Avoid error when cursor appears to be off-screen. (dump_screen): Include screen size in title. (_do_resize): New proc, from "resize". (resize): Rewrite. Do resize in two steps. * gdb.tui/empty.exp (layouts): Fix entries. (check_boxes): Remove xfail. (check_text): Dump screen on failure. Change-Id: I420e0259cb99b21adcd28f671b99161eefa7a51d
2019-08-16 23:16:12 +02:00
if (resize_message)
{
static int count;
printf_unfiltered ("@@ resize done %d, size = %dx%d\n", count,
tui_term_width (), tui_term_height ());
++count;
}
tui_redisplay_readline ();
}
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
}
2008-02-21 Pedro Alves <pedro@codesorcery.com> Silence a few -Wmissing-prototypes warnings. PR build/9877: * amd64-nat.c: Include "amd64-nat.h". * fork-child.c (_initialize_fork_child): Ditto. * gcore.c (_initialize_gcore): Ditto. * inf-ptrace.c: Include "inf-ptrace.h". (inf_ptrace_store_registers): Make it static. * linux-nat.c (linux_nat_terminal_ours): Make it static. (_initialize_linux_nat): Declare before definition. * linux-tdep.c: Include "linux-tdep.h". * linux-thread-db.c (_initialize_thread_db): Declare before definition. * proc-service.c (_initialize_proc_service): Ditto. * remote.c (remote_send_printf): Make it static. * solib.c: Include "solib.h". * symfile-mem.c (_initialize_symfile_mem): Declare before definition. * ada-lang.c (ada_la_decode, ada_match_name) (ada_suppress_symbol_printing, ada_is_array_type) (ada_value_ptr_subscript, ada_array_length) (ada_to_static_fixed_value): Make them static. (_initialize_ada_language): Declare before definition. * ada-tasks.c (ada_get_task_number, ada_get_environment_task) (ada_task_list_changed, ada_new_objfile_observer): Make them static. (_initialize_tasks): Declare before definition. * addrmap.c (_initialize_addrmap): Declare before definition. * auxv.c (default_auxv_parse): Make it static. * bfd-target.c (target_bfd_xfer_partial, target_bfd_xclose): Make them static. * breakpoint.c (remove_sal): Add line break. (expand_line_sal_maybe): Make it static. * cp-name-parser.y: Include "cp-support.h". * cp-valprint.c (cp_find_class_member): Make it static. * eval.c (value_f90_subarray): Ditto. * exceptions.c (print_any_exception): Ditto. * findcmd.c (_initialize_mem_search): Declare before definition. * frame.c (frame_observer_target_changed): Make it static. * gnu-v3-abi.c (gnuv3_find_method_in): Make it static. * inf-child.c: Include "inf-child.h". * inferior.h (valid_inferior_id): Rename to ... (valid_gdb_inferior_id): ... this. * infrun.c (infrun_thread_stop_requested, siginfo_make_value): Make them static. * jv-lang.c (java_language_arch_info): Make it static. * m2-typeprint.c (m2_get_discrete_bounds): Ditto. * osdata.c (info_osdata_command): Make it static. * regcache.c (regcache_observer_target_changed): Make it static. * reverse.c (_initialize_reverse): Declare before definition. * stabsread.c (cleanup_undefined_types_noname) (cleanup_undefined_types_1): Make them static. * symfile.c (place_section): Make it static. * symtab.c (find_pc_sect_psymtab_closer): Make it static. * target-descriptions.c (_initialize_target_descriptions): Declare before definition. * target.c (default_get_ada_task_ptid, find_default_can_async_p) (find_default_is_async_p, find_default_supports_non_stop): Make them static. (target_supports_non_stop): Add prototype. (dummy_pid_to_str): Make it static. * utils.c (_initialize_utils): Declare before definition. * ada-exp.y (_initialize_ada_exp): Declare before definition. * solib-svr4.c (HAS_LM_DYNAMIC_FROM_LINK_MAP): Add a prototype. * target.h (struct target_ops): Add a prototype to the to_can_execute_reverse callback. * macroscope.c (_initialize_macroscope): Declare before definition. * cp-namespace.c (_initialize_cp_namespace): Declare before definition. * python/python.c (_initialize_python): Declare before definition. * tui/tui-command.c: Include "tui/tui-command.h". * tui/tui-data.c (init_content_element, init_win_info): Make them static. * tui/tui-disasm.c: Include "tui/tui-disasm.h". * tui/tui-interp.c (_initialize_tui_interp): Declare before definition. * tui/tui-layout.c: Include "tui/tui-layout.h". (_initialize_tui_layout): Declare before definition. * tui/tui-regs.c: Include "tui/tui-regs.h". (tui_display_reg_element_at_line): Make it static. (_initialize_tui_regs): Declare before definition. * tui/tui-stack.c (_initialize_tui_stack): Declare before definition. * tui/tui-win.c: Include "tui/tui-win.h". (_initialize_tui_win): Declare before definition. (tui_sigwinch_handler): Make it static. Wrap in ifdef SIGWINCH. * tui/tui-win.h (tui_sigwinch_handler): Delete declaration. (tui_get_cmd_list): Add a prototype. * tui/tui-windata.c: Include tui-windata.h. * tui/tui-wingeneral.c (box_win): Make it static. * cli/cli-logging.c (show_logging_command): Make it static. (_initialize_cli_logging): Declare before definition. * mi/mi-common.c (_initialize_gdb_mi_common): Declare before definition.
2009-02-21 17:14:50 +01:00
#endif
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
/* Initialize TUI's SIGWINCH signal handler. Note that the handler is not
uninstalled when we exit TUI, so the handler should not assume that TUI is
always active. */
void
tui_initialize_win (void)
{
#ifdef SIGWINCH
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
tui_sigwinch_token
= create_async_signal_handler (tui_async_resize_screen, NULL);
{
#ifdef HAVE_SIGACTION
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
struct sigaction old_winch;
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
memset (&old_winch, 0, sizeof (old_winch));
old_winch.sa_handler = &tui_sigwinch_handler;
#ifdef SA_RESTART
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
old_winch.sa_flags = SA_RESTART;
#endif
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
sigaction (SIGWINCH, &old_winch, NULL);
#else
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
signal (SIGWINCH, &tui_sigwinch_handler);
#endif
Asynchronously resize the TUI This patch teaches the TUI to resize itself asynchronously instead of synchronously. Asynchronously resizing the screen when the underlying terminal gets resized is the more intuitive behavior and is surprisingly simple to implement thanks to GDB's async infrastructure. The implementation is straightforward. TUI's SIGWINCH handler is just tweaked to asynchronously invoke a new callback, tui_async_resize_screen, which is responsible for safely resizing the screen. Care must be taken to not to attempt to asynchronously resize the screen while the TUI is not active. When the TUI is not active, the callback will do nothing, but the screen will yet be resized in the next call to tui_enable() by virtue of win_resized being TRUE. (So, after the patch there are still two places where the screen gets resized: one in tui_enable() and the other now in tui_async_resize_screen() as opposed to being in tui_handle_resize_during_io(). The one in tui_enable() is still necessary to handle the case where the terminal gets resized inside the CLI: in that case, the TUI still needs resizing, but it must wait until the TUI gets re-enabled.) gdb/ChangeLog: * tui/tui-io.c (tui_handle_resize_during_io): Remove this function. (tui_putc): Don't call tui_handle_resize_during_io. (tui_getc): Likewise. (tui_mld_getc): Likewise. * tui/tui-win.c: Include event-loop.h and tui/tui-io.h. (tui_sigwinch_token): New static variable. (tui_initialize_win): Adjust documentation. Set tui_sigwinch_token. (tui_async_resize_screen): New asynchronous callback. (tui_sigwinch_handler): Adjust documentation. Asynchronously invoke tui_async_resize_screen.
2015-02-17 17:13:43 +01:00
}
#endif
}
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
tui_scroll_forward_command (const char *arg, int from_tty)
{
int num_to_scroll = 1;
struct tui_win_info *win_to_scroll;
/* Make sure the curses mode is enabled. */
tui_enable ();
if (arg == NULL)
Remove unnecessary casts of NULL 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-16 17:56:35 +02:00
parse_scrolling_args (arg, &win_to_scroll, NULL);
else
parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
Introduce methods for scrolling 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-16 19:22:38 +02:00
win_to_scroll->forward_scroll (num_to_scroll);
}
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
tui_scroll_backward_command (const char *arg, int from_tty)
{
int num_to_scroll = 1;
struct tui_win_info *win_to_scroll;
/* Make sure the curses mode is enabled. */
tui_enable ();
if (arg == NULL)
Remove unnecessary casts of NULL 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-16 17:56:35 +02:00
parse_scrolling_args (arg, &win_to_scroll, NULL);
else
parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
Introduce methods for scrolling 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-16 19:22:38 +02:00
win_to_scroll->backward_scroll (num_to_scroll);
}
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
tui_scroll_left_command (const char *arg, int from_tty)
{
int num_to_scroll;
struct tui_win_info *win_to_scroll;
/* Make sure the curses mode is enabled. */
tui_enable ();
parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
Introduce methods for scrolling 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-16 19:22:38 +02:00
win_to_scroll->left_scroll (num_to_scroll);
}
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
tui_scroll_right_command (const char *arg, int from_tty)
{
int num_to_scroll;
struct tui_win_info *win_to_scroll;
/* Make sure the curses mode is enabled. */
tui_enable ();
parse_scrolling_args (arg, &win_to_scroll, &num_to_scroll);
Introduce methods for scrolling 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-16 19:22:38 +02:00
win_to_scroll->right_scroll (num_to_scroll);
}
/* Answer the window represented by name. */
static struct tui_win_info *
tui_partial_win_by_name (gdb::string_view name)
{
struct tui_win_info *best = nullptr;
if (name != NULL)
{
for (tui_win_info *item : all_tui_windows ())
{
const char *cur_name = item->name ();
if (name == cur_name)
return item;
if (startswith (cur_name, name))
{
if (best != nullptr)
error (_("Window name \"%*s\" is ambiguous"),
(int) name.size (), name.data ());
best = item;
}
}
}
return best;
}
/* Set focus to the window named by 'arg'. */
static void
tui_set_focus_command (const char *arg, int from_tty)
{
tui_enable ();
if (arg == NULL)
error_no_arg (_("name of window to focus"));
struct tui_win_info *win_info = NULL;
if (subset_compare (arg, "next"))
win_info = tui_next_win (tui_win_with_focus ());
else if (subset_compare (arg, "prev"))
win_info = tui_prev_win (tui_win_with_focus ());
else
win_info = tui_partial_win_by_name (arg);
if (win_info == NULL)
error (_("Unrecognized window name \"%s\""), arg);
if (!win_info->is_visible ())
error (_("Window \"%s\" is not visible"), arg);
tui_set_win_focus_to (win_info);
keypad (TUI_CMD_WIN->handle.get (), win_info != TUI_CMD_WIN);
printf_filtered (_("Focus set to %s window.\n"),
tui_win_with_focus ()->name ());
}
static void
Constify add_info This patch constifies add_info and updates all the info commands. The bulk of this patch was written using a script; and then I did a manual pass to fix up the remaining compilation errors. I could not compile every changed file; in particular nto-procfs.c, gnu-nat.c, and darwin-nat-info.c; but I at least tried to check the correctness by inspection. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * frame.h (info_locals_command, info_args_command): Constify. * auto-load.h (auto_load_info_scripts): Constify. * inferior.h (registers_info): Constify. * copying.c: Rebuild. * copying.awk: Constify generated commands. * auto-load.c (auto_load_info_scripts) (info_auto_load_gdb_scripts): Constify. * cli/cli-decode.c (struct cmd_list_element): Take a cmd_const_cfunc_ftype. * command.h (add_info): Take a cmd_const_cfunc_ftype. * tui/tui-win.c (tui_all_windows_info): Constify. * python/py-auto-load.c (info_auto_load_python_scripts): Constify. * cli/cli-cmds.c (show_command): Remove non-const overload. * tracepoint.c (info_tvariables_command, info_scope_command): Constify. (info_static_tracepoint_markers_command): Constify. * thread.c (info_threads_command): Constify. (print_thread_info_1): Constify. * target.c (info_target_command): Constify. * symtab.c (info_sources_command, info_functions_command) (info_types_command): Constify. (info_variables_command): Remove non-const overload. * symfile.c (info_ext_lang_command): Constify. * stack.c (info_frame_command, info_locals_command) (info_args_command): Constify. (backtrace_command): Remove non-const overload. * source.c (info_source_command, info_line_command): Constify. * solib.c (info_sharedlibrary_command): Constify. * skip.c (info_skip_command): Constify. * ser-go32.c (info_serial_command): Constify. * reverse.c (info_bookmarks_command): Constify. * printcmd.c (info_symbol_command, info_address_command) (info_display_command): Constify. * osdata.c (info_osdata_command): Constify. * objc-lang.c (info_selectors_command, info_classes_command): Constify. * nto-procfs.c (procfs_pidlist, procfs_meminfo): Constify. * memattr.c (info_mem_command): Constify. * macrocmd.c (info_macro_command, info_macros_command): Constify. * linux-fork.c (info_checkpoints_command): Constify. * infrun.c (info_signals_command): Constify. * inflow.c (info_terminal_command): Constify. * inferior.c (info_inferiors_command): Constify. (print_inferior): Constify. * infcmd.c (info_program_command, info_all_registers_command) (info_registers_command, info_vector_command) (info_float_command): Constify. (registers_info): Constify. * gnu-nat.c (info_send_rights_cmd, info_recv_rights_cmd) (info_port_sets_cmd, info_dead_names_cmd, info_port_rights_cmd): Constify. * f-valprint.c (info_common_command): Constify. * dcache.c (info_dcache_command): Constify. (dcache_info_1): Constify. * darwin-nat-info.c (info_mach_tasks_command) (info_mach_task_command, info_mach_ports_command) (info_mach_port_command, info_mach_threads_command) (info_mach_thread_command, info_mach_regions_command) (info_mach_regions_recurse_command, info_mach_region_command) (info_mach_exceptions_command): Constify. (get_task_from_args): Constify. * cp-support.c (info_vtbl_command): Constify. * breakpoint.c (info_watchpoints_command) (info_tracepoints_command): Constify. (info_breakpoints_command): Remove non-const overload. * avr-tdep.c (avr_io_reg_read_command): Constify. * auxv.c (info_auxv_command): Constify. * ada-tasks.c (info_tasks_command): Constify. (info_task): Constify. * ada-lang.c (info_exceptions_command): Constify.
2017-10-14 06:07:26 +02:00
tui_all_windows_info (const char *arg, int from_tty)
{
if (!tui_active)
{
printf_filtered (_("The TUI is not active.\n"));
return;
}
struct tui_win_info *win_with_focus = tui_win_with_focus ();
struct ui_out *uiout = current_uiout;
ui_out_emit_table table_emitter (uiout, 3, -1, "tui-windows");
uiout->table_header (10, ui_left, "name", "Name");
uiout->table_header (5, ui_right, "lines", "Lines");
uiout->table_header (10, ui_left, "focus", "Focus");
uiout->table_body ();
for (tui_win_info *win_info : all_tui_windows ())
if (win_info->is_visible ())
{
ui_out_emit_tuple tuple_emitter (uiout, nullptr);
uiout->field_string ("name", win_info->name ());
uiout->field_signed ("lines", win_info->height);
if (win_with_focus == win_info)
uiout->field_string ("focus", _("(has focus)"));
else
uiout->field_skip ("focus");
uiout->text ("\n");
}
}
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
tui_refresh_all_command (const char *arg, int from_tty)
{
/* Make sure the curses mode is enabled. */
tui_enable ();
tui_refresh_all_win ();
}
/* The tab width that should be used by the TUI. */
unsigned int tui_tab_width = DEFAULT_TAB_LEN;
/* The tab width as set by the user. */
static unsigned int internal_tab_width = DEFAULT_TAB_LEN;
/* After the tab width is set, call this to update the relevant
windows. */
static void
update_tab_width ()
{
for (tui_win_info *win_info : all_tui_windows ())
{
if (win_info->is_visible ())
win_info->update_tab_width ();
}
}
/* Callback for "set tui tab-width". */
static void
tui_set_tab_width (const char *ignore,
int from_tty, struct cmd_list_element *c)
{
if (internal_tab_width == 0)
{
internal_tab_width = tui_tab_width;
error (_("Tab width must not be 0"));
}
tui_tab_width = internal_tab_width;
update_tab_width ();
}
/* Callback for "show tui tab-width". */
static void
tui_show_tab_width (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (gdb_stdout, _("TUI tab width is %s spaces.\n"), value);
}
/* See tui-win.h. */
bool compact_source = false;
/* Callback for "set tui compact-source". */
static void
tui_set_compact_source (const char *ignore, int from_tty,
struct cmd_list_element *c)
{
if (TUI_SRC_WIN != nullptr)
TUI_SRC_WIN->refill ();
}
/* Callback for "show tui compact-source". */
static void
tui_show_compact_source (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
printf_filtered (_("TUI source window compactness is %s.\n"), value);
}
/* Set the tab width of the specified window. */
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
tui_set_tab_width_command (const char *arg, int from_tty)
{
/* Make sure the curses mode is enabled. */
tui_enable ();
if (arg != NULL)
{
int ts;
ts = atoi (arg);
if (ts <= 0)
warning (_("Tab widths greater than 0 must be specified."));
else
{
internal_tab_width = ts;
tui_tab_width = ts;
update_tab_width ();
}
}
}
/* Set the height of the specified window. */
static void
tui_set_win_height_command (const char *arg, int from_tty)
{
/* Make sure the curses mode is enabled. */
tui_enable ();
if (arg == NULL)
error_no_arg (_("name of window"));
const char *buf = arg;
const char *buf_ptr = buf;
int new_height;
struct tui_win_info *win_info;
buf_ptr = skip_to_space (buf_ptr);
/* Validate the window name. */
gdb::string_view wname (buf, buf_ptr - buf);
win_info = tui_partial_win_by_name (wname);
if (win_info == NULL)
error (_("Unrecognized window name \"%s\""), arg);
if (!win_info->is_visible ())
error (_("Window \"%s\" is not visible"), arg);
/* Process the size. */
buf_ptr = skip_spaces (buf_ptr);
if (*buf_ptr != '\0')
{
bool negate = false;
bool fixed_size = true;
int input_no;;
if (*buf_ptr == '+' || *buf_ptr == '-')
{
if (*buf_ptr == '-')
negate = true;
fixed_size = false;
buf_ptr++;
}
input_no = atoi (buf_ptr);
if (input_no > 0)
{
if (negate)
input_no *= (-1);
if (fixed_size)
new_height = input_no;
else
new_height = win_info->height + input_no;
/* Now change the window's height, and adjust
all other windows around it. */
tui_adjust_window_height (win_info, new_height);
tui_update_gdb_sizes ();
}
else
error (_("Invalid window height specified"));
}
}
/* See tui-data.h. */
int
tui_win_info::max_height () const
{
return tui_term_height () - 2;
}
Add horizontal splitting to TUI layout 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-22 19:48:26 +01:00
/* See tui-data.h. */
int
tui_gen_win_info::max_width () const
{
return tui_term_width () - 2;
}
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
parse_scrolling_args (const char *arg,
struct tui_win_info **win_to_scroll,
int *num_to_scroll)
{
if (num_to_scroll)
*num_to_scroll = 0;
*win_to_scroll = tui_win_with_focus ();
/* First set up the default window to scroll, in case there is no
window name arg. */
if (arg != NULL)
{
char *buf_ptr;
/* Process the number of lines to scroll. */
std::string copy = arg;
buf_ptr = &copy[0];
if (isdigit (*buf_ptr))
{
char *num_str;
num_str = buf_ptr;
buf_ptr = strchr (buf_ptr, ' ');
if (buf_ptr != NULL)
{
*buf_ptr = '\0';
if (num_to_scroll)
*num_to_scroll = atoi (num_str);
buf_ptr++;
}
else if (num_to_scroll)
*num_to_scroll = atoi (num_str);
}
/* Process the window name if one is specified. */
if (buf_ptr != NULL)
{
-Wwrite-strings: The Rest This is the remainder boring constification that all looks more of less borderline obvious IMO. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * ada-exp.y (yyerror): Constify. * ada-lang.c (bound_name, get_selections) (ada_variant_discrim_type) (ada_variant_discrim_name, ada_value_struct_elt) (ada_lookup_struct_elt_type, is_unchecked_variant) (ada_which_variant_applies, standard_exc, ada_get_next_arg) (catch_ada_exception_command_split) (catch_ada_assert_command_split, catch_assert_command) (ada_op_name): Constify. * ada-lang.h (ada_yyerror, get_selections) (ada_variant_discrim_name, ada_value_struct_elt): Constify. * arc-tdep.c (arc_print_frame_cache): Constify. * arm-tdep.c (arm_skip_stub): Constify. * ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref) (gen_aggregate_elt_ref): Constify. * bcache.c (print_bcache_statistics): Constify. * bcache.h (print_bcache_statistics): Constify. * break-catch-throw.c (catch_exception_command_1): * breakpoint.c (struct ep_type_description::description): Constify. (add_solib_catchpoint): Constify. (catch_fork_command_1): Add cast. (add_catch_command): Constify. * breakpoint.h (add_catch_command, add_solib_catchpoint): Constify. * bsd-uthread.c (bsd_uthread_state): Constify. * buildsym.c (patch_subfile_names): Constify. * buildsym.h (next_symbol_text_func, patch_subfile_names): Constify. * c-exp.y (yyerror): Constify. (token::oper): Constify. * c-lang.h (c_yyerror, cp_print_class_member): Constify. * c-varobj.c (cplus_describe_child): Constify. * charset.c (find_charset_names): Add cast. (find_charset_names): Constify array and add const_cast. * cli/cli-cmds.c (complete_command, cd_command): Constify. (edit_command): Constify. * cli/cli-decode.c (lookup_cmd): Constify. * cli/cli-dump.c (dump_memory_command, dump_value_command): Constify. (struct dump_context): Constify. (add_dump_command, restore_command): Constify. * cli/cli-script.c (get_command_line): Constify. * cli/cli-script.h (get_command_line): Constify. * cli/cli-utils.c (check_for_argument): Constify. * cli/cli-utils.h (check_for_argument): Constify. * coff-pe-read.c (struct read_pe_section_data): Constify. * command.h (lookup_cmd): Constify. * common/print-utils.c (decimal2str): Constify. * completer.c (gdb_print_filename): Constify. * corefile.c (set_gnutarget): Constify. * cp-name-parser.y (yyerror): Constify. * cp-valprint.c (cp_print_class_member): Constify. * cris-tdep.c (cris_register_name, crisv32_register_name): Constify. * d-exp.y (yyerror): Constify. (struct token::oper): Constify. * d-lang.h (d_yyerror): Constify. * dbxread.c (struct header_file_location::name): Constify. (add_old_header_file, add_new_header_file, last_function_name) (dbx_next_symbol_text, add_bincl_to_list) (find_corresponding_bincl_psymtab, set_namestring) (find_stab_function_addr, read_dbx_symtab, start_psymtab) (dbx_end_psymtab, read_ofile_symtab, process_one_symbol): * defs.h (command_line_input, print_address_symbolic) (deprecated_readline_begin_hook): Constify. * dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name): Constify. * event-top.c (handle_line_of_input): Constify and add cast. * exceptions.c (catch_errors): Constify. * exceptions.h (catch_errors): Constify. * expprint.c (print_subexp_standard, op_string, op_name) (op_name_standard, dump_raw_expression, dump_raw_expression): * expression.h (op_name, op_string, dump_raw_expression): Constify. * f-exp.y (yyerror): Constify. (struct token::oper): Constify. (struct f77_boolean_val::name): Constify. * f-lang.c (f_word_break_characters): Constify. * f-lang.h (f_yyerror): Constify. * fork-child.c (fork_inferior): Add cast. * frv-tdep.c (struct gdbarch_tdep::register_names): Constify. (new_variant): Constify. * gdbarch.sh (pstring_ptr, pstring_list): Constify. * gdbarch.c: Regenerate. * gdbcore.h (set_gnutarget): Constify. * go-exp.y (yyerror): Constify. (token::oper): Constify. * go-lang.h (go_yyerror): Constify. * go32-nat.c (go32_sysinfo): Constify. * guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify. * guile/scm-cmd.c (cmdscm_function): Constify. * guile/scm-param.c (pascm_param_value): Constify. * h8300-tdep.c (h8300_register_name, h8300s_register_name) (h8300sx_register_name): Constify. * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Constify. * ia64-tdep.c (ia64_register_names): Constify. * infcmd.c (construct_inferior_arguments): Constify. (path_command, attach_post_wait): Constify. * language.c (show_range_command, show_case_command) (unk_lang_error): Constify. * language.h (language_defn::la_error) (language_defn::la_name_of_this): Constify. * linespec.c (decode_line_2): Constify. * linux-thread-db.c (thread_db_err_str): Constify. * lm32-tdep.c (lm32_register_name): Constify. * m2-exp.y (yyerror): Constify. * m2-lang.h (m2_yyerror): Constify. * m32r-tdep.c (m32r_register_names): Constify and make static. * m68hc11-tdep.c (m68hc11_register_names): Constify. * m88k-tdep.c (m88k_register_name): Constify. * macroexp.c (appendmem): Constify. * mdebugread.c (fdr_name, add_data_symbol, parse_type) (upgrade_type, parse_external, parse_partial_symbols) (mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab) (new_symbol): Constify. * memattr.c (mem_info_command): Constify. * mep-tdep.c (register_name_from_keyword): Constify. * mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env): Constify. * mi/mi-cmd-stack.c (list_args_or_locals): Constify. * mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify. * mi/mi-main.c (captured_mi_execute_command): Constify and add cast. (mi_execute_async_cli_command): Constify. * mips-tdep.c (mips_register_name): Constify. * mn10300-tdep.c (register_name, mn10300_generic_register_name) (am33_register_name, am33_2_register_name) * moxie-tdep.c (moxie_register_names): Constify. * nat/linux-osdata.c (osdata_type): Constify fields. * nto-tdep.c (nto_parse_redirection): Constify. * objc-lang.c (lookup_struct_typedef, lookup_objc_class) (lookup_child_selector): Constify. (objc_methcall::name): Constify. * objc-lang.h (lookup_objc_class, lookup_child_selector) (lookup_struct_typedef): Constify. * objfiles.c (pc_in_section): Constify. * objfiles.h (pc_in_section): Constify. * p-exp.y (struct token::oper): Constify. (yyerror): Constify. * p-lang.h (pascal_yyerror): Constify. * parser-defs.h (op_name_standard): Constify. (op_print::string): Constify. (exp_descriptor::op_name): Constify. * printcmd.c (print_address_symbolic): Constify. * psymtab.c (print_partial_symbols): Constify. * python/py-breakpoint.c (stop_func): Constify. (bppy_get_expression): Constify. * python/py-cmd.c (cmdpy_completer::name): Constify. (cmdpy_function): Constify. * python/py-event.c (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-event.h (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-evts.c (add_new_registry): Constify. * python/py-finishbreakpoint.c (outofscope_func): Constify. * python/py-framefilter.c (get_py_iter_from_func): Constify. * python/py-inferior.c (get_buffer): Add cast. * python/py-param.c (parm_constant::name): Constify. * python/py-unwind.c (fprint_frame_id): Constify. * python/python.c (gdbpy_parameter_value): Constify. * remote-fileio.c (remote_fio_func_map): Make 'name' const. * remote.c (memory_packet_config::name): Constify. (show_packet_config_cmd, remote_write_bytes) (remote_buffer_add_string): * reverse.c (exec_reverse_once): Constify. * rs6000-tdep.c (variant::name, variant::description): Constify. * rust-exp.y (rustyyerror): Constify. * rust-lang.c (rust_op_name): Constify. * rust-lang.h (rustyyerror): Constify. * serial.h (serial_ops::name): Constify. * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name) (sh_sh3e_register_name, sh_sh2e_register_name) (sh_sh2a_register_name, sh_sh2a_nofpu_register_name) (sh_sh_dsp_register_name, sh_sh3_dsp_register_name) (sh_sh4_register_name, sh_sh4_nofpu_register_name) (sh_sh4al_dsp_register_name): Constify. * sh64-tdep.c (sh64_register_name): Constify. * solib-darwin.c (lookup_symbol_from_bfd): Constify. * spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify. * stabsread.c (patch_block_stabs, read_type_number) (ref_map::stabs, ref_add, process_reference) (symbol_reference_defined, define_symbol, define_symbol) (error_type, read_type, read_member_functions, read_cpp_abbrev) (read_one_struct_field, read_struct_fields, read_baseclasses) (read_tilde_fields, read_struct_type, read_array_type) (read_enum_type, read_sun_builtin_type, read_sun_floating_type) (read_huge_number, read_range_type, read_args, common_block_start) (find_name_end): Constify. * stabsread.h (common_block_start, define_symbol) (process_one_symbol, symbol_reference_defined, ref_add): * symfile.c (get_section_index, add_symbol_file_command): * symfile.h (get_section_index): Constify. * target-descriptions.c (tdesc_type::name): Constify. (tdesc_free_type): Add cast. * target.c (find_default_run_target): (add_deprecated_target_alias, find_default_run_target) (target_announce_detach): Constify. (do_option): Constify. * target.h (add_deprecated_target_alias): Constify. * thread.c (print_thread_info_1): Constify. * top.c (deprecated_readline_begin_hook, command_line_input): Constify. (init_main): Add casts. * top.h (handle_line_of_input): Constify. * tracefile-tfile.c (tfile_write_uploaded_tsv): Constify. * tracepoint.c (tvariables_info_1, trace_status_mi): Constify. (tfind_command): Rename to ... (tfind_command_1): ... this and constify. (tfind_command): New function. (tfind_end_command, tfind_start_command): Adjust. (encode_source_string): Constify. * tracepoint.h (encode_source_string): Constify. * tui/tui-data.c (tui_partial_win_by_name): Constify. * tui/tui-data.h (tui_partial_win_by_name): Constify. * tui/tui-source.c (tui_set_source_content_nil): Constify. * tui/tui-source.h (tui_set_source_content_nil): Constify. * tui/tui-win.c (parse_scrolling_args): Constify. * tui/tui-windata.c (tui_erase_data_content): Constify. * tui/tui-windata.h (tui_erase_data_content): Constify. * tui/tui-winsource.c (tui_erase_source_content): Constify. * tui/tui.c (tui_enable): Add cast. * utils.c (defaulted_query): Constify. (init_page_info): Add cast. (puts_debug, subset_compare): Constify. * utils.h (subset_compare): Constify. * varobj.c (varobj_format_string): Constify. * varobj.h (varobj_format_string): Constify. * vax-tdep.c (vax_register_name): Constify. * windows-nat.c (windows_detach): Constify. * xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify. * xml-support.c (gdb_xml_end_element): Constify. * xml-tdesc.c (tdesc_start_reg): Constify. * xstormy16-tdep.c (xstormy16_register_name): Constify. * xtensa-tdep.c (xtensa_find_register_by_name): Constify. * xtensa-tdep.h (xtensa_register_t::name): Constify. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * gdbreplay.c (sync_error): Constify. * linux-x86-low.c (push_opcode): Constify.
2017-04-05 20:21:37 +02:00
const char *wname;
wname = skip_spaces (buf_ptr);
if (*wname != '\0')
{
*win_to_scroll = tui_partial_win_by_name (wname);
if (*win_to_scroll == NULL)
error (_("Unrecognized window `%s'"), wname);
if (!(*win_to_scroll)->is_visible ())
error (_("Window is not visible"));
else if (*win_to_scroll == TUI_CMD_WIN)
*win_to_scroll = *(tui_source_windows ().begin ());
}
}
}
}
/* Function to initialize gdb commands, for tui window
manipulation. */
gdb: add back declarations for _initialize functions 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-13 20:01:38 +01:00
void _initialize_tui_win ();
void
gdb: add back declarations for _initialize functions 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-13 20:01:38 +01:00
_initialize_tui_win ()
{
static struct cmd_list_element *tui_setlist;
static struct cmd_list_element *tui_showlist;
struct cmd_list_element *cmd;
/* Define the classes of commands.
They will appear in the help list in the reverse of this order. */
add_prefix_cmd ("tui", class_tui, set_tui_cmd,
Make first and last lines of 'command help documentation' consistent. 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-06-09 11:16:20 +02:00
_("TUI configuration variables."),
&tui_setlist, "set tui ",
0 /* allow-unknown */, &setlist);
add_prefix_cmd ("tui", class_tui, show_tui_cmd,
Make first and last lines of 'command help documentation' consistent. 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-06-09 11:16:20 +02:00
_("TUI configuration variables."),
&tui_showlist, "show tui ",
0 /* allow-unknown */, &showlist);
add_com ("refresh", class_tui, tui_refresh_all_command,
Remove trailing newlines from help text 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-06-04 14:17:09 +02:00
_("Refresh the terminal display."));
cmd = add_com ("tabset", class_tui, tui_set_tab_width_command, _("\
Set the width (in characters) of tab stops.\n\
Remove trailing newlines from help text 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-06-04 14:17:09 +02:00
Usage: tabset N"));
deprecate_cmd (cmd, "set tui tab-width");
cmd = add_com ("winheight", class_tui, tui_set_win_height_command, _("\
Set or modify the height of a specified window.\n\
Usage: winheight WINDOW-NAME [+ | -] NUM-LINES\n\
Use \"info win\" to see the names of the windows currently being displayed."));
add_com_alias ("wh", "winheight", class_tui, 0);
set_cmd_completer (cmd, winheight_completer);
add_info ("win", tui_all_windows_info,
_("List of all displayed windows.\n\
Usage: info win"));
cmd = add_com ("focus", class_tui, tui_set_focus_command, _("\
Set focus to named window or next/prev window.\n\
Usage: focus [WINDOW-NAME | next | prev]\n\
Use \"info win\" to see the names of the windows currently being displayed."));
add_com_alias ("fs", "focus", class_tui, 0);
set_cmd_completer (cmd, focus_completer);
add_com ("+", class_tui, tui_scroll_forward_command, _("\
Scroll window forward.\n\
Usage: + [N] [WIN]\n\
Scroll window WIN N lines forwards. Both WIN and N are optional, N\n\
defaults to 1, and WIN defaults to the currently focused window."));
add_com ("-", class_tui, tui_scroll_backward_command, _("\
Scroll window backward.\n\
Usage: - [N] [WIN]\n\
Scroll window WIN N lines backwards. Both WIN and N are optional, N\n\
defaults to 1, and WIN defaults to the currently focused window."));
add_com ("<", class_tui, tui_scroll_left_command, _("\
Scroll window text to the left.\n\
Usage: < [N] [WIN]\n\
Scroll window WIN N characters left. Both WIN and N are optional, N\n\
defaults to 1, and WIN defaults to the currently focused window."));
add_com (">", class_tui, tui_scroll_right_command, _("\
Scroll window text to the right.\n\
Usage: > [N] [WIN]\n\
Scroll window WIN N characters right. Both WIN and N are optional, N\n\
defaults to 1, and WIN defaults to the currently focused window."));
/* Define the tui control variables. */
add_setshow_enum_cmd ("border-kind", no_class, tui_border_kind_enums,
&tui_border_kind, _("\
Set the kind of border for TUI windows."), _("\
Show the kind of border for TUI windows."), _("\
This variable controls the border of TUI windows:\n\
Remove trailing newlines from help text 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-06-04 14:17:09 +02:00
space use a white space\n\
ascii use ascii characters + - | for the border\n\
acs use the Alternate Character Set"),
tui_set_var_cmd,
show_tui_border_kind,
&tui_setlist, &tui_showlist);
add_setshow_enum_cmd ("border-mode", no_class, tui_border_mode_enums,
&tui_border_mode, _("\
Set the attribute mode to use for the TUI window borders."), _("\
Show the attribute mode to use for the TUI window borders."), _("\
This variable controls the attributes to use for the window borders:\n\
Remove trailing newlines from help text 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-06-04 14:17:09 +02:00
normal normal display\n\
standout use highlight mode of terminal\n\
reverse use reverse video mode\n\
half use half bright\n\
half-standout use half bright and standout mode\n\
bold use extra bright or bold\n\
bold-standout use extra bright or bold with standout mode"),
tui_set_var_cmd,
show_tui_border_mode,
&tui_setlist, &tui_showlist);
add_setshow_enum_cmd ("active-border-mode", no_class, tui_border_mode_enums,
&tui_active_border_mode, _("\
Set the attribute mode to use for the active TUI window border."), _("\
Show the attribute mode to use for the active TUI window border."), _("\
This variable controls the attributes to use for the active window border:\n\
Remove trailing newlines from help text 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-06-04 14:17:09 +02:00
normal normal display\n\
standout use highlight mode of terminal\n\
reverse use reverse video mode\n\
half use half bright\n\
half-standout use half bright and standout mode\n\
bold use extra bright or bold\n\
bold-standout use extra bright or bold with standout mode"),
tui_set_var_cmd,
show_tui_active_border_mode,
&tui_setlist, &tui_showlist);
add_setshow_zuinteger_cmd ("tab-width", no_class,
&internal_tab_width, _("\
Set the tab width, in characters, for the TUI."), _("\
Make first and last lines of 'command help documentation' consistent. 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-06-09 11:16:20 +02:00
Show the tab witdh, in characters, for the TUI."), _("\
This variable controls how many spaces are used to display a tab character."),
tui_set_tab_width, tui_show_tab_width,
&tui_setlist, &tui_showlist);
Make TUI resizing tests more robust As Sergio pointed out, the TUI resizing tests are flaky. Debugging this showed three main problems. 1. expect's "stty" command processes its arguments one-by-one. So, rather than requesting a single resize, it sends two separate resize requests (one for rows and one for columns). This means gdb sees two SIGWINCH signals and resizes the terminal twice. I consider this a bug in expect, but I couldn't readily see how to report a bug; and anyway the fix wouldn't propagate very quickly. This patch works around this problem by explicitly doing two separate resizes (so it will be robust if expect ever does change); and then by waiting for each resize to complete before continuing. 2. gdb uses curses to drive the console rendering. Currently the test suite looks for terminal text insertion sequences to decide when a command has completed. However, it turns out that, sometimes, curses can output things in non-obvious ways. I didn't debug into curses but I guess this can happen due to output optimizations. No matter the reason, sometimes the current approach of only tracking text insertions is not enough to detect that gdb has finished rendering. This patch fixes this problem by arranging to detect the termination output after any curses command, not just insertion. 3. Detecting when a resize has completed is tricky. In fact, I could not find a way to reliably do this. This patch fixes this problem by adding a special maint "tui-resize-message" setting to gdb. When this is enabled, gdb will print a message after each SIGWINCH has been fully processed. The test suite enables this mode and then waits for the message in order to know when control can be returned to the calling test. This patch also adds a timeout, to avoid the situation where the terminal code fails to notice a change for some reason. This lets the test at least try to continue. gdb/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * tui/tui-win.c (resize_message): New global. (show_tui_resize_message): New function. (tui_async_resize_screen): Print message if requested. (_initialize_tui_win): Add tui-resize-message setting. * NEWS: Add entry for new commands. gdb/doc/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * gdb.texinfo (Maintenance Commands): Document new command. gdb/testsuite/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * lib/tuiterm.exp (_accept): Add wait_for parameter. Check output after any command. Expect prompt after WAIT_FOR is seen. (enter_tui): Enable resize messages. (command): Expect command in output. (get_line): Avoid error when cursor appears to be off-screen. (dump_screen): Include screen size in title. (_do_resize): New proc, from "resize". (resize): Rewrite. Do resize in two steps. * gdb.tui/empty.exp (layouts): Fix entries. (check_boxes): Remove xfail. (check_text): Dump screen on failure. Change-Id: I420e0259cb99b21adcd28f671b99161eefa7a51d
2019-08-16 23:16:12 +02:00
add_setshow_boolean_cmd ("tui-resize-message", class_maintenance,
&resize_message, _("\
Set TUI resize messaging."), _("\
Show TUI resize messaging."), _("\
When enabled GDB will print a message when the terminal is resized."),
nullptr,
show_tui_resize_message,
&maintenance_set_cmdlist,
&maintenance_show_cmdlist);
add_setshow_boolean_cmd ("compact-source", class_tui,
&compact_source, _("\
Set whether the TUI source window is compact."), _("\
Show whether the TUI source window is compact."), _("\
This variable controls whether the TUI source window is shown\n\
in a compact form. The compact form puts the source closer to\n\
the line numbers and uses less horizontal space."),
tui_set_compact_source, tui_show_compact_source,
&tui_setlist, &tui_showlist);
tui_border_style.changed.attach (tui_rehighlight_all);
tui_active_border_style.changed.attach (tui_rehighlight_all);
}