* tuiWin.c, tuiWin.h, tui.c, tui.h, tuiCommand.c: Add FSF copyright.
tuiCommand.h, tuiIO.c, tuiIO.h, tuiData.h, tuiData.c: Likewise.
tuiDataWin.c, tuiDataWin.h, tuiDisassem.c, tuiDisassem.h: Likewise.
tuiGeneralWin.c, tuiGeneralWin.h, tuiLayout.c, tuiLayout.h: Likewise.
tuiRegs.c, tuiRegs.h, tuiSource.c, tuiSource.h: Likewise.
tuiSouceWin.c, tuiSourceWin.h, tuiStack.c, tuiStack.h: Likewise.
2001-07-14 21:01:25 +02:00
|
|
|
/* TUI display registers in window.
|
2002-03-01 07:19:28 +01:00
|
|
|
|
2020-01-01 07:20:01 +01:00
|
|
|
Copyright (C) 1998-2020 Free Software Foundation, Inc.
|
2002-03-01 07:19:28 +01:00
|
|
|
|
* tuiWin.c, tuiWin.h, tui.c, tui.h, tuiCommand.c: Add FSF copyright.
tuiCommand.h, tuiIO.c, tuiIO.h, tuiData.h, tuiData.c: Likewise.
tuiDataWin.c, tuiDataWin.h, tuiDisassem.c, tuiDisassem.h: Likewise.
tuiGeneralWin.c, tuiGeneralWin.h, tuiLayout.c, tuiLayout.h: Likewise.
tuiRegs.c, tuiRegs.h, tuiSource.c, tuiSource.h: Likewise.
tuiSouceWin.c, tuiSourceWin.h, tuiStack.c, tuiStack.h: Likewise.
2001-07-14 21:01:25 +02:00
|
|
|
Contributed by Hewlett-Packard Company.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
* tuiWin.c, tuiWin.h, tui.c, tui.h, tuiCommand.c: Add FSF copyright.
tuiCommand.h, tuiIO.c, tuiIO.h, tuiData.h, tuiData.c: Likewise.
tuiDataWin.c, tuiDataWin.h, tuiDisassem.c, tuiDisassem.h: Likewise.
tuiGeneralWin.c, tuiGeneralWin.h, tuiLayout.c, tuiLayout.h: Likewise.
tuiRegs.c, tuiRegs.h, tuiSource.c, tuiSource.h: Likewise.
tuiSouceWin.c, tuiSourceWin.h, tuiStack.c, tuiStack.h: Likewise.
2001-07-14 21:01:25 +02:00
|
|
|
This file is part of GDB.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
* tuiWin.c, tuiWin.h, tui.c, tui.h, tuiCommand.c: Add FSF copyright.
tuiCommand.h, tuiIO.c, tuiIO.h, tuiData.h, tuiData.c: Likewise.
tuiDataWin.c, tuiDataWin.h, tuiDisassem.c, tuiDisassem.h: Likewise.
tuiGeneralWin.c, tuiGeneralWin.h, tuiLayout.c, tuiLayout.h: Likewise.
tuiRegs.c, tuiRegs.h, tuiSource.c, tuiSource.h: Likewise.
tuiSouceWin.c, tuiSourceWin.h, tuiStack.c, tuiStack.h: Likewise.
2001-07-14 21:01:25 +02:00
|
|
|
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
|
2007-08-23 20:08:50 +02:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
* tuiWin.c, tuiWin.h, tui.c, tui.h, tuiCommand.c: Add FSF copyright.
tuiCommand.h, tuiIO.c, tuiIO.h, tuiData.h, tuiData.c: Likewise.
tuiDataWin.c, tuiDataWin.h, tuiDisassem.c, tuiDisassem.h: Likewise.
tuiGeneralWin.c, tuiGeneralWin.h, tuiLayout.c, tuiLayout.h: Likewise.
tuiRegs.c, tuiRegs.h, tuiSource.c, tuiSource.h: Likewise.
tuiSouceWin.c, tuiSourceWin.h, tuiStack.c, tuiStack.h: Likewise.
2001-07-14 21:01:25 +02:00
|
|
|
(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
|
2007-08-23 20:08:50 +02:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
#include "defs.h"
|
2009-07-02 19:02:35 +02:00
|
|
|
#include "arch-utils.h"
|
2004-01-19 05:31:53 +01:00
|
|
|
#include "tui/tui.h"
|
|
|
|
#include "tui/tui-data.h"
|
1999-04-16 03:35:26 +02:00
|
|
|
#include "symtab.h"
|
|
|
|
#include "gdbtypes.h"
|
|
|
|
#include "gdbcmd.h"
|
|
|
|
#include "frame.h"
|
2002-08-25 11:12:36 +02:00
|
|
|
#include "regcache.h"
|
1999-04-16 03:35:26 +02:00
|
|
|
#include "inferior.h"
|
|
|
|
#include "target.h"
|
2004-01-19 05:31:53 +01:00
|
|
|
#include "tui/tui-layout.h"
|
|
|
|
#include "tui/tui-win.h"
|
|
|
|
#include "tui/tui-wingeneral.h"
|
|
|
|
#include "tui/tui-file.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-regs.h"
|
2015-01-31 09:47:14 +01:00
|
|
|
#include "tui/tui-io.h"
|
2004-03-13 15:14:01 +01:00
|
|
|
#include "reggroups.h"
|
gdb
* varobj.c (value_get_print_value): Include valprint.h.
(value_get_print_value): Use get_formatted_print_options.
* value.h (struct value_print_options): Declare.
(value_print, val_print, common_val_print, val_print_string):
Update.
* value.c: Include valprint.h.
(show_values): Use get_user_print_options.
(show_convenience): Likewise.
* valprint.h (prettyprint_arrays, prettyprint_structs): Don't
declare.
(struct value_print_options): New type.
(vtblprint, unionprint, addressprint, objectprint, print_max,
inspect_it, repeat_count_threshold, output_format,
stop_print_at_null): Don't declare.
(user_print_options, get_user_print_options,
get_raw_print_options, get_formatted_print_options): Declare.
(print_array_indexes_p): Don't declare.
(maybe_print_array_index, val_print_array_elements): Update.
* valprint.c (print_max): Remove.
(user_print_options): New global.
(get_user_print_options, get_raw_print_options,
get_formatted_print_options): New functions.
(print_array_indexes, repeat_count_threshold, stop_print_at_null,
prettyprint_structs, prettyprint_arrays, unionprint,
addressprint): Remove.
(val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(common_val_print): Likewise.
(print_array_indexes_p): Remove.
(maybe_print_array_index): Remove format, pretty arguments; add
options. Update.
(val_print_array_elements): Remove format, deref_ref, pretty
arguments; add options. Update.
(val_print_string): Add options argument. Update.
(_initialize_valprint): Use user_print_options.
(output_format): Remove.
(set_output_radix_1): Use user_print_options.
* typeprint.c: Include valprint.h.
(objectprint): Don't declare.
(whatis_exp): Use get_user_print_options.
* tui/tui-regs.c: Include valprint.h.
(tui_register_format): Use get_formatted_print_options.
* tracepoint.c: Include valprint.h.
(addressprint): Don't declare.
(trace_mention): Use get_user_print_options.
(tracepoints_info): Likewise.
* stack.c (print_frame_args): Use get_raw_print_options.
(print_frame_info): Use get_user_print_options.
(print_frame): Likewise.
* sh64-tdep.c: Include valprint.h
(sh64_do_register): Use get_formatted_print_options.
* scm-valprint.c (scm_inferior_print): Remove format, deref_ref,
pretty arguments; add options.
(scm_scmlist_print): Likewise. Update.
(scm_scmval_print): Likewise.
(scm_val_print): Likewise.
(scm_value_print): Remove format, pretty arguments; add options.
Update.
* scm-lang.h (scm_value_print, scm_val_print, scm_scmval_print):
Update.
* scm-lang.c (scm_printstr): Add options argument.
* python/python-value.c: Include valprint.h.
(valpy_str): Use get_user_print_options.
* printcmd.c: Include valprint.h.
(addressprint): Don't declare.
(inspect_it): Remove.
(print_formatted): Remove format option; add options. Update.
(print_scalar_formatted): Likewise.
(print_address_demangle): Use get_user_print_options.
(do_examine): Use get_formatted_print_options.
(print_command_1): Likewise.
(output_command): Use get_formatted_print_options.
(do_one_display): Likewise.
(print_variable_value): Use get_user_print_options.
* p-valprint.c (pascal_val_print): Remove format, deref_ref,
pretty arguments; add options. Update.
(pascal_value_print): Remove format, pretty arguments; add
options. Update.
(vtblprint, objectprint): Don't declare.
(pascal_static_field_print): Remove.
(pascal_object_print_value_fields): Remove format, pretty
arguments; add options. Update.
(pascal_object_print_static_field): Likewise.
(_initialize_pascal_valprint): Use user_print_options. Update.
* p-lang.h (pascal_val_print, pascal_value_print,
pascal_printstr, pascal_object_print_value_fields): Update.
(vtblprint, static_field_print): Don't declare.
* p-lang.c (pascal_printstr): Add options argument. Update.
* objc-lang.c (objc_printstr): Add options argument. Update.
* mt-tdep.c: Include valprint.h.
(mt_registers_info): Use get_raw_print_options.
* mips-tdep.c: Include valprint.h.
(mips_print_fp_register): Use get_formatted_print_options.
(mips_print_register): Likewise.
* mi/mi-main.c: Include valprint.h.
(get_register): Use get_user_print_options.
(mi_cmd_data_evaluate_expression): Likewise.
(mi_cmd_data_read_memory): Use get_formatted_print_options.
* mi/mi-cmd-stack.c: Include valprint.h.
(list_args_or_locals): Use get_raw_print_options.
* m2-valprint.c (print_function_pointer_address): Add addressprint
argument.
(m2_print_long_set): Remove format, pretty arguments.
(m2_print_unbounded_array): Remove format, deref_ref, pretty
arguments; add options. Update.
(print_unpacked_pointer): Remove format argument; add options.
Now static. Update.
(print_variable_at_address): Remove format, deref_ref, pretty
arguments; add options. Update.
(m2_print_array_contents): Likewise.
(m2_val_print): Likewise.
* m2-lang.h (m2_val_print): Update.
* m2-lang.c (m2_printstr): Add options argument. Update.
* language.h (struct value_print_options): Declare.
(struct language_defn) <la_printstr>: Add options argument.
<la_val_print>: Remove format, deref_ref, pretty argument; add
options.
<la_value_print>: Remove format, pretty arguments; add options.
<la_print_array_index>: Likewise.
(LA_VAL_PRINT, LA_VALUE_PRINT, LA_PRINT_STRING,
LA_PRINT_ARRAY_INDEX): Update.
(default_print_array_index): Update.
* language.c (default_print_array_index): Remove format, pretty
arguments; add options. Update.
(unk_lang_printstr): Add options argument.
(unk_lang_val_print): Remove format, deref_ref, pretty arguments;
add options.
(unk_lang_value_print): Remove format, pretty arguments; add
options.
* jv-valprint.c (java_value_print): Remove format, pretty
arguments; add options. Update.
(java_print_value_fields): Likewise.
(java_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
* jv-lang.h (java_val_print, java_value_print): Declare.
* infcmd.c: Include valprint.h.
(print_return_value): Use get_raw_print_options.
(default_print_registers_info): Use get_user_print_options,
get_formatted_print_options.
(registers_info): Use get_formatted_print_options.
* gdbtypes.h (struct value_print_options): Declare.
(print_scalar_formatted): Update.
* f-valprint.c (f77_print_array_1): Remove format, deref_ref,
pretty arguments; add options. Update.
(f77_print_array): Likewise.
(f_val_print): Likewise.
* f-lang.h (f_val_print): Update.
* f-lang.c (f_printstr): Add options argument. Update.
(c_value_print): Update declaration.
* expprint.c: Include valprint.h.
(print_subexp_standard): Use get_raw_print_options,
get_user_print_options.
* eval.c: Include valprint.h.
(objectprint): Don't declare.
(evaluate_subexp_standard): Use get_user_print_options.
* cp-valprint.c (vtblprint, objectprint, static_field_print):
Remove.
(cp_print_value_fields): Remove format, pretty arguments; add
options. Update.
(cp_print_value): Likewise.
(cp_print_static_field): Likewise.
(_initialize_cp_valprint): Use user_print_options. Update.
* c-valprint.c (print_function_pointer_address): Add addressprint
argument.
(c_val_print): Remove format, deref_ref, pretty arguments; add
options. Update.
(c_value_print): Add options argument. Update.
* c-lang.h (c_val_print, c_value_print, c_printstr): Update.
(vtblprint, static_field_print): Don't declare.
(cp_print_value_fields): Update.
* c-lang.c (c_printstr): Add options argument. Update.
* breakpoint.c: Include valprint.h.
(addressprint): Don't declare.
(watchpoint_value_print): Use get_user_print_options.
(print_one_breakpoint_location): Likewise.
(breakpoint_1, print_it_catch_fork, print_it_catch_vfork, mention,
print_exception_catchpoint): Likewise.
* auxv.c (fprint_target_auxv): Don't declare addressprint. Use
get_user_print_options.
* ada-valprint.c (struct ada_val_print_args): Remove format,
deref_ref, and pretty; add options.
(print_optional_low_bound): Add options argument.
(val_print_packed_array_elements): Remove format and pretty
arguments; add options. Update.
(printstr): Add options argument. Update.
(ada_printstr): Likewise.
(ada_val_print): Remove format, deref_ref, pretty arguments; add
options argument. Update.
(ada_val_print_stub): Update.
(ada_val_print_array): Remove format, deref_ref, pretty arguments;
add options. Update.
(ada_val_print_1): Likewise.
(print_variant_part): Likewise.
(ada_value_print): Remove format, pretty arguments; add options.
Update.
(print_record): Likewise.
(print_field_values): Likewise.
* ada-lang.h (ada_val_print, ada_value_print, ada_printstr):
Update.
* ada-lang.c (ada_print_array_index): Add options argument; remove
format and pretty arguments.
(print_one_exception): Use get_user_print_options.
gdb/testsuite
* gdb.base/exprs.exp (test_expr): Add enum formatting tests.
2008-10-28 18:19:58 +01:00
|
|
|
#include "valprint.h"
|
2015-05-27 00:23:23 +02:00
|
|
|
#include "completer.h"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-02-10 Andrew Cagney <cagney@redhat.com>
* defs.h: Do not include "tui.h".
* gdb_curses.h: New file.
* tui/tui-hooks.h: New file.
* tui/tui.h (tui_update_all_exec_infos): Delete declaration.
(tui_install_hooks, tui_remove_hooks): Delete declarations.
(tui_initialize_io): Delete declaration.
(tui_initialize_readline: Delete redundant declaration.
(struct tui_point): Delete definition.
* tui/tui-data.h (struct tui_point): Define.
* cli/cli-decode.c [TUI]: Include "tui/tui.h".
* utils.c: Include "tui/tui.h".
* tui/tui-data.h: Include "tui/tui.h" and "gdb_curses.h".
* printcmd.c [TUI]: Include "tui/tui.h".
* cli/cli-cmds.c [TUI]: Include "tui/tui.h".
* tui/tui-command.c: Include "gdb_curses.h".
* tui/tui.c, tui/tui-winsource.c, tui/tui-wingeneral.c: Ditto.
* tui/tui-windata.c, tui/tui-win.c, tui/tui-stack.c: Ditto.
* tui/tui-source.c, tui/tui-regs.c, tui/tui-layout.c: Ditto.
* tui/tui-io.c, tui/tui-disasm.c, tui/tui-data.c: : Ditto.
* tui/tui-hooks.c: Include "tui-hooks.h" and "gdb_curses.h".
* Makefile.in: Update all dependencies.
(tui_hooks_h, gdb_curses_h): Define.
(SUBDIR_TUI_CFLAGS): Remove -I${srcdir}/tui.
2004-02-10 20:08:19 +01:00
|
|
|
#include "gdb_curses.h"
|
2003-06-22 17:21:39 +02:00
|
|
|
|
2019-07-13 23:55:02 +02:00
|
|
|
/* Get the register from the frame and return a printable
|
|
|
|
representation of it. */
|
|
|
|
|
2019-07-14 00:01:34 +02:00
|
|
|
static gdb::unique_xmalloc_ptr<char>
|
2019-07-13 23:55:02 +02:00
|
|
|
tui_register_format (struct frame_info *frame, int regnum)
|
|
|
|
{
|
|
|
|
struct gdbarch *gdbarch = get_frame_arch (frame);
|
2009-06-17 20:36:44 +02:00
|
|
|
|
2019-07-13 23:55:02 +02:00
|
|
|
string_file stream;
|
|
|
|
|
|
|
|
scoped_restore save_pagination
|
|
|
|
= make_scoped_restore (&pagination_enabled, 0);
|
|
|
|
scoped_restore save_stdout
|
|
|
|
= make_scoped_restore (&gdb_stdout, &stream);
|
|
|
|
|
|
|
|
gdbarch_print_registers_info (gdbarch, &stream, frame, regnum, 1);
|
|
|
|
|
|
|
|
/* Remove the possible \n. */
|
|
|
|
std::string &str = stream.string ();
|
|
|
|
if (!str.empty () && str.back () == '\n')
|
|
|
|
str.resize (str.size () - 1);
|
|
|
|
|
|
|
|
/* Expand tabs into spaces, since ncurses on MS-Windows doesn't. */
|
2019-07-14 00:01:34 +02:00
|
|
|
return tui_expand_tabs (str.c_str ());
|
2019-07-13 23:55:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Get the register value from the given frame and format it for the
|
|
|
|
display. When changep is set, check if the new register value has
|
|
|
|
changed with respect to the previous call. */
|
|
|
|
static void
|
|
|
|
tui_get_register (struct frame_info *frame,
|
|
|
|
struct tui_data_item_window *data,
|
|
|
|
int regnum, bool *changedp)
|
|
|
|
{
|
|
|
|
if (changedp)
|
|
|
|
*changedp = false;
|
|
|
|
if (target_has_registers)
|
|
|
|
{
|
2019-07-14 00:01:34 +02:00
|
|
|
gdb::unique_xmalloc_ptr<char> new_content
|
|
|
|
= tui_register_format (frame, regnum);
|
2019-07-13 23:55:02 +02:00
|
|
|
|
|
|
|
if (changedp != NULL
|
2019-07-14 00:01:34 +02:00
|
|
|
&& strcmp (data->content.get (), new_content.get ()) != 0)
|
2019-07-13 23:55:02 +02:00
|
|
|
*changedp = true;
|
|
|
|
|
2019-07-14 00:01:34 +02:00
|
|
|
data->content = std::move (new_content);
|
2019-07-13 23:55:02 +02:00
|
|
|
}
|
|
|
|
}
|
2019-07-02 23:51:00 +02:00
|
|
|
|
|
|
|
/* See tui-regs.h. */
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
int
|
2019-06-26 23:44:51 +02:00
|
|
|
tui_data_window::last_regs_line_no () const
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2019-09-02 16:09:37 +02:00
|
|
|
int num_lines = m_regs_content.size () / m_regs_column_count;
|
|
|
|
if (m_regs_content.size () % m_regs_column_count)
|
2019-07-14 17:07:10 +02:00
|
|
|
num_lines++;
|
2004-02-08 01:05:16 +01:00
|
|
|
return num_lines;
|
2004-01-19 17:06:04 +01:00
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2019-07-02 23:41:08 +02:00
|
|
|
/* See tui-regs.h. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
int
|
2019-06-26 23:46:38 +02:00
|
|
|
tui_data_window::line_from_reg_element_no (int element_no) const
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2019-09-02 16:09:37 +02:00
|
|
|
if (element_no < m_regs_content.size ())
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
|
|
|
int i, line = (-1);
|
|
|
|
|
|
|
|
i = 1;
|
|
|
|
while (line == (-1))
|
|
|
|
{
|
2019-09-02 16:09:37 +02:00
|
|
|
if (element_no < m_regs_column_count * i)
|
1999-04-16 03:35:26 +02:00
|
|
|
line = i - 1;
|
|
|
|
else
|
|
|
|
i++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return line;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return (-1);
|
2004-01-19 17:06:04 +01:00
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2019-07-02 23:41:08 +02:00
|
|
|
/* See tui-regs.h. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
int
|
2019-06-26 23:49:00 +02:00
|
|
|
tui_data_window::first_reg_element_no_inline (int line_no) const
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2019-09-02 16:09:37 +02:00
|
|
|
if (line_no * m_regs_column_count <= m_regs_content.size ())
|
|
|
|
return ((line_no + 1) * m_regs_column_count) - m_regs_column_count;
|
1999-04-16 03:35:26 +02:00
|
|
|
else
|
|
|
|
return (-1);
|
2004-01-19 17:06:04 +01:00
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-03-13 15:14:01 +01:00
|
|
|
/* Show the registers of the given group in the data window
|
|
|
|
and refresh the window. */
|
1999-04-16 03:35:26 +02:00
|
|
|
void
|
2019-07-14 00:19:11 +02:00
|
|
|
tui_data_window::show_registers (struct reggroup *group)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2004-03-13 15:14:01 +01:00
|
|
|
if (group == 0)
|
|
|
|
group = general_reggroup;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-03-13 15:14:01 +01:00
|
|
|
if (target_has_registers && target_has_stack && target_has_memory)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2019-07-14 00:19:11 +02:00
|
|
|
show_register_group (group, get_selected_frame (NULL),
|
2019-09-02 16:09:37 +02:00
|
|
|
group == m_current_group);
|
2019-06-27 00:26:39 +02:00
|
|
|
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 23:20:09 +02:00
|
|
|
/* Clear all notation of changed values. */
|
2019-09-02 16:09:37 +02:00
|
|
|
for (auto &&data_item_win : m_regs_content)
|
2019-07-14 00:24:48 +02:00
|
|
|
data_item_win.highlight = false;
|
2019-09-02 16:09:37 +02:00
|
|
|
m_current_group = group;
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
2019-06-27 00:26:39 +02:00
|
|
|
else
|
|
|
|
{
|
2019-09-02 16:09:37 +02:00
|
|
|
m_current_group = 0;
|
2019-10-02 01:42:17 +02:00
|
|
|
m_regs_content.clear ();
|
2019-06-27 00:26:39 +02:00
|
|
|
}
|
2019-10-02 01:42:17 +02:00
|
|
|
|
|
|
|
rerender ();
|
2004-01-19 17:06:04 +01:00
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
2004-03-13 15:14:01 +01:00
|
|
|
/* Set the data window to display the registers of the register group
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 23:20:09 +02:00
|
|
|
using the given frame. Values are refreshed only when
|
2019-07-24 23:42:27 +02:00
|
|
|
refresh_values_only is true. */
|
2004-03-13 15:14:01 +01:00
|
|
|
|
2019-07-14 00:19:11 +02:00
|
|
|
void
|
|
|
|
tui_data_window::show_register_group (struct reggroup *group,
|
|
|
|
struct frame_info *frame,
|
2019-07-24 23:42:27 +02:00
|
|
|
bool refresh_values_only)
|
2004-03-13 15:14:01 +01:00
|
|
|
{
|
2009-06-17 20:36:44 +02:00
|
|
|
struct gdbarch *gdbarch = get_frame_arch (frame);
|
2004-03-13 15:14:01 +01:00
|
|
|
int nr_regs;
|
|
|
|
int regnum, pos;
|
|
|
|
|
|
|
|
/* Make a new title showing which group we display. */
|
2019-07-14 00:47:31 +02:00
|
|
|
title = string_printf ("Register group: %s", reggroup_name (group));
|
2004-03-13 15:14:01 +01:00
|
|
|
|
|
|
|
/* See how many registers must be displayed. */
|
|
|
|
nr_regs = 0;
|
2018-10-22 04:29:21 +02:00
|
|
|
for (regnum = 0; regnum < gdbarch_num_cooked_regs (gdbarch); regnum++)
|
2004-03-13 15:14:01 +01:00
|
|
|
{
|
2011-08-12 19:04:32 +02:00
|
|
|
const char *name;
|
|
|
|
|
|
|
|
/* Must be in the group. */
|
|
|
|
if (!gdbarch_register_reggroup_p (gdbarch, regnum, group))
|
|
|
|
continue;
|
|
|
|
|
|
|
|
/* If the register name is empty, it is undefined for this
|
|
|
|
processor, so don't display anything. */
|
|
|
|
name = gdbarch_register_name (gdbarch, regnum);
|
|
|
|
if (name == 0 || *name == '\0')
|
|
|
|
continue;
|
|
|
|
|
|
|
|
nr_regs++;
|
2004-03-13 15:14:01 +01:00
|
|
|
}
|
|
|
|
|
2019-09-02 16:09:37 +02:00
|
|
|
m_regs_content.resize (nr_regs);
|
2004-03-13 15:14:01 +01:00
|
|
|
|
2019-06-22 20:49:06 +02:00
|
|
|
/* Now set the register names and values. */
|
|
|
|
pos = 0;
|
|
|
|
for (regnum = 0; regnum < gdbarch_num_cooked_regs (gdbarch); regnum++)
|
2004-03-13 15:14:01 +01:00
|
|
|
{
|
2019-06-22 20:49:06 +02:00
|
|
|
struct tui_data_item_window *data_item_win;
|
|
|
|
const char *name;
|
2004-03-13 15:14:01 +01:00
|
|
|
|
2019-06-22 20:49:06 +02:00
|
|
|
/* Must be in the group. */
|
|
|
|
if (!gdbarch_register_reggroup_p (gdbarch, regnum, group))
|
|
|
|
continue;
|
2004-03-13 15:14:01 +01:00
|
|
|
|
2019-06-22 20:49:06 +02:00
|
|
|
/* If the register name is empty, it is undefined for this
|
|
|
|
processor, so don't display anything. */
|
|
|
|
name = gdbarch_register_name (gdbarch, regnum);
|
|
|
|
if (name == 0 || *name == '\0')
|
|
|
|
continue;
|
2004-03-13 15:14:01 +01:00
|
|
|
|
2019-09-02 16:09:37 +02:00
|
|
|
data_item_win = &m_regs_content[pos];
|
2019-06-22 20:49:06 +02:00
|
|
|
if (data_item_win)
|
|
|
|
{
|
|
|
|
if (!refresh_values_only)
|
|
|
|
{
|
|
|
|
data_item_win->item_no = regnum;
|
|
|
|
data_item_win->name = name;
|
|
|
|
data_item_win->highlight = false;
|
|
|
|
}
|
|
|
|
tui_get_register (frame, data_item_win, regnum, 0);
|
|
|
|
}
|
|
|
|
pos++;
|
|
|
|
}
|
2004-03-13 15:14:01 +01:00
|
|
|
}
|
|
|
|
|
2019-07-02 23:41:08 +02:00
|
|
|
/* See tui-regs.h. */
|
2019-06-27 00:13:39 +02:00
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
void
|
2019-06-27 00:13:39 +02:00
|
|
|
tui_data_window::display_registers_from (int start_element_no)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2019-07-14 17:07:10 +02:00
|
|
|
int j, item_win_width, cur_y;
|
|
|
|
|
|
|
|
int max_len = 0;
|
2019-09-02 16:09:37 +02:00
|
|
|
for (auto &&data_item_win : m_regs_content)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2019-07-14 17:07:10 +02:00
|
|
|
const char *p;
|
|
|
|
int len;
|
2004-03-13 15:14:01 +01:00
|
|
|
|
2019-07-14 17:07:10 +02:00
|
|
|
len = 0;
|
|
|
|
p = data_item_win.content.get ();
|
|
|
|
if (p != 0)
|
|
|
|
len = strlen (p);
|
|
|
|
|
|
|
|
if (len > max_len)
|
|
|
|
max_len = len;
|
|
|
|
}
|
|
|
|
item_win_width = max_len + 1;
|
|
|
|
int i = start_element_no;
|
|
|
|
|
2019-09-02 16:09:37 +02:00
|
|
|
m_regs_column_count = (width - 2) / item_win_width;
|
|
|
|
if (m_regs_column_count == 0)
|
|
|
|
m_regs_column_count = 1;
|
|
|
|
item_win_width = (width - 2) / m_regs_column_count;
|
2019-07-14 17:07:10 +02:00
|
|
|
|
|
|
|
/* Now create each data "sub" window, and write the display into
|
|
|
|
it. */
|
|
|
|
cur_y = 1;
|
2019-12-21 18:35:59 +01:00
|
|
|
while (i < m_regs_content.size () && cur_y <= height - 2)
|
2019-07-14 17:07:10 +02:00
|
|
|
{
|
|
|
|
for (j = 0;
|
2019-09-02 16:09:37 +02:00
|
|
|
j < m_regs_column_count && i < m_regs_content.size ();
|
2019-07-14 17:07:10 +02:00
|
|
|
j++)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2019-07-14 17:07:10 +02:00
|
|
|
/* Create the window if necessary. */
|
2019-09-02 16:09:37 +02:00
|
|
|
m_regs_content[i].resize (1, item_win_width,
|
|
|
|
(item_win_width * j) + 1, cur_y);
|
2019-07-14 17:07:10 +02:00
|
|
|
i++; /* Next register. */
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
2019-07-14 17:07:10 +02:00
|
|
|
cur_y++; /* Next row. */
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
2004-01-19 17:06:04 +01:00
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2019-07-02 23:41:08 +02:00
|
|
|
/* See tui-regs.h. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2019-06-27 00:15:46 +02:00
|
|
|
void
|
|
|
|
tui_data_window::display_reg_element_at_line (int start_element_no,
|
|
|
|
int start_line_no)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2019-07-14 17:07:10 +02:00
|
|
|
int element_no = start_element_no;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2019-07-14 17:07:10 +02:00
|
|
|
if (start_element_no != 0 && start_line_no != 0)
|
|
|
|
{
|
|
|
|
int last_line_no, first_line_on_last_page;
|
|
|
|
|
|
|
|
last_line_no = last_regs_line_no ();
|
|
|
|
first_line_on_last_page = last_line_no - (height - 2);
|
|
|
|
if (first_line_on_last_page < 0)
|
|
|
|
first_line_on_last_page = 0;
|
|
|
|
|
|
|
|
/* If the element_no causes us to scroll past the end of the
|
|
|
|
registers, adjust what element to really start the
|
|
|
|
display at. */
|
|
|
|
if (start_line_no > first_line_on_last_page)
|
|
|
|
element_no = first_reg_element_no_inline (first_line_on_last_page);
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
2019-07-14 17:07:10 +02:00
|
|
|
display_registers_from (element_no);
|
2004-02-08 01:05:16 +01:00
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2019-07-02 23:41:08 +02:00
|
|
|
/* See tui-regs.h. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
int
|
2019-06-27 00:13:39 +02:00
|
|
|
tui_data_window::display_registers_from_line (int line_no)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2019-07-14 17:07:10 +02:00
|
|
|
int element_no;
|
|
|
|
|
|
|
|
if (line_no < 0)
|
|
|
|
line_no = 0;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* Make sure that we don't display off the end of the
|
|
|
|
registers. */
|
|
|
|
if (line_no >= last_regs_line_no ())
|
2019-06-26 23:56:56 +02:00
|
|
|
{
|
2019-09-02 16:09:37 +02:00
|
|
|
line_no = line_from_reg_element_no (m_regs_content.size () - 1);
|
2019-07-14 17:07:10 +02:00
|
|
|
if (line_no < 0)
|
|
|
|
line_no = 0;
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-07-14 17:07:10 +02:00
|
|
|
element_no = first_reg_element_no_inline (line_no);
|
2019-09-02 16:09:37 +02:00
|
|
|
if (element_no < m_regs_content.size ())
|
2019-07-14 17:07:10 +02:00
|
|
|
display_reg_element_at_line (element_no, line_no);
|
|
|
|
else
|
|
|
|
line_no = (-1);
|
|
|
|
|
|
|
|
return line_no;
|
2004-01-19 17:06:04 +01:00
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
2019-07-02 23:41:08 +02:00
|
|
|
/* Answer the index first element displayed. If none are displayed,
|
|
|
|
then return (-1). */
|
|
|
|
int
|
|
|
|
tui_data_window::first_data_item_displayed ()
|
|
|
|
{
|
2019-09-02 16:09:37 +02:00
|
|
|
for (int i = 0; i < m_regs_content.size (); i++)
|
2019-07-02 23:41:08 +02:00
|
|
|
{
|
|
|
|
struct tui_gen_win_info *data_item_win;
|
|
|
|
|
2019-09-02 16:09:37 +02:00
|
|
|
data_item_win = &m_regs_content[i];
|
Remove separate visibility flag
TUI windows keep track of their visibility in a boolean field.
However, this is not needed, because a window is visible if and only
if it has an underlying curses handle. So, we can remove this
separate field.
gdb/ChangeLog
2019-08-16 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_is_window_visible): Update.
* tui/tui-wingeneral.c (tui_make_window)
(tui_gen_win_info::make_visible, tui_refresh_all): Update.
* tui/tui-win.c (window_name_completer, tui_refresh_all_win)
(tui_set_focus_command, tui_all_windows_info, update_tab_width)
(tui_set_win_height_command, parse_scrolling_args): Update.
* tui/tui-source.c (tui_source_window::style_changed): Update.
* tui/tui-regs.c (tui_show_registers)
(tui_data_window::first_data_item_displayed)
(tui_data_window::delete_data_content_windows)
(tui_check_register_values, tui_reg_command): Update.
* tui/tui-disasm.c (tui_show_disassem): Update.
* tui/tui-data.h (struct tui_gen_win_info) <is_visible>: New
method.
<is_visible>: Remove field.
* tui/tui-data.c (tui_next_win, tui_prev_win)
(tui_delete_invisible_windows): Update.
2019-07-12 02:03:45 +02:00
|
|
|
if (data_item_win->is_visible ())
|
2019-07-02 23:41:08 +02:00
|
|
|
return i;
|
|
|
|
}
|
|
|
|
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* See tui-regs.h. */
|
|
|
|
|
|
|
|
void
|
|
|
|
tui_data_window::delete_data_content_windows ()
|
|
|
|
{
|
2019-09-02 16:09:37 +02:00
|
|
|
for (auto &&win : m_regs_content)
|
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
|
|
|
win.handle.reset (nullptr);
|
2019-07-02 23:41:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
void
|
|
|
|
tui_data_window::erase_data_content (const char *prompt)
|
|
|
|
{
|
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
|
|
|
werase (handle.get ());
|
2019-07-06 01:14:46 +02:00
|
|
|
check_and_display_highlight_if_needed ();
|
2019-07-02 23:41:08 +02:00
|
|
|
if (prompt != NULL)
|
|
|
|
{
|
|
|
|
int half_width = (width - 2) / 2;
|
|
|
|
int x_pos;
|
|
|
|
|
|
|
|
if (strlen (prompt) >= half_width)
|
|
|
|
x_pos = 1;
|
|
|
|
else
|
|
|
|
x_pos = half_width - strlen (prompt);
|
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
|
|
|
mvwaddstr (handle.get (), (height / 2), x_pos, (char *) prompt);
|
2019-07-02 23:41:08 +02:00
|
|
|
}
|
2019-12-27 16:47:41 +01:00
|
|
|
tui_wrefresh (handle.get ());
|
2019-07-02 23:41:08 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/* See tui-regs.h. */
|
|
|
|
|
|
|
|
void
|
2019-07-14 16:27:34 +02:00
|
|
|
tui_data_window::rerender ()
|
2019-07-02 23:41:08 +02:00
|
|
|
{
|
2019-09-02 16:09:37 +02:00
|
|
|
if (m_regs_content.empty ())
|
2019-07-14 16:21:16 +02:00
|
|
|
erase_data_content (_("[ Register Values Unavailable ]"));
|
2019-07-02 23:41:08 +02:00
|
|
|
else
|
|
|
|
{
|
|
|
|
erase_data_content (NULL);
|
|
|
|
delete_data_content_windows ();
|
|
|
|
display_registers_from (0);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/* Scroll the data window vertically forward or backward. */
|
|
|
|
void
|
|
|
|
tui_data_window::do_scroll_vertical (int num_to_scroll)
|
|
|
|
{
|
|
|
|
int first_element_no;
|
|
|
|
int first_line = (-1);
|
|
|
|
|
|
|
|
first_element_no = first_data_item_displayed ();
|
2019-09-02 16:09:37 +02:00
|
|
|
if (first_element_no < m_regs_content.size ())
|
2019-07-02 23:41:08 +02:00
|
|
|
first_line = line_from_reg_element_no (first_element_no);
|
|
|
|
else
|
|
|
|
{ /* Calculate the first line from the element number which is in
|
|
|
|
the general data content. */
|
|
|
|
}
|
|
|
|
|
|
|
|
if (first_line >= 0)
|
|
|
|
{
|
|
|
|
first_line += num_to_scroll;
|
|
|
|
erase_data_content (NULL);
|
|
|
|
delete_data_content_windows ();
|
|
|
|
display_registers_from_line (first_line);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* See tui-regs.h. */
|
|
|
|
|
|
|
|
void
|
|
|
|
tui_data_window::refresh_window ()
|
|
|
|
{
|
|
|
|
tui_gen_win_info::refresh_window ();
|
2019-09-02 16:09:37 +02:00
|
|
|
for (auto &&win : m_regs_content)
|
2019-07-14 00:24:48 +02:00
|
|
|
win.refresh_window ();
|
2019-07-02 23:41:08 +02:00
|
|
|
}
|
|
|
|
|
2019-12-27 16:47:41 +01:00
|
|
|
void
|
|
|
|
tui_data_window::no_refresh ()
|
|
|
|
{
|
|
|
|
tui_gen_win_info::no_refresh ();
|
|
|
|
for (auto &&win : m_regs_content)
|
|
|
|
win.no_refresh ();
|
|
|
|
}
|
|
|
|
|
2004-01-19 17:06:04 +01:00
|
|
|
/* This function check all displayed registers for changes in values,
|
|
|
|
given a particular frame. If the values have changed, they are
|
|
|
|
updated with the new value and highlighted. */
|
1999-04-16 03:35:26 +02:00
|
|
|
void
|
2019-07-14 00:15:30 +02:00
|
|
|
tui_data_window::check_register_values (struct frame_info *frame)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2019-09-02 16:09:37 +02:00
|
|
|
if (m_regs_content.empty ())
|
|
|
|
show_registers (m_current_group);
|
2019-07-14 00:15:30 +02:00
|
|
|
else
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2019-09-02 16:09:37 +02:00
|
|
|
for (auto &&data_item_win : m_regs_content)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2019-07-14 00:15:30 +02:00
|
|
|
int was_hilighted;
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2019-07-14 00:24:48 +02:00
|
|
|
was_hilighted = data_item_win.highlight;
|
2004-03-13 15:14:01 +01:00
|
|
|
|
2019-07-14 00:24:48 +02:00
|
|
|
tui_get_register (frame, &data_item_win,
|
|
|
|
data_item_win.item_no,
|
|
|
|
&data_item_win.highlight);
|
2004-03-13 15:14:01 +01:00
|
|
|
|
2019-07-14 00:24:48 +02:00
|
|
|
if (data_item_win.highlight || was_hilighted)
|
2019-07-15 23:28:56 +02:00
|
|
|
data_item_win.rerender ();
|
1999-04-16 03:35:26 +02:00
|
|
|
}
|
|
|
|
}
|
2004-01-19 17:06:04 +01:00
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2007-08-14 Michael Snyder <msnyder@access-company.com>
* tui-command.c, tui-data.c, tui-data.h, tui-disasm.c, tui-file.c,
tui-hooks.c, tui-interp.c, tui-io.c, tui-layout.c, tui-out.c,
tui-regs.c, tui-regs.h, tui-source.c, tui-stack.c, tui-win.c,
tui-windata.c, tui-wingeneral.c, tui-winsource.c, tui-winsource.h,
tui.c, tui.h: Comment reformatting to coding standard (capitals,
spaces after periods, etc).
2007-08-14 23:20:09 +02:00
|
|
|
/* Display a register in a window. If hilite is TRUE, then the value
|
|
|
|
will be displayed in reverse video. */
|
2019-07-15 23:28:56 +02:00
|
|
|
void
|
|
|
|
tui_data_item_window::rerender ()
|
2004-03-13 15:14:01 +01:00
|
|
|
{
|
2019-07-15 23:28:56 +02:00
|
|
|
int i;
|
|
|
|
|
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
|
|
|
scrollok (handle.get (), FALSE);
|
2019-07-15 23:28:56 +02:00
|
|
|
if (highlight)
|
|
|
|
/* We ignore the return value, casting it to void in order to avoid
|
|
|
|
a compiler warning. The warning itself was introduced by a patch
|
|
|
|
to ncurses 5.7 dated 2009-08-29, changing this macro to expand
|
|
|
|
to code that causes the compiler to generate an unused-value
|
|
|
|
warning. */
|
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
|
|
|
(void) wstandout (handle.get ());
|
2004-03-13 15:14:01 +01:00
|
|
|
|
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
|
|
|
wmove (handle.get (), 0, 0);
|
2019-07-15 23:28:56 +02:00
|
|
|
for (i = 1; i < width; i++)
|
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
|
|
|
waddch (handle.get (), ' ');
|
|
|
|
wmove (handle.get (), 0, 0);
|
2019-07-15 23:28:56 +02:00
|
|
|
if (content)
|
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
|
|
|
waddstr (handle.get (), content.get ());
|
2019-07-15 23:28:56 +02:00
|
|
|
|
|
|
|
if (highlight)
|
|
|
|
/* We ignore the return value, casting it to void in order to avoid
|
|
|
|
a compiler warning. The warning itself was introduced by a patch
|
|
|
|
to ncurses 5.7 dated 2009-08-29, changing this macro to expand
|
|
|
|
to code that causes the compiler to generate an unused-value
|
|
|
|
warning. */
|
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
|
|
|
(void) wstandend (handle.get ());
|
2019-07-15 23:28:56 +02:00
|
|
|
refresh_window ();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
tui_data_item_window::refresh_window ()
|
|
|
|
{
|
|
|
|
if (handle != nullptr)
|
|
|
|
{
|
|
|
|
/* This seems to be needed because the data items are nested
|
|
|
|
windows, which according to the ncurses man pages aren't well
|
|
|
|
supported. */
|
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
|
|
|
touchwin (handle.get ());
|
2019-12-27 16:47:41 +01:00
|
|
|
tui_wrefresh (handle.get ());
|
2004-03-13 15:14:01 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-05-27 00:23:23 +02:00
|
|
|
/* Helper for "tui reg next", wraps a call to REGGROUP_NEXT, but adds wrap
|
|
|
|
around behaviour. Returns the next register group, or NULL if the
|
|
|
|
register window is not currently being displayed. */
|
|
|
|
|
|
|
|
static struct reggroup *
|
2019-06-27 03:45:53 +02:00
|
|
|
tui_reg_next (struct reggroup *current_group, struct gdbarch *gdbarch)
|
1999-04-16 03:35:26 +02:00
|
|
|
{
|
2015-05-27 00:23:23 +02:00
|
|
|
struct reggroup *group = NULL;
|
2009-07-02 19:02:35 +02:00
|
|
|
|
2019-06-27 03:45:53 +02:00
|
|
|
if (current_group != NULL)
|
2004-03-13 15:14:01 +01:00
|
|
|
{
|
2019-06-27 03:45:53 +02:00
|
|
|
group = reggroup_next (gdbarch, current_group);
|
2015-05-21 21:21:40 +02:00
|
|
|
if (group == NULL)
|
|
|
|
group = reggroup_next (gdbarch, NULL);
|
2004-03-13 15:14:01 +01:00
|
|
|
}
|
2015-05-27 00:23:23 +02:00
|
|
|
return group;
|
2004-03-13 15:14:01 +01:00
|
|
|
}
|
|
|
|
|
2015-05-27 00:23:23 +02:00
|
|
|
/* Helper for "tui reg prev", wraps a call to REGGROUP_PREV, but adds wrap
|
|
|
|
around behaviour. Returns the previous register group, or NULL if the
|
|
|
|
register window is not currently being displayed. */
|
2015-05-21 21:51:53 +02:00
|
|
|
|
2015-05-27 00:23:23 +02:00
|
|
|
static struct reggroup *
|
2019-06-27 03:45:53 +02:00
|
|
|
tui_reg_prev (struct reggroup *current_group, struct gdbarch *gdbarch)
|
2015-05-21 21:51:53 +02:00
|
|
|
{
|
2015-05-27 00:23:23 +02:00
|
|
|
struct reggroup *group = NULL;
|
2015-05-21 21:51:53 +02:00
|
|
|
|
2019-06-27 03:45:53 +02:00
|
|
|
if (current_group != NULL)
|
2015-05-21 21:51:53 +02:00
|
|
|
{
|
2019-06-27 03:45:53 +02:00
|
|
|
group = reggroup_prev (gdbarch, current_group);
|
2015-05-21 21:51:53 +02:00
|
|
|
if (group == NULL)
|
|
|
|
group = reggroup_prev (gdbarch, NULL);
|
|
|
|
}
|
2015-05-27 00:23:23 +02:00
|
|
|
return group;
|
2015-05-21 21:51:53 +02:00
|
|
|
}
|
|
|
|
|
2019-07-14 00:08:33 +02:00
|
|
|
/* A helper function to display the register window in the appropriate
|
|
|
|
way. */
|
|
|
|
|
|
|
|
static void
|
|
|
|
tui_reg_layout ()
|
|
|
|
{
|
|
|
|
enum tui_layout_type cur_layout = tui_current_layout ();
|
|
|
|
enum tui_layout_type new_layout;
|
|
|
|
if (cur_layout == SRC_COMMAND || cur_layout == SRC_DATA_COMMAND)
|
|
|
|
new_layout = SRC_DATA_COMMAND;
|
|
|
|
else
|
|
|
|
new_layout = DISASSEM_DATA_COMMAND;
|
|
|
|
tui_set_layout (new_layout);
|
|
|
|
}
|
|
|
|
|
2015-05-27 00:23:23 +02:00
|
|
|
/* Implement the 'tui reg' command. Changes the register group displayed
|
|
|
|
in the tui register window. Displays the tui register window if it is
|
|
|
|
not already on display. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2004-03-13 15:14:01 +01:00
|
|
|
static void
|
2017-09-10 05:51:10 +02:00
|
|
|
tui_reg_command (const char *args, int from_tty)
|
2004-03-13 15:14:01 +01:00
|
|
|
{
|
2015-05-27 00:23:23 +02:00
|
|
|
struct gdbarch *gdbarch = get_current_arch ();
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2015-05-27 00:23:23 +02:00
|
|
|
if (args != NULL)
|
|
|
|
{
|
|
|
|
struct reggroup *group, *match = NULL;
|
|
|
|
size_t len = strlen (args);
|
|
|
|
|
|
|
|
/* Make sure the curses mode is enabled. */
|
|
|
|
tui_enable ();
|
|
|
|
|
2019-12-27 16:47:41 +01:00
|
|
|
tui_suppress_output suppress;
|
|
|
|
|
2015-05-27 00:23:23 +02:00
|
|
|
/* Make sure the register window is visible. If not, select an
|
|
|
|
appropriate layout. We need to do this before trying to run the
|
|
|
|
'next' or 'prev' commands. */
|
Remove separate visibility flag
TUI windows keep track of their visibility in a boolean field.
However, this is not needed, because a window is visible if and only
if it has an underlying curses handle. So, we can remove this
separate field.
gdb/ChangeLog
2019-08-16 Tom Tromey <tom@tromey.com>
* tui/tui.c (tui_is_window_visible): Update.
* tui/tui-wingeneral.c (tui_make_window)
(tui_gen_win_info::make_visible, tui_refresh_all): Update.
* tui/tui-win.c (window_name_completer, tui_refresh_all_win)
(tui_set_focus_command, tui_all_windows_info, update_tab_width)
(tui_set_win_height_command, parse_scrolling_args): Update.
* tui/tui-source.c (tui_source_window::style_changed): Update.
* tui/tui-regs.c (tui_show_registers)
(tui_data_window::first_data_item_displayed)
(tui_data_window::delete_data_content_windows)
(tui_check_register_values, tui_reg_command): Update.
* tui/tui-disasm.c (tui_show_disassem): Update.
* tui/tui-data.h (struct tui_gen_win_info) <is_visible>: New
method.
<is_visible>: Remove field.
* tui/tui-data.c (tui_next_win, tui_prev_win)
(tui_delete_invisible_windows): Update.
2019-07-12 02:03:45 +02:00
|
|
|
if (TUI_DATA_WIN == NULL || !TUI_DATA_WIN->is_visible ())
|
2019-07-01 04:43:32 +02:00
|
|
|
tui_reg_layout ();
|
2015-05-27 00:23:23 +02:00
|
|
|
|
2019-07-15 03:45:55 +02:00
|
|
|
struct reggroup *current_group = TUI_DATA_WIN->get_current_group ();
|
2015-05-27 00:23:23 +02:00
|
|
|
if (strncmp (args, "next", len) == 0)
|
2019-06-27 03:45:53 +02:00
|
|
|
match = tui_reg_next (current_group, gdbarch);
|
2015-05-27 00:23:23 +02:00
|
|
|
else if (strncmp (args, "prev", len) == 0)
|
2019-06-27 03:45:53 +02:00
|
|
|
match = tui_reg_prev (current_group, gdbarch);
|
2015-05-27 00:23:23 +02:00
|
|
|
|
|
|
|
/* This loop matches on the initial part of a register group
|
|
|
|
name. If this initial part in ARGS matches only one register
|
|
|
|
group then the switch is made. */
|
|
|
|
for (group = reggroup_next (gdbarch, NULL);
|
|
|
|
group != NULL;
|
|
|
|
group = reggroup_next (gdbarch, group))
|
|
|
|
{
|
|
|
|
if (strncmp (reggroup_name (group), args, len) == 0)
|
|
|
|
{
|
|
|
|
if (match != NULL)
|
|
|
|
error (_("ambiguous register group name '%s'"), args);
|
|
|
|
match = group;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (match == NULL)
|
|
|
|
error (_("unknown register group '%s'"), args);
|
|
|
|
|
2019-07-14 00:19:11 +02:00
|
|
|
TUI_DATA_WIN->show_registers (match);
|
2015-05-27 00:23:23 +02:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
struct reggroup *group;
|
|
|
|
int first;
|
|
|
|
|
|
|
|
printf_unfiltered (_("\"tui reg\" must be followed by the name of "
|
|
|
|
"either a register group,\nor one of 'next' "
|
|
|
|
"or 'prev'. Known register groups are:\n"));
|
|
|
|
|
|
|
|
for (first = 1, group = reggroup_next (gdbarch, NULL);
|
|
|
|
group != NULL;
|
|
|
|
first = 0, group = reggroup_next (gdbarch, group))
|
|
|
|
{
|
|
|
|
if (!first)
|
|
|
|
printf_unfiltered (", ");
|
|
|
|
printf_unfiltered ("%s", reggroup_name (group));
|
|
|
|
}
|
|
|
|
|
|
|
|
printf_unfiltered ("\n");
|
|
|
|
}
|
2004-03-13 15:14:01 +01:00
|
|
|
}
|
|
|
|
|
2015-05-27 00:23:23 +02:00
|
|
|
/* Complete names of register groups, and add the special "prev" and "next"
|
|
|
|
names. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
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
|
2015-05-27 00:23:23 +02:00
|
|
|
tui_reggroup_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,
|
2015-05-27 00:23:23 +02:00
|
|
|
const char *text, const char *word)
|
2004-03-13 15:14:01 +01:00
|
|
|
{
|
2015-05-27 00:23:23 +02:00
|
|
|
static const char *extra[] = { "next", "prev", NULL };
|
|
|
|
size_t len = strlen (word);
|
|
|
|
const char **tmp;
|
|
|
|
|
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
|
|
|
reggroup_completer (ignore, tracker, text, word);
|
2015-05-27 00:23:23 +02:00
|
|
|
|
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
|
|
|
/* XXXX use complete_on_enum instead? */
|
2015-05-27 00:23:23 +02:00
|
|
|
for (tmp = extra; *tmp != NULL; ++tmp)
|
|
|
|
{
|
|
|
|
if (strncmp (word, *tmp, len) == 0)
|
2019-06-04 23:40:54 +02:00
|
|
|
tracker.add_completion (make_unique_xstrdup (*tmp));
|
2015-05-27 00:23:23 +02:00
|
|
|
}
|
2004-03-13 15:14:01 +01:00
|
|
|
}
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2020-01-13 20:01:38 +01:00
|
|
|
void _initialize_tui_regs ();
|
2019-07-02 23:41:08 +02:00
|
|
|
void
|
2020-01-13 20:01:38 +01:00
|
|
|
_initialize_tui_regs ()
|
2019-07-02 23:41:08 +02:00
|
|
|
{
|
|
|
|
struct cmd_list_element **tuicmd, *cmd;
|
|
|
|
|
|
|
|
tuicmd = tui_get_cmd_list ();
|
|
|
|
|
|
|
|
cmd = add_cmd ("reg", class_tui, tui_reg_command, _("\
|
|
|
|
TUI command to control the register window."), tuicmd);
|
|
|
|
set_cmd_completer (cmd, tui_reggroup_completer);
|
|
|
|
}
|