binutils-gdb/gdb/cli/cli-cmds.c

2448 lines
70 KiB
C
Raw Normal View History

2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
/* GDB CLI commands.
2002-01-17 23:15:18 +01:00
Copyright (C) 2000-2020 Free Software Foundation, Inc.
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01: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
along with this program. If not, see <http://www.gnu.org/licenses/>. */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
#include "defs.h"
* disasm.h (gdb_disassembly): Add GDBARCH parameter. (gdb_print_insn): Likewise. * disasm.c (dump_insns): Add GDBARCH parameter. Use it instead of current_gdbarch. (do_mixed_source_and_assembly): Add GDBARCH parameter. Pass to dump_insns. (do_assembly_only): Likewise. (gdb_disassembly): Add GDBARCH parameter. Use it instead of current_gdbarch. Pass to subroutines. (gdb_print_insn): Add GDBARCH parameter. Use it instead of current_gdbarch. * stack.c (struct gdb_disassembly_stub_args): Add GDBARCH member. (gdb_disassembly_stub): Pass architecture to gdb_disassembly. (do_gdb_disassembly): Add GDBARCH argument. Store into args. (print_frame_info): Pass architecture to do_gdb_disassembly. * printcmd.c (print_formatted): Pass architecture to gdb_print_insn. * mi/mi-cmd-disas.c: Include "arch-utils.h" (mi_cmd_disassemble): Pass architecture to gdb_disassembly. * cli/cli-cmds.c: Include "arch-utils.h". (print_disassembly): Add GDBARCH parameter. Pass to gdb_disassembly and tui_show_assembly. (disassemble_current_function): Pass architecture to tui_get_low_disassembly_address and print_disassembly. (disassemble_command): Pass architecture to tui_get_low_disassembly_address and print_disassembly. * tui/tui.c (tui_show_assembly): Add GDBARCH parameter. Pass to tui_update_source_windows_with_addr. * tui/tui-data.h (struct tui_locator_element): Add GDBARCH member. (struct tui_source_info): Likewise. * tui/tui-data.c (tui_clear_win_detail): Clear source_info.gdbarch. * tui/tui-disasm.c (tui_disassemble): Add GDBARCH parameter. Pass to gdb_print_insn. (tui_find_disassembly_address): Add GDBARCH parameter. Pass to tui_disassemble. (tui_set_disassem_content): Add GDBARCH parameter. Install into source_info.gdbarch. Pass to tui_disassemble. (tui_show_disassem): Add GDBARCH parameter. Pass to tui_update_source_window. (tui_show_disassem_and_update_source): Add GDBARCH parameter. Pass to tui_show_disassem and tui_update_source_window. (tui_get_begin_asm_address): Return locator architecture in addition to locator PC value. (tui_get_low_disassembly_address): Add GDBARCH parameter. Pass to tui_get_low_disassembly_address. (tui_vertical_disassem_scroll): Pass architecture to subroutines. * tui/tui-disasm.h (tui_set_disassem_content): Add GDBARCH parameter. (tui_show_disassem): Likewise. (tui_show_disassem_and_update_source): Likewise. (tui_get_begin_asm_address): Return architecture and PC value. * tui/tui.h (tui_get_low_disassembly_address): Add GDBARCH parameter. (tui_show_assembly): Add GDBARCH parameter. * tui/tui-layout.c (extract_display_start_addr): Return current window architecture in addition to current PC value. (tui_set_layout): Update calls to tui_get_low_disassembly_address and extract_display_start_addr. Pass architecture to tui_update_source_windows_with_addr. * tui/tui-source.c: Include "objfiles.h". (tui_set_source_content): Initialize window architecture. (tui_show_symtab_source): Add GDBARCH parameter. Pass to tui_update_source_window_as_is * tui/tui-source.h (tui_show_symtab_source): Add GDBARCH parameter. * tui/tui-stack.c (tui_set_locator_info): Add GDBARCH parameter. Install locator architecture. (tui_set_locator_filename): Update call. (tui_show_frame_info): Pass architecture to tui_set_locator_info and subroutines. * tui/tui-win.c (make_visible_with_new_height): Pass architecture to tui_update_source_window. * tui/tui-winsource.c: Include "objfiles.h". (tui_display_main): Update call to tui_get_begin_asm_address. Pass architecture to tui_update_source_windows_with_addr. (tui_update_source_window): Add GDBARCH parameter. Pass to tui_update_source_window_as_is. (tui_update_source_window_as_is): Add GDBARCH parameter. Pass to tui_set_disassem_content. (tui_update_source_windows_with_addr): Add GDBARCH parameter. Pass to subroutines. (tui_update_source_windows_with_line): Pass objfile architecture to subroutines. (tui_horizontal_source_scroll): Pass architecture to tui_update_source_window_as_is. * tui/tui-winsource.h (tui_update_source_window): Add GDBARCH parameter. (tui_update_source_window_as_is): Likewise. (tui_update_source_windows_with_addr): Likewise.
2009-07-02 19:17:42 +02:00
#include "arch-utils.h"
#include "readline/tilde.h"
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
#include "completer.h"
#include "target.h" /* For baud_rate, remote_debug and remote_timeout. */
Rename common to gdbsupport This is the next patch in the ongoing series to move gdbsever to the top level. This patch just renames the "common" directory. The idea is to do this move in two parts: first rename the directory (this patch), then move the directory to the top. This approach makes the patches a bit more tractable. I chose the name "gdbsupport" for the directory. However, as this patch was largely written by sed, we could pick a new name without too much difficulty. Tested by the buildbot. gdb/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * contrib/ari/gdb_ari.sh: Change common to gdbsupport. * configure: Rebuild. * configure.ac: Change common to gdbsupport. * gdbsupport: Rename from common. * acinclude.m4: Change common to gdbsupport. * Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES) (HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to gdbsupport. * aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c, amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c, amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c, amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c, amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c, arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c, arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c, arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c, arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c, auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h, btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c, charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c, cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c, coff-pe-read.c, command.h, compile/compile-c-support.c, compile/compile-c.h, compile/compile-cplus-symbols.c, compile/compile-cplus-types.c, compile/compile-cplus.h, compile/compile-loc2c.c, compile/compile.c, completer.c, completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c, cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c, darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c, disasm.h, dtrace-probe.c, dwarf-index-cache.c, dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c, dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c, event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c, features/aarch64-core.c, features/aarch64-fpu.c, features/aarch64-pauth.c, features/aarch64-sve.c, features/i386/32bit-avx.c, features/i386/32bit-avx512.c, features/i386/32bit-core.c, features/i386/32bit-linux.c, features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c, features/i386/32bit-segments.c, features/i386/32bit-sse.c, features/i386/64bit-avx.c, features/i386/64bit-avx512.c, features/i386/64bit-core.c, features/i386/64bit-linux.c, features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c, features/i386/64bit-segments.c, features/i386/64bit-sse.c, features/i386/x32-core.c, features/riscv/32bit-cpu.c, features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c, features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c, features/riscv/64bit-fpu.c, features/tic6x-c6xp.c, features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h, findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h, gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c, gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c, go32-nat.c, guile/guile.c, guile/scm-ports.c, guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c, i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c, i386-linux-tdep.c, i386-tdep.c, i387-tdep.c, ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c, inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h, inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h, inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c, linux-tdep.c, linux-thread-db.c, location.c, machoread.c, macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h, mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h, minsyms.c, mips-linux-tdep.c, namespace.h, nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h, nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c, nat/amd64-linux-siginfo.c, nat/fork-inferior.c, nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c, nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c, nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h, nat/linux-waitpid.c, nat/mips-linux-watch.c, nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c, nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c, nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h, obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c, parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c, procfs.c, producer.c, progspace.h, psymtab.h, python/py-framefilter.c, python/py-inferior.c, python/py-ref.h, python/py-type.c, python/python.c, record-btrace.c, record-full.c, record.c, record.h, regcache-dump.c, regcache.c, regcache.h, remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c, riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c, selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c, ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c, source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c, stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h, symtab.c, symtab.h, target-descriptions.c, target-descriptions.h, target-memory.c, target.c, target.h, target/waitstatus.c, target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c, top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c, tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h, unittests/array-view-selftests.c, unittests/child-path-selftests.c, unittests/cli-utils-selftests.c, unittests/common-utils-selftests.c, unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c, unittests/format_pieces-selftests.c, unittests/function-view-selftests.c, unittests/lookup_name_info-selftests.c, unittests/memory-map-selftests.c, unittests/memrange-selftests.c, unittests/mkdir-recursive-selftests.c, unittests/observable-selftests.c, unittests/offset-type-selftests.c, unittests/optional-selftests.c, unittests/parse-connection-spec-selftests.c, unittests/ptid-selftests.c, unittests/rsp-low-selftests.c, unittests/scoped_fd-selftests.c, unittests/scoped_mmap-selftests.c, unittests/scoped_restore-selftests.c, unittests/string_view-selftests.c, unittests/style-selftests.c, unittests/tracepoint-selftests.c, unittests/unpack-selftests.c, unittests/utils-selftests.c, unittests/xml-utils-selftests.c, utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c, value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c, xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c, xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport. gdb/gdbserver/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac: Change common to gdbsupport. * acinclude.m4: Change common to gdbsupport. * Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS) (version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change common to gdbsupport. * ax.c, event-loop.c, fork-child.c, gdb_proc_service.h, gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c, inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c, linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c, linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c, linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h, nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c, server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h, thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change common to gdbsupport.
2019-05-06 04:29:24 +02:00
#include "gdbsupport/gdb_wait.h" /* For shell escape implementation. */
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
#include "gdbcmd.h"
#include "gdb_regex.h" /* Used by apropos_command. */
#include "gdb_vfork.h"
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
#include "linespec.h"
#include "expression.h"
#include "frame.h"
#include "value.h"
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
#include "language.h"
#include "filenames.h" /* For DOSish file names. */
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
#include "objfiles.h"
#include "source.h"
#include "disasm.h"
#include "tracepoint.h"
Rename common to gdbsupport This is the next patch in the ongoing series to move gdbsever to the top level. This patch just renames the "common" directory. The idea is to do this move in two parts: first rename the directory (this patch), then move the directory to the top. This approach makes the patches a bit more tractable. I chose the name "gdbsupport" for the directory. However, as this patch was largely written by sed, we could pick a new name without too much difficulty. Tested by the buildbot. gdb/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * contrib/ari/gdb_ari.sh: Change common to gdbsupport. * configure: Rebuild. * configure.ac: Change common to gdbsupport. * gdbsupport: Rename from common. * acinclude.m4: Change common to gdbsupport. * Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES) (HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to gdbsupport. * aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c, amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c, amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c, amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c, amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c, arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c, arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c, arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c, arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c, auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h, btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c, charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c, cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c, coff-pe-read.c, command.h, compile/compile-c-support.c, compile/compile-c.h, compile/compile-cplus-symbols.c, compile/compile-cplus-types.c, compile/compile-cplus.h, compile/compile-loc2c.c, compile/compile.c, completer.c, completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c, cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c, darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c, disasm.h, dtrace-probe.c, dwarf-index-cache.c, dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c, dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c, event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c, features/aarch64-core.c, features/aarch64-fpu.c, features/aarch64-pauth.c, features/aarch64-sve.c, features/i386/32bit-avx.c, features/i386/32bit-avx512.c, features/i386/32bit-core.c, features/i386/32bit-linux.c, features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c, features/i386/32bit-segments.c, features/i386/32bit-sse.c, features/i386/64bit-avx.c, features/i386/64bit-avx512.c, features/i386/64bit-core.c, features/i386/64bit-linux.c, features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c, features/i386/64bit-segments.c, features/i386/64bit-sse.c, features/i386/x32-core.c, features/riscv/32bit-cpu.c, features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c, features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c, features/riscv/64bit-fpu.c, features/tic6x-c6xp.c, features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h, findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h, gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c, gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c, go32-nat.c, guile/guile.c, guile/scm-ports.c, guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c, i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c, i386-linux-tdep.c, i386-tdep.c, i387-tdep.c, ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c, inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h, inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h, inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c, linux-tdep.c, linux-thread-db.c, location.c, machoread.c, macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h, mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h, minsyms.c, mips-linux-tdep.c, namespace.h, nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h, nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c, nat/amd64-linux-siginfo.c, nat/fork-inferior.c, nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c, nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c, nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h, nat/linux-waitpid.c, nat/mips-linux-watch.c, nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c, nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c, nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h, obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c, parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c, procfs.c, producer.c, progspace.h, psymtab.h, python/py-framefilter.c, python/py-inferior.c, python/py-ref.h, python/py-type.c, python/python.c, record-btrace.c, record-full.c, record.c, record.h, regcache-dump.c, regcache.c, regcache.h, remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c, riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c, selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c, ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c, source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c, stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h, symtab.c, symtab.h, target-descriptions.c, target-descriptions.h, target-memory.c, target.c, target.h, target/waitstatus.c, target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c, top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c, tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h, unittests/array-view-selftests.c, unittests/child-path-selftests.c, unittests/cli-utils-selftests.c, unittests/common-utils-selftests.c, unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c, unittests/format_pieces-selftests.c, unittests/function-view-selftests.c, unittests/lookup_name_info-selftests.c, unittests/memory-map-selftests.c, unittests/memrange-selftests.c, unittests/mkdir-recursive-selftests.c, unittests/observable-selftests.c, unittests/offset-type-selftests.c, unittests/optional-selftests.c, unittests/parse-connection-spec-selftests.c, unittests/ptid-selftests.c, unittests/rsp-low-selftests.c, unittests/scoped_fd-selftests.c, unittests/scoped_mmap-selftests.c, unittests/scoped_restore-selftests.c, unittests/string_view-selftests.c, unittests/style-selftests.c, unittests/tracepoint-selftests.c, unittests/unpack-selftests.c, unittests/utils-selftests.c, unittests/xml-utils-selftests.c, utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c, value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c, xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c, xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport. gdb/gdbserver/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac: Change common to gdbsupport. * acinclude.m4: Change common to gdbsupport. * Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS) (version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change common to gdbsupport. * ax.c, event-loop.c, fork-child.c, gdb_proc_service.h, gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c, inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c, linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c, linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c, linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h, nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c, server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h, thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change common to gdbsupport.
2019-05-06 04:29:24 +02:00
#include "gdbsupport/filestuff.h"
Explicit locations: use new location API This patch converts the code base to use the new struct event_location API being introduced. This patch preserves the current functionality and adds no new features. The "big picture" API usage introduced by this patch may be illustrated with a simple exmaple. Where previously developers would write: void my_command (char *arg, int from_tty) { create_breakpoint (..., arg, ...); ... } one now uses: void my_command (char *arg, int from_tty) { struct event_locaiton *location; struct cleanup *back_to; location = string_to_event_locaiton (&arg, ...); back_to = make_cleanup_delete_event_location (location); create_breakpoint (..., location, ...); do_cleanups (back_to); } Linespec-decoding functions (now called location-decoding) such as decode_line_full no longer skip argument pointers over processed input. That functionality has been moved into string_to_event_location as demonstrated above. gdb/ChangeLog * ax-gdb.c: Include location.h. (agent_command_1) Use linespec location instead of address string. * break-catch-throw.c: Include location.h. (re_set_exception_catchpoint): Use linespec locations instead of address strings. * breakpoint.c: Include location.h. (create_overlay_event_breakpoint, create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_breakpoints_after_exec): Use linespec location instead of address string. (print_breakpoint_location): Use locations and event_location_to_string. Print extra_string for pending locations for non-MI streams. (print_one_breakpoint_location): Use locations and event_location_to_string. (init_raw_breakpoint_without_location): Initialize b->location. (create_thread_event_breakpoint): Use linespec location instead of address string. (init_breakpoint_sal): Likewise. Only save extra_string if it is non-NULL and not the empty string. Use event_location_to_string instead of `addr_string'. Constify `p' and `endp'. Use skip_spaces_const/skip_space_const instead of non-const versions. Copy the location into the breakpoint. If LOCATION is NULL, save the breakpoint address as a linespec location instead of an address string. (create_breakpoint_sal): Change `addr_string' parameter to a struct event_location. All uses updated. (create_breakpoints_sal): Likewise for local variable `addr_string'. (parse_breakpoint_sals): Use locations instead of address strings. Remove check for empty linespec with conditional. Refactor. (decode_static_tracepoint_spec): Make argument const and update function. (create_breakpoint): Change `arg' to a struct event_location and rename. Remove `copy_arg' and `addr_start'. If EXTRA_STRING is empty, set it to NULL. Don't populate `canonical' for pending breakpoints. Pass `extra_string' to find_condition_and_thread. Clear `extra_string' if `rest' was NULL. Do not error with "garbage after location" if setting a dprintf breakpoint. Copy the location into the breakpoint instead of an address string. (break_command_1): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Check against `arg_cp' for a probe linespec. (dprintf_command): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Throw an exception if no format string was specified. (print_recreate_ranged_breakpoint): Use event_location_to_string instead of address strings. (break_range_command, until_break_command) (init_ada_exception_breakpoint): Use locations instead of address strings. (say_where): Print out extra_string for pending locations. (base_breakpoint_dtor): Delete `location' and `location_range_end' of the breakpoint. (base_breakpoint_create_sals_from_location): Use struct event_location instead of address string. Remove `addr_start' and `copy_arg' parameters. (base_breakpoint_decode_location): Use struct event_location instead of address string. (bkpt_re_set): Use locations instead of address strings. Use event_location_empty_p to check for unset location. (bkpt_print_recreate): Use event_location_to_string instead of an address string. Print out extra_string for pending locations. (bkpt_create_sals_from_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location): Use struct event_location instead of address string. (bkpt_probe_decode_location): Use struct event_location instead of address string. (tracepoint_print_recreate): Use event_location_to_string to recreate the tracepoint. (tracepoint_create_sals_from_location, tracepoint_decode_location) (tracepoint_probe_create_sals_from_location) (tracepoint_probe_decode_location): Use struct event_location instead of address string. (dprintf_print_recreate): Use event_location_to_string to recreate the dprintf. (dprintf_re_set): Remove check for valid/missing format string. (strace_marker_create_sals_from_location) (strace_marker_create_breakpoints_sal, strace_marker_decode_location) (update_static_tracepoint): Use struct event_location instead of address string. (location_to_sals): Likewise. Pass `extra_string' to find_condition_and_thread. For newly resolved pending breakpoint locations, clear the location's string representation. Assert that the breakpoint's condition string is NULL when condition_not_parsed. (breakpoint_re_set_default, create_sals_from_location_default) (decode_location_default, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Use locations instead of address strings. * breakpoint.h (struct breakpoint_ops) <create_sals_from_location>: Use struct event_location instead of address string. Update all uses. <decode_location>: Likewise. (struct breakpoint) <addr_string>: Change to struct event_location and rename `location'. <addr_string_range_end>: Change to struct event_location and rename `location_range_end'. (create_breakpoint): Use struct event_location instead of address string. * cli/cli-cmds.c: Include location.h. (edit_command, list_command): Use locations instead of address strings. * elfread.c: Include location.h. (elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string. * guile/scm-breakpoint.c: Include location.h. (bpscm_print_breakpoint_smob): Use event_location_to_string. (gdbscm_register_breakpoint): Use locations instead of address strings. * linespec.c: Include location.h. (struct ls_parser) <stream>: Change to const char *. (PARSER_STREAM): Update. (lionespec_lexer_lex_keyword): According to find_condition_and_thread, keywords must be followed by whitespace. (canonicalize_linespec): Save a linespec location into `canonical'. Save a canonical linespec into `canonical'. (parse_linespec): Change `argptr' to const char * and rename `arg'. All uses updated. Update function description. (linespec_parser_new): Initialize `parser'. Update initialization of parsing stream. (event_location_to_sals): New function. (decode_line_full): Change `argptr' to a struct event_location and rename it `location'. Use locations instead of address strings. Call event_location_to_sals instead of parse_linespec. (decode_line_1): Likewise. (decode_line_with_current_source, decode_line_with_last_displayed) Use locations instead of address strings. (decode_objc): Likewise. Change `argptr' to const char * and rename `arg'. (destroy_linespec_result): Delete the linespec result's location instead of freeing the address string. * linespec.h (struct linespec_result) <addr_string>: Change to struct event_location and rename to ... <location>: ... this. (decode_line_1, decode_line_full): Change `argptr' to struct event_location. All callers updated. * mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h. (mi_cmd_break_insert_1): Use locations instead of address strings. Throw an error if there was "garbage" at the end of the specified linespec. * probe.c: Include location.h. (parse_probes): Change `argptr' to struct event_location. Use event locations instead of address strings. * probe.h (parse_probes): Change `argptr' to struct event_location. * python/py-breakpoint.c: Include location.h. (bppy_get_location): Constify local variable `str'. Use event_location_to_string. (bppy_init): Use locations instead of address strings. * python/py-finishbreakpoint.c: Include location.h. (bpfinishpy_init): Remove local variable `addr_str'. Use locations instead of address strings. * python/python.c: Include location.h. (gdbpy_decode_line): Use locations instead of address strings. * remote.c: Include location.h. (remote_download_tracepoint): Use locations instead of address strings. * spu-tdep.c: Include location.h. (spu_catch_start): Remove local variable `buf'. Use locations instead of address strings. * tracepoint.c: Include location.h. (scope_info): Use locations instead of address strings. (encode_source_string): Constify parameter `src'. * tracepoint.h (encode_source_string): Likewise. gdb/testsuite/ChangeLog * gdb.base/dprintf-pending.exp: Update dprintf "without format" test. Add tests for missing ",FMT" and ",".
2015-08-12 02:09:35 +02:00
#include "location.h"
Disassemble blocks with non-contiguous ranges This patch adds support for disassembly of blocks with non-contiguous ranges. These blocks are printed as follows: (gdb) disassemble foo Dump of assembler code for function foo: Address range 0x401136 to 0x401151: 0x0000000000401136 <+0>: push %rbp 0x0000000000401137 <+1>: mov %rsp,%rbp 0x000000000040113a <+4>: callq 0x401134 <bar> 0x000000000040113f <+9>: mov 0x2eef(%rip),%eax # 0x404034 <e> 0x0000000000401145 <+15>: test %eax,%eax 0x0000000000401147 <+17>: je 0x40114e <foo+24> 0x0000000000401149 <+19>: callq 0x401128 <foo+4294967282> 0x000000000040114e <+24>: nop 0x000000000040114f <+25>: pop %rbp 0x0000000000401150 <+26>: retq Address range 0x401128 to 0x401134: 0x0000000000401128 <+-14>: push %rbp 0x0000000000401129 <+-13>: mov %rsp,%rbp 0x000000000040112c <+-10>: callq 0x401126 <baz> 0x0000000000401131 <+-5>: nop 0x0000000000401132 <+-4>: pop %rbp 0x0000000000401133 <+-3>: retq End of assembler dump. This is an actual dump from the test case that I constructed for this work. The ranges are printed in the order encountered in the debug info. For the above example, note that the second range occupies lower addresses than the first range. Functions with contiguous ranges are still printed as follows: (gdb) disassemble main Dump of assembler code for function main: 0x0000000000401151 <+0>: push %rbp 0x0000000000401152 <+1>: mov %rsp,%rbp 0x0000000000401155 <+4>: callq 0x401136 <foo> 0x000000000040115a <+9>: mov $0x0,%eax 0x000000000040115f <+14>: pop %rbp 0x0000000000401160 <+15>: retq End of assembler dump. gdb/ChangeLog: * cli/cli-cmds.c (block.h): Include. (print_disassembly): Handle printing of non-contiguous blocks. (disassemble_current_function): Likewise. (disassemble_command): Likewise.
2018-08-24 01:00:49 +02:00
#include "block.h"
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
#include "ui-out.h"
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
#include "interps.h"
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
#include "top.h"
#include "cli/cli-decode.h"
#include "cli/cli-script.h"
#include "cli/cli-setshow.h"
#include "cli/cli-cmds.h"
#include "cli/cli-style.h"
* breakpoint.c (catch_syscall_split_args): Use skip_spaces. (trace_pass_command): Likewise. * cli/cli-cmds.c: Include cli/cli-utils.h. (source_command): Use skip-spaces. (disassemble_command): Likewise. * findcmd.c: Include cli/cli-utils.h. (parse_find_args): Use skip_spaces. * go32-nat.c: Include cli/cli-utils.h. (go32_sldt): Use skip_spaces. (go32_sgdt): Likewise. (go32_sidt): Likewise. (go32_pde): Likewise. (go32_pte): Likewise. (go32_pte_for_address): Likewise. * infcmd.c: Include cli/cli-utils.h. (registers_info): Use skip_spaces. * linux-tdep.c (read_mapping): Use skip_spaces_const. (linux_info_proc): Likewise. * linux-thread-db.c: Include cli/cli-utils.h. (info_auto_load_libthread_db): Use skip_spaces_const. * m32r-rom.c: Include cli/cli-utils.h. (m32r_upload_command): Use skip_spaces. * maint.c: Include cli/cli-utils.h. (maintenance_translate_address): Use skip_spaces. * mi/mi-parse.c: Include cli/cli-utils.h. (mi_parse_argv): Use skip_spaces. (mi_parse): Likewise. * minsyms.c: Include cli/cli-utils.h. (msymbol_hash_iw): Use skip_spaces_const. * objc-lang.c: Include cli/cli-utils.h. (parse_selector): Use skip_spaces. (parse_method): Likewise. * python/python.c: Include cli/cli-utils.h. (python_interactive_command)[HAVE_PYTHON]: Use skip_spaces. (python_command)[HAVE_PYTHON]: Likewise. (python_interactive_command)[!HAVE_PYTHON]: Likewise. * remote-m32r-sdi.c: Include cli/cli-utils.h. (m32r_load): Use skip_spaces. * serial.c: Include cli/cli-utils.h. (serial_open): Use skip_spaces_const. * stack.c: Include cli/cli-utils.h. (parse_frame_specification_1): Use skip_spaces_const. * symfile.c: Include cli/cli-utils.h. (set_ext_lang_command): Use skip_spaces. * symtab.c: Include cli/cli-utils.h. (rbreak_command): Use skip_spaces. * thread.c (thread_name_command): Use skip_spaces. * tracepoint.c (validate_actionline): Use skip_spaces. (encode_actions_1): Likewise. (trace_find_range_command): Likewise. (trace_find_outside_command): Likewise. (trace_dump_actions): Likewise.
2013-03-07 22:57:30 +01:00
#include "cli/cli-utils.h"
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
Extension Language API * configure.ac (libpython checking): Remove all but python.o from CONFIG_OBS. Remove all but python.c from CONFIG_SRCS. * configure: Regenerate. * Makefile.in (SFILES): Add extension.c. (HFILES_NO_SRCDIR): Add extension.h, extension-priv.h (COMMON_OBS): Add extension.o. * extension.h: New file. * extension-priv.h: New file. * extension.c: New file. * python/python-internal.h: #include "extension.h". (gdbpy_auto_load_enabled): Declare. (gdbpy_apply_val_pretty_printer): Declare. (gdbpy_apply_frame_filter): Declare. (gdbpy_preserve_values): Declare. (gdbpy_breakpoint_cond_says_stop): Declare. (gdbpy_breakpoint_has_cond): Declare. (void source_python_script_for_objfile): Delete. * python/python.c: #include "extension-priv.h". Delete inclusion of "observer.h". (extension_language_python): Moved here and renamed from script_language_python in py-auto-load.c. Redefined to be of type extension_language_defn. (python_extension_script_ops): New global. (python_extension_ops): New global. (struct python_env): New member previous_active. (restore_python_env): Call restore_active_ext_lang. (ensure_python_env): Call set_active_ext_lang. (gdbpy_clear_quit_flag): Renamed from clear_quit_flag, made static. New arg extlang. (gdbpy_set_quit_flag): Renamed from set_quit_flag, made static. New arg extlang. (gdbpy_check_quit_flag): Renamed from check_quit_flag, made static. New arg extlang. (gdbpy_eval_from_control_command): Renamed from eval_python_from_control_command, made static. New arg extlang. (gdbpy_source_script) Renamed from source_python_script, made static. New arg extlang. (gdbpy_before_prompt_hook): Renamed from before_prompt_hook. Change result to int. New arg extlang. (gdbpy_source_objfile_script): Renamed from source_python_script_for_objfile, made static. New arg extlang. (gdbpy_start_type_printers): Renamed from start_type_printers, made static. New args extlang, extlang_printers. Change result type to "void". (gdbpy_apply_type_printers): Renamed from apply_type_printers, made static. New arg extlang. Rename arg printers to extlang_printers and change type to ext_lang_type_printers *. (gdbpy_free_type_printers): Renamed from free_type_printers, made static. Replace argument arg with extlang, extlang_printers. (!HAVE_PYTHON, eval_python_from_control_command): Delete. (!HAVE_PYTHON, source_python_script): Delete. (!HAVE_PYTHON, gdbpy_should_stop): Delete. (!HAVE_PYTHON, gdbpy_breakpoint_has_py_cond): Delete. (!HAVE_PYTHON, start_type_printers): Delete. (!HAVE_PYTHON, apply_type_printers): Delete. (!HAVE_PYTHON, free_type_printers): Delete. (_initialize_python): Delete call to observer_attach_before_prompt. (finalize_python): Set/restore active extension language. (gdbpy_finish_initialization) Renamed from finish_python_initialization, made static. New arg extlang. (gdbpy_initialized): New function. * python/python.h: #include "extension.h". Delete #include "value.h", "mi/mi-cmds.h". (extension_language_python): Declare. (GDBPY_AUTO_FILE_NAME): Delete. (enum py_bt_status): Moved to extension.h and renamed to ext_lang_bt_status. (enum frame_filter_flags): Moved to extension.h. (enum py_frame_args): Moved to extension.h and renamed to ext_lang_frame_args. (finish_python_initialization): Delete. (eval_python_from_control_command): Delete. (source_python_script): Delete. (apply_val_pretty_printer): Delete. (apply_frame_filter): Delete. (preserve_python_values): Delete. (gdbpy_script_language_defn): Delete. (gdbpy_should_stop, gdbpy_breakpoint_has_py_cond): Delete. (start_type_printers, apply_type_printers, free_type_printers): Delete. * auto-load.c: #include "extension.h". (GDB_AUTO_FILE_NAME): Delete. (auto_load_gdb_scripts_enabled): Make public. New arg extlang. (script_language_gdb): Delete, moved to extension.c and renamed to extension_language_gdb. (source_gdb_script_for_objfile): Delete. (auto_load_pspace_info): New member unsupported_script_warning_printed. (loaded_script): Change type of language member to struct extension_language_defn *. (init_loaded_scripts_info): Initialize unsupported_script_warning_printed. (maybe_add_script): Make static. Change type of language arg to struct extension_language_defn *. (clear_section_scripts): Reset unsupported_script_warning_printed. (auto_load_objfile_script_1): Rewrite to use extension language API. (auto_load_objfile_script): Make public. Remove support-compiled-in and auto-load-enabled checks, moved to auto_load_scripts_for_objfile. (source_section_scripts): Rewrite to use extension language API. (load_auto_scripts_for_objfile): Rewrite to use auto_load_scripts_for_objfile. (collect_matching_scripts_data): Change type of language member to struct extension_language_defn *. (auto_load_info_scripts): Change type of language arg to struct extension_language_defn *. (unsupported_script_warning_print): New function. (script_not_found_warning_print): Make static. (_initialize_auto_load): Rewrite construction of scripts-directory help. * auto-load.h (struct objfile): Add forward decl. (struct script_language): Delete. (struct auto_load_pspace_info): Add forward decl. (struct extension_language_defn): Add forward decl. (maybe_add_script): Delete. (auto_load_objfile_script): Declare. (script_not_found_warning_print): Delete. (auto_load_info_scripts): Update prototype. (auto_load_gdb_scripts_enabled): Declare. * python/py-auto-load.c (gdbpy_auto_load_enabled): Renamed from auto_load_python_scripts_enabled and made public. (script_language_python): Delete, moved to python.c. (gdbpy_script_language_defn): Delete. (info_auto_load_python_scripts): Update to use extension_language_python. * breakpoint.c (condition_command): Replace call to gdbpy_breakpoint_has_py_cond with call to get_breakpoint_cond_ext_lang. (bpstat_check_breakpoint_conditions): Replace call to gdbpy_should_stop with call to breakpoint_ext_lang_cond_says_stop. * python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Renamed from gdbpy_should_stop. Change result type to enum scr_bp_stop. New arg slang. Return SCR_BP_STOP_UNSET if py_bp_object is NULL. (gdbpy_breakpoint_has_cond): Renamed from gdbpy_breakpoint_has_py_cond. New arg slang. (local_setattro): Print name of extension language with existing stop condition. * valprint.c (val_print, value_print): Update to call apply_ext_lang_val_pretty_printer. * cp-valprint.c (cp_print_value): Update call to apply_ext_lang_val_pretty_printer. * python/py-prettyprint.c: Remove #ifdef HAVE_PYTHON. (gdbpy_apply_val_pretty_printer): Renamed from apply_val_pretty_printer. New arg extlang. (!HAVE_PYTHON, apply_val_pretty_printer): Delete. * cli/cli-cmds.c (source_script_from_stream): Rewrite to use extension language API. * cli/cli-script.c (execute_control_command): Update to call eval_ext_lang_from_control_command. * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Update to use enum ext_lang_bt_status values. Update call to apply_ext_lang_frame_filter. (mi_cmd_stack_list_locals): Ditto. (mi_cmd_stack_list_args): Ditto. (mi_cmd_stack_list_variables): Ditto. * mi/mi-main.c: Delete #include "python/python-internal.h". Add #include "extension.h". (mi_cmd_list_features): Replace reference to python internal variable gdb_python_initialized with call to ext_lang_initialized_p. * stack.c (backtrace_command_1): Update to use enum ext_lang_bt_status. Update to use enum ext_lang_frame_args. Update to call apply_ext_lang_frame_filter. * python/py-framefilter.c (extract_sym): Update to use enum ext_lang_bt_status. (extract_value, py_print_type, py_print_value): Ditto. (py_print_single_arg, enumerate_args, enumerate_locals): Ditto. (py_mi_print_variables, py_print_locals, py_print_args): Ditto. (py_print_frame): Ditto. (gdbpy_apply_frame_filter): Renamed from apply_frame_filter. New arg extlang. Update to use enum ext_lang_bt_status. * top.c (gdb_init): Delete #ifdef HAVE_PYTHON call to finish_python_initialization. Replace with call to finish_ext_lang_initialization. * typeprint.c (do_free_global_table): Update to call free_ext_lang_type_printers. (create_global_typedef_table): Update to call start_ext_lang_type_printers. (find_global_typedef): Update to call apply_ext_lang_type_printers. * typeprint.h (struct ext_lang_type_printers): Add forward decl. (type_print_options): Change type of global_printers from "void *" to "struct ext_lang_type_printers *". * value.c (preserve_values): Update to call preserve_ext_lang_values. * python/py-value.c: Remove #ifdef HAVE_PYTHON. (gdbpy_preserve_values): Renamed from preserve_python_values. New arg extlang. (!HAVE_PYTHON, preserve_python_values): Delete. * utils.c (quit_flag): Delete, moved to extension.c. (clear_quit_flag, set_quit_flag, check_quit_flag): Delete, moved to extension.c. * eval.c: Delete #include "python/python.h". * main.c: Delete #include "python/python.h". * defs.h: Update comment. testsuite/ * gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected output. * gdb.gdb/python-interrupts.exp: New file.
2014-02-06 04:27:58 +01:00
#include "extension.h"
Rename common to gdbsupport This is the next patch in the ongoing series to move gdbsever to the top level. This patch just renames the "common" directory. The idea is to do this move in two parts: first rename the directory (this patch), then move the directory to the top. This approach makes the patches a bit more tractable. I chose the name "gdbsupport" for the directory. However, as this patch was largely written by sed, we could pick a new name without too much difficulty. Tested by the buildbot. gdb/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * contrib/ari/gdb_ari.sh: Change common to gdbsupport. * configure: Rebuild. * configure.ac: Change common to gdbsupport. * gdbsupport: Rename from common. * acinclude.m4: Change common to gdbsupport. * Makefile.in (CONFIG_SRC_SUBDIR, COMMON_SFILES) (HFILES_NO_SRCDIR, stamp-version, ALLDEPFILES): Change common to gdbsupport. * aarch64-tdep.c, ada-lang.c, ada-lang.h, agent.c, alloc.c, amd64-darwin-tdep.c, amd64-dicos-tdep.c, amd64-fbsd-nat.c, amd64-fbsd-tdep.c, amd64-linux-nat.c, amd64-linux-tdep.c, amd64-nbsd-tdep.c, amd64-obsd-tdep.c, amd64-sol2-tdep.c, amd64-tdep.c, amd64-windows-tdep.c, arch-utils.c, arch/aarch64-insn.c, arch/aarch64.c, arch/aarch64.h, arch/amd64.c, arch/amd64.h, arch/arm-get-next-pcs.c, arch/arm-linux.c, arch/arm.c, arch/i386.c, arch/i386.h, arch/ppc-linux-common.c, arch/riscv.c, arch/riscv.h, arch/tic6x.c, arm-tdep.c, auto-load.c, auxv.c, ax-gdb.c, ax-general.c, ax.h, breakpoint.c, breakpoint.h, btrace.c, btrace.h, build-id.c, build-id.h, c-lang.h, charset.c, charset.h, cli/cli-cmds.c, cli/cli-cmds.h, cli/cli-decode.c, cli/cli-dump.c, cli/cli-option.h, cli/cli-script.c, coff-pe-read.c, command.h, compile/compile-c-support.c, compile/compile-c.h, compile/compile-cplus-symbols.c, compile/compile-cplus-types.c, compile/compile-cplus.h, compile/compile-loc2c.c, compile/compile.c, completer.c, completer.h, contrib/ari/gdb_ari.sh, corefile.c, corelow.c, cp-support.c, cp-support.h, cp-valprint.c, csky-tdep.c, ctf.c, darwin-nat.c, debug.c, defs.h, disasm-selftests.c, disasm.c, disasm.h, dtrace-probe.c, dwarf-index-cache.c, dwarf-index-cache.h, dwarf-index-write.c, dwarf2-frame.c, dwarf2expr.c, dwarf2loc.c, dwarf2read.c, event-loop.c, event-top.c, exceptions.c, exec.c, extension.h, fbsd-nat.c, features/aarch64-core.c, features/aarch64-fpu.c, features/aarch64-pauth.c, features/aarch64-sve.c, features/i386/32bit-avx.c, features/i386/32bit-avx512.c, features/i386/32bit-core.c, features/i386/32bit-linux.c, features/i386/32bit-mpx.c, features/i386/32bit-pkeys.c, features/i386/32bit-segments.c, features/i386/32bit-sse.c, features/i386/64bit-avx.c, features/i386/64bit-avx512.c, features/i386/64bit-core.c, features/i386/64bit-linux.c, features/i386/64bit-mpx.c, features/i386/64bit-pkeys.c, features/i386/64bit-segments.c, features/i386/64bit-sse.c, features/i386/x32-core.c, features/riscv/32bit-cpu.c, features/riscv/32bit-csr.c, features/riscv/32bit-fpu.c, features/riscv/64bit-cpu.c, features/riscv/64bit-csr.c, features/riscv/64bit-fpu.c, features/tic6x-c6xp.c, features/tic6x-core.c, features/tic6x-gp.c, filename-seen-cache.h, findcmd.c, findvar.c, fork-child.c, gcore.c, gdb_bfd.c, gdb_bfd.h, gdb_proc_service.h, gdb_regex.c, gdb_select.h, gdb_usleep.c, gdbarch-selftests.c, gdbthread.h, gdbtypes.h, gnu-nat.c, go32-nat.c, guile/guile.c, guile/scm-ports.c, guile/scm-safe-call.c, guile/scm-type.c, i386-fbsd-nat.c, i386-fbsd-tdep.c, i386-go32-tdep.c, i386-linux-nat.c, i386-linux-tdep.c, i386-tdep.c, i387-tdep.c, ia64-libunwind-tdep.c, ia64-linux-nat.c, inf-child.c, inf-ptrace.c, infcall.c, infcall.h, infcmd.c, inferior-iter.h, inferior.c, inferior.h, inflow.c, inflow.h, infrun.c, infrun.h, inline-frame.c, language.h, linespec.c, linux-fork.c, linux-nat.c, linux-tdep.c, linux-thread-db.c, location.c, machoread.c, macrotab.h, main.c, maint.c, maint.h, memattr.c, memrange.h, mi/mi-cmd-break.h, mi/mi-cmd-env.c, mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-interp.c, mi/mi-main.c, mi/mi-parse.h, minsyms.c, mips-linux-tdep.c, namespace.h, nat/aarch64-linux-hw-point.c, nat/aarch64-linux-hw-point.h, nat/aarch64-linux.c, nat/aarch64-sve-linux-ptrace.c, nat/amd64-linux-siginfo.c, nat/fork-inferior.c, nat/linux-btrace.c, nat/linux-btrace.h, nat/linux-namespaces.c, nat/linux-nat.h, nat/linux-osdata.c, nat/linux-personality.c, nat/linux-procfs.c, nat/linux-ptrace.c, nat/linux-ptrace.h, nat/linux-waitpid.c, nat/mips-linux-watch.c, nat/mips-linux-watch.h, nat/ppc-linux.c, nat/x86-dregs.c, nat/x86-dregs.h, nat/x86-linux-dregs.c, nat/x86-linux.c, nto-procfs.c, nto-tdep.c, objfile-flags.h, objfiles.c, objfiles.h, obsd-nat.c, observable.h, osdata.c, p-valprint.c, parse.c, parser-defs.h, ppc-linux-nat.c, printcmd.c, probe.c, proc-api.c, procfs.c, producer.c, progspace.h, psymtab.h, python/py-framefilter.c, python/py-inferior.c, python/py-ref.h, python/py-type.c, python/python.c, record-btrace.c, record-full.c, record.c, record.h, regcache-dump.c, regcache.c, regcache.h, remote-fileio.c, remote-fileio.h, remote-sim.c, remote.c, riscv-tdep.c, rs6000-aix-tdep.c, rust-exp.y, s12z-tdep.c, selftest-arch.c, ser-base.c, ser-event.c, ser-pipe.c, ser-tcp.c, ser-unix.c, skip.c, solib-aix.c, solib-target.c, solib.c, source-cache.c, source.c, source.h, sparc-nat.c, spu-linux-nat.c, stack.c, stap-probe.c, symfile-add-flags.h, symfile.c, symfile.h, symtab.c, symtab.h, target-descriptions.c, target-descriptions.h, target-memory.c, target.c, target.h, target/waitstatus.c, target/waitstatus.h, thread-iter.h, thread.c, tilegx-tdep.c, top.c, top.h, tracefile-tfile.c, tracefile.c, tracepoint.c, tracepoint.h, tui/tui-io.c, ui-file.c, ui-out.h, unittests/array-view-selftests.c, unittests/child-path-selftests.c, unittests/cli-utils-selftests.c, unittests/common-utils-selftests.c, unittests/copy_bitwise-selftests.c, unittests/environ-selftests.c, unittests/format_pieces-selftests.c, unittests/function-view-selftests.c, unittests/lookup_name_info-selftests.c, unittests/memory-map-selftests.c, unittests/memrange-selftests.c, unittests/mkdir-recursive-selftests.c, unittests/observable-selftests.c, unittests/offset-type-selftests.c, unittests/optional-selftests.c, unittests/parse-connection-spec-selftests.c, unittests/ptid-selftests.c, unittests/rsp-low-selftests.c, unittests/scoped_fd-selftests.c, unittests/scoped_mmap-selftests.c, unittests/scoped_restore-selftests.c, unittests/string_view-selftests.c, unittests/style-selftests.c, unittests/tracepoint-selftests.c, unittests/unpack-selftests.c, unittests/utils-selftests.c, unittests/xml-utils-selftests.c, utils.c, utils.h, valarith.c, valops.c, valprint.c, value.c, value.h, varobj.c, varobj.h, windows-nat.c, x86-linux-nat.c, xml-support.c, xml-support.h, xml-tdesc.h, xstormy16-tdep.c, xtensa-linux-nat.c, dwarf2read.h: Change common to gdbsupport. gdb/gdbserver/ChangeLog 2019-07-09 Tom Tromey <tom@tromey.com> * configure: Rebuild. * configure.ac: Change common to gdbsupport. * acinclude.m4: Change common to gdbsupport. * Makefile.in (SFILES, OBS, GDBREPLAY_OBS, IPA_OBJS) (version-generated.c, gdbsupport/%-ipa.o, gdbsupport/%.o): Change common to gdbsupport. * ax.c, event-loop.c, fork-child.c, gdb_proc_service.h, gdbreplay.c, gdbthread.h, hostio-errno.c, hostio.c, i387-fp.c, inferiors.c, inferiors.h, linux-aarch64-tdesc-selftest.c, linux-amd64-ipa.c, linux-i386-ipa.c, linux-low.c, linux-tic6x-low.c, linux-x86-low.c, linux-x86-tdesc-selftest.c, linux-x86-tdesc.c, lynx-i386-low.c, lynx-low.c, mem-break.h, nto-x86-low.c, regcache.c, regcache.h, remote-utils.c, server.c, server.h, spu-low.c, symbol.c, target.h, tdesc.c, tdesc.h, thread-db.c, tracepoint.c, win32-i386-low.c, win32-low.c: Change common to gdbsupport.
2019-05-06 04:29:24 +02:00
#include "gdbsupport/pathstuff.h"
#ifdef TUI
#include "tui/tui.h" /* For tui_active et.al. */
#endif
#include <fcntl.h>
gdb: Use std::min and std::max throughout Otherwise including <string> or some other C++ header is broken. E.g.: In file included from /opt/gcc/include/c++/7.0.0/bits/char_traits.h:39:0, from /opt/gcc/include/c++/7.0.0/string:40, from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/infrun.c:68: /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2 min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2 max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ In file included from .../src/gdb/infrun.c:21:0: To the best of my grepping abilities, I believe I adjusted all min/max calls. gdb/ChangeLog: 2016-09-16 Pedro Alves <palves@redhat.com> * defs.h (min, max): Delete. * aarch64-tdep.c: Include <algorithm> and use std::min and std::max throughout. * aarch64-tdep.c: Likewise. * alpha-tdep.c: Likewise. * amd64-tdep.c: Likewise. * amd64-windows-tdep.c: Likewise. * arm-tdep.c: Likewise. * avr-tdep.c: Likewise. * breakpoint.c: Likewise. * btrace.c: Likewise. * ctf.c: Likewise. * disasm.c: Likewise. * doublest.c: Likewise. * dwarf2loc.c: Likewise. * dwarf2read.c: Likewise. * environ.c: Likewise. * exec.c: Likewise. * f-exp.y: Likewise. * findcmd.c: Likewise. * ft32-tdep.c: Likewise. * gcore.c: Likewise. * hppa-tdep.c: Likewise. * i386-darwin-tdep.c: Likewise. * i386-tdep.c: Likewise. * linux-thread-db.c: Likewise. * lm32-tdep.c: Likewise. * m32r-tdep.c: Likewise. * m88k-tdep.c: Likewise. * memrange.c: Likewise. * minidebug.c: Likewise. * mips-tdep.c: Likewise. * moxie-tdep.c: Likewise. * nds32-tdep.c: Likewise. * nios2-tdep.c: Likewise. * nto-procfs.c: Likewise. * parse.c: Likewise. * ppc-sysv-tdep.c: Likewise. * probe.c: Likewise. * record-btrace.c: Likewise. * remote.c: Likewise. * rs6000-tdep.c: Likewise. * rx-tdep.c: Likewise. * s390-linux-nat.c: Likewise. * s390-linux-tdep.c: Likewise. * ser-tcp.c: Likewise. * sh-tdep.c: Likewise. * sh64-tdep.c: Likewise. * source.c: Likewise. * sparc-tdep.c: Likewise. * symfile.c: Likewise. * target-memory.c: Likewise. * target.c: Likewise. * tic6x-tdep.c: Likewise. * tilegx-tdep.c: Likewise. * tracefile-tfile.c: Likewise. * tracepoint.c: Likewise. * valprint.c: Likewise. * value.c: Likewise. * xtensa-tdep.c: Likewise. * cli/cli-cmds.c: Likewise. * compile/compile-object-load.c: Likewise.
2016-09-16 20:55:17 +02:00
#include <algorithm>
#include <string>
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
/* Prototypes for local utility functions */
Make "list ambiguous" show symbol names too Currently, with an ambiguous "list first,last", we get: (gdb) list bar,main Specified first line 'bar' is ambiguous: file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97 file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98 This commit makes gdb's output above a bit clearer by printing the symbol name as well: (gdb) list bar,main Specified first line 'bar' is ambiguous: file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)" file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)" And while at it, makes gdb print the symbol name when actually listing multiple locations too. I.e., before (with "set listsize 2"): (gdb) list bar file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97 96 97 int bar (A) { return 11; } file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98 97 int bar (A) { return 11; } 98 int bar (B) { return 22; } After: (gdb) list bar file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)" 96 97 int bar (A) { return 11; } file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)" 97 int bar (A) { return 11; } 98 int bar (B) { return 22; } Currently, the result of decoding a linespec loses information about the original symbol that was found. All we end up with is an address. This makes it difficult to find the original symbol again to get at its print name. Fix that by storing a pointer to the symbol in the sal. We already store the symtab and obj_section, so it feels like a natural progression to me. This avoids having to do any extra symbol lookup too. gdb/ChangeLog: 2017-09-20 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (list_command): Use print_sal_location. (print_sal_location): New function. (ambiguous_line_spec): Use print_sal_location. * linespec.c (symbol_to_sal): Record the symbol in the sal. * symtab.c (find_function_start_sal): Likewise. * symtab.h (symtab_and_line::symbol): New field. gdb/testsuite/ChangeLog: 2017-09-20 Pedro Alves <palves@redhat.com> * gdb.base/list-ambiguous.exp (test_list_ambiguous_symbol): Expect symbol names in gdb's output. * gdb.cp/overload.exp ("list all overloads"): Likewise.
2017-09-20 17:12:54 +02:00
static void print_sal_location (const symtab_and_line &sal);
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
static void ambiguous_line_spec (gdb::array_view<const symtab_and_line> sals,
Clarify "list" output when specified lines are ambiguous Currently, with "list LINESPEC1,LINESPEC2", if one of the linespecs is ambiguous, i.e., if it expands to multiple locations, you get this seemingly odd output: (gdb) list foo,bar file: "file0.c", line number: 26 file: "file1.c", line number: 29 Since "foo" above expands to multiple locations, the specified range is indeterminate, and GDB is trying to be helpful by showing you what was ambiguous. It looks confusing to me, though. I think it'd be much more user friendly if GDB actually told you that, like this: (gdb) list foo,bar Specified first line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 (gdb) list bar,foo Specified last line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 Note, I'm using "first" and "last" in the output because that's what the manual uses: ~~~ list first,last Print lines from first to last. [...] ~~~ Tested on x86-64 GNU/Linux. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (edit_command): Pass message to ambiguous_line_spec. (list_command): Pass message to ambiguous_line_spec. Say "first"/"last" instead of "start" and "end" to be consistent with the manual. (ambiguous_line_spec): Add 'format' and vararg parameters. Use them to print formatted message. gdb/testsuite/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * gdb.base/list-ambiguous.exp: New file. * gdb.base/list-ambiguous0.c: New file. * gdb.base/list-ambiguous1.c: New file. * gdb.base/list.exp (test_list_range): Adjust expected output.
2017-09-04 17:49:29 +02:00
const char *format, ...)
ATTRIBUTE_PRINTF (2, 3);
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
static void filter_sals (std::vector<symtab_and_line> &);
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
/* See cli-cmds.h. */
unsigned int max_user_call_depth;
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
/* Define all cmd_list_elements. */
/* Chain containing all defined commands. */
struct cmd_list_element *cmdlist;
/* Chain containing all defined info subcommands. */
struct cmd_list_element *infolist;
/* Chain containing all defined enable subcommands. */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
struct cmd_list_element *enablelist;
/* Chain containing all defined disable subcommands. */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
struct cmd_list_element *disablelist;
/* Chain containing all defined stop subcommands. */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
struct cmd_list_element *stoplist;
/* Chain containing all defined delete subcommands. */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
struct cmd_list_element *deletelist;
/* Chain containing all defined detach subcommands. */
struct cmd_list_element *detachlist;
/* Chain containing all defined kill subcommands. */
gdb/ 2009-07-02 Pedro Alves <pedro@codesourcery.com> * linux-nat.c (linux_child_follow_fork): If we're staying attached to the child process, enable event reporting on it. Don't handle checkpoints here. Instead, add the child fork to the lwp thread and inferior lists without clobbering the previous inferior. Let the thread_db layer learn about a new child process, even if following the parent. (linux_nat_switch_fork): Delete lwps of the current inferior only, instead of clearing the whole list. Use thread_change_ptid to give the core the illusion the new checkpoint is still the same inferior. Clear the register cache. (linux_handle_extended_wait): Handle checkpoints here. (linux_multi_process): Turn on. * linux-fork.c (struct fork_info) <pc>: Remove field. (init_fork_list): Do not delete the checkpoint from the inferior list (it is not there). (fork_load_infrun_state): Don't switch inferior_ptid here. Pass the new checkpoint's ptid to linux_nat_switch_fork. (fork_save_infrun_state): Make static. Don't stop the pc field of fork_info, it's gone. (linux_fork_mourn_inferior): Don't delete the checkpoint from the inferior list, it's not there. (linux_fork_detach): Ditto. (delete_fork_command): Replace mention of fork/checkpoint by checkpoint only. (detach_fork_command): Likewise. Don't delete the checkpoint from the inferior list. (info_forks_command): Adjust. (restore_detach_fork): Delete. (checkpointing_pid): New. (linux_fork_checkpointing_p): New. (save_detach_fork): Delete. (checkpoint_command): Delete temp_detach_fork. Don't remove breakpoints, that's a nop. Store the pid of the process we're checkpointing, and use make_cleanup_restore_integer to restore it. Don't reinsert breakpoints here. (process_command, fork_command): Delete. (restart_command): Update comments to only mention checkpoints, not forks. (_initialize_linux_fork): Delete "fork", "process", "info forks" commands. * linux-fork.h (fork_save_infrun_state, fork_list): Delete declarations. (linux_fork_checkpointing_p): Declare. * cli/cli-cmds.c (killlist): New. * cli/cli-cmds.h (killlist): Declare. * gdbcmd.h (killlist): Declare. * inferior.c: Include "gdbthread.h". (detach_inferior_command, kill_inferior_command) (inferior_command): New. (info_inferiors_command): Allow specifying a specific inferior id. (_initialize_inferiors): Register "inferior", "kill inferior" and "detach inferior" commands. * infcmd.c (_initialize_infcmd): Make "kill" a prefix command. * gdbthread.h (any_thread_of_process): Declare. * thread.c (any_thread_of_process): New. * NEWS: Mention multi-inferior debugging. Mention 'info inferiors', 'inferior', 'detach inferior' and 'kill inferior' as new commands. (Removed commands): New section, mentioning that 'info forks', 'fork', 'process', 'delete fork' and 'detach fork' are now gone. gdb/testsuite/ 2009-07-02 Pedro Alves <pedro@codesourcery.com> * gdb.base/multi-forks.exp: Only run detach-on-fork tests on linux. Adjust to use "inferior", "info inferiors", "detach inferior" and "kill inferior" instead of "restart", "info fork", "detach fork" and "delete fork". * gdb.base/ending-run.exp: Spell out "info". * gdb.base/help.exp: Adjust to use test_prefix_command_help for the "kill" command. gdb/doc/ 2009-07-02 Pedro Alves <pedro@codesourcery.com> * gdb.texinfo (Debugging multiple inferiors): Document the "inferior", "detach inferior" and "kill inferior" commands. (Debugging Programs with Multiple Processes): Adjust to mention generic "inferior" commands. Delete mention of "detach fork" and "delete fork". Cross reference to "Debugging multiple inferiors" section.
2009-07-02 23:57:28 +02:00
struct cmd_list_element *killlist;
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
/* Chain containing all defined set subcommands */
struct cmd_list_element *setlist;
/* Chain containing all defined unset subcommands */
struct cmd_list_element *unsetlist;
/* Chain containing all defined show subcommands. */
struct cmd_list_element *showlist;
/* Chain containing all defined \"set history\". */
struct cmd_list_element *sethistlist;
/* Chain containing all defined \"show history\". */
struct cmd_list_element *showhistlist;
/* Chain containing all defined \"unset history\". */
struct cmd_list_element *unsethistlist;
/* Chain containing all defined maintenance subcommands. */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
struct cmd_list_element *maintenancelist;
/* Chain containing all defined "maintenance info" subcommands. */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
struct cmd_list_element *maintenanceinfolist;
/* Chain containing all defined "maintenance print" subcommands. */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
struct cmd_list_element *maintenanceprintlist;
2017-07-26 15:55:31 +02:00
/* Chain containing all defined "maintenance check" subcommands. */
struct cmd_list_element *maintenancechecklist;
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
struct cmd_list_element *setprintlist;
struct cmd_list_element *showprintlist;
struct cmd_list_element *setdebuglist;
struct cmd_list_element *showdebuglist;
struct cmd_list_element *setchecklist;
struct cmd_list_element *showchecklist;
2006-07-21 16:46:56 +02:00
/* Command tracing state. */
int source_verbose = 0;
Change boolean options to bool instead of int This is for add_setshow_boolean_cmd as well as the gdb::option interface. gdb/ChangeLog: 2019-09-17 Christian Biesinger <cbiesinger@google.com> * ada-lang.c (ada_ignore_descriptive_types_p): Change to bool. (print_signatures): Likewise. (trust_pad_over_xvs): Likewise. * arch/aarch64-insn.c (aarch64_debug): Likewise. * arch/aarch64-insn.h (aarch64_debug): Likewise. * arm-linux-nat.c (arm_apcs_32): Likewise. * arm-linux-tdep.c (arm_apcs_32): Likewise. * arm-nbsd-nat.c (arm_apcs_32): Likewise. * arm-tdep.c (arm_debug): Likewise. (arm_apcs_32): Likewise. * auto-load.c (debug_auto_load): Likewise. (auto_load_gdb_scripts): Likewise. (global_auto_load): Likewise. (auto_load_local_gdbinit): Likewise. (auto_load_local_gdbinit_loaded): Likewise. * auto-load.h (global_auto_load): Likewise. (auto_load_local_gdbinit): Likewise. (auto_load_local_gdbinit_loaded): Likewise. * breakpoint.c (disconnected_dprintf): Likewise. (breakpoint_proceeded): Likewise. (automatic_hardware_breakpoints): Likewise. (always_inserted_mode): Likewise. (target_exact_watchpoints): Likewise. (_initialize_breakpoint): Update. * breakpoint.h (target_exact_watchpoints): Change to bool. * btrace.c (maint_btrace_pt_skip_pad): Likewise. * cli/cli-cmds.c (trace_commands): Likewise. * cli/cli-cmds.h (trace_commands): Likewise. * cli/cli-decode.c (add_setshow_boolean_cmd): Change int* argument to bool*. * cli/cli-logging.c (logging_overwrite): Change to bool. (logging_redirect): Likewise. (debug_redirect): Likewise. * cli/cli-option.h (option_def) <boolean>: Change return type to bool*. (struct boolean_option_def) <get_var_address_cb_>: Change return type to bool. <boolean_option_def>: Update. (struct flag_option_def): Change default type of Context to bool from int. <flag_option_def>: Change return type of var_address_cb_ to bool*. * cli/cli-setshow.c (do_set_command): Cast to bool* instead of int*. (get_setshow_command_value_string): Likewise. * cli/cli-style.c (cli_styling): Change to bool. (source_styling): Likewise. * cli/cli-style.h (source_styling): Likewise. (cli_styling): Likewise. * cli/cli-utils.h (struct qcs_flags) <quiet, cont, silent>: Change to bool. * command.h (var_types): Update comment. (add_setshow_boolean_cmd): Change int* var argument to bool*. * compile/compile-cplus-types.c (debug_compile_cplus_types): Change to bool. (debug_compile_cplus_scopes): Likewise. * compile/compile-internal.h (compile_debug): Likewise. * compile/compile.c (compile_debug): Likewise. (struct compile_options) <raw>: Likewise. * cp-support.c (catch_demangler_crashes): Likewise. * cris-tdep.c (usr_cmd_cris_version_valid): Likewise. (usr_cmd_cris_dwarf2_cfi): Likewise. * csky-tdep.c (csky_debug): Likewise. * darwin-nat.c (enable_mach_exceptions): Likewise. * dcache.c (dcache_enabled_p): Likewise. * defs.h (info_verbose): Likewise. * demangle.c (demangle): Likewise. (asm_demangle): Likewise. * dwarf-index-cache.c (debug_index_cache): Likewise. * dwarf2-frame.c (dwarf2_frame_unwinders_enabled_p): Likewise. * dwarf2-frame.h (dwarf2_frame_unwinders_enabled_p): Likewise. * dwarf2read.c (check_physname): Likewise. (use_deprecated_index_sections): Likewise. (dwarf_always_disassemble): Likewise. * eval.c (overload_resolution): Likewise. * event-top.c (set_editing_cmd_var): Likewise. (exec_done_display_p): Likewise. * event-top.h (set_editing_cmd_var): Likewise. (exec_done_display_p): Likewise. * exec.c (write_files): Likewise. * fbsd-nat.c (debug_fbsd_lwp): Likewise (debug_fbsd_nat): Likewise. * frame.h (struct frame_print_options) <print_raw_frame_arguments>: Likewise. (struct set_backtrace_options) <backtrace_past_main>: Likewise. <backtrace_past_entry> Likewise. * gdb-demangle.h (demangle): Likewise. (asm_demangle): Likewise. * gdb_bfd.c (bfd_sharing): Likewise. * gdbcore.h (write_files): Likewise. * gdbsupport/common-debug.c (show_debug_regs): Likewise. * gdbsupport/common-debug.h (show_debug_regs): Likewise. * gdbthread.h (print_thread_events): Likewise. * gdbtypes.c (opaque_type_resolution): Likewise. (strict_type_checking): Likewise. * gnu-nat.c (gnu_debug_flag): Likewise. * guile/scm-auto-load.c (auto_load_guile_scripts): Likewise. * guile/scm-param.c (pascm_variable): Add boolval. (add_setshow_generic): Update. (pascm_param_value): Update. (pascm_set_param_value_x): Update. * hppa-tdep.c (hppa_debug): Change to bool.. * infcall.c (may_call_functions_p): Likewise. (coerce_float_to_double_p): Likewise. (unwind_on_signal_p): Likewise. (unwind_on_terminating_exception_p): Likewise. * infcmd.c (startup_with_shell): Likewise. * inferior.c (print_inferior_events): Likewise. * inferior.h (startup_with_shell): Likewise. (print_inferior_events): Likewise. * infrun.c (step_stop_if_no_debug): Likewise. (detach_fork): Likewise. (debug_displaced): Likewise. (disable_randomization): Likewise. (non_stop): Likewise. (non_stop_1): Likewise. (observer_mode): Likewise. (observer_mode_1): Likewise. (set_observer_mode): Update. (sched_multi): Change to bool. * infrun.h (debug_displaced): Likewise. (sched_multi): Likewise. (step_stop_if_no_debug): Likewise. (non_stop): Likewise. (disable_randomization): Likewise. * linux-tdep.c (use_coredump_filter): Likewise. (dump_excluded_mappings): Likewise. * linux-thread-db.c (auto_load_thread_db): Likewise. (check_thread_db_on_load): Likewise. * main.c (captured_main_1): Update. * maint-test-options.c (struct test_options_opts) <flag_opt, xx1_opt, xx2_opt, boolean_opt>: Change to bool. * maint-test-settings.c (maintenance_test_settings_boolean): Likewise. * maint.c (maintenance_profile_p): Likewise. (per_command_time): Likewise. (per_command_space): Likewise. (per_command_symtab): Likewise. * memattr.c (inaccessible_by_default): Likewise. * mi/mi-main.c (mi_async): Likewise. (mi_async_1): Likewise. * mips-tdep.c (mips64_transfers_32bit_regs_p): Likewise. * nat/fork-inferior.h (startup_with_shell): Likewise. * nat/linux-namespaces.c (debug_linux_namespaces): Likewise. * nat/linux-namespaces.h (debug_linux_namespaces): Likewise. * nios2-tdep.c (nios2_debug): Likewise. * or1k-tdep.c (or1k_debug): Likewise. * parse.c (parser_debug): Likewise. * parser-defs.h (parser_debug): Likewise. * printcmd.c (print_symbol_filename): Likewise. * proc-api.c (procfs_trace): Likewise. * python/py-auto-load.c (auto_load_python_scripts): Likewise. * python/py-param.c (union parmpy_variable): Add "bool boolval" field. (set_parameter_value): Update. (add_setshow_generic): Update. * python/py-value.c (copy_py_bool_obj): Change argument from int* to bool*. * python/python.c (gdbpy_parameter_value): Cast to bool* instead of int*. * ravenscar-thread.c (ravenscar_task_support): Change to bool. * record-btrace.c (record_btrace_target::store_registers): Update. * record-full.c (record_full_memory_query): Change to bool. (record_full_stop_at_limit): Likewise. * record-full.h (record_full_memory_query): Likewise. * remote-notif.c (notif_debug): Likewise. * remote-notif.h (notif_debug): Likewise. * remote.c (use_range_stepping): Likewise. (interrupt_on_connect): Likewise. (remote_break): Likewise. * ser-tcp.c (tcp_auto_retry): Likewise. * ser-unix.c (serial_hwflow): Likewise. * skip.c (debug_skip): Likewise. * solib-aix.c (solib_aix_debug): Likewise. * spu-tdep.c (spu_stop_on_load_p): Likewise. (spu_auto_flush_cache_p): Likewise. * stack.c (struct backtrace_cmd_options) <full, no_filters, hide>: Likewise. (struct info_print_options) <quiet>: Likewise. * symfile-debug.c (debug_symfile): Likewise. * symfile.c (auto_solib_add): Likewise. (separate_debug_file_debug): Likewise. * symfile.h (auto_solib_add): Likewise. (separate_debug_file_debug): Likewise. * symtab.c (basenames_may_differ): Likewise. (struct filename_partial_match_opts) <dirname, basename>: Likewise. (struct info_print_options) <quiet, exclude_minsyms>: Likewise. (struct info_types_options) <quiet>: Likewise. * symtab.h (demangle): Likewise. (basenames_may_differ): Likewise. * target-dcache.c (stack_cache_enabled_1): Likewise. (code_cache_enabled_1): Likewise. * target.c (trust_readonly): Likewise. (may_write_registers): Likewise. (may_write_memory): Likewise. (may_insert_breakpoints): Likewise. (may_insert_tracepoints): Likewise. (may_insert_fast_tracepoints): Likewise. (may_stop): Likewise. (auto_connect_native_target): Likewise. (target_stop_and_wait): Update. (target_async_permitted): Change to bool. (target_async_permitted_1): Likewise. (may_write_registers_1): Likewise. (may_write_memory_1): Likewise. (may_insert_breakpoints_1): Likewise. (may_insert_tracepoints_1): Likewise. (may_insert_fast_tracepoints_1): Likewise. (may_stop_1): Likewise. * target.h (target_async_permitted): Likewise. (may_write_registers): Likewise. (may_write_memory): Likewise. (may_insert_breakpoints): Likewise. (may_insert_tracepoints): Likewise. (may_insert_fast_tracepoints): Likewise. (may_stop): Likewise. * thread.c (struct info_threads_opts) <show_global_ids>: Likewise. (make_thread_apply_all_options_def_group): Change argument from int* to bool*. (thread_apply_all_command): Update. (print_thread_events): Change to bool. * top.c (confirm): Likewise. (command_editing_p): Likewise. (history_expansion_p): Likewise. (write_history_p): Likewise. (info_verbose): Likewise. * top.h (confirm): Likewise. (history_expansion_p): Likewise. * tracepoint.c (disconnected_tracing): Likewise. (circular_trace_buffer): Likewise. * typeprint.c (print_methods): Likewise. (print_typedefs): Likewise. * utils.c (debug_timestamp): Likewise. (sevenbit_strings): Likewise. (pagination_enabled): Likewise. * utils.h (sevenbit_strings): Likewise. (pagination_enabled): Likewise. * valops.c (overload_resolution): Likewise. * valprint.h (struct value_print_options) <prettyformat_arrays, prettyformat_structs, vtblprint, unionprint, addressprint, objectprint, stop_print_at_null, print_array_indexes, deref_ref, static_field_print, pascal_static_field_print, raw, summary, symbol_print, finish_print>: Likewise. * windows-nat.c (new_console): Likewise. (cygwin_exceptions): Likewise. (new_group): Likewise. (debug_exec): Likewise. (debug_events): Likewise. (debug_memory): Likewise. (debug_exceptions): Likewise. (useshell): Likewise. * windows-tdep.c (maint_display_all_tib): Likewise. * xml-support.c (debug_xml): Likewise.
2019-09-14 21:36:58 +02:00
bool trace_commands = false;
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
/* 'script-extension' option support. */
static const char script_ext_off[] = "off";
static const char script_ext_soft[] = "soft";
static const char script_ext_strict[] = "strict";
gdb/ Code cleanup: Make 1440 bytes of data segment read-only. * arch-utils.c (endian_enum): Make it const char *const []. * arm-tdep.c (fp_model_strings, arm_abi_strings, arm_mode_strings): Likewise. * breakpoint.c (always_inserted_enums): Likewise. * cli/cli-cmds.c (script_ext_enums): Likewise. * cli/cli-decode.c (add_setshow_enum_cmd, complete_on_enum): Make the enumlist parameter const char *const *. * cli/cli-decode.h (struct cmd_list_element): Make the enums field const char *const *. * command.h (complete_on_enum, add_setshow_enum_cmd): Make the enumlist parameter const char *const *. * cris-tdep.c (cris_modes): Make it const char *const []. * filesystem.c (target_file_system_kinds): Likewise. * i386-tdep.c (valid_flavors, valid_conventions): Likewise. * infrun.c (follow_fork_mode_kind_names, follow_exec_mode_names) (can_use_displaced_stepping_enum, scheduler_enums) (exec_direction_names): Likewise. * language.c (_initialize_language): Make the type_or_range_names and case_sensitive_names variables const char *const []. * mips-tdep.c (mips_abi_strings): Make it const char *const []. * python/python.c (python_excp_enums): Likewise. * remote.c (interrupt_sequence_modes): Likewise. * rs6000-tdep.c (powerpc_vector_strings): Likewise. * serial.c (logbase_enums): Likewise. * sh-tdep.c (sh_cc_enum): Likewise. * stack.c (print_frame_arguments_choices, print_entry_values_choices): Likewise. * symtab.c (multiple_symbols_modes): Likewise. * tui/tui-win.c (tui_border_kind_enums, tui_border_mode_enums): Likewise. * utils.c (internal_problem_modes): Likewise.
2012-01-28 19:08:22 +01:00
static const char *const script_ext_enums[] = {
script_ext_off,
script_ext_soft,
script_ext_strict,
NULL
};
static const char *script_ext_mode = script_ext_soft;
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
/* Utility used everywhere when at least one argument is needed and
none is supplied. */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
void
error_no_arg (const char *why)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Argument required (%s)."), why);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
}
Introduce the "with" command ( See original discussion and prototype here: https://sourceware.org/ml/gdb-patches/2019-05/msg00570.html ) (gdb) help with Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING. Usage: with SETTING [VALUE] [-- COMMAND] Usage: w SETTING [VALUE] [-- COMMAND] With no COMMAND, repeats the last executed command. SETTING is any setting you can change with the "set" subcommands. E.g.: with language pascal -- print obj with print elements unlimited -- print obj As can be seen above, the "with" command is just like "set", but instead of setting the setting permanently, it sets the setting, runs a command and then restores the setting. (gdb) p g_s $1 = {a = 1, b = 2, c = 3} (gdb) with language ada -- print g_s $2 = (a => 1, b => 2, c => 3) Warning: the current language does not match this frame. (gdb) show language The current source language is "auto; currently c". (gdb) with print elements 100 -- with print object on -- print 1 $3 = 1 You can shorten things a bit though, as long as unambiguous. So this: (gdb) with print elements 100 -- with print object off -- print 1 is the same as: (gdb) w p el 100 -- w p o 0 -- p 1 Note that the patch adds a "w" alias for "with", as "w" is not currently taken: (gdb) w Ambiguous command "w": watch, wh, whatis, where, while, while-stepping, winheight, ws. Let me know if you'd prefer to reserve "w" for one of the other commands above. IMHO, this command will end up being used frequently enough that it deserves the "w" shorthand. A nice feature is that this is fully integrated with TAB-completion: (gdb) with p[TAB] pagination print prompt python (gdb) with print [TAB] address max-depth static-members array max-symbolic-offset symbol array-indexes null-stop symbol-filename asm-demangle object symbol-loading demangle pascal_static-members thread-events elements pretty type entry-values raw union frame-arguments repeats vtbl inferior-events sevenbit-strings (gdb) with print [TAB] (gdb) with print elements unlimited -- thread apply all -[TAB] -ascending -c -q -s (gdb) with print elements unlimited -- print -[TAB] -address -max-depth -repeats -vtbl -array -null-stop -static-members -array-indexes -object -symbol -elements -pretty -union The main advantage of this new command compared to command options, like the new "print -OPT", is that this command works with any setting, and, it works nicely when you want to override a setting while running a user-defined command, like: (gdb) with print pretty -- usercmd The disadvantage is that it isn't as compact or easy to type. I think of command options and this command as complementary. I think that even with this new command, it makes sense to continue developing the command options in the direction of exposing most-oft-used settings as command options. Inspired by Philippe's "/" command proposal, if no command is specified, then the last command is re-invoked, under the overridden setting: (gdb) p g_s $1 = {a = 1, b = 2, c = 3} (gdb) with language ada $2 = (a => 1, b => 2, c => 3) Warning: the current language does not match this frame. Note: "with" requires "--" to separate the setting from the command. It might be possible to do without that, but, I haven't tried it yet, and I think that this can go in without it. We can always downgrade to making "--" optional if we manage to make it work. On to the patch itself, the implementation of the command is simpler than one might expect. A few details: - I factored out a bit from pipe_command into repeat_previous directly, because otherwise I'd need to copy&paste the same code and same error message in the with command. - The parse_cli_var_uinteger / parse_cli_var_zuinteger_unlimited / do_set_command changes are necessary since we can now pass an empty string as argument. - do_show_command was split in two, as a FIXME comment suggests, but for a different reason: we need to get a string version of a "set" command's value, and we already had code for that in do_show_command. That code is now factored out to the new get_setshow_command_value_string function. - There's a new "maint with" command added too: (gdb) help maint with Like "with", but works with "maintenance set" variables. Usage: maintenance with SETTING [VALUE] [-- COMMAND] With no COMMAND, repeats the last executed command. SETTING is any setting you can change with the "maintenance set" subcommands. "with" and "maint with" share 99% of the implementation. This might be useful on its own, but it's also useful for testing, since with this, we can use the "maint set/show test-settings" settings for exercising the "with" machinery with all the command type variants (all enum var_types). This is done in the new gdb/base/with.exp testcase. The documentation bits are originally based on Philippe's docs for the "/" command, hence the attribution in the ChangeLog. gdb/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> * NEWS (New commands): Mention "with" and "maint with". * cli/cli-cmds.c (with_command_1, with_command_completer_1) (with_command, with_command_completer): New. (pipe_command): Adjust to new repeat_previous interface. (_initialize_cli_cmds): Install the "with" command and its "w" alias. * cli/cli-cmds.h (with_command_1, with_command_completer_1): New declarations. * cli/cli-setshow.c (parse_cli_var_uinteger) (parse_cli_var_zuinteger_unlimited, do_set_command): Handle empty argument strings for all var_types. (get_setshow_command_value_string): New, factored out from ... (do_show_command): ... this. * cli/cli-setshow.h: Include <string>. (get_setshow_command_value_string): Declare. * command.h (repeat_previous): Now returns const char *. Adjust comment. * maint.c: Include "cli/cli-cmds.h". (maintenance_with_cmd, maintenance_with_cmd_completer): New. (_initialize_maint_cmds): Register the "maintenance with" command. * top.c (repeat_previous): Move bits from pipe_command here: Return the saved command line, if any; error out if there's no command to relaunch. gdb/doc/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.texinfo (Command Settings): New node documenting the general concept of settings, how to change them, and the new "with" command. (Maintenance Commands): Document "maint with". gdb/testsuite/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> * gdb.base/with.c: New file. * gdb.base/with.exp: New file.
2019-07-03 14:34:20 +02:00
/* See cli/cli-cmds.h. */
void
with_command_1 (const char *set_cmd_prefix,
cmd_list_element *setlist, const char *args, int from_tty)
{
if (args == nullptr)
error (_("Missing arguments."));
Introduce the "with" command ( See original discussion and prototype here: https://sourceware.org/ml/gdb-patches/2019-05/msg00570.html ) (gdb) help with Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING. Usage: with SETTING [VALUE] [-- COMMAND] Usage: w SETTING [VALUE] [-- COMMAND] With no COMMAND, repeats the last executed command. SETTING is any setting you can change with the "set" subcommands. E.g.: with language pascal -- print obj with print elements unlimited -- print obj As can be seen above, the "with" command is just like "set", but instead of setting the setting permanently, it sets the setting, runs a command and then restores the setting. (gdb) p g_s $1 = {a = 1, b = 2, c = 3} (gdb) with language ada -- print g_s $2 = (a => 1, b => 2, c => 3) Warning: the current language does not match this frame. (gdb) show language The current source language is "auto; currently c". (gdb) with print elements 100 -- with print object on -- print 1 $3 = 1 You can shorten things a bit though, as long as unambiguous. So this: (gdb) with print elements 100 -- with print object off -- print 1 is the same as: (gdb) w p el 100 -- w p o 0 -- p 1 Note that the patch adds a "w" alias for "with", as "w" is not currently taken: (gdb) w Ambiguous command "w": watch, wh, whatis, where, while, while-stepping, winheight, ws. Let me know if you'd prefer to reserve "w" for one of the other commands above. IMHO, this command will end up being used frequently enough that it deserves the "w" shorthand. A nice feature is that this is fully integrated with TAB-completion: (gdb) with p[TAB] pagination print prompt python (gdb) with print [TAB] address max-depth static-members array max-symbolic-offset symbol array-indexes null-stop symbol-filename asm-demangle object symbol-loading demangle pascal_static-members thread-events elements pretty type entry-values raw union frame-arguments repeats vtbl inferior-events sevenbit-strings (gdb) with print [TAB] (gdb) with print elements unlimited -- thread apply all -[TAB] -ascending -c -q -s (gdb) with print elements unlimited -- print -[TAB] -address -max-depth -repeats -vtbl -array -null-stop -static-members -array-indexes -object -symbol -elements -pretty -union The main advantage of this new command compared to command options, like the new "print -OPT", is that this command works with any setting, and, it works nicely when you want to override a setting while running a user-defined command, like: (gdb) with print pretty -- usercmd The disadvantage is that it isn't as compact or easy to type. I think of command options and this command as complementary. I think that even with this new command, it makes sense to continue developing the command options in the direction of exposing most-oft-used settings as command options. Inspired by Philippe's "/" command proposal, if no command is specified, then the last command is re-invoked, under the overridden setting: (gdb) p g_s $1 = {a = 1, b = 2, c = 3} (gdb) with language ada $2 = (a => 1, b => 2, c => 3) Warning: the current language does not match this frame. Note: "with" requires "--" to separate the setting from the command. It might be possible to do without that, but, I haven't tried it yet, and I think that this can go in without it. We can always downgrade to making "--" optional if we manage to make it work. On to the patch itself, the implementation of the command is simpler than one might expect. A few details: - I factored out a bit from pipe_command into repeat_previous directly, because otherwise I'd need to copy&paste the same code and same error message in the with command. - The parse_cli_var_uinteger / parse_cli_var_zuinteger_unlimited / do_set_command changes are necessary since we can now pass an empty string as argument. - do_show_command was split in two, as a FIXME comment suggests, but for a different reason: we need to get a string version of a "set" command's value, and we already had code for that in do_show_command. That code is now factored out to the new get_setshow_command_value_string function. - There's a new "maint with" command added too: (gdb) help maint with Like "with", but works with "maintenance set" variables. Usage: maintenance with SETTING [VALUE] [-- COMMAND] With no COMMAND, repeats the last executed command. SETTING is any setting you can change with the "maintenance set" subcommands. "with" and "maint with" share 99% of the implementation. This might be useful on its own, but it's also useful for testing, since with this, we can use the "maint set/show test-settings" settings for exercising the "with" machinery with all the command type variants (all enum var_types). This is done in the new gdb/base/with.exp testcase. The documentation bits are originally based on Philippe's docs for the "/" command, hence the attribution in the ChangeLog. gdb/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> * NEWS (New commands): Mention "with" and "maint with". * cli/cli-cmds.c (with_command_1, with_command_completer_1) (with_command, with_command_completer): New. (pipe_command): Adjust to new repeat_previous interface. (_initialize_cli_cmds): Install the "with" command and its "w" alias. * cli/cli-cmds.h (with_command_1, with_command_completer_1): New declarations. * cli/cli-setshow.c (parse_cli_var_uinteger) (parse_cli_var_zuinteger_unlimited, do_set_command): Handle empty argument strings for all var_types. (get_setshow_command_value_string): New, factored out from ... (do_show_command): ... this. * cli/cli-setshow.h: Include <string>. (get_setshow_command_value_string): Declare. * command.h (repeat_previous): Now returns const char *. Adjust comment. * maint.c: Include "cli/cli-cmds.h". (maintenance_with_cmd, maintenance_with_cmd_completer): New. (_initialize_maint_cmds): Register the "maintenance with" command. * top.c (repeat_previous): Move bits from pipe_command here: Return the saved command line, if any; error out if there's no command to relaunch. gdb/doc/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.texinfo (Command Settings): New node documenting the general concept of settings, how to change them, and the new "with" command. (Maintenance Commands): Document "maint with". gdb/testsuite/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> * gdb.base/with.c: New file. * gdb.base/with.exp: New file.
2019-07-03 14:34:20 +02:00
const char *delim = strstr (args, "--");
const char *nested_cmd = nullptr;
if (delim == args)
error (_("Missing setting before '--' delimiter"));
if (delim == nullptr || *skip_spaces (&delim[2]) == '\0')
nested_cmd = repeat_previous ();
cmd_list_element *set_cmd = lookup_cmd (&args, setlist, set_cmd_prefix,
/*allow_unknown=*/ 0,
/*ignore_help_classes=*/ 1);
gdb_assert (set_cmd != nullptr);
if (set_cmd->var == nullptr)
error (_("Cannot use this setting with the \"with\" command"));
std::string temp_value
= (delim == nullptr ? args : std::string (args, delim - args));
if (nested_cmd == nullptr)
nested_cmd = skip_spaces (delim + 2);
std::string org_value = get_setshow_command_value_string (set_cmd);
/* Tweak the setting to the new temporary value. */
do_set_command (temp_value.c_str (), from_tty, set_cmd);
try
{
scoped_restore save_async = make_scoped_restore (&current_ui->async, 0);
/* Execute the nested command. */
execute_command (nested_cmd, from_tty);
}
catch (const gdb_exception &ex)
{
/* Restore the setting and rethrow. If restoring the setting
throws, swallow the new exception and warn. There's nothing
else we can reasonably do. */
try
{
do_set_command (org_value.c_str (), from_tty, set_cmd);
}
catch (const gdb_exception &ex2)
{
warning (_("Couldn't restore setting: %s"), ex2.what ());
}
throw;
}
/* Restore the setting. */
do_set_command (org_value.c_str (), from_tty, set_cmd);
}
/* See cli/cli-cmds.h. */
void
with_command_completer_1 (const char *set_cmd_prefix,
completion_tracker &tracker,
const char *text)
{
tracker.set_use_custom_word_point (true);
const char *delim = strstr (text, "--");
/* If we're still not past the "--" delimiter, complete the "with"
command as if it was a "set" command. */
if (delim == text
|| delim == nullptr
|| !isspace (delim[-1])
|| !(isspace (delim[2]) || delim[2] == '\0'))
{
std::string new_text = std::string (set_cmd_prefix) + text;
tracker.advance_custom_word_point_by (-(int) strlen (set_cmd_prefix));
complete_nested_command_line (tracker, new_text.c_str ());
return;
}
/* We're past the "--" delimiter. Complete on the sub command. */
const char *nested_cmd = skip_spaces (delim + 2);
tracker.advance_custom_word_point_by (nested_cmd - text);
complete_nested_command_line (tracker, nested_cmd);
}
/* The "with" command. */
static void
with_command (const char *args, int from_tty)
{
with_command_1 ("set ", setlist, args, from_tty);
}
/* "with" command completer. */
static void
with_command_completer (struct cmd_list_element *ignore,
completion_tracker &tracker,
const char *text, const char * /*word*/)
{
with_command_completer_1 ("set ", tracker, text);
}
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
/* Provide documentation on command or list given by COMMAND. FROM_TTY
is ignored. */
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
help_command (const char *command, int from_tty)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
help_cmd (command, gdb_stdout);
}
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
Add max-completions parameter, and implement tab-completion limiting. This commit adds a new exception, MAX_COMPLETIONS_REACHED_ERROR, to be thrown whenever the completer has generated too many candidates to be useful. A new user-settable variable, "max_completions", is added to control this behaviour. A top-level completion limit is added to complete_line_internal, as the final check to ensure the user never sees too many completions. An additional limit is added to default_make_symbol_completion_list_break_on, to halt time-consuming symbol table expansions. gdb/ChangeLog: PR cli/9007 PR cli/11920 PR cli/15548 * cli/cli-cmds.c (complete_command): Notify user if max-completions reached. * common/common-exceptions.h (enum errors) <MAX_COMPLETIONS_REACHED_ERROR>: New value. * completer.h (get_max_completions_reached_message): New declaration. (max_completions): Likewise. (completion_tracker_t): New typedef. (new_completion_tracker): New declaration. (make_cleanup_free_completion_tracker): Likewise. (maybe_add_completion_enum): New enum. (maybe_add_completion): New declaration. (throw_max_completions_reached_error): Likewise. * completer.c (max_completions): New global variable. (new_completion_tracker): New function. (free_completion_tracker): Likewise. (make_cleanup_free_completion_tracker): Likewise. (maybe_add_completions): Likewise. (throw_max_completions_reached_error): Likewise. (complete_line): Remove duplicates and limit result to max_completions entries. (get_max_completions_reached_message): New function. (gdb_display_match_list): Handle max_completions. (_initialize_completer): New declaration and function. * symtab.c: Include completer.h. (completion_tracker): New static variable. (completion_list_add_name): Call maybe_add_completion. (default_make_symbol_completion_list_break_on_1): Renamed from default_make_symbol_completion_list_break_on. Maintain completion_tracker across calls to completion_list_add_name. (default_make_symbol_completion_list_break_on): New function. * top.c (init_main): Set rl_completion_display_matches_hook. * tui/tui-io.c: Include completer.h. (tui_old_rl_display_matches_hook): New static global. (tui_rl_display_match_list): Notify user if max-completions reached. (tui_setup_io): Save/restore rl_completion_display_matches_hook. * NEWS (New Options): Mention set/show max-completions. gdb/doc/ChangeLog: * gdb.texinfo (Command Completion): Document new "set/show max-completions" option. gdb/testsuite/ChangeLog: * gdb.base/completion.exp: Disable completion limiting for existing tests. Add new tests to check completion limiting. * gdb.linespec/ls-errs.exp: Disable completion limiting.
2015-02-01 00:07:22 +01:00
/* Note: The "complete" command is used by Emacs to implement completion.
[Is that why this function writes output with *_unfiltered?] */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
complete_command (const char *arg, int from_tty)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
dont_repeat ();
Add max-completions parameter, and implement tab-completion limiting. This commit adds a new exception, MAX_COMPLETIONS_REACHED_ERROR, to be thrown whenever the completer has generated too many candidates to be useful. A new user-settable variable, "max_completions", is added to control this behaviour. A top-level completion limit is added to complete_line_internal, as the final check to ensure the user never sees too many completions. An additional limit is added to default_make_symbol_completion_list_break_on, to halt time-consuming symbol table expansions. gdb/ChangeLog: PR cli/9007 PR cli/11920 PR cli/15548 * cli/cli-cmds.c (complete_command): Notify user if max-completions reached. * common/common-exceptions.h (enum errors) <MAX_COMPLETIONS_REACHED_ERROR>: New value. * completer.h (get_max_completions_reached_message): New declaration. (max_completions): Likewise. (completion_tracker_t): New typedef. (new_completion_tracker): New declaration. (make_cleanup_free_completion_tracker): Likewise. (maybe_add_completion_enum): New enum. (maybe_add_completion): New declaration. (throw_max_completions_reached_error): Likewise. * completer.c (max_completions): New global variable. (new_completion_tracker): New function. (free_completion_tracker): Likewise. (make_cleanup_free_completion_tracker): Likewise. (maybe_add_completions): Likewise. (throw_max_completions_reached_error): Likewise. (complete_line): Remove duplicates and limit result to max_completions entries. (get_max_completions_reached_message): New function. (gdb_display_match_list): Handle max_completions. (_initialize_completer): New declaration and function. * symtab.c: Include completer.h. (completion_tracker): New static variable. (completion_list_add_name): Call maybe_add_completion. (default_make_symbol_completion_list_break_on_1): Renamed from default_make_symbol_completion_list_break_on. Maintain completion_tracker across calls to completion_list_add_name. (default_make_symbol_completion_list_break_on): New function. * top.c (init_main): Set rl_completion_display_matches_hook. * tui/tui-io.c: Include completer.h. (tui_old_rl_display_matches_hook): New static global. (tui_rl_display_match_list): Notify user if max-completions reached. (tui_setup_io): Save/restore rl_completion_display_matches_hook. * NEWS (New Options): Mention set/show max-completions. gdb/doc/ChangeLog: * gdb.texinfo (Command Completion): Document new "set/show max-completions" option. gdb/testsuite/ChangeLog: * gdb.base/completion.exp: Disable completion limiting for existing tests. Add new tests to check completion limiting. * gdb.linespec/ls-errs.exp: Disable completion limiting.
2015-02-01 00:07:22 +01:00
if (max_completions == 0)
{
/* Only print this for non-mi frontends. An MI frontend may not
be able to handle this. */
Class-ify ui_out This patch finalizes the C++ conversion of the ui-out subsystem, by turning the ui_out and ui_out_impl structures into a single class hierarchy. ui_out functions are turned into virtual methods of that new class, so as a result there are a lot of call sites to update. In the previous version of the patchset, there were separate ui_out and ui_out_impl classes, but it wasn't really useful and added boilerplate. In this version there is simply an ui_out base class that is extended for CLI, TUI and MI. It's a bit hard to maintain a ChangeLog for such a big patch, I did my best but I'm sure there are some missing or outdated info in there... gdb/ChangeLog: * ui-out.h (ui_out_begin, ui_out_end, ui_out_table_header, ui_out_table_body, ui_out_field_int, ui_out_field_fmt_int, ui_out_field_core_addr, ui_out_field_string, ui_out_field_stream, ui_out_field_fmt, ui_out_field_skip, ui_out_spaces, ui_out_text, ui_out_message, ui_out_wrap_hint, ui_out_flush, ui_out_test_flags, ui_out_query_field, ui_out_is_mi_like_p, ui_out_redirect): Remove, replace with a method in class ui_out. (table_begin_ftype): Remove, replace with pure virtual method in class ui_out. (table_body_ftype): Likewise. (table_end_ftype): Likewise. (table_header_ftype): Likewise. (ui_out_begin_ftype): Likewise. (ui_out_end_ftype): Likewise. (field_int_ftype): Likewise. (field_skip_ftype): Likewise. (field_string_ftype): Likewise. (field_fmt_ftype): Likewise. (spaces_ftype): Likewise. (text_ftype): Likewise. (message_ftype): Likewise. (wrap_hint_ftype): Likewise. (flush_ftype): Likewise. (redirect_ftype): Likewise. (data_destroy_ftype): Likewise. (struct ui_out_impl): Remove, replace with class ui_out. (ui_out_new): Remove. (class ui_out): New class. * ui-out.c (struct ui_out): Remove, replaced with class ui_out. (current_level): Remove, replace with ui_out method. (push_level): Likewise. (pop_level): Likewise. (uo_table_begin, uo_table_body, uo_table_end, uo_table_header, uo_begin, uo_end, uo_field_int, uo_field_skip, uo_field_fmt, uo_spaces, uo_text, uo_message, uo_wrap_hint, uo_flush, uo_redirect, uo_field_string): Remove. (ui_out_table_begin): Replace with ... (ui_out::table_begin): ... this. (ui_out_table_body): Replace with ... (ui_out::table_body): ... this. (ui_out_table_end): Replace with ... (ui_out::table_end): ... this. (ui_out_table_header): Replace with ... (ui_out::table_header): ... this. (ui_out_begin): Replace with ... (ui_out::begin): ... this. (ui_out_end): Replace with ... (ui_out::end): ... this. (ui_out_field_int): Replace with ... (ui_out::field_int): ... this. (ui_out_field_fmt_int): Replace with ... (ui_out::field_fmt_int): ... this. (ui_out_field_core_addr): Replace with ... (ui_out::field_core_addr): ... this. (ui_out_field_stream): Replace with ... (ui_out::field_stream): ... this. (ui_out_field_skip): Replace with ... (ui_out::field_skip): ... this. (ui_out_field_string): Replace with ... (ui_out::field_string): ... this. (ui_out_field_fmt): Replace with ... (ui_out::field_fmt): ... this. (ui_out_spaces): Replace with ... (ui_out::spaces): ... this. (ui_out_text): Replace with ... (ui_out::text): ... this. (ui_out_message): Replace with ... (ui_out::message): ... this. (ui_out_wrap_hint): Replace with ... (ui_out::wrap_hint): ... this. (ui_out_flush): Replace with ... (ui_out::flush): ... this. (ui_out_redirect): Replace with ... (ui_out::redirect): ... this. (ui_out_test_flags): Replace with ... (ui_out::test_flags): ... this. (ui_out_is_mi_like_p): Replace with ... (ui_out::is_mi_like_p): ... this. (verify_field): Replace with ... (ui_out::verify_field): ... this. (ui_out_query_field): Replace with ... (ui_out::query_table_field): ... this. (ui_out_data): Remove. (ui_out_new): Remove, replace with ... (ui_out::ui_out): ... this constructor. (do_cleanup_table_end, make_cleanup_ui_out_tuple_begin_end, do_cleanup_end, make_cleanup_ui_out_tuple_begin_end, make_cleanup_ui_out_list_begin_end): Update fallouts of struct ui_out -> class ui_out change. * cli-out.c (cli_out_data): Remove. (cli_uiout_dtor): Remove. (cli_table_begin): Replace with ... (cli_ui_out::do_table_begin): ... this new method. (cli_table_body): Replace with ... (cli_ui_out::do_table_body): ... this new method. (cli_table_end): Replace with ... (cli_ui_out::do_table_end): ... this new method. (cli_table_header): Replace with ... (cli_ui_out::do_table_header): ... this new method. (cli_begin): Replace with ... (cli_ui_out::do_begin): ... this new method. (cli_end): Replace with ... (cli_ui_out::do_end): ... this new method. (cli_field_int): Replace with ... (cli_ui_out::do_field_int): ... this new method. (cli_field_skip): Replace with ... (cli_ui_out::do_field_skip): ... this new method. (cli_field_string): Replace with ... (cli_ui_out::do_field_string): ... this new method. (cli_field_fmt): Replace with ... (cli_ui_out::do_field_fmt): ... this new method. (cli_spaces): Replace with ... (cli_ui_out::do_spaces): ... this new method. (cli_text): Replace with ... (cli_ui_out::do_text): ... this new method. (cli_message): Replace with ... (cli_ui_out::do_message): ... this new method. (cli_wrap_hint): Replace with ... (cli_ui_out::do_wrap_hint): ... this new method. (cli_flush): Replace with ... (cli_ui_out::do_flush): ... this new method. (cli_redirect): Replace with ... (cli_ui_out::do_redirect): ... this new method. (out_field_fmt): Replace with ... (cli_ui_out::out_field_fmt): ... this new method. (field_separator): Replace with ... (cli_ui_out::field_separator): ... this new method. (cli_out_set_stream): Replace with ... (cli_ui_out::set_stream): ... this new method. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_ui_out_impl::cli_ui_out_impl): New constructor. (cli_ui_out_impl::~cli_ui_out_impl): New destructor. (cli_out_new): Change return type to cli_ui_out *, instantiate a cli_ui_out. * cli-out.h (cli_ui_out_data): Remove, replace with class cli_ui_out. (class cli_ui_out): New class. (cli_ui_out_impl): Remove. (cli_out_data_ctor): Remove. (cli_out_new): Change return type to cli_ui_out*. (cli_out_set_stream): Remove. * cli/cli-interp.c (struct cli_interp) <cli_uiout>: Change type to cli_ui_out*. (cli_interpreter_resume): Adapt. (cli_interpreter_exec): Adapt. * mi/mi-out.c (mi_ui_out_data, mi_out_data): Remove. (mi_ui_out_impl): Remove. (mi_table_begin): Replace with ... (mi_ui_out::do_table_begin): ... this. (mi_table_body): Replace with ... (mi_ui_out::do_table_body): ... this. (mi_table_end): Replace with ... (mi_ui_out::do_table_end): ... this. (mi_table_header): Replace with ... (mi_ui_out::do_table_header): ... this. (mi_begin): Replace with ... (mi_ui_out::do_begin): ... this. (mi_end): Replace with ... (mi_ui_out::do_end): ... this. (mi_field_int): Replace with ... (mi_ui_out::do_field_int): ... this. (mi_field_skip): Replace with ... (mi_ui_out::do_field_skip): ... this. (mi_field_string): Replace with ... (mi_ui_out::do_field_string): ... this. (mi_field_fmt): Replace with ... (mi_ui_out::do_field_fmt): ... this. (mi_spaces): Replace with ... (mi_ui_out::do_spaces): ... this. (mi_text): Replace with ... (mi_ui_out::do_text): ... this. (mi_message): Replace with ... (mi_ui_out::do_message): ... this. (mi_wrap_hint): Replace with ... (mi_ui_out::do_wrap_hint): ... this. (mi_flush): Replace with ... (mi_ui_out::do_flush): ... this. (mi_redirect): Replace with ... (mi_ui_out::do_redirect): (field_separator): Replace with ... (mi_ui_out::field_separator): (mi_open): Replace with ... (mi_ui_out::open): ... this. (mi_close): Replace with ... (mi_ui_out::close): ... this. (mi_out_rewind): Replace with ... (mi_ui_out::rewind): ... this. (mi_out_put): Replace with ... (mi_ui_out::put): ... this. (mi_version): Replace with ... (mi_ui_out::version): ... this. (mi_out_data_ctor): Replace with ... (mi_ui_out::mi_ui_out): ... this. (mi_out_data_dtor): Replace with ... (mi_ui_out::~mi_ui_out): ... this. (mi_out_new): Change return type to mi_ui_out*, instantiate an mi_ui_out object. (as_mi_ui_out): New function. (mi_version): Update fallouts of struct ui_out to class ui_out transition. (mi_out_put): Likewise. (mi_out_rewind): Likewise. * mi/mi-out.h (mi_out_new): Change return type to mi_ui_out*. * tui/tui-out.c (tui_ui_out_data, tui_out_data, tui_ui_out_impl): Remove. (tui_field_int): Replace with ... (tui_ui_out::do_field_int): ... this. (tui_field_string): Replace with ... (tui_ui_out::do_field_string): ... this. (tui_field_fmt): Replace with ... (tui_ui_out::do_field_fmt): ... this. (tui_text): Replace with ... (tui_ui_out::do_text): ... this. (tui_out_new): Change return type to tui_ui_out*, instantiate tui_ui_out object. (tui_ui_out::tui_ui_out): New. * tui/tui-out.h: New file. * tui/tui.h (tui_out_new): Move declaration to tui/tui-out.h. * tui/tui-io.c: Include tui/tui-out.h. (tui_old_uiout): Change type to cli_ui_out*. (tui_setup_io): Use dynamic_cast. * tui/tui-io.h (tui_old_uiout): Change type to cli_ui_out*. * tui/tui-interp.c (tui_resume): Adapt. * ada-lang.c (print_it_exception): Update fallouts of struct ui_out to class ui_out transition. (print_one_exception): Likewise. (print_mention_exception): Likewise. * ada-tasks.c (print_ada_task_info): Likewise. (info_task): Likewise. (task_command): Likewise. * auto-load.c (print_script): Likewise. (auto_load_info_scripts): Likewise. (info_auto_load_cmd): Likewise. * break-catch-sig.c (signal_catchpoint_print_one): Likewise. * break-catch-syscall.c (print_it_catch_syscall): Likewise. (print_one_catch_syscall): Likewise. * break-catch-throw.c (print_it_exception_catchpoint): Likewise. (print_one_exception_catchpoint): Likewise. (print_one_detail_exception_catchpoint): Likewise. (print_mention_exception_catchpoint): Likewise. * breakpoint.c (maybe_print_thread_hit_breakpoint): Likewise. (print_solib_event): Likewise. (watchpoint_check): Likewise. (wrap_indent_at_field): Likewise. (print_breakpoint_location): Likewise. (output_thread_groups): Likewise. (print_one_breakpoint_location): Likewise. (breakpoint_1): Likewise. (default_collect_info): Likewise. (watchpoints_info): Likewise. (print_it_catch_fork): Likewise. (print_one_catch_fork): Likewise. (print_it_catch_vfork): Likewise. (print_one_catch_vfork): Likewise. (print_it_catch_solib): Likewise. (print_one_catch_solib): Likewise. (print_it_catch_exec): Likewise. (print_one_catch_exec): Likewise. (mention): Likewise. (print_it_ranged_breakpoint): Likewise. (print_one_ranged_breakpoint): Likewise. (print_one_detail_ranged_breakpoint): Likewise. (print_mention_ranged_breakpoint): Likewise. (print_it_watchpoint): Likewise. (print_mention_watchpoint): Likewise. (print_it_masked_watchpoint): Likewise. (print_one_detail_masked_watchpoint): Likewise. (print_mention_masked_watchpoint): Likewise. (bkpt_print_it): Likewise. (tracepoint_print_one_detail): Likewise. (tracepoint_print_mention): Likewise. (update_static_tracepoint): Likewise. (tracepoints_info): Likewise. (save_breakpoints): Likewise. * cli/cli-cmds.c (complete_command): Likewise. * cli/cli-logging.c (set_logging_redirect): Likewise. (pop_output_files): Likewise. (handle_redirections): Likewise. * cli/cli-script.c (print_command_lines): Likewise. * cli/cli-setshow.c (do_show_command): Likewise. (cmd_show_list): Likewise. * cp-abi.c (list_cp_abis): Likewise. (show_cp_abi_cmd): Likewise. * darwin-nat-info.c (darwin_debug_regions_recurse): Likewise. * disasm.c (gdb_pretty_print_insn): Likewise. (do_mixed_source_and_assembly_deprecated): Likewise. (do_mixed_source_and_assembly): Likewise. * gdb_bfd.c (print_one_bfd): Likewise. (maintenance_info_bfds): Likewise. * guile/scm-breakpoint.c (gdbscm_breakpoint_commands): Likewise. * guile/scm-ports.c (ioscm_with_output_to_port_worker): Likewise. * i386-linux-tdep.c (i386_linux_handle_segmentation_fault): Likewise. * i386-tdep.c (i386_mpx_print_bounds): Likewise. * infcmd.c (run_command_1): Likewise. (print_return_value_1): Likewise. * inferior.c (print_selected_inferior): Likewise. (print_inferior): Likewise. * infrun.c (print_end_stepping_range_reason): Likewise. (print_signal_exited_reason): Likewise. (print_exited_reason): Likewise. (print_signal_received_reason): Likewise. (print_no_history_reason): Likewise. * interps.c (interp_set): Likewise. * linespec.c (decode_line_full): Likewise. * linux-thread-db.c (info_auto_load_libthread_db): Likewise. * mi/mi-cmd-env.c (mi_cmd_env_pwd): Likewise. (mi_cmd_env_path): Likewise. (mi_cmd_env_dir): Likewise. (mi_cmd_inferior_tty_show): Likewise. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file): Likewise. (print_partial_file_name): Likewise. (mi_cmd_file_list_exec_source_files): Likewise. * mi/mi-cmd-info.c (mi_cmd_info_ada_exceptions): Likewise. (mi_cmd_info_gdb_mi_command): Likewise. * mi/mi-cmd-stack.c (mi_cmd_stack_info_depth): Likewise. (mi_cmd_stack_list_args): Likewise. (list_arg_or_local): Likewise. * mi/mi-cmd-var.c (print_varobj): Likewise. (mi_cmd_var_create): Likewise. (mi_cmd_var_delete): Likewise. (mi_cmd_var_set_format): Likewise. (mi_cmd_var_show_format): Likewise. (mi_cmd_var_info_num_children): Likewise. (mi_cmd_var_list_children): Likewise. (mi_cmd_var_info_type): Likewise. (mi_cmd_var_info_path_expression): Likewise. (mi_cmd_var_info_expression): Likewise. (mi_cmd_var_show_attributes): Likewise. (mi_cmd_var_evaluate_expression): Likewise. (mi_cmd_var_assign): Likewise. (varobj_update_one): Likewise. * mi/mi-interp.c (as_mi_interp): Likewise. (mi_on_normal_stop_1): Likewise. (mi_tsv_modified): Likewise. (mi_breakpoint_created): Likewise. (mi_breakpoint_modified): Likewise. (mi_solib_loaded): Likewise. (mi_solib_unloaded): Likewise. (mi_command_param_changed): Likewise. (mi_memory_changed): Likewise. (mi_user_selected_context_changed): Likewise. * mi/mi-main.c (print_one_inferior): Likewise. (output_cores): Likewise. (list_available_thread_groups): Likewise. (mi_cmd_data_list_register_names): Likewise. (mi_cmd_data_list_changed_registers): Likewise. (output_register): Likewise. (mi_cmd_data_evaluate_expression): Likewise. (mi_cmd_data_read_memory): Likewise. (mi_cmd_data_read_memory_bytes): Likewise. (mi_cmd_list_features): Likewise. (mi_cmd_list_target_features): Likewise. (mi_cmd_add_inferior): Likewise. (mi_execute_command): Likewise. (mi_load_progress): Likewise. (print_variable_or_computed): Likewise. (mi_cmd_trace_frame_collected): Likewise. * mi/mi-symbol-cmds.c (mi_cmd_symbol_list_lines): Likewise. * osdata.c (info_osdata_command): Likewise. * probe.c (gen_ui_out_table_header_info): Likewise. (print_ui_out_not_applicables): Likewise. (print_ui_out_info): Likewise. (info_probes_for_ops): Likewise. (enable_probes_command): Likewise. (disable_probes_command): Likewise. * progspace.c (print_program_space): Likewise. * python/py-breakpoint.c (bppy_get_commands): Likewise. * python/py-framefilter.c (py_print_type): Likewise. (py_print_value): Likewise. (py_print_single_arg): Likewise. (enumerate_args): Likewise. (enumerate_locals): Likewise. (py_print_args): Likewise. (py_print_frame): Likewise. * record-btrace.c (btrace_ui_out_decode_error): Likewise. (btrace_call_history_insn_range): Likewise. (btrace_call_history_src_line): Likewise. (btrace_call_history): Likewise. * remote.c (show_remote_cmd): Likewise. * skip.c (skip_info): Likewise. * solib.c (info_sharedlibrary_command): Likewise. * source.c (print_source_lines_base): Likewise. * spu-tdep.c (info_spu_event_command): Likewise. (info_spu_signal_command): Likewise. (info_spu_mailbox_list): Likewise. (info_spu_dma_cmdlist): Likewise. (info_spu_dma_command): Likewise. (info_spu_proxydma_command): Likewise. * stack.c (print_stack_frame): Likewise. (print_frame_arg): Likewise. (read_frame_arg): Likewise. (print_frame_args): Likewise. (print_frame_info): Likewise. (print_frame): Likewise. * symfile.c (load_progress): Likewise. (generic_load): Likewise. (print_transfer_performance): Likewise. * thread.c (do_captured_list_thread_ids): Likewise. (print_thread_info_1): Likewise. (restore_selected_frame): Likewise. (do_captured_thread_select): Likewise. (print_selected_thread_frame): Likewise. * top.c (execute_command_to_string): Likewise. * tracepoint.c (tvariables_info_1): Likewise. (trace_status_mi): Likewise. (tfind_1): Likewise. (print_one_static_tracepoint_marker): Likewise. (info_static_tracepoint_markers_command): Likewise. * utils.c (do_ui_out_redirect_pop): Likewise. (fputs_maybe_filtered): Likewise.
2016-12-22 22:17:31 +01:00
if (!current_uiout->is_mi_like_p ())
Add max-completions parameter, and implement tab-completion limiting. This commit adds a new exception, MAX_COMPLETIONS_REACHED_ERROR, to be thrown whenever the completer has generated too many candidates to be useful. A new user-settable variable, "max_completions", is added to control this behaviour. A top-level completion limit is added to complete_line_internal, as the final check to ensure the user never sees too many completions. An additional limit is added to default_make_symbol_completion_list_break_on, to halt time-consuming symbol table expansions. gdb/ChangeLog: PR cli/9007 PR cli/11920 PR cli/15548 * cli/cli-cmds.c (complete_command): Notify user if max-completions reached. * common/common-exceptions.h (enum errors) <MAX_COMPLETIONS_REACHED_ERROR>: New value. * completer.h (get_max_completions_reached_message): New declaration. (max_completions): Likewise. (completion_tracker_t): New typedef. (new_completion_tracker): New declaration. (make_cleanup_free_completion_tracker): Likewise. (maybe_add_completion_enum): New enum. (maybe_add_completion): New declaration. (throw_max_completions_reached_error): Likewise. * completer.c (max_completions): New global variable. (new_completion_tracker): New function. (free_completion_tracker): Likewise. (make_cleanup_free_completion_tracker): Likewise. (maybe_add_completions): Likewise. (throw_max_completions_reached_error): Likewise. (complete_line): Remove duplicates and limit result to max_completions entries. (get_max_completions_reached_message): New function. (gdb_display_match_list): Handle max_completions. (_initialize_completer): New declaration and function. * symtab.c: Include completer.h. (completion_tracker): New static variable. (completion_list_add_name): Call maybe_add_completion. (default_make_symbol_completion_list_break_on_1): Renamed from default_make_symbol_completion_list_break_on. Maintain completion_tracker across calls to completion_list_add_name. (default_make_symbol_completion_list_break_on): New function. * top.c (init_main): Set rl_completion_display_matches_hook. * tui/tui-io.c: Include completer.h. (tui_old_rl_display_matches_hook): New static global. (tui_rl_display_match_list): Notify user if max-completions reached. (tui_setup_io): Save/restore rl_completion_display_matches_hook. * NEWS (New Options): Mention set/show max-completions. gdb/doc/ChangeLog: * gdb.texinfo (Command Completion): Document new "set/show max-completions" option. gdb/testsuite/ChangeLog: * gdb.base/completion.exp: Disable completion limiting for existing tests. Add new tests to check completion limiting. * gdb.linespec/ls-errs.exp: Disable completion limiting.
2015-02-01 00:07:22 +01:00
{
printf_unfiltered (_("max-completions is zero,"
" completion is disabled.\n"));
}
return;
}
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
if (arg == NULL)
arg = "";
"complete" command and completion word break characters The linespec/locations/completer testcase added later in the series tests every completion with both TAB completion and the "complete" command. This exposed problems in the "complete" command, around determining the completion word point. First, the complete command has a too-simple approximation of what readline's TAB-completion code does to find the completion word point. Unfortunately, readline doesn't expose the functionality it uses internally, so to fix this this patch copies over the relevant code, and adjusts it a bit to better fit the use cases we need it for. (Specifically, our version avoids relying on the rl_word_break_characters, etc. globals, and instead takes those as arguments.) A following patch will want to use this function for TAB-completion too, but the "complete" command was a good excuse to split this to a separate patch. Then, notice how the complete_command does not call into the completer for the command being completed to determine the right set of word break characters. It always uses the default set. That is fixed by having the "complete" command call into complete_line_internal for a full handle_brkchars phase, just TAB-completion. gdb/ChangeLog: 2017-07-17 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (complete_command): Use a completion tracker along with completion_find_completion_word for handle_brkchars phase. * completer.c (RL_QF_SINGLE_QUOTE, RL_QF_DOUBLE_QUOTE) (RL_QF_BACKSLASH, RL_QF_OTHER_QUOTE): New. (struct gdb_rl_completion_word_info): New. (gdb_rl_find_completion_word): New. (completion_find_completion_word): New. * completer.h (completion_find_completion_word): Declare.
2017-07-17 16:30:59 +02:00
int quote_char = '\0';
const char *word;
completion_result result = complete (arg, &word, &quote_char);
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
if (result.number_matches != 0)
{
std::string arg_prefix (arg, word - arg);
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
if (result.number_matches == 1)
printf_unfiltered ("%s%s\n", arg_prefix.c_str (), result.match_list[0]);
else
{
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
result.sort_match_list ();
for (size_t i = 0; i < result.number_matches; i++)
{
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
printf_unfiltered ("%s%s",
arg_prefix.c_str (),
result.match_list[i + 1]);
"complete" command and completion word break characters The linespec/locations/completer testcase added later in the series tests every completion with both TAB completion and the "complete" command. This exposed problems in the "complete" command, around determining the completion word point. First, the complete command has a too-simple approximation of what readline's TAB-completion code does to find the completion word point. Unfortunately, readline doesn't expose the functionality it uses internally, so to fix this this patch copies over the relevant code, and adjusts it a bit to better fit the use cases we need it for. (Specifically, our version avoids relying on the rl_word_break_characters, etc. globals, and instead takes those as arguments.) A following patch will want to use this function for TAB-completion too, but the "complete" command was a good excuse to split this to a separate patch. Then, notice how the complete_command does not call into the completer for the command being completed to determine the right set of word break characters. It always uses the default set. That is fixed by having the "complete" command call into complete_line_internal for a full handle_brkchars phase, just TAB-completion. gdb/ChangeLog: 2017-07-17 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (complete_command): Use a completion tracker along with completion_find_completion_word for handle_brkchars phase. * completer.c (RL_QF_SINGLE_QUOTE, RL_QF_DOUBLE_QUOTE) (RL_QF_BACKSLASH, RL_QF_OTHER_QUOTE): New. (struct gdb_rl_completion_word_info): New. (gdb_rl_find_completion_word): New. (completion_find_completion_word): New. * completer.h (completion_find_completion_word): Declare.
2017-07-17 16:30:59 +02:00
if (quote_char)
printf_unfiltered ("%c", quote_char);
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
printf_unfiltered ("\n");
}
}
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
if (result.number_matches == max_completions)
Add max-completions parameter, and implement tab-completion limiting. This commit adds a new exception, MAX_COMPLETIONS_REACHED_ERROR, to be thrown whenever the completer has generated too many candidates to be useful. A new user-settable variable, "max_completions", is added to control this behaviour. A top-level completion limit is added to complete_line_internal, as the final check to ensure the user never sees too many completions. An additional limit is added to default_make_symbol_completion_list_break_on, to halt time-consuming symbol table expansions. gdb/ChangeLog: PR cli/9007 PR cli/11920 PR cli/15548 * cli/cli-cmds.c (complete_command): Notify user if max-completions reached. * common/common-exceptions.h (enum errors) <MAX_COMPLETIONS_REACHED_ERROR>: New value. * completer.h (get_max_completions_reached_message): New declaration. (max_completions): Likewise. (completion_tracker_t): New typedef. (new_completion_tracker): New declaration. (make_cleanup_free_completion_tracker): Likewise. (maybe_add_completion_enum): New enum. (maybe_add_completion): New declaration. (throw_max_completions_reached_error): Likewise. * completer.c (max_completions): New global variable. (new_completion_tracker): New function. (free_completion_tracker): Likewise. (make_cleanup_free_completion_tracker): Likewise. (maybe_add_completions): Likewise. (throw_max_completions_reached_error): Likewise. (complete_line): Remove duplicates and limit result to max_completions entries. (get_max_completions_reached_message): New function. (gdb_display_match_list): Handle max_completions. (_initialize_completer): New declaration and function. * symtab.c: Include completer.h. (completion_tracker): New static variable. (completion_list_add_name): Call maybe_add_completion. (default_make_symbol_completion_list_break_on_1): Renamed from default_make_symbol_completion_list_break_on. Maintain completion_tracker across calls to completion_list_add_name. (default_make_symbol_completion_list_break_on): New function. * top.c (init_main): Set rl_completion_display_matches_hook. * tui/tui-io.c: Include completer.h. (tui_old_rl_display_matches_hook): New static global. (tui_rl_display_match_list): Notify user if max-completions reached. (tui_setup_io): Save/restore rl_completion_display_matches_hook. * NEWS (New Options): Mention set/show max-completions. gdb/doc/ChangeLog: * gdb.texinfo (Command Completion): Document new "set/show max-completions" option. gdb/testsuite/ChangeLog: * gdb.base/completion.exp: Disable completion limiting for existing tests. Add new tests to check completion limiting. * gdb.linespec/ls-errs.exp: Disable completion limiting.
2015-02-01 00:07:22 +01:00
{
"complete" command and completion word break characters The linespec/locations/completer testcase added later in the series tests every completion with both TAB completion and the "complete" command. This exposed problems in the "complete" command, around determining the completion word point. First, the complete command has a too-simple approximation of what readline's TAB-completion code does to find the completion word point. Unfortunately, readline doesn't expose the functionality it uses internally, so to fix this this patch copies over the relevant code, and adjusts it a bit to better fit the use cases we need it for. (Specifically, our version avoids relying on the rl_word_break_characters, etc. globals, and instead takes those as arguments.) A following patch will want to use this function for TAB-completion too, but the "complete" command was a good excuse to split this to a separate patch. Then, notice how the complete_command does not call into the completer for the command being completed to determine the right set of word break characters. It always uses the default set. That is fixed by having the "complete" command call into complete_line_internal for a full handle_brkchars phase, just TAB-completion. gdb/ChangeLog: 2017-07-17 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (complete_command): Use a completion tracker along with completion_find_completion_word for handle_brkchars phase. * completer.c (RL_QF_SINGLE_QUOTE, RL_QF_DOUBLE_QUOTE) (RL_QF_BACKSLASH, RL_QF_OTHER_QUOTE): New. (struct gdb_rl_completion_word_info): New. (gdb_rl_find_completion_word): New. (completion_find_completion_word): New. * completer.h (completion_find_completion_word): Declare.
2017-07-17 16:30:59 +02:00
/* ARG_PREFIX and WORD are included in the output so that emacs
Add max-completions parameter, and implement tab-completion limiting. This commit adds a new exception, MAX_COMPLETIONS_REACHED_ERROR, to be thrown whenever the completer has generated too many candidates to be useful. A new user-settable variable, "max_completions", is added to control this behaviour. A top-level completion limit is added to complete_line_internal, as the final check to ensure the user never sees too many completions. An additional limit is added to default_make_symbol_completion_list_break_on, to halt time-consuming symbol table expansions. gdb/ChangeLog: PR cli/9007 PR cli/11920 PR cli/15548 * cli/cli-cmds.c (complete_command): Notify user if max-completions reached. * common/common-exceptions.h (enum errors) <MAX_COMPLETIONS_REACHED_ERROR>: New value. * completer.h (get_max_completions_reached_message): New declaration. (max_completions): Likewise. (completion_tracker_t): New typedef. (new_completion_tracker): New declaration. (make_cleanup_free_completion_tracker): Likewise. (maybe_add_completion_enum): New enum. (maybe_add_completion): New declaration. (throw_max_completions_reached_error): Likewise. * completer.c (max_completions): New global variable. (new_completion_tracker): New function. (free_completion_tracker): Likewise. (make_cleanup_free_completion_tracker): Likewise. (maybe_add_completions): Likewise. (throw_max_completions_reached_error): Likewise. (complete_line): Remove duplicates and limit result to max_completions entries. (get_max_completions_reached_message): New function. (gdb_display_match_list): Handle max_completions. (_initialize_completer): New declaration and function. * symtab.c: Include completer.h. (completion_tracker): New static variable. (completion_list_add_name): Call maybe_add_completion. (default_make_symbol_completion_list_break_on_1): Renamed from default_make_symbol_completion_list_break_on. Maintain completion_tracker across calls to completion_list_add_name. (default_make_symbol_completion_list_break_on): New function. * top.c (init_main): Set rl_completion_display_matches_hook. * tui/tui-io.c: Include completer.h. (tui_old_rl_display_matches_hook): New static global. (tui_rl_display_match_list): Notify user if max-completions reached. (tui_setup_io): Save/restore rl_completion_display_matches_hook. * NEWS (New Options): Mention set/show max-completions. gdb/doc/ChangeLog: * gdb.texinfo (Command Completion): Document new "set/show max-completions" option. gdb/testsuite/ChangeLog: * gdb.base/completion.exp: Disable completion limiting for existing tests. Add new tests to check completion limiting. * gdb.linespec/ls-errs.exp: Disable completion limiting.
2015-02-01 00:07:22 +01:00
will include the message in the output. */
printf_unfiltered (_("%s%s %s\n"),
"complete" command and completion word break characters The linespec/locations/completer testcase added later in the series tests every completion with both TAB completion and the "complete" command. This exposed problems in the "complete" command, around determining the completion word point. First, the complete command has a too-simple approximation of what readline's TAB-completion code does to find the completion word point. Unfortunately, readline doesn't expose the functionality it uses internally, so to fix this this patch copies over the relevant code, and adjusts it a bit to better fit the use cases we need it for. (Specifically, our version avoids relying on the rl_word_break_characters, etc. globals, and instead takes those as arguments.) A following patch will want to use this function for TAB-completion too, but the "complete" command was a good excuse to split this to a separate patch. Then, notice how the complete_command does not call into the completer for the command being completed to determine the right set of word break characters. It always uses the default set. That is fixed by having the "complete" command call into complete_line_internal for a full handle_brkchars phase, just TAB-completion. gdb/ChangeLog: 2017-07-17 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (complete_command): Use a completion tracker along with completion_find_completion_word for handle_brkchars phase. * completer.c (RL_QF_SINGLE_QUOTE, RL_QF_DOUBLE_QUOTE) (RL_QF_BACKSLASH, RL_QF_OTHER_QUOTE): New. (struct gdb_rl_completion_word_info): New. (gdb_rl_find_completion_word): New. (completion_find_completion_word): New. * completer.h (completion_find_completion_word): Declare.
2017-07-17 16:30:59 +02:00
arg_prefix.c_str (), word,
Add max-completions parameter, and implement tab-completion limiting. This commit adds a new exception, MAX_COMPLETIONS_REACHED_ERROR, to be thrown whenever the completer has generated too many candidates to be useful. A new user-settable variable, "max_completions", is added to control this behaviour. A top-level completion limit is added to complete_line_internal, as the final check to ensure the user never sees too many completions. An additional limit is added to default_make_symbol_completion_list_break_on, to halt time-consuming symbol table expansions. gdb/ChangeLog: PR cli/9007 PR cli/11920 PR cli/15548 * cli/cli-cmds.c (complete_command): Notify user if max-completions reached. * common/common-exceptions.h (enum errors) <MAX_COMPLETIONS_REACHED_ERROR>: New value. * completer.h (get_max_completions_reached_message): New declaration. (max_completions): Likewise. (completion_tracker_t): New typedef. (new_completion_tracker): New declaration. (make_cleanup_free_completion_tracker): Likewise. (maybe_add_completion_enum): New enum. (maybe_add_completion): New declaration. (throw_max_completions_reached_error): Likewise. * completer.c (max_completions): New global variable. (new_completion_tracker): New function. (free_completion_tracker): Likewise. (make_cleanup_free_completion_tracker): Likewise. (maybe_add_completions): Likewise. (throw_max_completions_reached_error): Likewise. (complete_line): Remove duplicates and limit result to max_completions entries. (get_max_completions_reached_message): New function. (gdb_display_match_list): Handle max_completions. (_initialize_completer): New declaration and function. * symtab.c: Include completer.h. (completion_tracker): New static variable. (completion_list_add_name): Call maybe_add_completion. (default_make_symbol_completion_list_break_on_1): Renamed from default_make_symbol_completion_list_break_on. Maintain completion_tracker across calls to completion_list_add_name. (default_make_symbol_completion_list_break_on): New function. * top.c (init_main): Set rl_completion_display_matches_hook. * tui/tui-io.c: Include completer.h. (tui_old_rl_display_matches_hook): New static global. (tui_rl_display_match_list): Notify user if max-completions reached. (tui_setup_io): Save/restore rl_completion_display_matches_hook. * NEWS (New Options): Mention set/show max-completions. gdb/doc/ChangeLog: * gdb.texinfo (Command Completion): Document new "set/show max-completions" option. gdb/testsuite/ChangeLog: * gdb.base/completion.exp: Disable completion limiting for existing tests. Add new tests to check completion limiting. * gdb.linespec/ls-errs.exp: Disable completion limiting.
2015-02-01 00:07:22 +01:00
get_max_completions_reached_message ());
}
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
}
}
int
is_complete_command (struct cmd_list_element *c)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
return cmd_cfunc_eq (c, complete_command);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
}
static void
show_version (const char *args, int from_tty)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
Remove some text from --version output I happened to notice recently that "gdb --version" says: GNU gdb (GDB) 8.0.50.20170911-git Copyright (C) 2017 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word". This is a bit on the wordy side, but also references interactive commands, which I think doesn't really make sense for --version. This patch removes some text from --version, while leaving it in the "show version" output. It also adds a newline between the URLs and the "For help, ..." text, because I thought that was easier to read. Finally, it indents one of the URLs, since that was simpler to read, but not the other URL, because the current format is specified by the GNU coding standards section on "--version". Now the --version output looks like: GNU gdb (GDB) 8.1.50.20180511-git Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Tested by the buildbot. gdb/ChangeLog 2018-06-05 Tom Tromey <tom@tromey.com> * cli/cli-cmds.c (show_version): Update. * top.c (print_gdb_version): Add "interactive" parameter. Update. * main.c (captured_main_1): Update. * top.h (print_gdb_version): Add "interactive" parameter and a comment. gdb/testsuite/ChangeLog 2018-06-05 Tom Tromey <tom@tromey.com> * gdb.base/default.exp: Update expected "show version" output.
2018-05-11 20:21:03 +02:00
print_gdb_version (gdb_stdout, true);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
printf_filtered ("\n");
}
static void
show_configuration (const char *args, int from_tty)
{
print_gdb_configuration (gdb_stdout);
}
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
/* Handle the quit command. */
void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
quit_command (const char *args, int from_tty)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
int exit_code = 0;
/* An optional expression may be used to cause gdb to terminate with
the value of that expression. */
if (args)
{
struct value *val = parse_and_eval (args);
exit_code = (int) value_as_long (val);
}
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
if (!quit_confirm ())
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Not confirmed."));
2010-01-06 21:31:28 +01:00
make -gdb-exit call disconnect_tracing too, and don't lose history if the target errors on "quit" Gareth mentions in PR gdb/15275: "The MI '-gdb-exit' command mi_cmd_gdb_exit() never calls disconnect_tracing() and therefore exits correctly." It should, so to get out of tfind mode, as quit may detach instead of kill, and we don't want to confuse the memory/register accesses etc. of the detach process. So we should push down the disconnect tracing bits at least to quit_force. But we can't as is, as that would swallow the error thrown by answering "no" to: Trace is running but will stop on detach; detach anyway? (y or n) So to address that, we split disconnect_tracing in two. One part that does the query, and another part that does the rest, and we make quit_force call the latter. Looking at quit_force, it does several things, some of which are a bit independent of the others. It first kills/detaches, and then writes history, and then runs the final cleanups. It seems better to me to do each of these things even if the previous thing throws. E.g., as is, if something throws while detaching, then we skip writing history. Tested on x86_64 Fedora 17. gdb/ 2013-04-10 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (quit_command): Call query_if_trace_running instead of disconnect_tracing. * infcmd.c (detach_command, disconnect_command): Call query_if_trace_running. Adjust. * top.c: Include "tracepoint.h". (quit_target): Delete. Contents moved ... (quit_force): ... here. Wrap each stage of teardown in TRY_CATCH. Call disconnect_tracing before detaching.
2013-04-10 16:10:35 +02:00
query_if_trace_running (from_tty);
2010-01-06 21:31:28 +01:00
quit_force (args ? &exit_code : NULL, from_tty);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
}
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
pwd_command (const char *args, int from_tty)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
if (args)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("The \"pwd\" command does not take an argument: %s"), args);
gdb::unique_xmalloc_ptr<char> cwd (getcwd (NULL, 0));
if (cwd == NULL)
error (_("Error finding name of working directory: %s"),
safe_strerror (errno));
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
if (strcmp (cwd.get (), current_directory) != 0)
printf_unfiltered (_("Working directory %ps\n (canonically %ps).\n"),
styled_string (file_name_style.style (),
current_directory),
styled_string (file_name_style.style (), cwd.get ()));
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
else
printf_unfiltered (_("Working directory %ps.\n"),
styled_string (file_name_style.style (),
current_directory));
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
}
void
cd_command (const char *dir, int from_tty)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
int len;
/* Found something other than leading repetitions of "/..". */
int found_real_path;
char *p;
/* If the new directory is absolute, repeat is a no-op; if relative,
repeat might be useful but is more likely to be a mistake. */
dont_repeat ();
gdb::unique_xmalloc_ptr<char> dir_holder
(tilde_expand (dir != NULL ? dir : "~"));
dir = dir_holder.get ();
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
if (chdir (dir) < 0)
perror_with_name (dir);
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
/* There's too much mess with DOSish names like "d:", "d:.",
"d:./foo" etc. Instead of having lots of special #ifdef'ed code,
simply get the canonicalized name of the current directory. */
gdb::unique_xmalloc_ptr<char> cwd (getcwd (NULL, 0));
dir = cwd.get ();
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
#endif
len = strlen (dir);
if (IS_DIR_SEPARATOR (dir[len - 1]))
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
/* Remove the trailing slash unless this is a root directory
(including a drive letter on non-Unix systems). */
if (!(len == 1) /* "/" */
#ifdef HAVE_DOS_BASED_FILE_SYSTEM
&& !(len == 3 && dir[1] == ':') /* "d:/" */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
#endif
)
len--;
}
dir_holder.reset (savestring (dir, len));
if (IS_ABSOLUTE_PATH (dir_holder.get ()))
{
xfree (current_directory);
current_directory = dir_holder.release ();
}
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
else
{
if (IS_DIR_SEPARATOR (current_directory[strlen (current_directory) - 1]))
current_directory = concat (current_directory, dir_holder.get (),
(char *) NULL);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
else
current_directory = concat (current_directory, SLASH_STRING,
dir_holder.get (), (char *) NULL);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
}
/* Now simplify any occurrences of `.' and `..' in the pathname. */
found_real_path = 0;
for (p = current_directory; *p;)
{
if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.'
&& (p[2] == 0 || IS_DIR_SEPARATOR (p[2])))
memmove (p, p + 2, strlen (p + 2) + 1);
else if (IS_DIR_SEPARATOR (p[0]) && p[1] == '.' && p[2] == '.'
&& (p[3] == 0 || IS_DIR_SEPARATOR (p[3])))
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
if (found_real_path)
{
/* Search backwards for the directory just before the "/.."
and obliterate it and the "/..". */
char *q = p;
while (q != current_directory && !IS_DIR_SEPARATOR (q[-1]))
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
--q;
if (q == current_directory)
/* current_directory is
a relative pathname ("can't happen"--leave it alone). */
++p;
else
{
memmove (q - 1, p + 3, strlen (p + 3) + 1);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
p = q - 1;
}
}
else
/* We are dealing with leading repetitions of "/..", for
example "/../..", which is the Mach super-root. */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
p += 3;
}
else
{
found_real_path = 1;
++p;
}
}
forget_cached_source_info ();
if (from_tty)
pwd_command ((char *) 0, 1);
}
/* Show the current value of the 'script-extension' option. */
static void
show_script_ext_mode (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
fprintf_filtered (file,
_("Script filename extension recognition is \"%s\".\n"),
value);
}
/* Try to open SCRIPT_FILE.
If successful, the full path name is stored in *FULL_PATHP,
and the stream is returned.
If not successful, return NULL; errno is set for the last file
we tried to open.
If SEARCH_PATH is non-zero, and the file isn't found in cwd,
gdb/ Replace xfullpath calls by gdb_realpath calls. * cli/cli-cmds.c (find_and_open_script): Remove xfullpath from the function comment. * dwarf2read.c (dw2_map_expand_apply): Remove parameter full_path. Remove it from the iterate_over_some_symtabs call. (dw2_map_symtabs_matching_filename): Remove parameter full_path. Remove it from the dw2_map_expand_apply calls, remove a block handling it. * psymtab.c (partial_map_expand_apply): Remove parameter full_path. Remove it from the iterate_over_some_symtabs call. (partial_map_symtabs_matching_filename): Remove parameter full_path. Remove it from the partial_map_expand_apply calls, remove a block handling it. Drop gdb_realpath call and cleanups from the real_path handling. * source.c (openp): Drop the comment part about xfullpath. Replace xfullpath calls by gdb_realpath calls. (find_and_open_source): Replace xfullpath call by gdb_realpath call. * symfile.h (struct quick_symbol_functions): Remove parameter full_path from method map_symtabs_matching_filename and its comment. * symmisc.c (maintenance_print_msymbols): Replace xfullpath call by gdb_realpath call. * symtab.c (iterate_over_some_symtabs): Remove parameter full_path, remove it also from the function comment, remove a block handling it. Drop gdb_realpath call and cleanups from the real_path handling. (iterate_over_symtabs): Drop variable full_path and its use. * symtab.h (iterate_over_some_symtabs): Remove parameter full_path. * utils.c (xfullpath): Remove. * utils.h (xfullpath): Remove. gdb/testsuite/ * gdb.gdb/xfullpath.exp: Replace xfullpath calls by gdb_realpath calls.
2013-02-03 16:54:18 +01:00
search for it in the source search path. */
gdb::optional<open_script>
find_and_open_script (const char *script_file, int search_path)
{
int fd;
openp_flags search_flags = OPF_TRY_CWD_FIRST | OPF_RETURN_REALPATH;
gdb::optional<open_script> opened;
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
gdb::unique_xmalloc_ptr<char> file (tilde_expand (script_file));
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
if (search_path)
search_flags |= OPF_SEARCH_IN_PATH;
/* Search for and open 'file' on the search path used for source
files. Put the full location in *FULL_PATHP. */
gdb::unique_xmalloc_ptr<char> full_path;
fd = openp (source_path, search_flags,
file.get (), O_RDONLY, &full_path);
if (fd == -1)
return opened;
FILE *result = fdopen (fd, FOPEN_RT);
if (result == NULL)
{
int save_errno = errno;
close (fd);
errno = save_errno;
}
else
opened.emplace (gdb_file_up (result), std::move (full_path));
return opened;
}
/* Load script FILE, which has already been opened as STREAM.
FILE_TO_OPEN is the form of FILE to use if one needs to open the file.
This is provided as FILE may have been found via the source search path.
An important thing to note here is that FILE may be a symlink to a file
with a different or non-existing suffix, and thus one cannot infer the
extension language from FILE_TO_OPEN. */
static void
source_script_from_stream (FILE *stream, const char *file,
const char *file_to_open)
{
Extension Language API * configure.ac (libpython checking): Remove all but python.o from CONFIG_OBS. Remove all but python.c from CONFIG_SRCS. * configure: Regenerate. * Makefile.in (SFILES): Add extension.c. (HFILES_NO_SRCDIR): Add extension.h, extension-priv.h (COMMON_OBS): Add extension.o. * extension.h: New file. * extension-priv.h: New file. * extension.c: New file. * python/python-internal.h: #include "extension.h". (gdbpy_auto_load_enabled): Declare. (gdbpy_apply_val_pretty_printer): Declare. (gdbpy_apply_frame_filter): Declare. (gdbpy_preserve_values): Declare. (gdbpy_breakpoint_cond_says_stop): Declare. (gdbpy_breakpoint_has_cond): Declare. (void source_python_script_for_objfile): Delete. * python/python.c: #include "extension-priv.h". Delete inclusion of "observer.h". (extension_language_python): Moved here and renamed from script_language_python in py-auto-load.c. Redefined to be of type extension_language_defn. (python_extension_script_ops): New global. (python_extension_ops): New global. (struct python_env): New member previous_active. (restore_python_env): Call restore_active_ext_lang. (ensure_python_env): Call set_active_ext_lang. (gdbpy_clear_quit_flag): Renamed from clear_quit_flag, made static. New arg extlang. (gdbpy_set_quit_flag): Renamed from set_quit_flag, made static. New arg extlang. (gdbpy_check_quit_flag): Renamed from check_quit_flag, made static. New arg extlang. (gdbpy_eval_from_control_command): Renamed from eval_python_from_control_command, made static. New arg extlang. (gdbpy_source_script) Renamed from source_python_script, made static. New arg extlang. (gdbpy_before_prompt_hook): Renamed from before_prompt_hook. Change result to int. New arg extlang. (gdbpy_source_objfile_script): Renamed from source_python_script_for_objfile, made static. New arg extlang. (gdbpy_start_type_printers): Renamed from start_type_printers, made static. New args extlang, extlang_printers. Change result type to "void". (gdbpy_apply_type_printers): Renamed from apply_type_printers, made static. New arg extlang. Rename arg printers to extlang_printers and change type to ext_lang_type_printers *. (gdbpy_free_type_printers): Renamed from free_type_printers, made static. Replace argument arg with extlang, extlang_printers. (!HAVE_PYTHON, eval_python_from_control_command): Delete. (!HAVE_PYTHON, source_python_script): Delete. (!HAVE_PYTHON, gdbpy_should_stop): Delete. (!HAVE_PYTHON, gdbpy_breakpoint_has_py_cond): Delete. (!HAVE_PYTHON, start_type_printers): Delete. (!HAVE_PYTHON, apply_type_printers): Delete. (!HAVE_PYTHON, free_type_printers): Delete. (_initialize_python): Delete call to observer_attach_before_prompt. (finalize_python): Set/restore active extension language. (gdbpy_finish_initialization) Renamed from finish_python_initialization, made static. New arg extlang. (gdbpy_initialized): New function. * python/python.h: #include "extension.h". Delete #include "value.h", "mi/mi-cmds.h". (extension_language_python): Declare. (GDBPY_AUTO_FILE_NAME): Delete. (enum py_bt_status): Moved to extension.h and renamed to ext_lang_bt_status. (enum frame_filter_flags): Moved to extension.h. (enum py_frame_args): Moved to extension.h and renamed to ext_lang_frame_args. (finish_python_initialization): Delete. (eval_python_from_control_command): Delete. (source_python_script): Delete. (apply_val_pretty_printer): Delete. (apply_frame_filter): Delete. (preserve_python_values): Delete. (gdbpy_script_language_defn): Delete. (gdbpy_should_stop, gdbpy_breakpoint_has_py_cond): Delete. (start_type_printers, apply_type_printers, free_type_printers): Delete. * auto-load.c: #include "extension.h". (GDB_AUTO_FILE_NAME): Delete. (auto_load_gdb_scripts_enabled): Make public. New arg extlang. (script_language_gdb): Delete, moved to extension.c and renamed to extension_language_gdb. (source_gdb_script_for_objfile): Delete. (auto_load_pspace_info): New member unsupported_script_warning_printed. (loaded_script): Change type of language member to struct extension_language_defn *. (init_loaded_scripts_info): Initialize unsupported_script_warning_printed. (maybe_add_script): Make static. Change type of language arg to struct extension_language_defn *. (clear_section_scripts): Reset unsupported_script_warning_printed. (auto_load_objfile_script_1): Rewrite to use extension language API. (auto_load_objfile_script): Make public. Remove support-compiled-in and auto-load-enabled checks, moved to auto_load_scripts_for_objfile. (source_section_scripts): Rewrite to use extension language API. (load_auto_scripts_for_objfile): Rewrite to use auto_load_scripts_for_objfile. (collect_matching_scripts_data): Change type of language member to struct extension_language_defn *. (auto_load_info_scripts): Change type of language arg to struct extension_language_defn *. (unsupported_script_warning_print): New function. (script_not_found_warning_print): Make static. (_initialize_auto_load): Rewrite construction of scripts-directory help. * auto-load.h (struct objfile): Add forward decl. (struct script_language): Delete. (struct auto_load_pspace_info): Add forward decl. (struct extension_language_defn): Add forward decl. (maybe_add_script): Delete. (auto_load_objfile_script): Declare. (script_not_found_warning_print): Delete. (auto_load_info_scripts): Update prototype. (auto_load_gdb_scripts_enabled): Declare. * python/py-auto-load.c (gdbpy_auto_load_enabled): Renamed from auto_load_python_scripts_enabled and made public. (script_language_python): Delete, moved to python.c. (gdbpy_script_language_defn): Delete. (info_auto_load_python_scripts): Update to use extension_language_python. * breakpoint.c (condition_command): Replace call to gdbpy_breakpoint_has_py_cond with call to get_breakpoint_cond_ext_lang. (bpstat_check_breakpoint_conditions): Replace call to gdbpy_should_stop with call to breakpoint_ext_lang_cond_says_stop. * python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Renamed from gdbpy_should_stop. Change result type to enum scr_bp_stop. New arg slang. Return SCR_BP_STOP_UNSET if py_bp_object is NULL. (gdbpy_breakpoint_has_cond): Renamed from gdbpy_breakpoint_has_py_cond. New arg slang. (local_setattro): Print name of extension language with existing stop condition. * valprint.c (val_print, value_print): Update to call apply_ext_lang_val_pretty_printer. * cp-valprint.c (cp_print_value): Update call to apply_ext_lang_val_pretty_printer. * python/py-prettyprint.c: Remove #ifdef HAVE_PYTHON. (gdbpy_apply_val_pretty_printer): Renamed from apply_val_pretty_printer. New arg extlang. (!HAVE_PYTHON, apply_val_pretty_printer): Delete. * cli/cli-cmds.c (source_script_from_stream): Rewrite to use extension language API. * cli/cli-script.c (execute_control_command): Update to call eval_ext_lang_from_control_command. * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Update to use enum ext_lang_bt_status values. Update call to apply_ext_lang_frame_filter. (mi_cmd_stack_list_locals): Ditto. (mi_cmd_stack_list_args): Ditto. (mi_cmd_stack_list_variables): Ditto. * mi/mi-main.c: Delete #include "python/python-internal.h". Add #include "extension.h". (mi_cmd_list_features): Replace reference to python internal variable gdb_python_initialized with call to ext_lang_initialized_p. * stack.c (backtrace_command_1): Update to use enum ext_lang_bt_status. Update to use enum ext_lang_frame_args. Update to call apply_ext_lang_frame_filter. * python/py-framefilter.c (extract_sym): Update to use enum ext_lang_bt_status. (extract_value, py_print_type, py_print_value): Ditto. (py_print_single_arg, enumerate_args, enumerate_locals): Ditto. (py_mi_print_variables, py_print_locals, py_print_args): Ditto. (py_print_frame): Ditto. (gdbpy_apply_frame_filter): Renamed from apply_frame_filter. New arg extlang. Update to use enum ext_lang_bt_status. * top.c (gdb_init): Delete #ifdef HAVE_PYTHON call to finish_python_initialization. Replace with call to finish_ext_lang_initialization. * typeprint.c (do_free_global_table): Update to call free_ext_lang_type_printers. (create_global_typedef_table): Update to call start_ext_lang_type_printers. (find_global_typedef): Update to call apply_ext_lang_type_printers. * typeprint.h (struct ext_lang_type_printers): Add forward decl. (type_print_options): Change type of global_printers from "void *" to "struct ext_lang_type_printers *". * value.c (preserve_values): Update to call preserve_ext_lang_values. * python/py-value.c: Remove #ifdef HAVE_PYTHON. (gdbpy_preserve_values): Renamed from preserve_python_values. New arg extlang. (!HAVE_PYTHON, preserve_python_values): Delete. * utils.c (quit_flag): Delete, moved to extension.c. (clear_quit_flag, set_quit_flag, check_quit_flag): Delete, moved to extension.c. * eval.c: Delete #include "python/python.h". * main.c: Delete #include "python/python.h". * defs.h: Update comment. testsuite/ * gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected output. * gdb.gdb/python-interrupts.exp: New file.
2014-02-06 04:27:58 +01:00
if (script_ext_mode != script_ext_off)
{
Extension Language API * configure.ac (libpython checking): Remove all but python.o from CONFIG_OBS. Remove all but python.c from CONFIG_SRCS. * configure: Regenerate. * Makefile.in (SFILES): Add extension.c. (HFILES_NO_SRCDIR): Add extension.h, extension-priv.h (COMMON_OBS): Add extension.o. * extension.h: New file. * extension-priv.h: New file. * extension.c: New file. * python/python-internal.h: #include "extension.h". (gdbpy_auto_load_enabled): Declare. (gdbpy_apply_val_pretty_printer): Declare. (gdbpy_apply_frame_filter): Declare. (gdbpy_preserve_values): Declare. (gdbpy_breakpoint_cond_says_stop): Declare. (gdbpy_breakpoint_has_cond): Declare. (void source_python_script_for_objfile): Delete. * python/python.c: #include "extension-priv.h". Delete inclusion of "observer.h". (extension_language_python): Moved here and renamed from script_language_python in py-auto-load.c. Redefined to be of type extension_language_defn. (python_extension_script_ops): New global. (python_extension_ops): New global. (struct python_env): New member previous_active. (restore_python_env): Call restore_active_ext_lang. (ensure_python_env): Call set_active_ext_lang. (gdbpy_clear_quit_flag): Renamed from clear_quit_flag, made static. New arg extlang. (gdbpy_set_quit_flag): Renamed from set_quit_flag, made static. New arg extlang. (gdbpy_check_quit_flag): Renamed from check_quit_flag, made static. New arg extlang. (gdbpy_eval_from_control_command): Renamed from eval_python_from_control_command, made static. New arg extlang. (gdbpy_source_script) Renamed from source_python_script, made static. New arg extlang. (gdbpy_before_prompt_hook): Renamed from before_prompt_hook. Change result to int. New arg extlang. (gdbpy_source_objfile_script): Renamed from source_python_script_for_objfile, made static. New arg extlang. (gdbpy_start_type_printers): Renamed from start_type_printers, made static. New args extlang, extlang_printers. Change result type to "void". (gdbpy_apply_type_printers): Renamed from apply_type_printers, made static. New arg extlang. Rename arg printers to extlang_printers and change type to ext_lang_type_printers *. (gdbpy_free_type_printers): Renamed from free_type_printers, made static. Replace argument arg with extlang, extlang_printers. (!HAVE_PYTHON, eval_python_from_control_command): Delete. (!HAVE_PYTHON, source_python_script): Delete. (!HAVE_PYTHON, gdbpy_should_stop): Delete. (!HAVE_PYTHON, gdbpy_breakpoint_has_py_cond): Delete. (!HAVE_PYTHON, start_type_printers): Delete. (!HAVE_PYTHON, apply_type_printers): Delete. (!HAVE_PYTHON, free_type_printers): Delete. (_initialize_python): Delete call to observer_attach_before_prompt. (finalize_python): Set/restore active extension language. (gdbpy_finish_initialization) Renamed from finish_python_initialization, made static. New arg extlang. (gdbpy_initialized): New function. * python/python.h: #include "extension.h". Delete #include "value.h", "mi/mi-cmds.h". (extension_language_python): Declare. (GDBPY_AUTO_FILE_NAME): Delete. (enum py_bt_status): Moved to extension.h and renamed to ext_lang_bt_status. (enum frame_filter_flags): Moved to extension.h. (enum py_frame_args): Moved to extension.h and renamed to ext_lang_frame_args. (finish_python_initialization): Delete. (eval_python_from_control_command): Delete. (source_python_script): Delete. (apply_val_pretty_printer): Delete. (apply_frame_filter): Delete. (preserve_python_values): Delete. (gdbpy_script_language_defn): Delete. (gdbpy_should_stop, gdbpy_breakpoint_has_py_cond): Delete. (start_type_printers, apply_type_printers, free_type_printers): Delete. * auto-load.c: #include "extension.h". (GDB_AUTO_FILE_NAME): Delete. (auto_load_gdb_scripts_enabled): Make public. New arg extlang. (script_language_gdb): Delete, moved to extension.c and renamed to extension_language_gdb. (source_gdb_script_for_objfile): Delete. (auto_load_pspace_info): New member unsupported_script_warning_printed. (loaded_script): Change type of language member to struct extension_language_defn *. (init_loaded_scripts_info): Initialize unsupported_script_warning_printed. (maybe_add_script): Make static. Change type of language arg to struct extension_language_defn *. (clear_section_scripts): Reset unsupported_script_warning_printed. (auto_load_objfile_script_1): Rewrite to use extension language API. (auto_load_objfile_script): Make public. Remove support-compiled-in and auto-load-enabled checks, moved to auto_load_scripts_for_objfile. (source_section_scripts): Rewrite to use extension language API. (load_auto_scripts_for_objfile): Rewrite to use auto_load_scripts_for_objfile. (collect_matching_scripts_data): Change type of language member to struct extension_language_defn *. (auto_load_info_scripts): Change type of language arg to struct extension_language_defn *. (unsupported_script_warning_print): New function. (script_not_found_warning_print): Make static. (_initialize_auto_load): Rewrite construction of scripts-directory help. * auto-load.h (struct objfile): Add forward decl. (struct script_language): Delete. (struct auto_load_pspace_info): Add forward decl. (struct extension_language_defn): Add forward decl. (maybe_add_script): Delete. (auto_load_objfile_script): Declare. (script_not_found_warning_print): Delete. (auto_load_info_scripts): Update prototype. (auto_load_gdb_scripts_enabled): Declare. * python/py-auto-load.c (gdbpy_auto_load_enabled): Renamed from auto_load_python_scripts_enabled and made public. (script_language_python): Delete, moved to python.c. (gdbpy_script_language_defn): Delete. (info_auto_load_python_scripts): Update to use extension_language_python. * breakpoint.c (condition_command): Replace call to gdbpy_breakpoint_has_py_cond with call to get_breakpoint_cond_ext_lang. (bpstat_check_breakpoint_conditions): Replace call to gdbpy_should_stop with call to breakpoint_ext_lang_cond_says_stop. * python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Renamed from gdbpy_should_stop. Change result type to enum scr_bp_stop. New arg slang. Return SCR_BP_STOP_UNSET if py_bp_object is NULL. (gdbpy_breakpoint_has_cond): Renamed from gdbpy_breakpoint_has_py_cond. New arg slang. (local_setattro): Print name of extension language with existing stop condition. * valprint.c (val_print, value_print): Update to call apply_ext_lang_val_pretty_printer. * cp-valprint.c (cp_print_value): Update call to apply_ext_lang_val_pretty_printer. * python/py-prettyprint.c: Remove #ifdef HAVE_PYTHON. (gdbpy_apply_val_pretty_printer): Renamed from apply_val_pretty_printer. New arg extlang. (!HAVE_PYTHON, apply_val_pretty_printer): Delete. * cli/cli-cmds.c (source_script_from_stream): Rewrite to use extension language API. * cli/cli-script.c (execute_control_command): Update to call eval_ext_lang_from_control_command. * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Update to use enum ext_lang_bt_status values. Update call to apply_ext_lang_frame_filter. (mi_cmd_stack_list_locals): Ditto. (mi_cmd_stack_list_args): Ditto. (mi_cmd_stack_list_variables): Ditto. * mi/mi-main.c: Delete #include "python/python-internal.h". Add #include "extension.h". (mi_cmd_list_features): Replace reference to python internal variable gdb_python_initialized with call to ext_lang_initialized_p. * stack.c (backtrace_command_1): Update to use enum ext_lang_bt_status. Update to use enum ext_lang_frame_args. Update to call apply_ext_lang_frame_filter. * python/py-framefilter.c (extract_sym): Update to use enum ext_lang_bt_status. (extract_value, py_print_type, py_print_value): Ditto. (py_print_single_arg, enumerate_args, enumerate_locals): Ditto. (py_mi_print_variables, py_print_locals, py_print_args): Ditto. (py_print_frame): Ditto. (gdbpy_apply_frame_filter): Renamed from apply_frame_filter. New arg extlang. Update to use enum ext_lang_bt_status. * top.c (gdb_init): Delete #ifdef HAVE_PYTHON call to finish_python_initialization. Replace with call to finish_ext_lang_initialization. * typeprint.c (do_free_global_table): Update to call free_ext_lang_type_printers. (create_global_typedef_table): Update to call start_ext_lang_type_printers. (find_global_typedef): Update to call apply_ext_lang_type_printers. * typeprint.h (struct ext_lang_type_printers): Add forward decl. (type_print_options): Change type of global_printers from "void *" to "struct ext_lang_type_printers *". * value.c (preserve_values): Update to call preserve_ext_lang_values. * python/py-value.c: Remove #ifdef HAVE_PYTHON. (gdbpy_preserve_values): Renamed from preserve_python_values. New arg extlang. (!HAVE_PYTHON, preserve_python_values): Delete. * utils.c (quit_flag): Delete, moved to extension.c. (clear_quit_flag, set_quit_flag, check_quit_flag): Delete, moved to extension.c. * eval.c: Delete #include "python/python.h". * main.c: Delete #include "python/python.h". * defs.h: Update comment. testsuite/ * gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected output. * gdb.gdb/python-interrupts.exp: New file.
2014-02-06 04:27:58 +01:00
const struct extension_language_defn *extlang
= get_ext_lang_of_file (file);
if (extlang != NULL)
{
Extension Language API * configure.ac (libpython checking): Remove all but python.o from CONFIG_OBS. Remove all but python.c from CONFIG_SRCS. * configure: Regenerate. * Makefile.in (SFILES): Add extension.c. (HFILES_NO_SRCDIR): Add extension.h, extension-priv.h (COMMON_OBS): Add extension.o. * extension.h: New file. * extension-priv.h: New file. * extension.c: New file. * python/python-internal.h: #include "extension.h". (gdbpy_auto_load_enabled): Declare. (gdbpy_apply_val_pretty_printer): Declare. (gdbpy_apply_frame_filter): Declare. (gdbpy_preserve_values): Declare. (gdbpy_breakpoint_cond_says_stop): Declare. (gdbpy_breakpoint_has_cond): Declare. (void source_python_script_for_objfile): Delete. * python/python.c: #include "extension-priv.h". Delete inclusion of "observer.h". (extension_language_python): Moved here and renamed from script_language_python in py-auto-load.c. Redefined to be of type extension_language_defn. (python_extension_script_ops): New global. (python_extension_ops): New global. (struct python_env): New member previous_active. (restore_python_env): Call restore_active_ext_lang. (ensure_python_env): Call set_active_ext_lang. (gdbpy_clear_quit_flag): Renamed from clear_quit_flag, made static. New arg extlang. (gdbpy_set_quit_flag): Renamed from set_quit_flag, made static. New arg extlang. (gdbpy_check_quit_flag): Renamed from check_quit_flag, made static. New arg extlang. (gdbpy_eval_from_control_command): Renamed from eval_python_from_control_command, made static. New arg extlang. (gdbpy_source_script) Renamed from source_python_script, made static. New arg extlang. (gdbpy_before_prompt_hook): Renamed from before_prompt_hook. Change result to int. New arg extlang. (gdbpy_source_objfile_script): Renamed from source_python_script_for_objfile, made static. New arg extlang. (gdbpy_start_type_printers): Renamed from start_type_printers, made static. New args extlang, extlang_printers. Change result type to "void". (gdbpy_apply_type_printers): Renamed from apply_type_printers, made static. New arg extlang. Rename arg printers to extlang_printers and change type to ext_lang_type_printers *. (gdbpy_free_type_printers): Renamed from free_type_printers, made static. Replace argument arg with extlang, extlang_printers. (!HAVE_PYTHON, eval_python_from_control_command): Delete. (!HAVE_PYTHON, source_python_script): Delete. (!HAVE_PYTHON, gdbpy_should_stop): Delete. (!HAVE_PYTHON, gdbpy_breakpoint_has_py_cond): Delete. (!HAVE_PYTHON, start_type_printers): Delete. (!HAVE_PYTHON, apply_type_printers): Delete. (!HAVE_PYTHON, free_type_printers): Delete. (_initialize_python): Delete call to observer_attach_before_prompt. (finalize_python): Set/restore active extension language. (gdbpy_finish_initialization) Renamed from finish_python_initialization, made static. New arg extlang. (gdbpy_initialized): New function. * python/python.h: #include "extension.h". Delete #include "value.h", "mi/mi-cmds.h". (extension_language_python): Declare. (GDBPY_AUTO_FILE_NAME): Delete. (enum py_bt_status): Moved to extension.h and renamed to ext_lang_bt_status. (enum frame_filter_flags): Moved to extension.h. (enum py_frame_args): Moved to extension.h and renamed to ext_lang_frame_args. (finish_python_initialization): Delete. (eval_python_from_control_command): Delete. (source_python_script): Delete. (apply_val_pretty_printer): Delete. (apply_frame_filter): Delete. (preserve_python_values): Delete. (gdbpy_script_language_defn): Delete. (gdbpy_should_stop, gdbpy_breakpoint_has_py_cond): Delete. (start_type_printers, apply_type_printers, free_type_printers): Delete. * auto-load.c: #include "extension.h". (GDB_AUTO_FILE_NAME): Delete. (auto_load_gdb_scripts_enabled): Make public. New arg extlang. (script_language_gdb): Delete, moved to extension.c and renamed to extension_language_gdb. (source_gdb_script_for_objfile): Delete. (auto_load_pspace_info): New member unsupported_script_warning_printed. (loaded_script): Change type of language member to struct extension_language_defn *. (init_loaded_scripts_info): Initialize unsupported_script_warning_printed. (maybe_add_script): Make static. Change type of language arg to struct extension_language_defn *. (clear_section_scripts): Reset unsupported_script_warning_printed. (auto_load_objfile_script_1): Rewrite to use extension language API. (auto_load_objfile_script): Make public. Remove support-compiled-in and auto-load-enabled checks, moved to auto_load_scripts_for_objfile. (source_section_scripts): Rewrite to use extension language API. (load_auto_scripts_for_objfile): Rewrite to use auto_load_scripts_for_objfile. (collect_matching_scripts_data): Change type of language member to struct extension_language_defn *. (auto_load_info_scripts): Change type of language arg to struct extension_language_defn *. (unsupported_script_warning_print): New function. (script_not_found_warning_print): Make static. (_initialize_auto_load): Rewrite construction of scripts-directory help. * auto-load.h (struct objfile): Add forward decl. (struct script_language): Delete. (struct auto_load_pspace_info): Add forward decl. (struct extension_language_defn): Add forward decl. (maybe_add_script): Delete. (auto_load_objfile_script): Declare. (script_not_found_warning_print): Delete. (auto_load_info_scripts): Update prototype. (auto_load_gdb_scripts_enabled): Declare. * python/py-auto-load.c (gdbpy_auto_load_enabled): Renamed from auto_load_python_scripts_enabled and made public. (script_language_python): Delete, moved to python.c. (gdbpy_script_language_defn): Delete. (info_auto_load_python_scripts): Update to use extension_language_python. * breakpoint.c (condition_command): Replace call to gdbpy_breakpoint_has_py_cond with call to get_breakpoint_cond_ext_lang. (bpstat_check_breakpoint_conditions): Replace call to gdbpy_should_stop with call to breakpoint_ext_lang_cond_says_stop. * python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Renamed from gdbpy_should_stop. Change result type to enum scr_bp_stop. New arg slang. Return SCR_BP_STOP_UNSET if py_bp_object is NULL. (gdbpy_breakpoint_has_cond): Renamed from gdbpy_breakpoint_has_py_cond. New arg slang. (local_setattro): Print name of extension language with existing stop condition. * valprint.c (val_print, value_print): Update to call apply_ext_lang_val_pretty_printer. * cp-valprint.c (cp_print_value): Update call to apply_ext_lang_val_pretty_printer. * python/py-prettyprint.c: Remove #ifdef HAVE_PYTHON. (gdbpy_apply_val_pretty_printer): Renamed from apply_val_pretty_printer. New arg extlang. (!HAVE_PYTHON, apply_val_pretty_printer): Delete. * cli/cli-cmds.c (source_script_from_stream): Rewrite to use extension language API. * cli/cli-script.c (execute_control_command): Update to call eval_ext_lang_from_control_command. * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Update to use enum ext_lang_bt_status values. Update call to apply_ext_lang_frame_filter. (mi_cmd_stack_list_locals): Ditto. (mi_cmd_stack_list_args): Ditto. (mi_cmd_stack_list_variables): Ditto. * mi/mi-main.c: Delete #include "python/python-internal.h". Add #include "extension.h". (mi_cmd_list_features): Replace reference to python internal variable gdb_python_initialized with call to ext_lang_initialized_p. * stack.c (backtrace_command_1): Update to use enum ext_lang_bt_status. Update to use enum ext_lang_frame_args. Update to call apply_ext_lang_frame_filter. * python/py-framefilter.c (extract_sym): Update to use enum ext_lang_bt_status. (extract_value, py_print_type, py_print_value): Ditto. (py_print_single_arg, enumerate_args, enumerate_locals): Ditto. (py_mi_print_variables, py_print_locals, py_print_args): Ditto. (py_print_frame): Ditto. (gdbpy_apply_frame_filter): Renamed from apply_frame_filter. New arg extlang. Update to use enum ext_lang_bt_status. * top.c (gdb_init): Delete #ifdef HAVE_PYTHON call to finish_python_initialization. Replace with call to finish_ext_lang_initialization. * typeprint.c (do_free_global_table): Update to call free_ext_lang_type_printers. (create_global_typedef_table): Update to call start_ext_lang_type_printers. (find_global_typedef): Update to call apply_ext_lang_type_printers. * typeprint.h (struct ext_lang_type_printers): Add forward decl. (type_print_options): Change type of global_printers from "void *" to "struct ext_lang_type_printers *". * value.c (preserve_values): Update to call preserve_ext_lang_values. * python/py-value.c: Remove #ifdef HAVE_PYTHON. (gdbpy_preserve_values): Renamed from preserve_python_values. New arg extlang. (!HAVE_PYTHON, preserve_python_values): Delete. * utils.c (quit_flag): Delete, moved to extension.c. (clear_quit_flag, set_quit_flag, check_quit_flag): Delete, moved to extension.c. * eval.c: Delete #include "python/python.h". * main.c: Delete #include "python/python.h". * defs.h: Update comment. testsuite/ * gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected output. * gdb.gdb/python-interrupts.exp: New file.
2014-02-06 04:27:58 +01:00
if (ext_lang_present_p (extlang))
{
script_sourcer_func *sourcer
= ext_lang_script_sourcer (extlang);
gdb_assert (sourcer != NULL);
sourcer (extlang, stream, file_to_open);
Extension Language API * configure.ac (libpython checking): Remove all but python.o from CONFIG_OBS. Remove all but python.c from CONFIG_SRCS. * configure: Regenerate. * Makefile.in (SFILES): Add extension.c. (HFILES_NO_SRCDIR): Add extension.h, extension-priv.h (COMMON_OBS): Add extension.o. * extension.h: New file. * extension-priv.h: New file. * extension.c: New file. * python/python-internal.h: #include "extension.h". (gdbpy_auto_load_enabled): Declare. (gdbpy_apply_val_pretty_printer): Declare. (gdbpy_apply_frame_filter): Declare. (gdbpy_preserve_values): Declare. (gdbpy_breakpoint_cond_says_stop): Declare. (gdbpy_breakpoint_has_cond): Declare. (void source_python_script_for_objfile): Delete. * python/python.c: #include "extension-priv.h". Delete inclusion of "observer.h". (extension_language_python): Moved here and renamed from script_language_python in py-auto-load.c. Redefined to be of type extension_language_defn. (python_extension_script_ops): New global. (python_extension_ops): New global. (struct python_env): New member previous_active. (restore_python_env): Call restore_active_ext_lang. (ensure_python_env): Call set_active_ext_lang. (gdbpy_clear_quit_flag): Renamed from clear_quit_flag, made static. New arg extlang. (gdbpy_set_quit_flag): Renamed from set_quit_flag, made static. New arg extlang. (gdbpy_check_quit_flag): Renamed from check_quit_flag, made static. New arg extlang. (gdbpy_eval_from_control_command): Renamed from eval_python_from_control_command, made static. New arg extlang. (gdbpy_source_script) Renamed from source_python_script, made static. New arg extlang. (gdbpy_before_prompt_hook): Renamed from before_prompt_hook. Change result to int. New arg extlang. (gdbpy_source_objfile_script): Renamed from source_python_script_for_objfile, made static. New arg extlang. (gdbpy_start_type_printers): Renamed from start_type_printers, made static. New args extlang, extlang_printers. Change result type to "void". (gdbpy_apply_type_printers): Renamed from apply_type_printers, made static. New arg extlang. Rename arg printers to extlang_printers and change type to ext_lang_type_printers *. (gdbpy_free_type_printers): Renamed from free_type_printers, made static. Replace argument arg with extlang, extlang_printers. (!HAVE_PYTHON, eval_python_from_control_command): Delete. (!HAVE_PYTHON, source_python_script): Delete. (!HAVE_PYTHON, gdbpy_should_stop): Delete. (!HAVE_PYTHON, gdbpy_breakpoint_has_py_cond): Delete. (!HAVE_PYTHON, start_type_printers): Delete. (!HAVE_PYTHON, apply_type_printers): Delete. (!HAVE_PYTHON, free_type_printers): Delete. (_initialize_python): Delete call to observer_attach_before_prompt. (finalize_python): Set/restore active extension language. (gdbpy_finish_initialization) Renamed from finish_python_initialization, made static. New arg extlang. (gdbpy_initialized): New function. * python/python.h: #include "extension.h". Delete #include "value.h", "mi/mi-cmds.h". (extension_language_python): Declare. (GDBPY_AUTO_FILE_NAME): Delete. (enum py_bt_status): Moved to extension.h and renamed to ext_lang_bt_status. (enum frame_filter_flags): Moved to extension.h. (enum py_frame_args): Moved to extension.h and renamed to ext_lang_frame_args. (finish_python_initialization): Delete. (eval_python_from_control_command): Delete. (source_python_script): Delete. (apply_val_pretty_printer): Delete. (apply_frame_filter): Delete. (preserve_python_values): Delete. (gdbpy_script_language_defn): Delete. (gdbpy_should_stop, gdbpy_breakpoint_has_py_cond): Delete. (start_type_printers, apply_type_printers, free_type_printers): Delete. * auto-load.c: #include "extension.h". (GDB_AUTO_FILE_NAME): Delete. (auto_load_gdb_scripts_enabled): Make public. New arg extlang. (script_language_gdb): Delete, moved to extension.c and renamed to extension_language_gdb. (source_gdb_script_for_objfile): Delete. (auto_load_pspace_info): New member unsupported_script_warning_printed. (loaded_script): Change type of language member to struct extension_language_defn *. (init_loaded_scripts_info): Initialize unsupported_script_warning_printed. (maybe_add_script): Make static. Change type of language arg to struct extension_language_defn *. (clear_section_scripts): Reset unsupported_script_warning_printed. (auto_load_objfile_script_1): Rewrite to use extension language API. (auto_load_objfile_script): Make public. Remove support-compiled-in and auto-load-enabled checks, moved to auto_load_scripts_for_objfile. (source_section_scripts): Rewrite to use extension language API. (load_auto_scripts_for_objfile): Rewrite to use auto_load_scripts_for_objfile. (collect_matching_scripts_data): Change type of language member to struct extension_language_defn *. (auto_load_info_scripts): Change type of language arg to struct extension_language_defn *. (unsupported_script_warning_print): New function. (script_not_found_warning_print): Make static. (_initialize_auto_load): Rewrite construction of scripts-directory help. * auto-load.h (struct objfile): Add forward decl. (struct script_language): Delete. (struct auto_load_pspace_info): Add forward decl. (struct extension_language_defn): Add forward decl. (maybe_add_script): Delete. (auto_load_objfile_script): Declare. (script_not_found_warning_print): Delete. (auto_load_info_scripts): Update prototype. (auto_load_gdb_scripts_enabled): Declare. * python/py-auto-load.c (gdbpy_auto_load_enabled): Renamed from auto_load_python_scripts_enabled and made public. (script_language_python): Delete, moved to python.c. (gdbpy_script_language_defn): Delete. (info_auto_load_python_scripts): Update to use extension_language_python. * breakpoint.c (condition_command): Replace call to gdbpy_breakpoint_has_py_cond with call to get_breakpoint_cond_ext_lang. (bpstat_check_breakpoint_conditions): Replace call to gdbpy_should_stop with call to breakpoint_ext_lang_cond_says_stop. * python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Renamed from gdbpy_should_stop. Change result type to enum scr_bp_stop. New arg slang. Return SCR_BP_STOP_UNSET if py_bp_object is NULL. (gdbpy_breakpoint_has_cond): Renamed from gdbpy_breakpoint_has_py_cond. New arg slang. (local_setattro): Print name of extension language with existing stop condition. * valprint.c (val_print, value_print): Update to call apply_ext_lang_val_pretty_printer. * cp-valprint.c (cp_print_value): Update call to apply_ext_lang_val_pretty_printer. * python/py-prettyprint.c: Remove #ifdef HAVE_PYTHON. (gdbpy_apply_val_pretty_printer): Renamed from apply_val_pretty_printer. New arg extlang. (!HAVE_PYTHON, apply_val_pretty_printer): Delete. * cli/cli-cmds.c (source_script_from_stream): Rewrite to use extension language API. * cli/cli-script.c (execute_control_command): Update to call eval_ext_lang_from_control_command. * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Update to use enum ext_lang_bt_status values. Update call to apply_ext_lang_frame_filter. (mi_cmd_stack_list_locals): Ditto. (mi_cmd_stack_list_args): Ditto. (mi_cmd_stack_list_variables): Ditto. * mi/mi-main.c: Delete #include "python/python-internal.h". Add #include "extension.h". (mi_cmd_list_features): Replace reference to python internal variable gdb_python_initialized with call to ext_lang_initialized_p. * stack.c (backtrace_command_1): Update to use enum ext_lang_bt_status. Update to use enum ext_lang_frame_args. Update to call apply_ext_lang_frame_filter. * python/py-framefilter.c (extract_sym): Update to use enum ext_lang_bt_status. (extract_value, py_print_type, py_print_value): Ditto. (py_print_single_arg, enumerate_args, enumerate_locals): Ditto. (py_mi_print_variables, py_print_locals, py_print_args): Ditto. (py_print_frame): Ditto. (gdbpy_apply_frame_filter): Renamed from apply_frame_filter. New arg extlang. Update to use enum ext_lang_bt_status. * top.c (gdb_init): Delete #ifdef HAVE_PYTHON call to finish_python_initialization. Replace with call to finish_ext_lang_initialization. * typeprint.c (do_free_global_table): Update to call free_ext_lang_type_printers. (create_global_typedef_table): Update to call start_ext_lang_type_printers. (find_global_typedef): Update to call apply_ext_lang_type_printers. * typeprint.h (struct ext_lang_type_printers): Add forward decl. (type_print_options): Change type of global_printers from "void *" to "struct ext_lang_type_printers *". * value.c (preserve_values): Update to call preserve_ext_lang_values. * python/py-value.c: Remove #ifdef HAVE_PYTHON. (gdbpy_preserve_values): Renamed from preserve_python_values. New arg extlang. (!HAVE_PYTHON, preserve_python_values): Delete. * utils.c (quit_flag): Delete, moved to extension.c. (clear_quit_flag, set_quit_flag, check_quit_flag): Delete, moved to extension.c. * eval.c: Delete #include "python/python.h". * main.c: Delete #include "python/python.h". * defs.h: Update comment. testsuite/ * gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected output. * gdb.gdb/python-interrupts.exp: New file.
2014-02-06 04:27:58 +01:00
return;
}
else if (script_ext_mode == script_ext_soft)
{
/* Assume the file is a gdb script.
This is handled below. */
}
else
throw_ext_lang_unsupported (extlang);
}
}
Extension Language API * configure.ac (libpython checking): Remove all but python.o from CONFIG_OBS. Remove all but python.c from CONFIG_SRCS. * configure: Regenerate. * Makefile.in (SFILES): Add extension.c. (HFILES_NO_SRCDIR): Add extension.h, extension-priv.h (COMMON_OBS): Add extension.o. * extension.h: New file. * extension-priv.h: New file. * extension.c: New file. * python/python-internal.h: #include "extension.h". (gdbpy_auto_load_enabled): Declare. (gdbpy_apply_val_pretty_printer): Declare. (gdbpy_apply_frame_filter): Declare. (gdbpy_preserve_values): Declare. (gdbpy_breakpoint_cond_says_stop): Declare. (gdbpy_breakpoint_has_cond): Declare. (void source_python_script_for_objfile): Delete. * python/python.c: #include "extension-priv.h". Delete inclusion of "observer.h". (extension_language_python): Moved here and renamed from script_language_python in py-auto-load.c. Redefined to be of type extension_language_defn. (python_extension_script_ops): New global. (python_extension_ops): New global. (struct python_env): New member previous_active. (restore_python_env): Call restore_active_ext_lang. (ensure_python_env): Call set_active_ext_lang. (gdbpy_clear_quit_flag): Renamed from clear_quit_flag, made static. New arg extlang. (gdbpy_set_quit_flag): Renamed from set_quit_flag, made static. New arg extlang. (gdbpy_check_quit_flag): Renamed from check_quit_flag, made static. New arg extlang. (gdbpy_eval_from_control_command): Renamed from eval_python_from_control_command, made static. New arg extlang. (gdbpy_source_script) Renamed from source_python_script, made static. New arg extlang. (gdbpy_before_prompt_hook): Renamed from before_prompt_hook. Change result to int. New arg extlang. (gdbpy_source_objfile_script): Renamed from source_python_script_for_objfile, made static. New arg extlang. (gdbpy_start_type_printers): Renamed from start_type_printers, made static. New args extlang, extlang_printers. Change result type to "void". (gdbpy_apply_type_printers): Renamed from apply_type_printers, made static. New arg extlang. Rename arg printers to extlang_printers and change type to ext_lang_type_printers *. (gdbpy_free_type_printers): Renamed from free_type_printers, made static. Replace argument arg with extlang, extlang_printers. (!HAVE_PYTHON, eval_python_from_control_command): Delete. (!HAVE_PYTHON, source_python_script): Delete. (!HAVE_PYTHON, gdbpy_should_stop): Delete. (!HAVE_PYTHON, gdbpy_breakpoint_has_py_cond): Delete. (!HAVE_PYTHON, start_type_printers): Delete. (!HAVE_PYTHON, apply_type_printers): Delete. (!HAVE_PYTHON, free_type_printers): Delete. (_initialize_python): Delete call to observer_attach_before_prompt. (finalize_python): Set/restore active extension language. (gdbpy_finish_initialization) Renamed from finish_python_initialization, made static. New arg extlang. (gdbpy_initialized): New function. * python/python.h: #include "extension.h". Delete #include "value.h", "mi/mi-cmds.h". (extension_language_python): Declare. (GDBPY_AUTO_FILE_NAME): Delete. (enum py_bt_status): Moved to extension.h and renamed to ext_lang_bt_status. (enum frame_filter_flags): Moved to extension.h. (enum py_frame_args): Moved to extension.h and renamed to ext_lang_frame_args. (finish_python_initialization): Delete. (eval_python_from_control_command): Delete. (source_python_script): Delete. (apply_val_pretty_printer): Delete. (apply_frame_filter): Delete. (preserve_python_values): Delete. (gdbpy_script_language_defn): Delete. (gdbpy_should_stop, gdbpy_breakpoint_has_py_cond): Delete. (start_type_printers, apply_type_printers, free_type_printers): Delete. * auto-load.c: #include "extension.h". (GDB_AUTO_FILE_NAME): Delete. (auto_load_gdb_scripts_enabled): Make public. New arg extlang. (script_language_gdb): Delete, moved to extension.c and renamed to extension_language_gdb. (source_gdb_script_for_objfile): Delete. (auto_load_pspace_info): New member unsupported_script_warning_printed. (loaded_script): Change type of language member to struct extension_language_defn *. (init_loaded_scripts_info): Initialize unsupported_script_warning_printed. (maybe_add_script): Make static. Change type of language arg to struct extension_language_defn *. (clear_section_scripts): Reset unsupported_script_warning_printed. (auto_load_objfile_script_1): Rewrite to use extension language API. (auto_load_objfile_script): Make public. Remove support-compiled-in and auto-load-enabled checks, moved to auto_load_scripts_for_objfile. (source_section_scripts): Rewrite to use extension language API. (load_auto_scripts_for_objfile): Rewrite to use auto_load_scripts_for_objfile. (collect_matching_scripts_data): Change type of language member to struct extension_language_defn *. (auto_load_info_scripts): Change type of language arg to struct extension_language_defn *. (unsupported_script_warning_print): New function. (script_not_found_warning_print): Make static. (_initialize_auto_load): Rewrite construction of scripts-directory help. * auto-load.h (struct objfile): Add forward decl. (struct script_language): Delete. (struct auto_load_pspace_info): Add forward decl. (struct extension_language_defn): Add forward decl. (maybe_add_script): Delete. (auto_load_objfile_script): Declare. (script_not_found_warning_print): Delete. (auto_load_info_scripts): Update prototype. (auto_load_gdb_scripts_enabled): Declare. * python/py-auto-load.c (gdbpy_auto_load_enabled): Renamed from auto_load_python_scripts_enabled and made public. (script_language_python): Delete, moved to python.c. (gdbpy_script_language_defn): Delete. (info_auto_load_python_scripts): Update to use extension_language_python. * breakpoint.c (condition_command): Replace call to gdbpy_breakpoint_has_py_cond with call to get_breakpoint_cond_ext_lang. (bpstat_check_breakpoint_conditions): Replace call to gdbpy_should_stop with call to breakpoint_ext_lang_cond_says_stop. * python/py-breakpoint.c (gdbpy_breakpoint_cond_says_stop): Renamed from gdbpy_should_stop. Change result type to enum scr_bp_stop. New arg slang. Return SCR_BP_STOP_UNSET if py_bp_object is NULL. (gdbpy_breakpoint_has_cond): Renamed from gdbpy_breakpoint_has_py_cond. New arg slang. (local_setattro): Print name of extension language with existing stop condition. * valprint.c (val_print, value_print): Update to call apply_ext_lang_val_pretty_printer. * cp-valprint.c (cp_print_value): Update call to apply_ext_lang_val_pretty_printer. * python/py-prettyprint.c: Remove #ifdef HAVE_PYTHON. (gdbpy_apply_val_pretty_printer): Renamed from apply_val_pretty_printer. New arg extlang. (!HAVE_PYTHON, apply_val_pretty_printer): Delete. * cli/cli-cmds.c (source_script_from_stream): Rewrite to use extension language API. * cli/cli-script.c (execute_control_command): Update to call eval_ext_lang_from_control_command. * mi/mi-cmd-stack.c (mi_cmd_stack_list_frames): Update to use enum ext_lang_bt_status values. Update call to apply_ext_lang_frame_filter. (mi_cmd_stack_list_locals): Ditto. (mi_cmd_stack_list_args): Ditto. (mi_cmd_stack_list_variables): Ditto. * mi/mi-main.c: Delete #include "python/python-internal.h". Add #include "extension.h". (mi_cmd_list_features): Replace reference to python internal variable gdb_python_initialized with call to ext_lang_initialized_p. * stack.c (backtrace_command_1): Update to use enum ext_lang_bt_status. Update to use enum ext_lang_frame_args. Update to call apply_ext_lang_frame_filter. * python/py-framefilter.c (extract_sym): Update to use enum ext_lang_bt_status. (extract_value, py_print_type, py_print_value): Ditto. (py_print_single_arg, enumerate_args, enumerate_locals): Ditto. (py_mi_print_variables, py_print_locals, py_print_args): Ditto. (py_print_frame): Ditto. (gdbpy_apply_frame_filter): Renamed from apply_frame_filter. New arg extlang. Update to use enum ext_lang_bt_status. * top.c (gdb_init): Delete #ifdef HAVE_PYTHON call to finish_python_initialization. Replace with call to finish_ext_lang_initialization. * typeprint.c (do_free_global_table): Update to call free_ext_lang_type_printers. (create_global_typedef_table): Update to call start_ext_lang_type_printers. (find_global_typedef): Update to call apply_ext_lang_type_printers. * typeprint.h (struct ext_lang_type_printers): Add forward decl. (type_print_options): Change type of global_printers from "void *" to "struct ext_lang_type_printers *". * value.c (preserve_values): Update to call preserve_ext_lang_values. * python/py-value.c: Remove #ifdef HAVE_PYTHON. (gdbpy_preserve_values): Renamed from preserve_python_values. New arg extlang. (!HAVE_PYTHON, preserve_python_values): Delete. * utils.c (quit_flag): Delete, moved to extension.c. (clear_quit_flag, set_quit_flag, check_quit_flag): Delete, moved to extension.c. * eval.c: Delete #include "python/python.h". * main.c: Delete #include "python/python.h". * defs.h: Update comment. testsuite/ * gdb.python/py-breakpoint.exp (test_bkpt_eval_funcs): Update expected output. * gdb.gdb/python-interrupts.exp: New file.
2014-02-06 04:27:58 +01:00
script_from_file (stream, file);
}
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
/* Worker to perform the "source" command.
Load script FILE.
If SEARCH_PATH is non-zero, and the file isn't found in cwd,
search for it in the source search path. */
static void
source_script_with_search (const char *file, int from_tty, int search_path)
{
if (file == NULL || *file == 0)
error (_("source command requires file name of file to source."));
gdb::optional<open_script> opened = find_and_open_script (file, search_path);
if (!opened)
{
/* The script wasn't found, or was otherwise inaccessible.
If the source command was invoked interactively, throw an
error. Otherwise (e.g. if it was invoked by a script),
just emit a warning, rather than cause an error. */
if (from_tty)
perror_with_name (file);
else
{
perror_warning_with_name (file);
return;
}
}
/* The python support reopens the file, so we need to pass full_path here
in case the file was found on the search path. It's useful to do this
anyway so that error messages show the actual file used. But only do
this if we (may have) used search_path, as printing the full path in
errors for the non-search case can be more noise than signal. */
source_script_from_stream (opened->stream.get (), file,
search_path ? opened->full_path.get () : file);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
}
/* Wrapper around source_script_with_search to export it to main.c
for use in loading .gdbinit scripts. */
void
source_script (const char *file, int from_tty)
{
source_script_with_search (file, from_tty, 0);
}
2006-07-21 16:46:56 +02:00
static void
source_command (const char *args, int from_tty)
2006-07-21 16:46:56 +02:00
{
const char *file = args;
int search_path = 0;
2006-07-21 16:46:56 +02:00
scoped_restore save_source_verbose = make_scoped_restore (&source_verbose);
2006-07-21 16:46:56 +02:00
/* -v causes the source command to run in verbose mode.
-s causes the file to be searched in the source search path,
even if the file name contains a '/'.
2006-07-21 16:46:56 +02:00
We still have to be able to handle filenames with spaces in a
backward compatible way, so buildargv is not appropriate. */
if (args)
{
while (args[0] != '\0')
2006-07-21 16:46:56 +02:00
{
/* Make sure leading white space does not break the
comparisons. */
* breakpoint.c (catch_syscall_split_args): Use skip_spaces. (trace_pass_command): Likewise. * cli/cli-cmds.c: Include cli/cli-utils.h. (source_command): Use skip-spaces. (disassemble_command): Likewise. * findcmd.c: Include cli/cli-utils.h. (parse_find_args): Use skip_spaces. * go32-nat.c: Include cli/cli-utils.h. (go32_sldt): Use skip_spaces. (go32_sgdt): Likewise. (go32_sidt): Likewise. (go32_pde): Likewise. (go32_pte): Likewise. (go32_pte_for_address): Likewise. * infcmd.c: Include cli/cli-utils.h. (registers_info): Use skip_spaces. * linux-tdep.c (read_mapping): Use skip_spaces_const. (linux_info_proc): Likewise. * linux-thread-db.c: Include cli/cli-utils.h. (info_auto_load_libthread_db): Use skip_spaces_const. * m32r-rom.c: Include cli/cli-utils.h. (m32r_upload_command): Use skip_spaces. * maint.c: Include cli/cli-utils.h. (maintenance_translate_address): Use skip_spaces. * mi/mi-parse.c: Include cli/cli-utils.h. (mi_parse_argv): Use skip_spaces. (mi_parse): Likewise. * minsyms.c: Include cli/cli-utils.h. (msymbol_hash_iw): Use skip_spaces_const. * objc-lang.c: Include cli/cli-utils.h. (parse_selector): Use skip_spaces. (parse_method): Likewise. * python/python.c: Include cli/cli-utils.h. (python_interactive_command)[HAVE_PYTHON]: Use skip_spaces. (python_command)[HAVE_PYTHON]: Likewise. (python_interactive_command)[!HAVE_PYTHON]: Likewise. * remote-m32r-sdi.c: Include cli/cli-utils.h. (m32r_load): Use skip_spaces. * serial.c: Include cli/cli-utils.h. (serial_open): Use skip_spaces_const. * stack.c: Include cli/cli-utils.h. (parse_frame_specification_1): Use skip_spaces_const. * symfile.c: Include cli/cli-utils.h. (set_ext_lang_command): Use skip_spaces. * symtab.c: Include cli/cli-utils.h. (rbreak_command): Use skip_spaces. * thread.c (thread_name_command): Use skip_spaces. * tracepoint.c (validate_actionline): Use skip_spaces. (encode_actions_1): Likewise. (trace_find_range_command): Likewise. (trace_find_outside_command): Likewise. (trace_dump_actions): Likewise.
2013-03-07 22:57:30 +01:00
args = skip_spaces (args);
if (args[0] != '-')
break;
if (args[1] == 'v' && isspace (args[2]))
{
source_verbose = 1;
/* Skip passed -v. */
args = &args[3];
}
else if (args[1] == 's' && isspace (args[2]))
{
search_path = 1;
2006-07-21 16:46:56 +02:00
/* Skip passed -s. */
args = &args[3];
}
else
break;
2006-07-21 16:46:56 +02:00
}
* breakpoint.c (catch_syscall_split_args): Use skip_spaces. (trace_pass_command): Likewise. * cli/cli-cmds.c: Include cli/cli-utils.h. (source_command): Use skip-spaces. (disassemble_command): Likewise. * findcmd.c: Include cli/cli-utils.h. (parse_find_args): Use skip_spaces. * go32-nat.c: Include cli/cli-utils.h. (go32_sldt): Use skip_spaces. (go32_sgdt): Likewise. (go32_sidt): Likewise. (go32_pde): Likewise. (go32_pte): Likewise. (go32_pte_for_address): Likewise. * infcmd.c: Include cli/cli-utils.h. (registers_info): Use skip_spaces. * linux-tdep.c (read_mapping): Use skip_spaces_const. (linux_info_proc): Likewise. * linux-thread-db.c: Include cli/cli-utils.h. (info_auto_load_libthread_db): Use skip_spaces_const. * m32r-rom.c: Include cli/cli-utils.h. (m32r_upload_command): Use skip_spaces. * maint.c: Include cli/cli-utils.h. (maintenance_translate_address): Use skip_spaces. * mi/mi-parse.c: Include cli/cli-utils.h. (mi_parse_argv): Use skip_spaces. (mi_parse): Likewise. * minsyms.c: Include cli/cli-utils.h. (msymbol_hash_iw): Use skip_spaces_const. * objc-lang.c: Include cli/cli-utils.h. (parse_selector): Use skip_spaces. (parse_method): Likewise. * python/python.c: Include cli/cli-utils.h. (python_interactive_command)[HAVE_PYTHON]: Use skip_spaces. (python_command)[HAVE_PYTHON]: Likewise. (python_interactive_command)[!HAVE_PYTHON]: Likewise. * remote-m32r-sdi.c: Include cli/cli-utils.h. (m32r_load): Use skip_spaces. * serial.c: Include cli/cli-utils.h. (serial_open): Use skip_spaces_const. * stack.c: Include cli/cli-utils.h. (parse_frame_specification_1): Use skip_spaces_const. * symfile.c: Include cli/cli-utils.h. (set_ext_lang_command): Use skip_spaces. * symtab.c: Include cli/cli-utils.h. (rbreak_command): Use skip_spaces. * thread.c (thread_name_command): Use skip_spaces. * tracepoint.c (validate_actionline): Use skip_spaces. (encode_actions_1): Likewise. (trace_find_range_command): Likewise. (trace_find_outside_command): Likewise. (trace_dump_actions): Likewise.
2013-03-07 22:57:30 +01:00
file = skip_spaces (args);
2006-07-21 16:46:56 +02:00
}
source_script_with_search (file, from_tty, search_path);
2006-07-21 16:46:56 +02:00
}
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
echo_command (const char *text, int from_tty)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
const char *p = text;
int c;
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
if (text)
while ((c = *p++) != '\0')
{
if (c == '\\')
{
/* \ at end of argument is used after spaces
so they won't be lost. */
if (*p == 0)
return;
gdb 2010-03-05 Corinna Vinschen <vinschen@redhat.com> Tom Tromey <tromey@redhat.com> * utils.c (host_char_to_target): Add 'gdbarch' argument. (parse_escape): Likewise. * python/py-utils.c (unicode_to_target_string): Update. (unicode_to_target_python_string): Update. (target_string_to_unicode): Update. * printcmd.c (printf_command): Update. * p-exp.y (yylex): Update. * objc-exp.y (yylex): Update. * mi/mi-parse.c: Include charset.h. (mi_parse_escape): New function. (mi_parse_argv): Use it. * jv-exp.y (yylex): Update. * i386-cygwin-tdep.c (i386_cygwin_auto_wide_charset): New function. (i386_cygwin_init_abi): Call set_gdbarch_auto_wide_charset. * gdbarch.sh (auto_charset, auto_wide_charset): New. * gdbarch.c: Rebuild. * gdbarch.h: Rebuild. * defs.h (parse_escape): Update. * cli/cli-setshow.c: Include arch-utils.h. (do_setshow_command): Update. * cli/cli-cmds.c (echo_command): Update. * charset.h (target_charset, target_wide_charset): Update. * charset.c: Include arch-utils.h. (target_charset_name): Default to "auto". (target_wide_charset_name): Likewise. (show_target_charset_name): Handle "auto". (show_target_wide_charset_name): Likewise. (be_le_arch): New global. (set_be_le_names): Add 'gdbarch' argument. (validate): Likewise. Don't call set_be_le_names. (set_charset_sfunc, set_host_charset_sfunc) (set_target_charset_sfunc, set_target_wide_charset_sfunc): Update. (target_charset): Add 'gdbarch' argument. (target_wide_charset): Likewise. Remove 'byte_order' argument. (auto_target_charset_name): New global. (default_auto_charset, default_auto_wide_charset): New functions. (_initialize_charset): Set auto_target_charset_name. Allow "auto" for target charsets. Copy result of nl_langinfo. Use GetACP if USE_WIN32API. * c-lang.c (charset_for_string_type): Add 'gdbarch' argument, remove 'byte_order' argument. Update. (classify_type): Likewise. (c_emit_char): Update. (c_printchar): Update. (c_printstr): Update. (c_get_string): Update. (evaluate_subexp_c): Update. * arch-utils.h (default_auto_charset, default_auto_wide_charset): Declare. * python/python.c (gdbpy_target_charset): New function. (gdbpy_target_wide_charset): Likewise. (GdbMethods): Update. * NEWS: Update. gdb/doc * gdb.texinfo (Basic Python): Document target_charset and target_wide_charset. gdb/testsuite * gdb.python/py-prettyprint.py (pp_nullstr.to_string): Use gdb.target_charset. (pp_ns.to_string): Likewise.
2010-03-05 21:18:19 +01:00
c = parse_escape (get_current_arch (), &p);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
if (c >= 0)
printf_filtered ("%c", c);
}
else
printf_filtered ("%c", c);
}
reset_terminal_style (gdb_stdout);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
/* Force this output to appear now. */
wrap_here ("");
gdb_flush (gdb_stdout);
}
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
/* Sets the last launched shell command convenience variables based on
EXIT_STATUS. */
static void
exit_status_set_internal_vars (int exit_status)
{
struct internalvar *var_code = lookup_internalvar ("_shell_exitcode");
struct internalvar *var_signal = lookup_internalvar ("_shell_exitsignal");
clear_internalvar (var_code);
clear_internalvar (var_signal);
if (WIFEXITED (exit_status))
set_internalvar_integer (var_code, WEXITSTATUS (exit_status));
Improve process exit status macros on MinGW When a Windows program is terminated by a fatal exception, its exit code is the value of that exception, as defined by the various EXCEPTION_* symbols in the Windows API headers. This commit emulates WTERMSIG etc. by translating the fatal exception codes to more-or-less equivalent Posix signals. gdb/ChangeLog: 2020-01-06 Eli Zaretskii <eliz@gnu.org> Pedro Alves <palves@redhat.com> * Makefile.in (COMMON_SFILES): Add gdbsupport/gdb_wait.c. * windows-tdep.c: New enumeration of WINDOWS_SIG* signals. (windows_gdb_signal_to_target): New function, uses the above enumeration to convert GDB internal signal codes to equivalent Windows codes. (windows_init_abi): Call set_gdbarch_gdb_signal_to_target. * windows-nat.c: Include "gdb_wait.h". (get_windows_debug_event): Extract the fatal exception from the exit status and convert to the equivalent Posix signal number. * cli/cli-cmds.c (exit_status_set_internal_vars): Account for the possibility that WTERMSIG returns GDB_SIGNAL_UNKNOWN. * gdbsupport/gdb_wait.c: New file, implements windows_status_to_termsig. * gdbsupport/gdb_wait.h (WIFEXITED, WIFSIGNALED, WEXITSTATUS) (WTERMSIG) [__MINGW32__]: Separate definitions for MinGW. gdb/gdbserver/ChangeLog: 2020-01-06 Eli Zaretskii <eliz@gnu.org> Pedro Alves <palves@redhat.com> * win32-low.c (get_child_debug_event): Extract the fatal exception from the exit status and convert to the equivalent Posix signal number. (win32_wait): Allow TARGET_WAITKIND_SIGNALLED status as well. * Makefile.in (OBS, SFILES): Add gdb_wait.[co].
2020-01-06 12:51:54 +01:00
#ifdef __MINGW32__
else if (WIFSIGNALED (exit_status) && WTERMSIG (exit_status) == -1)
{
/* The -1 condition can happen on MinGW, if we don't recognize
the fatal exception code encoded in the exit status; see
gdbsupport/gdb_wait.c. We don't want to lose information in
the exit status in that case. Record it as a normal exit
with the full exit status, including the higher 0xC0000000
bits. */
set_internalvar_integer (var_code, exit_status);
}
#endif
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
else if (WIFSIGNALED (exit_status))
set_internalvar_integer (var_signal, WTERMSIG (exit_status));
else
Remove newlines from warnings ARI pointed out that a recent patch introduced a call to "warning" with a string that ended in a newline: https://sourceware.org/ml/gdb-patches/2019-06/msg00000.html This is generally forbidden, I believe, because warning adds its own newline. This patch removes all of the trailing newlines I was able to find. I searched for 'warning (.*\\n"' and then fixed the ones where the newline appeared at the end of the string (some had internal newlines). Tested on x86-64 Fedora 29. gdb/ChangeLog 2019-06-10 Tom Tromey <tromey@adacore.com> * m32c-tdep.c (m32c_m16c_address_to_pointer): Don't end warning with a newline. * guile/guile.c (handle_boot_error): Don't end warning with a newline. * cli/cli-cmds.c (exit_status_set_internal_vars): Don't end warning with a newline. * s12z-tdep.c (s12z_skip_prologue): Don't end warning with a newline. (s12z_frame_cache): Likewise. * dwarf-index-cache.c (index_cache::store): Don't end warning with a newline. * solib-svr4.c (disable_probes_interface): Don't end warning with a newline. * nat/fork-inferior.c (fork_inferior): Don't end warning with a newline. * python/python.c (do_finish_initialization): Don't end warning with a newline. gdb/gdbserver/ChangeLog 2019-06-10 Tom Tromey <tromey@adacore.com> * remote-utils.c (look_up_one_symbol, relocate_instruction): Don't end warning with a newline. * linux-s390-low.c (s390_get_wordsize): Don't end warning with a newline. * thread-db.c (attach_thread): Don't end warning with a newline. (thread_db_notice_clone): Likewise. * tracepoint.c (gdb_agent_helper_thread): Don't end warning with a newline. * linux-x86-low.c (x86_get_min_fast_tracepoint_insn_len): Don't end warning with a newline.
2019-06-03 16:07:29 +02:00
warning (_("unexpected shell command exit status %d"), exit_status);
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
}
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
static void
shell_escape (const char *arg, int from_tty)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
#if defined(CANT_FORK) || \
(!defined(HAVE_WORKING_VFORK) && !defined(HAVE_WORKING_FORK))
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
/* If ARG is NULL, they want an inferior shell, but `system' just
reports if the shell is available when passed a NULL arg. */
int rc = system (arg ? arg : "");
if (!arg)
arg = "inferior shell";
if (rc == -1)
Remove excess calls to gdb_flush A customer noticed some mildly odd MI output, where CLI output was split into multiple MI strings at unusual boundaries, like this: ~"$1 = (b => true" ~", p => 0x407260" This is technically correct according to the MI spec, but still unusual, in that there's no particular reason for the string to be split where it is. I tracked this down to a call to gdb_flush in generic_val_print. Then, I went through all calls to gdb_flush and removed the ones I thought were superfluous. In particular: * Any call in the value-printing code; * Likewise the type-printing code (just a single call); and * Any call that immediately followed a printf that obviously ended with a newline, my belief being that gdb's standard output streams are line buffered (by inheriting the behavior from stdio) Regression tested on x86-64 Fedora 29. I didn't add a new test case. I tend to think we don't necessarily want to specify this behavior in the tests. Let me know what you think of this. gdb/ChangeLog 2019-03-05 Tom Tromey <tromey@adacore.com> * windows-nat.c (windows_nat_target::attach) (windows_nat_target::detach): Don't call gdb_flush. * valprint.c (generic_val_print, val_print, val_print_string): Don't call gdb_flush. * utils.c (defaulted_query): Don't call gdb_flush. * typeprint.c (print_type_scalar): Don't call gdb_flush. * target.c (target_announce_detach): Don't call gdb_flush. * sparc64-tdep.c (adi_print_versions): Don't call gdb_flush. * remote.c (extended_remote_target::attach): Don't call gdb_flush. * procfs.c (procfs_target::detach): Don't call gdb_flush. * printcmd.c (do_examine): Don't call gdb_flush. (info_display_command): Don't call gdb_flush. * p-valprint.c (pascal_val_print): Don't call gdb_flush. * nto-procfs.c (nto_procfs_target::attach): Don't call gdb_flush. * memattr.c (info_mem_command): Don't call gdb_flush. * mdebugread.c (mdebug_build_psymtabs): Don't call gdb_flush. * m2-valprint.c (m2_val_print): Don't call gdb_flush. * infrun.c (follow_exec, handle_command): Don't call gdb_flush. * inf-ptrace.c (inf_ptrace_target::attach): Don't call gdb_flush. * hppa-tdep.c (unwind_command): Don't call gdb_flush. * gnu-nat.c (gnu_nat_target::attach): Don't call gdb_flush. (gnu_nat_target::detach): Don't call gdb_flush. * f-valprint.c (f_val_print): Don't call gdb_flush. * darwin-nat.c (darwin_nat_target::attach): Don't call gdb_flush. * cli/cli-script.c (read_command_lines): Don't call gdb_flush. * cli/cli-cmds.c (shell_escape, print_disassembly): Don't call gdb_flush. * c-valprint.c (c_val_print): Don't call gdb_flush. * ada-valprint.c (ada_print_scalar): Don't call gdb_flush.
2019-02-19 21:36:17 +01:00
fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", arg,
safe_strerror (errno));
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
else if (rc)
Remove excess calls to gdb_flush A customer noticed some mildly odd MI output, where CLI output was split into multiple MI strings at unusual boundaries, like this: ~"$1 = (b => true" ~", p => 0x407260" This is technically correct according to the MI spec, but still unusual, in that there's no particular reason for the string to be split where it is. I tracked this down to a call to gdb_flush in generic_val_print. Then, I went through all calls to gdb_flush and removed the ones I thought were superfluous. In particular: * Any call in the value-printing code; * Likewise the type-printing code (just a single call); and * Any call that immediately followed a printf that obviously ended with a newline, my belief being that gdb's standard output streams are line buffered (by inheriting the behavior from stdio) Regression tested on x86-64 Fedora 29. I didn't add a new test case. I tend to think we don't necessarily want to specify this behavior in the tests. Let me know what you think of this. gdb/ChangeLog 2019-03-05 Tom Tromey <tromey@adacore.com> * windows-nat.c (windows_nat_target::attach) (windows_nat_target::detach): Don't call gdb_flush. * valprint.c (generic_val_print, val_print, val_print_string): Don't call gdb_flush. * utils.c (defaulted_query): Don't call gdb_flush. * typeprint.c (print_type_scalar): Don't call gdb_flush. * target.c (target_announce_detach): Don't call gdb_flush. * sparc64-tdep.c (adi_print_versions): Don't call gdb_flush. * remote.c (extended_remote_target::attach): Don't call gdb_flush. * procfs.c (procfs_target::detach): Don't call gdb_flush. * printcmd.c (do_examine): Don't call gdb_flush. (info_display_command): Don't call gdb_flush. * p-valprint.c (pascal_val_print): Don't call gdb_flush. * nto-procfs.c (nto_procfs_target::attach): Don't call gdb_flush. * memattr.c (info_mem_command): Don't call gdb_flush. * mdebugread.c (mdebug_build_psymtabs): Don't call gdb_flush. * m2-valprint.c (m2_val_print): Don't call gdb_flush. * infrun.c (follow_exec, handle_command): Don't call gdb_flush. * inf-ptrace.c (inf_ptrace_target::attach): Don't call gdb_flush. * hppa-tdep.c (unwind_command): Don't call gdb_flush. * gnu-nat.c (gnu_nat_target::attach): Don't call gdb_flush. (gnu_nat_target::detach): Don't call gdb_flush. * f-valprint.c (f_val_print): Don't call gdb_flush. * darwin-nat.c (darwin_nat_target::attach): Don't call gdb_flush. * cli/cli-script.c (read_command_lines): Don't call gdb_flush. * cli/cli-cmds.c (shell_escape, print_disassembly): Don't call gdb_flush. * c-valprint.c (c_val_print): Don't call gdb_flush. * ada-valprint.c (ada_print_scalar): Don't call gdb_flush.
2019-02-19 21:36:17 +01:00
fprintf_unfiltered (gdb_stderr, "%s exited with status %d\n", arg, rc);
#ifdef GLOBAL_CURDIR
/* Make sure to return to the directory GDB thinks it is, in case
the shell command we just ran changed it. */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
chdir (current_directory);
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
exit_status_set_internal_vars (rc);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
#endif
#else /* Can fork. */
int status, pid;
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
if ((pid = vfork ()) == 0)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
const char *p, *user_shell = get_shell ();
PR gdb/7912: * Makefile.in (SFILES): Add filestuff.c (COMMON_OBS): Add filestuff.o. (filestuff.o): New target. * auto-load.c (auto_load_objfile_script_1): Use gdb_fopen_cloexec. * auxv.c (procfs_xfer_auxv): Use gdb_open_cloexec. * cli/cli-cmds.c (shell_escape): Call close_most_fds. * cli/cli-dump.c (fopen_with_cleanup): Use gdb_fopen_cloexec. * common/agent.c (gdb_connect_sync_socket): Use gdb_socket_cloexec. * common/filestuff.c: New file. * common/filestuff.h: New file. * common/linux-osdata.c (linux_common_core_of_thread) (command_from_pid, commandline_from_pid, print_source_lines) (linux_xfer_osdata_shm, linux_xfer_osdata_sem) (linux_xfer_osdata_msg, linux_xfer_osdata_modules): Use gdb_fopen_cloexec. * common/linux-procfs.c (linux_proc_get_int) (linux_proc_pid_has_state): Use gdb_fopen_cloexec. * config.in, configure: Rebuild. * configure.ac: Don't check for sys/socket.h. Check for fdwalk, pipe2. * corelow.c (core_open): Use gdb_open_cloexec. * dwarf2read.c (write_psymtabs_to_index): Use gdb_fopen_cloexec. * fork-child.c (fork_inferior): Call close_most_fds. * gdb_bfd.c (gdb_bfd_open): Use gdb_open_cloexec. * inf-child.c (inf_child_fileio_readlink): Use gdb_open_cloexec. * linux-nat.c (linux_nat_thread_name, linux_proc_pending_signals): Use gdb_fopen_cloexec. (linux_proc_xfer_partial, linux_proc_xfer_spu): Use gdb_open_cloexec. (linux_async_pipe): Use gdb_pipe_cloexec. * remote-fileio.c (remote_fileio_func_open): Use gdb_open_cloexec. * remote.c (remote_file_put, remote_file_get): Use gdb_fopen_cloexec. * ser-pipe.c (pipe_open): Use gdb_socketpair_cloexec, close_most_fds. * ser-tcp.c (net_open): Use gdb_socket_cloexec. * ser-unix.c (hardwire_open): Use gdb_open_cloexec. * solib.c (solib_find): Use gdb_open_cloexec. * source.c (openp, find_and_open_source): Use gdb_open_cloexec. * tracepoint.c (tfile_start): Use gdb_fopen_cloexec. (tfile_open): Use gdb_open_cloexec. * tui/tui-io.c (tui_initialize_io): Use gdb_pipe_cloexec. * ui-file.c (gdb_fopen): Use gdb_fopen_cloexec. * xml-support.c (xml_fetch_content_from_file): Use gdb_fopen_cloexec. * main.c (captured_main): Call notice_open_fds. gdbserver * Makefile.in (SFILES): Add filestuff.c. (OBS): Add filestuff.o. (filestuff.o): New target. * config.in, configure: Rebuild. * configure.ac: Check for fdwalk, pipe2.
2013-04-22 18:46:15 +02:00
close_most_fds ();
/* Get the name of the shell for arg0. */
p = lbasename (user_shell);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
if (!arg)
execl (user_shell, p, (char *) 0);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
else
execl (user_shell, p, "-c", arg, (char *) 0);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
fprintf_unfiltered (gdb_stderr, "Cannot execute %s: %s\n", user_shell,
safe_strerror (errno));
_exit (0177);
}
if (pid != -1)
waitpid (pid, &status, 0);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
else
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Fork failed"));
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
exit_status_set_internal_vars (status);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
#endif /* Can fork. */
}
/* Implementation of the "shell" command. */
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
shell_command (const char *arg, int from_tty)
{
shell_escape (arg, from_tty);
}
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
edit_command (const char *arg, int from_tty)
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
{
struct symtab_and_line sal;
struct symbol *sym;
-Wwrite-strings: The Rest This is the remainder boring constification that all looks more of less borderline obvious IMO. gdb/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * ada-exp.y (yyerror): Constify. * ada-lang.c (bound_name, get_selections) (ada_variant_discrim_type) (ada_variant_discrim_name, ada_value_struct_elt) (ada_lookup_struct_elt_type, is_unchecked_variant) (ada_which_variant_applies, standard_exc, ada_get_next_arg) (catch_ada_exception_command_split) (catch_ada_assert_command_split, catch_assert_command) (ada_op_name): Constify. * ada-lang.h (ada_yyerror, get_selections) (ada_variant_discrim_name, ada_value_struct_elt): Constify. * arc-tdep.c (arc_print_frame_cache): Constify. * arm-tdep.c (arm_skip_stub): Constify. * ax-gdb.c (gen_binop, gen_struct_ref_recursive, gen_struct_ref) (gen_aggregate_elt_ref): Constify. * bcache.c (print_bcache_statistics): Constify. * bcache.h (print_bcache_statistics): Constify. * break-catch-throw.c (catch_exception_command_1): * breakpoint.c (struct ep_type_description::description): Constify. (add_solib_catchpoint): Constify. (catch_fork_command_1): Add cast. (add_catch_command): Constify. * breakpoint.h (add_catch_command, add_solib_catchpoint): Constify. * bsd-uthread.c (bsd_uthread_state): Constify. * buildsym.c (patch_subfile_names): Constify. * buildsym.h (next_symbol_text_func, patch_subfile_names): Constify. * c-exp.y (yyerror): Constify. (token::oper): Constify. * c-lang.h (c_yyerror, cp_print_class_member): Constify. * c-varobj.c (cplus_describe_child): Constify. * charset.c (find_charset_names): Add cast. (find_charset_names): Constify array and add const_cast. * cli/cli-cmds.c (complete_command, cd_command): Constify. (edit_command): Constify. * cli/cli-decode.c (lookup_cmd): Constify. * cli/cli-dump.c (dump_memory_command, dump_value_command): Constify. (struct dump_context): Constify. (add_dump_command, restore_command): Constify. * cli/cli-script.c (get_command_line): Constify. * cli/cli-script.h (get_command_line): Constify. * cli/cli-utils.c (check_for_argument): Constify. * cli/cli-utils.h (check_for_argument): Constify. * coff-pe-read.c (struct read_pe_section_data): Constify. * command.h (lookup_cmd): Constify. * common/print-utils.c (decimal2str): Constify. * completer.c (gdb_print_filename): Constify. * corefile.c (set_gnutarget): Constify. * cp-name-parser.y (yyerror): Constify. * cp-valprint.c (cp_print_class_member): Constify. * cris-tdep.c (cris_register_name, crisv32_register_name): Constify. * d-exp.y (yyerror): Constify. (struct token::oper): Constify. * d-lang.h (d_yyerror): Constify. * dbxread.c (struct header_file_location::name): Constify. (add_old_header_file, add_new_header_file, last_function_name) (dbx_next_symbol_text, add_bincl_to_list) (find_corresponding_bincl_psymtab, set_namestring) (find_stab_function_addr, read_dbx_symtab, start_psymtab) (dbx_end_psymtab, read_ofile_symtab, process_one_symbol): * defs.h (command_line_input, print_address_symbolic) (deprecated_readline_begin_hook): Constify. * dwarf2read.c (anonymous_struct_prefix, dwarf_bool_name): Constify. * event-top.c (handle_line_of_input): Constify and add cast. * exceptions.c (catch_errors): Constify. * exceptions.h (catch_errors): Constify. * expprint.c (print_subexp_standard, op_string, op_name) (op_name_standard, dump_raw_expression, dump_raw_expression): * expression.h (op_name, op_string, dump_raw_expression): Constify. * f-exp.y (yyerror): Constify. (struct token::oper): Constify. (struct f77_boolean_val::name): Constify. * f-lang.c (f_word_break_characters): Constify. * f-lang.h (f_yyerror): Constify. * fork-child.c (fork_inferior): Add cast. * frv-tdep.c (struct gdbarch_tdep::register_names): Constify. (new_variant): Constify. * gdbarch.sh (pstring_ptr, pstring_list): Constify. * gdbarch.c: Regenerate. * gdbcore.h (set_gnutarget): Constify. * go-exp.y (yyerror): Constify. (token::oper): Constify. * go-lang.h (go_yyerror): Constify. * go32-nat.c (go32_sysinfo): Constify. * guile/scm-breakpoint.c (gdbscm_breakpoint_expression): Constify. * guile/scm-cmd.c (cmdscm_function): Constify. * guile/scm-param.c (pascm_param_value): Constify. * h8300-tdep.c (h8300_register_name, h8300s_register_name) (h8300sx_register_name): Constify. * hppa-tdep.c (hppa32_register_name, hppa64_register_name): Constify. * ia64-tdep.c (ia64_register_names): Constify. * infcmd.c (construct_inferior_arguments): Constify. (path_command, attach_post_wait): Constify. * language.c (show_range_command, show_case_command) (unk_lang_error): Constify. * language.h (language_defn::la_error) (language_defn::la_name_of_this): Constify. * linespec.c (decode_line_2): Constify. * linux-thread-db.c (thread_db_err_str): Constify. * lm32-tdep.c (lm32_register_name): Constify. * m2-exp.y (yyerror): Constify. * m2-lang.h (m2_yyerror): Constify. * m32r-tdep.c (m32r_register_names): Constify and make static. * m68hc11-tdep.c (m68hc11_register_names): Constify. * m88k-tdep.c (m88k_register_name): Constify. * macroexp.c (appendmem): Constify. * mdebugread.c (fdr_name, add_data_symbol, parse_type) (upgrade_type, parse_external, parse_partial_symbols) (mdebug_next_symbol_text, cross_ref, mylookup_symbol, new_psymtab) (new_symbol): Constify. * memattr.c (mem_info_command): Constify. * mep-tdep.c (register_name_from_keyword): Constify. * mi/mi-cmd-env.c (mi_cmd_env_path, _initialize_mi_cmd_env): Constify. * mi/mi-cmd-stack.c (list_args_or_locals): Constify. * mi/mi-cmd-var.c (mi_cmd_var_show_attributes): Constify. * mi/mi-main.c (captured_mi_execute_command): Constify and add cast. (mi_execute_async_cli_command): Constify. * mips-tdep.c (mips_register_name): Constify. * mn10300-tdep.c (register_name, mn10300_generic_register_name) (am33_register_name, am33_2_register_name) * moxie-tdep.c (moxie_register_names): Constify. * nat/linux-osdata.c (osdata_type): Constify fields. * nto-tdep.c (nto_parse_redirection): Constify. * objc-lang.c (lookup_struct_typedef, lookup_objc_class) (lookup_child_selector): Constify. (objc_methcall::name): Constify. * objc-lang.h (lookup_objc_class, lookup_child_selector) (lookup_struct_typedef): Constify. * objfiles.c (pc_in_section): Constify. * objfiles.h (pc_in_section): Constify. * p-exp.y (struct token::oper): Constify. (yyerror): Constify. * p-lang.h (pascal_yyerror): Constify. * parser-defs.h (op_name_standard): Constify. (op_print::string): Constify. (exp_descriptor::op_name): Constify. * printcmd.c (print_address_symbolic): Constify. * psymtab.c (print_partial_symbols): Constify. * python/py-breakpoint.c (stop_func): Constify. (bppy_get_expression): Constify. * python/py-cmd.c (cmdpy_completer::name): Constify. (cmdpy_function): Constify. * python/py-event.c (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-event.h (evpy_add_attribute) (gdbpy_initialize_event_generic): Constify. * python/py-evts.c (add_new_registry): Constify. * python/py-finishbreakpoint.c (outofscope_func): Constify. * python/py-framefilter.c (get_py_iter_from_func): Constify. * python/py-inferior.c (get_buffer): Add cast. * python/py-param.c (parm_constant::name): Constify. * python/py-unwind.c (fprint_frame_id): Constify. * python/python.c (gdbpy_parameter_value): Constify. * remote-fileio.c (remote_fio_func_map): Make 'name' const. * remote.c (memory_packet_config::name): Constify. (show_packet_config_cmd, remote_write_bytes) (remote_buffer_add_string): * reverse.c (exec_reverse_once): Constify. * rs6000-tdep.c (variant::name, variant::description): Constify. * rust-exp.y (rustyyerror): Constify. * rust-lang.c (rust_op_name): Constify. * rust-lang.h (rustyyerror): Constify. * serial.h (serial_ops::name): Constify. * sh-tdep.c (sh_sh_register_name, sh_sh3_register_name) (sh_sh3e_register_name, sh_sh2e_register_name) (sh_sh2a_register_name, sh_sh2a_nofpu_register_name) (sh_sh_dsp_register_name, sh_sh3_dsp_register_name) (sh_sh4_register_name, sh_sh4_nofpu_register_name) (sh_sh4al_dsp_register_name): Constify. * sh64-tdep.c (sh64_register_name): Constify. * solib-darwin.c (lookup_symbol_from_bfd): Constify. * spu-tdep.c (spu_register_name, info_spu_dma_cmdlist): Constify. * stabsread.c (patch_block_stabs, read_type_number) (ref_map::stabs, ref_add, process_reference) (symbol_reference_defined, define_symbol, define_symbol) (error_type, read_type, read_member_functions, read_cpp_abbrev) (read_one_struct_field, read_struct_fields, read_baseclasses) (read_tilde_fields, read_struct_type, read_array_type) (read_enum_type, read_sun_builtin_type, read_sun_floating_type) (read_huge_number, read_range_type, read_args, common_block_start) (find_name_end): Constify. * stabsread.h (common_block_start, define_symbol) (process_one_symbol, symbol_reference_defined, ref_add): * symfile.c (get_section_index, add_symbol_file_command): * symfile.h (get_section_index): Constify. * target-descriptions.c (tdesc_type::name): Constify. (tdesc_free_type): Add cast. * target.c (find_default_run_target): (add_deprecated_target_alias, find_default_run_target) (target_announce_detach): Constify. (do_option): Constify. * target.h (add_deprecated_target_alias): Constify. * thread.c (print_thread_info_1): Constify. * top.c (deprecated_readline_begin_hook, command_line_input): Constify. (init_main): Add casts. * top.h (handle_line_of_input): Constify. * tracefile-tfile.c (tfile_write_uploaded_tsv): Constify. * tracepoint.c (tvariables_info_1, trace_status_mi): Constify. (tfind_command): Rename to ... (tfind_command_1): ... this and constify. (tfind_command): New function. (tfind_end_command, tfind_start_command): Adjust. (encode_source_string): Constify. * tracepoint.h (encode_source_string): Constify. * tui/tui-data.c (tui_partial_win_by_name): Constify. * tui/tui-data.h (tui_partial_win_by_name): Constify. * tui/tui-source.c (tui_set_source_content_nil): Constify. * tui/tui-source.h (tui_set_source_content_nil): Constify. * tui/tui-win.c (parse_scrolling_args): Constify. * tui/tui-windata.c (tui_erase_data_content): Constify. * tui/tui-windata.h (tui_erase_data_content): Constify. * tui/tui-winsource.c (tui_erase_source_content): Constify. * tui/tui.c (tui_enable): Add cast. * utils.c (defaulted_query): Constify. (init_page_info): Add cast. (puts_debug, subset_compare): Constify. * utils.h (subset_compare): Constify. * varobj.c (varobj_format_string): Constify. * varobj.h (varobj_format_string): Constify. * vax-tdep.c (vax_register_name): Constify. * windows-nat.c (windows_detach): Constify. * xcoffread.c (process_linenos, xcoff_next_symbol_text): Constify. * xml-support.c (gdb_xml_end_element): Constify. * xml-tdesc.c (tdesc_start_reg): Constify. * xstormy16-tdep.c (xstormy16_register_name): Constify. * xtensa-tdep.c (xtensa_find_register_by_name): Constify. * xtensa-tdep.h (xtensa_register_t::name): Constify. gdb/gdbserver/ChangeLog: 2017-04-05 Pedro Alves <palves@redhat.com> * gdbreplay.c (sync_error): Constify. * linux-x86-low.c (push_opcode): Constify.
2017-04-05 20:21:37 +02:00
const char *editor;
char *p;
const char *fn;
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
/* Pull in the current default source line if necessary. */
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
if (arg == 0)
{
set_default_source_symtab_and_line ();
sal = get_current_source_symtab_and_line ();
}
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
/* Bare "edit" edits file with present line. */
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
if (arg == 0)
{
if (sal.symtab == 0)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("No default source file yet."));
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
sal.line += get_lines_to_list () / 2;
}
else
{
Constify some linespec functions This changes a few linespec functions to work on "const char *" and then fixes up all the callers. This allows further constification elsewhere. gdb/ChangeLog 2017-09-27 Tom Tromey <tom@tromey.com> * tracepoint.c (info_scope_command): Constify. * python/python.c (gdbpy_decode_line): Constify. * python/py-breakpoint.c (bppy_init): Constify. * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Constify. * location.h: (new_linespec_location) (string_to_event_location_basic, string_to_event_location): Constify. * location.c (new_linespec_location) (string_to_event_location_basic, string_to_event_location): Constify. * linespec.h (decode_line_with_current_source) (decode_line_with_last_displayed, linespec_lex_to_end): Constify. * linespec.c (linespec_lex_to_end) (decode_line_with_current_source) (decode_line_with_last_displayed): Constify. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Constify. * cli/cli-cmds.c (edit_command, list_command): Constify. * breakpoint.h (until_break_command, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (init_ada_exception_breakpoint): Constify. * breakpoint.c (break_command_1, dprintf_command) (break_range_command, watch_command_wrapper) (rwatch_command_wrapper, awatch_command_wrapper) (until_break_command, init_ada_exception_breakpoint) (strace_marker_create_sals_from_location, trace_command) (ftrace_command, strace_command, struct tracepoint): Constify. * ax-gdb.c (agent_command_1): Constify. * ada-lang.c (ada_exception_sal): Constify.
2017-09-13 02:32:41 +02:00
const char *arg1;
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
Explicit locations: use new location API This patch converts the code base to use the new struct event_location API being introduced. This patch preserves the current functionality and adds no new features. The "big picture" API usage introduced by this patch may be illustrated with a simple exmaple. Where previously developers would write: void my_command (char *arg, int from_tty) { create_breakpoint (..., arg, ...); ... } one now uses: void my_command (char *arg, int from_tty) { struct event_locaiton *location; struct cleanup *back_to; location = string_to_event_locaiton (&arg, ...); back_to = make_cleanup_delete_event_location (location); create_breakpoint (..., location, ...); do_cleanups (back_to); } Linespec-decoding functions (now called location-decoding) such as decode_line_full no longer skip argument pointers over processed input. That functionality has been moved into string_to_event_location as demonstrated above. gdb/ChangeLog * ax-gdb.c: Include location.h. (agent_command_1) Use linespec location instead of address string. * break-catch-throw.c: Include location.h. (re_set_exception_catchpoint): Use linespec locations instead of address strings. * breakpoint.c: Include location.h. (create_overlay_event_breakpoint, create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_breakpoints_after_exec): Use linespec location instead of address string. (print_breakpoint_location): Use locations and event_location_to_string. Print extra_string for pending locations for non-MI streams. (print_one_breakpoint_location): Use locations and event_location_to_string. (init_raw_breakpoint_without_location): Initialize b->location. (create_thread_event_breakpoint): Use linespec location instead of address string. (init_breakpoint_sal): Likewise. Only save extra_string if it is non-NULL and not the empty string. Use event_location_to_string instead of `addr_string'. Constify `p' and `endp'. Use skip_spaces_const/skip_space_const instead of non-const versions. Copy the location into the breakpoint. If LOCATION is NULL, save the breakpoint address as a linespec location instead of an address string. (create_breakpoint_sal): Change `addr_string' parameter to a struct event_location. All uses updated. (create_breakpoints_sal): Likewise for local variable `addr_string'. (parse_breakpoint_sals): Use locations instead of address strings. Remove check for empty linespec with conditional. Refactor. (decode_static_tracepoint_spec): Make argument const and update function. (create_breakpoint): Change `arg' to a struct event_location and rename. Remove `copy_arg' and `addr_start'. If EXTRA_STRING is empty, set it to NULL. Don't populate `canonical' for pending breakpoints. Pass `extra_string' to find_condition_and_thread. Clear `extra_string' if `rest' was NULL. Do not error with "garbage after location" if setting a dprintf breakpoint. Copy the location into the breakpoint instead of an address string. (break_command_1): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Check against `arg_cp' for a probe linespec. (dprintf_command): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Throw an exception if no format string was specified. (print_recreate_ranged_breakpoint): Use event_location_to_string instead of address strings. (break_range_command, until_break_command) (init_ada_exception_breakpoint): Use locations instead of address strings. (say_where): Print out extra_string for pending locations. (base_breakpoint_dtor): Delete `location' and `location_range_end' of the breakpoint. (base_breakpoint_create_sals_from_location): Use struct event_location instead of address string. Remove `addr_start' and `copy_arg' parameters. (base_breakpoint_decode_location): Use struct event_location instead of address string. (bkpt_re_set): Use locations instead of address strings. Use event_location_empty_p to check for unset location. (bkpt_print_recreate): Use event_location_to_string instead of an address string. Print out extra_string for pending locations. (bkpt_create_sals_from_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location): Use struct event_location instead of address string. (bkpt_probe_decode_location): Use struct event_location instead of address string. (tracepoint_print_recreate): Use event_location_to_string to recreate the tracepoint. (tracepoint_create_sals_from_location, tracepoint_decode_location) (tracepoint_probe_create_sals_from_location) (tracepoint_probe_decode_location): Use struct event_location instead of address string. (dprintf_print_recreate): Use event_location_to_string to recreate the dprintf. (dprintf_re_set): Remove check for valid/missing format string. (strace_marker_create_sals_from_location) (strace_marker_create_breakpoints_sal, strace_marker_decode_location) (update_static_tracepoint): Use struct event_location instead of address string. (location_to_sals): Likewise. Pass `extra_string' to find_condition_and_thread. For newly resolved pending breakpoint locations, clear the location's string representation. Assert that the breakpoint's condition string is NULL when condition_not_parsed. (breakpoint_re_set_default, create_sals_from_location_default) (decode_location_default, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Use locations instead of address strings. * breakpoint.h (struct breakpoint_ops) <create_sals_from_location>: Use struct event_location instead of address string. Update all uses. <decode_location>: Likewise. (struct breakpoint) <addr_string>: Change to struct event_location and rename `location'. <addr_string_range_end>: Change to struct event_location and rename `location_range_end'. (create_breakpoint): Use struct event_location instead of address string. * cli/cli-cmds.c: Include location.h. (edit_command, list_command): Use locations instead of address strings. * elfread.c: Include location.h. (elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string. * guile/scm-breakpoint.c: Include location.h. (bpscm_print_breakpoint_smob): Use event_location_to_string. (gdbscm_register_breakpoint): Use locations instead of address strings. * linespec.c: Include location.h. (struct ls_parser) <stream>: Change to const char *. (PARSER_STREAM): Update. (lionespec_lexer_lex_keyword): According to find_condition_and_thread, keywords must be followed by whitespace. (canonicalize_linespec): Save a linespec location into `canonical'. Save a canonical linespec into `canonical'. (parse_linespec): Change `argptr' to const char * and rename `arg'. All uses updated. Update function description. (linespec_parser_new): Initialize `parser'. Update initialization of parsing stream. (event_location_to_sals): New function. (decode_line_full): Change `argptr' to a struct event_location and rename it `location'. Use locations instead of address strings. Call event_location_to_sals instead of parse_linespec. (decode_line_1): Likewise. (decode_line_with_current_source, decode_line_with_last_displayed) Use locations instead of address strings. (decode_objc): Likewise. Change `argptr' to const char * and rename `arg'. (destroy_linespec_result): Delete the linespec result's location instead of freeing the address string. * linespec.h (struct linespec_result) <addr_string>: Change to struct event_location and rename to ... <location>: ... this. (decode_line_1, decode_line_full): Change `argptr' to struct event_location. All callers updated. * mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h. (mi_cmd_break_insert_1): Use locations instead of address strings. Throw an error if there was "garbage" at the end of the specified linespec. * probe.c: Include location.h. (parse_probes): Change `argptr' to struct event_location. Use event locations instead of address strings. * probe.h (parse_probes): Change `argptr' to struct event_location. * python/py-breakpoint.c: Include location.h. (bppy_get_location): Constify local variable `str'. Use event_location_to_string. (bppy_init): Use locations instead of address strings. * python/py-finishbreakpoint.c: Include location.h. (bpfinishpy_init): Remove local variable `addr_str'. Use locations instead of address strings. * python/python.c: Include location.h. (gdbpy_decode_line): Use locations instead of address strings. * remote.c: Include location.h. (remote_download_tracepoint): Use locations instead of address strings. * spu-tdep.c: Include location.h. (spu_catch_start): Remove local variable `buf'. Use locations instead of address strings. * tracepoint.c: Include location.h. (scope_info): Use locations instead of address strings. (encode_source_string): Constify parameter `src'. * tracepoint.h (encode_source_string): Likewise. gdb/testsuite/ChangeLog * gdb.base/dprintf-pending.exp: Update dprintf "without format" test. Add tests for missing ",FMT" and ",".
2015-08-12 02:09:35 +02:00
/* Now should only be one argument -- decode it in SAL. */
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
arg1 = arg;
Introduce event_location_up This removes make_cleanup_delete_event_location and instead changes the various location functions to return an event_location_up, a new unique_ptr typedef. This is largely straightforward, but be sure to examine the init_breakpoint_sal change. I believe the code I deleted there is dead, because "location != NULL" can never be true in that branch; but you should double-check. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * tracepoint.c (scope_info): Update. * spu-tdep.c (spu_catch_start): Update. * python/python.c (gdbpy_decode_line): Update. * python/py-finishbreakpoint.c (bpfinishpy_init): Update. * python/py-breakpoint.c (bppy_init): Update. * probe.c (parse_probes): Update. * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Update. * location.h (event_location_deleter): New struct. (event_location_up): New typedef. (new_linespec_location, new_address_location, new_probe_location) (new_explicit_location, copy_event_location) (string_to_event_location, string_to_event_location_basic) (string_to_explicit_location): Update return type. (make_cleanup_delete_event_location): Remove. * location.c (new_linespec_location, new_address_location) (new_probe_location, new_explicit_location, copy_event_location): Return event_location_up. (delete_event_location_cleanup) (make_cleanup_delete_event_location): Remove. (string_to_explicit_location, string_to_event_location_basic) (string_to_event_location): Return event_location_up. * linespec.c (canonicalize_linespec, event_location_to_sals) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc): Update. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Update. * completer.c (location_completer): Update. * cli/cli-cmds.c (edit_command, list_command): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint) (create_thread_event_breakpoint): Update. (init_breakpoint_sal): Update. Remove some dead code. (create_breakpoint_sal): Change type of "location". Update. (create_breakpoints_sal, create_breakpoint, break_command_1) (dprintf_command, break_range_command, until_break_command) (init_ada_exception_breakpoint) (strace_marker_create_sals_from_location) (update_static_tracepoint, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Update. * break-catch-throw.c (re_set_exception_catchpoint): Update. * ax-gdb.c (agent_command_1): Update.
2017-04-06 04:44:01 +02:00
event_location_up location = string_to_event_location (&arg1,
current_language);
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
std::vector<symtab_and_line> sals = decode_line_1 (location.get (),
DECODE_LINE_LIST_MODE,
NULL, NULL, 0);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
filter_sals (sals);
if (sals.empty ())
{
/* C++ */
return;
}
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
if (sals.size () > 1)
{
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
ambiguous_line_spec (sals,
Clarify "list" output when specified lines are ambiguous Currently, with "list LINESPEC1,LINESPEC2", if one of the linespecs is ambiguous, i.e., if it expands to multiple locations, you get this seemingly odd output: (gdb) list foo,bar file: "file0.c", line number: 26 file: "file1.c", line number: 29 Since "foo" above expands to multiple locations, the specified range is indeterminate, and GDB is trying to be helpful by showing you what was ambiguous. It looks confusing to me, though. I think it'd be much more user friendly if GDB actually told you that, like this: (gdb) list foo,bar Specified first line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 (gdb) list bar,foo Specified last line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 Note, I'm using "first" and "last" in the output because that's what the manual uses: ~~~ list first,last Print lines from first to last. [...] ~~~ Tested on x86-64 GNU/Linux. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (edit_command): Pass message to ambiguous_line_spec. (list_command): Pass message to ambiguous_line_spec. Say "first"/"last" instead of "start" and "end" to be consistent with the manual. (ambiguous_line_spec): Add 'format' and vararg parameters. Use them to print formatted message. gdb/testsuite/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * gdb.base/list-ambiguous.exp: New file. * gdb.base/list-ambiguous0.c: New file. * gdb.base/list-ambiguous1.c: New file. * gdb.base/list.exp (test_list_range): Adjust expected output.
2017-09-04 17:49:29 +02:00
_("Specified line is ambiguous:\n"));
return;
}
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
sal = sals[0];
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
if (*arg1)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Junk at end of line specification."));
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
/* If line was specified by address, first print exactly which
line, and which file. In this case, sal.symtab == 0 means
address is outside of all known source files, not that user
failed to give a filename. */
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
if (*arg == '*')
{
* defs.h (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter. * utils.c (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter, use it instead of current_gdbarch. * ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter. * ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter, use it instead of current_gdbarch. Update calls to ui_out_field_core_addr to pass architecture: * ada-lang.c (print_one_exception): Update. * breakpoint.c (print_one_breakpoint_location, print_one_exception_catchpoint): Update. * disasm.c (dump_insns): Update. * darwin-nat-info.c (darwin_debug_regions_recurse): Update. * mi/mi-main.c (mi_cmd_data_read_memory): Update. * mi/mi-symbol-cmds.c: Include "objfiles.h". (mi_cmd_symbol_list_lines): Update. * stack.c (print_frame_info, print_frame): Update. Update callers of paddress to pass architecture: * ada-tasks.c (info_task): Update. * ada-valprint.c (ada_val_print_1): Update. * annotate.c (annotate_source, annotate_frame_begin): Update. * breakpoint.c (insert_bp_location, describe_other_breakpoints, mention): Update. * cli/cli-cmds.c (edit_command, list_command, print_disassembly): Update. * corefile.c (memory_error): Update. * c-valprint.c (print_function_pointer_address, c_val_print): Update. * disasm.c (dis_asm_print_address): Update. * exec.c (print_section_info): Update. * f-valprint.c (f_val_print): Update. * infcmd.c: Include "arch-utils.h". (jump_command, program_info): Update. * linux-fork.c: Include "arch-utils.h". (info_forks_command): Update. * m2-valprint.c (print_function_pointer_address, print_unpacked_pointer, print_variable_at_address, m2_val_print): Update. * m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command): Update. * printcmd.c (print_address, print_address_demangle, address_info): Update. * p-valprint.c (pascal_val_print): Update. * source.c: Include "arch-utils.h". (line_info): Update. * stack.c (frame_info, print_block_frame_labels): Update. * symfile.c (add_symbol_file_command, list_overlays_command): Update. * symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1, print_symbol, print_partial_symbols, maintenance_info_psymtabs, maintenance_check_symtabs): Update. * symtab.c (find_pc_sect_symtab): Update. * target.c (deprecated_debug_xfer_memory): Update. * tracepoint.c (scope_info): Update. * tui/tui-stack.c (tui_make_status_line): Update. * valprint.c (val_print_string): Update. Update callers of paddr_nz to use paddress instead (keeping user-visible output identical): * alpha-tdep.c (alpha_heuristic_proc_start): Update. * amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn, amd64_displaced_step_fixup): Update. * arch-utils.c (simple_displaced_step_copy_insn): Update. * auxv.c (fprint_target_auxv): Update. * breakpoint.c (insert_single_step_breakpoint): Update. * buildsym.c (finish_block): Update. * cli/cli-dump.c (restore_section_callback): Update. * fbsd-nat.c (fbsd_find_memory_regions): Update. * frame.c (frame_unwind_register_value): Update. * gcore.c (gcore_create_callback): Update. * hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update. * i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm, i386_record_lea_modrm_addr, i386_record_lea_modrm, i386_process_record): Update. * ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id, ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id, ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update. * infrun.c (displaced_step_prepare, displaced_step_fixup, handle_inferior_event, insert_step_resume_breakpoint_at_sal, insert_longjmp_resume_breakpoint): Update. * linux-nat.c (linux_nat_find_memory_regions): Update. * linux-record.c (record_linux_system_call): Update. * mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call, mips_o32_push_dummy_call, mips_o64_push_dummy_call): Update. * monitor.c (monitor_error, monitor_remove_breakpoint): Update. * record.c (record_arch_list_add_mem, record_wait, record_xfer_partial): Update. * remote-mips.c (mips_fetch_word, mips_check_lsi_error, mips_common_breakpoint): Update. * remote-sim.c (gdbsim_xfer_inferior_memory): Update. * rs6000-tdep.c (ppc_displaced_step_fixup): Update. * solib-som.c (som_current_sos): Update. * symfile.c (load_progress, generic_load): Update. * symfile-mem.c (add_vsyscall_page): Update. * valops.c (value_fetch_lazy): Update. * windows-tdep.c (windows_xfer_shared_library): Update. Update callers of paddr_nz to use paddress instead (changing user-visible output to make it more correct): * dwarf2loc.c (locexpr_describe_location): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint, ia64_memory_remove_breakpoint): Update. * jv-valprint.c (java_value_print): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. * monitor.c (monitor_read_memory): Update. Update callers of paddr to use paddress instead (changing user-visible output to make it more correct): * arm-tdep.c (arm_push_dummy_call): Update. * breakpoint.c (insert_bp_location, create_thread_event_breakpoint, create_breakpoint): Update. * darwin-nat-info.c (darwin_debug_regions): Update. * dcache.c (dcache_info): Update. * dsrec.c (load_srec, make_srec): Update. * dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program, dwarf2_frame_cache): Update. * gcore.c (gcore_copy_callback): Update. * gnu-nat.c (gnu_xfer_memory): Update. * mips-linux-nat.c (mips_show_dr): Update. * monitor.c (monitor_write_memory, monitor_insert_breakpoint, monitor_remove_breakpoint): Update. * remote.c (compare_sections_command): Update. * remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint, m32r_remove_breakpoint, m32r_insert_watchpoint, m32r_remove_watchpoint): Update. * sol-thread.c (info_cb): Update. * symfile.c (load_progress): Update. Update callers of paddress or paddr_nz to use hex_string instead (changes output of internal/error/debug messages only): * dwarf2read.c (dump_die_shallow): Update. * frame.c (fprint_field, fprint_frame, frame_pc_unwind, get_frame_func, create_new_frame): Update. * hppa-tdep.c (find_unwind_entry, unwind_command): Update. * ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x, ia64_get_dyn_info_list): Update. * maint.c (maintenance_translate_address): Update. * mi/mi-cmd-var.c (mi_cmd_var_create): Update. * target.c (target_flash_erase): Update. Update callers of paddr/paddr_nz to use phex/phex_nz instead, using an appropriate address size. Remove use of strlen_paddr. * exec.c (exec_files_info): Update. * i386-nat.c (i386_show_dr): Update. * remote.c (remote_flash_erase): Update. * m32r-rom.c (m32r_load_section): Update. * monitor.c (monitor_vsprintf, monitor_store_register): Update. * remote.c (remote_check_symbols, remote_search_memory): Update. * remote-mips.c (mips_request, mips_common_breakpoint): Update. * scm-valprint.c (scm_ipruk, scm_scmval_print): Update. * sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update. * sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs, sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs, sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs, sh_dsp_show_regs): Update. * xcoffsolib.c (sharedlibrary_command): Update. * maint.c (maint_print_section_info): Add ADDR_SIZE parameter. Use hex_string_custom instead of paddr. (print_bfd_section_info): Pass address size. (print_objfile_section_info): Likewise. * annotate.h (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * annotate.c (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * source.c (identify_source_line): Update call to annotate_source. * stack.c (print_frame_info, print_frame): Update call to annotate_frame_begin. * breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter. (create_breakpoint, create_ada_exception_breakpoint): Update call. * stack.c (print_block_frame_labels): Add GDBARCH parameter. (print_frame_label_vars): Update call. * symmisc.c (print_partial_symbols): Add GDBARCH parameter. (dump_psymtab): Update call to print_partial_symbols. (struct print_symbol_args): Add GDBARCH member. (dump_symtab_1): Set print_symbol_args architecture member. (print_symbol): Use it. * windows-tdep.h (windows_xfer_shared_library): Add GDBARCH parameter. * windows-tdep.c (windows_xfer_shared_library): Likewise. * i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member. (core_process_module_section): Pass architecture from cpms_data to windows_xfer_shared_library. (windows_core_xfer_shared_libraries): Initialize cmps_data architecture member. * windows-nat.c (windows_xfer_shared_libraries): Pass architecture to windows_xfer_shared_library. * defs.h (print_address): Add GDBARCH parameter. * printcmd.c (print_address): Add GDBARCH parameter. (print_scalar_formatted, do_examine): Update call. * findcmd.c (find_command): Update call. * tracepoint.c: Include "arch-utils.h". (trace_find_line_command): Update call. * tui/tui-disasm.c (tui_disassemble): Update call. * value.h (print_address_demangle): Add GDBARCH parameter. * printcmd.c (print_address_demangle): Add GDBARCH parameter. * c-valprint.c (print_function_pointer_address, c_val_print): Update call. * f-valprint.c (f_val_print): Update call. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update call. * jv-valprint.c (java_val_print): Update call. * m2-valprint.c (print_function_pointer_address, m2_val_print): Update call. * p-valprint.c (pascal_val_print): Update call. * disasm.c (gdb_disassemble_info): Install architecture into di.application_data field. testsuite/ChangeLog: * gdb.threads/tls-shared.exp: Update to locexpr_describe_location change to prefix TLS offset in hex with 0x. doc/ChangeLog: * gdbint.texinfo (Item Output Functions): Update signature for ui_out_field_core_addr.
2009-07-02 19:21:10 +02:00
struct gdbarch *gdbarch;
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
if (sal.symtab == 0)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("No source file for address %s."),
paddress (get_current_arch (), sal.pc));
* defs.h (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter. * utils.c (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter, use it instead of current_gdbarch. * ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter. * ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter, use it instead of current_gdbarch. Update calls to ui_out_field_core_addr to pass architecture: * ada-lang.c (print_one_exception): Update. * breakpoint.c (print_one_breakpoint_location, print_one_exception_catchpoint): Update. * disasm.c (dump_insns): Update. * darwin-nat-info.c (darwin_debug_regions_recurse): Update. * mi/mi-main.c (mi_cmd_data_read_memory): Update. * mi/mi-symbol-cmds.c: Include "objfiles.h". (mi_cmd_symbol_list_lines): Update. * stack.c (print_frame_info, print_frame): Update. Update callers of paddress to pass architecture: * ada-tasks.c (info_task): Update. * ada-valprint.c (ada_val_print_1): Update. * annotate.c (annotate_source, annotate_frame_begin): Update. * breakpoint.c (insert_bp_location, describe_other_breakpoints, mention): Update. * cli/cli-cmds.c (edit_command, list_command, print_disassembly): Update. * corefile.c (memory_error): Update. * c-valprint.c (print_function_pointer_address, c_val_print): Update. * disasm.c (dis_asm_print_address): Update. * exec.c (print_section_info): Update. * f-valprint.c (f_val_print): Update. * infcmd.c: Include "arch-utils.h". (jump_command, program_info): Update. * linux-fork.c: Include "arch-utils.h". (info_forks_command): Update. * m2-valprint.c (print_function_pointer_address, print_unpacked_pointer, print_variable_at_address, m2_val_print): Update. * m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command): Update. * printcmd.c (print_address, print_address_demangle, address_info): Update. * p-valprint.c (pascal_val_print): Update. * source.c: Include "arch-utils.h". (line_info): Update. * stack.c (frame_info, print_block_frame_labels): Update. * symfile.c (add_symbol_file_command, list_overlays_command): Update. * symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1, print_symbol, print_partial_symbols, maintenance_info_psymtabs, maintenance_check_symtabs): Update. * symtab.c (find_pc_sect_symtab): Update. * target.c (deprecated_debug_xfer_memory): Update. * tracepoint.c (scope_info): Update. * tui/tui-stack.c (tui_make_status_line): Update. * valprint.c (val_print_string): Update. Update callers of paddr_nz to use paddress instead (keeping user-visible output identical): * alpha-tdep.c (alpha_heuristic_proc_start): Update. * amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn, amd64_displaced_step_fixup): Update. * arch-utils.c (simple_displaced_step_copy_insn): Update. * auxv.c (fprint_target_auxv): Update. * breakpoint.c (insert_single_step_breakpoint): Update. * buildsym.c (finish_block): Update. * cli/cli-dump.c (restore_section_callback): Update. * fbsd-nat.c (fbsd_find_memory_regions): Update. * frame.c (frame_unwind_register_value): Update. * gcore.c (gcore_create_callback): Update. * hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update. * i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm, i386_record_lea_modrm_addr, i386_record_lea_modrm, i386_process_record): Update. * ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id, ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id, ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update. * infrun.c (displaced_step_prepare, displaced_step_fixup, handle_inferior_event, insert_step_resume_breakpoint_at_sal, insert_longjmp_resume_breakpoint): Update. * linux-nat.c (linux_nat_find_memory_regions): Update. * linux-record.c (record_linux_system_call): Update. * mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call, mips_o32_push_dummy_call, mips_o64_push_dummy_call): Update. * monitor.c (monitor_error, monitor_remove_breakpoint): Update. * record.c (record_arch_list_add_mem, record_wait, record_xfer_partial): Update. * remote-mips.c (mips_fetch_word, mips_check_lsi_error, mips_common_breakpoint): Update. * remote-sim.c (gdbsim_xfer_inferior_memory): Update. * rs6000-tdep.c (ppc_displaced_step_fixup): Update. * solib-som.c (som_current_sos): Update. * symfile.c (load_progress, generic_load): Update. * symfile-mem.c (add_vsyscall_page): Update. * valops.c (value_fetch_lazy): Update. * windows-tdep.c (windows_xfer_shared_library): Update. Update callers of paddr_nz to use paddress instead (changing user-visible output to make it more correct): * dwarf2loc.c (locexpr_describe_location): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint, ia64_memory_remove_breakpoint): Update. * jv-valprint.c (java_value_print): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. * monitor.c (monitor_read_memory): Update. Update callers of paddr to use paddress instead (changing user-visible output to make it more correct): * arm-tdep.c (arm_push_dummy_call): Update. * breakpoint.c (insert_bp_location, create_thread_event_breakpoint, create_breakpoint): Update. * darwin-nat-info.c (darwin_debug_regions): Update. * dcache.c (dcache_info): Update. * dsrec.c (load_srec, make_srec): Update. * dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program, dwarf2_frame_cache): Update. * gcore.c (gcore_copy_callback): Update. * gnu-nat.c (gnu_xfer_memory): Update. * mips-linux-nat.c (mips_show_dr): Update. * monitor.c (monitor_write_memory, monitor_insert_breakpoint, monitor_remove_breakpoint): Update. * remote.c (compare_sections_command): Update. * remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint, m32r_remove_breakpoint, m32r_insert_watchpoint, m32r_remove_watchpoint): Update. * sol-thread.c (info_cb): Update. * symfile.c (load_progress): Update. Update callers of paddress or paddr_nz to use hex_string instead (changes output of internal/error/debug messages only): * dwarf2read.c (dump_die_shallow): Update. * frame.c (fprint_field, fprint_frame, frame_pc_unwind, get_frame_func, create_new_frame): Update. * hppa-tdep.c (find_unwind_entry, unwind_command): Update. * ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x, ia64_get_dyn_info_list): Update. * maint.c (maintenance_translate_address): Update. * mi/mi-cmd-var.c (mi_cmd_var_create): Update. * target.c (target_flash_erase): Update. Update callers of paddr/paddr_nz to use phex/phex_nz instead, using an appropriate address size. Remove use of strlen_paddr. * exec.c (exec_files_info): Update. * i386-nat.c (i386_show_dr): Update. * remote.c (remote_flash_erase): Update. * m32r-rom.c (m32r_load_section): Update. * monitor.c (monitor_vsprintf, monitor_store_register): Update. * remote.c (remote_check_symbols, remote_search_memory): Update. * remote-mips.c (mips_request, mips_common_breakpoint): Update. * scm-valprint.c (scm_ipruk, scm_scmval_print): Update. * sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update. * sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs, sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs, sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs, sh_dsp_show_regs): Update. * xcoffsolib.c (sharedlibrary_command): Update. * maint.c (maint_print_section_info): Add ADDR_SIZE parameter. Use hex_string_custom instead of paddr. (print_bfd_section_info): Pass address size. (print_objfile_section_info): Likewise. * annotate.h (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * annotate.c (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * source.c (identify_source_line): Update call to annotate_source. * stack.c (print_frame_info, print_frame): Update call to annotate_frame_begin. * breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter. (create_breakpoint, create_ada_exception_breakpoint): Update call. * stack.c (print_block_frame_labels): Add GDBARCH parameter. (print_frame_label_vars): Update call. * symmisc.c (print_partial_symbols): Add GDBARCH parameter. (dump_psymtab): Update call to print_partial_symbols. (struct print_symbol_args): Add GDBARCH member. (dump_symtab_1): Set print_symbol_args architecture member. (print_symbol): Use it. * windows-tdep.h (windows_xfer_shared_library): Add GDBARCH parameter. * windows-tdep.c (windows_xfer_shared_library): Likewise. * i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member. (core_process_module_section): Pass architecture from cpms_data to windows_xfer_shared_library. (windows_core_xfer_shared_libraries): Initialize cmps_data architecture member. * windows-nat.c (windows_xfer_shared_libraries): Pass architecture to windows_xfer_shared_library. * defs.h (print_address): Add GDBARCH parameter. * printcmd.c (print_address): Add GDBARCH parameter. (print_scalar_formatted, do_examine): Update call. * findcmd.c (find_command): Update call. * tracepoint.c: Include "arch-utils.h". (trace_find_line_command): Update call. * tui/tui-disasm.c (tui_disassemble): Update call. * value.h (print_address_demangle): Add GDBARCH parameter. * printcmd.c (print_address_demangle): Add GDBARCH parameter. * c-valprint.c (print_function_pointer_address, c_val_print): Update call. * f-valprint.c (f_val_print): Update call. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update call. * jv-valprint.c (java_val_print): Update call. * m2-valprint.c (print_function_pointer_address, m2_val_print): Update call. * p-valprint.c (pascal_val_print): Update call. * disasm.c (gdb_disassemble_info): Install architecture into di.application_data field. testsuite/ChangeLog: * gdb.threads/tls-shared.exp: Update to locexpr_describe_location change to prefix TLS offset in hex with 0x. doc/ChangeLog: * gdbint.texinfo (Item Output Functions): Update signature for ui_out_field_core_addr.
2009-07-02 19:21:10 +02:00
gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab));
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
sym = find_pc_function (sal.pc);
if (sym)
* defs.h (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter. * utils.c (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter, use it instead of current_gdbarch. * ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter. * ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter, use it instead of current_gdbarch. Update calls to ui_out_field_core_addr to pass architecture: * ada-lang.c (print_one_exception): Update. * breakpoint.c (print_one_breakpoint_location, print_one_exception_catchpoint): Update. * disasm.c (dump_insns): Update. * darwin-nat-info.c (darwin_debug_regions_recurse): Update. * mi/mi-main.c (mi_cmd_data_read_memory): Update. * mi/mi-symbol-cmds.c: Include "objfiles.h". (mi_cmd_symbol_list_lines): Update. * stack.c (print_frame_info, print_frame): Update. Update callers of paddress to pass architecture: * ada-tasks.c (info_task): Update. * ada-valprint.c (ada_val_print_1): Update. * annotate.c (annotate_source, annotate_frame_begin): Update. * breakpoint.c (insert_bp_location, describe_other_breakpoints, mention): Update. * cli/cli-cmds.c (edit_command, list_command, print_disassembly): Update. * corefile.c (memory_error): Update. * c-valprint.c (print_function_pointer_address, c_val_print): Update. * disasm.c (dis_asm_print_address): Update. * exec.c (print_section_info): Update. * f-valprint.c (f_val_print): Update. * infcmd.c: Include "arch-utils.h". (jump_command, program_info): Update. * linux-fork.c: Include "arch-utils.h". (info_forks_command): Update. * m2-valprint.c (print_function_pointer_address, print_unpacked_pointer, print_variable_at_address, m2_val_print): Update. * m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command): Update. * printcmd.c (print_address, print_address_demangle, address_info): Update. * p-valprint.c (pascal_val_print): Update. * source.c: Include "arch-utils.h". (line_info): Update. * stack.c (frame_info, print_block_frame_labels): Update. * symfile.c (add_symbol_file_command, list_overlays_command): Update. * symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1, print_symbol, print_partial_symbols, maintenance_info_psymtabs, maintenance_check_symtabs): Update. * symtab.c (find_pc_sect_symtab): Update. * target.c (deprecated_debug_xfer_memory): Update. * tracepoint.c (scope_info): Update. * tui/tui-stack.c (tui_make_status_line): Update. * valprint.c (val_print_string): Update. Update callers of paddr_nz to use paddress instead (keeping user-visible output identical): * alpha-tdep.c (alpha_heuristic_proc_start): Update. * amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn, amd64_displaced_step_fixup): Update. * arch-utils.c (simple_displaced_step_copy_insn): Update. * auxv.c (fprint_target_auxv): Update. * breakpoint.c (insert_single_step_breakpoint): Update. * buildsym.c (finish_block): Update. * cli/cli-dump.c (restore_section_callback): Update. * fbsd-nat.c (fbsd_find_memory_regions): Update. * frame.c (frame_unwind_register_value): Update. * gcore.c (gcore_create_callback): Update. * hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update. * i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm, i386_record_lea_modrm_addr, i386_record_lea_modrm, i386_process_record): Update. * ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id, ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id, ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update. * infrun.c (displaced_step_prepare, displaced_step_fixup, handle_inferior_event, insert_step_resume_breakpoint_at_sal, insert_longjmp_resume_breakpoint): Update. * linux-nat.c (linux_nat_find_memory_regions): Update. * linux-record.c (record_linux_system_call): Update. * mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call, mips_o32_push_dummy_call, mips_o64_push_dummy_call): Update. * monitor.c (monitor_error, monitor_remove_breakpoint): Update. * record.c (record_arch_list_add_mem, record_wait, record_xfer_partial): Update. * remote-mips.c (mips_fetch_word, mips_check_lsi_error, mips_common_breakpoint): Update. * remote-sim.c (gdbsim_xfer_inferior_memory): Update. * rs6000-tdep.c (ppc_displaced_step_fixup): Update. * solib-som.c (som_current_sos): Update. * symfile.c (load_progress, generic_load): Update. * symfile-mem.c (add_vsyscall_page): Update. * valops.c (value_fetch_lazy): Update. * windows-tdep.c (windows_xfer_shared_library): Update. Update callers of paddr_nz to use paddress instead (changing user-visible output to make it more correct): * dwarf2loc.c (locexpr_describe_location): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint, ia64_memory_remove_breakpoint): Update. * jv-valprint.c (java_value_print): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. * monitor.c (monitor_read_memory): Update. Update callers of paddr to use paddress instead (changing user-visible output to make it more correct): * arm-tdep.c (arm_push_dummy_call): Update. * breakpoint.c (insert_bp_location, create_thread_event_breakpoint, create_breakpoint): Update. * darwin-nat-info.c (darwin_debug_regions): Update. * dcache.c (dcache_info): Update. * dsrec.c (load_srec, make_srec): Update. * dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program, dwarf2_frame_cache): Update. * gcore.c (gcore_copy_callback): Update. * gnu-nat.c (gnu_xfer_memory): Update. * mips-linux-nat.c (mips_show_dr): Update. * monitor.c (monitor_write_memory, monitor_insert_breakpoint, monitor_remove_breakpoint): Update. * remote.c (compare_sections_command): Update. * remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint, m32r_remove_breakpoint, m32r_insert_watchpoint, m32r_remove_watchpoint): Update. * sol-thread.c (info_cb): Update. * symfile.c (load_progress): Update. Update callers of paddress or paddr_nz to use hex_string instead (changes output of internal/error/debug messages only): * dwarf2read.c (dump_die_shallow): Update. * frame.c (fprint_field, fprint_frame, frame_pc_unwind, get_frame_func, create_new_frame): Update. * hppa-tdep.c (find_unwind_entry, unwind_command): Update. * ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x, ia64_get_dyn_info_list): Update. * maint.c (maintenance_translate_address): Update. * mi/mi-cmd-var.c (mi_cmd_var_create): Update. * target.c (target_flash_erase): Update. Update callers of paddr/paddr_nz to use phex/phex_nz instead, using an appropriate address size. Remove use of strlen_paddr. * exec.c (exec_files_info): Update. * i386-nat.c (i386_show_dr): Update. * remote.c (remote_flash_erase): Update. * m32r-rom.c (m32r_load_section): Update. * monitor.c (monitor_vsprintf, monitor_store_register): Update. * remote.c (remote_check_symbols, remote_search_memory): Update. * remote-mips.c (mips_request, mips_common_breakpoint): Update. * scm-valprint.c (scm_ipruk, scm_scmval_print): Update. * sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update. * sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs, sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs, sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs, sh_dsp_show_regs): Update. * xcoffsolib.c (sharedlibrary_command): Update. * maint.c (maint_print_section_info): Add ADDR_SIZE parameter. Use hex_string_custom instead of paddr. (print_bfd_section_info): Pass address size. (print_objfile_section_info): Likewise. * annotate.h (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * annotate.c (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * source.c (identify_source_line): Update call to annotate_source. * stack.c (print_frame_info, print_frame): Update call to annotate_frame_begin. * breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter. (create_breakpoint, create_ada_exception_breakpoint): Update call. * stack.c (print_block_frame_labels): Add GDBARCH parameter. (print_frame_label_vars): Update call. * symmisc.c (print_partial_symbols): Add GDBARCH parameter. (dump_psymtab): Update call to print_partial_symbols. (struct print_symbol_args): Add GDBARCH member. (dump_symtab_1): Set print_symbol_args architecture member. (print_symbol): Use it. * windows-tdep.h (windows_xfer_shared_library): Add GDBARCH parameter. * windows-tdep.c (windows_xfer_shared_library): Likewise. * i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member. (core_process_module_section): Pass architecture from cpms_data to windows_xfer_shared_library. (windows_core_xfer_shared_libraries): Initialize cmps_data architecture member. * windows-nat.c (windows_xfer_shared_libraries): Pass architecture to windows_xfer_shared_library. * defs.h (print_address): Add GDBARCH parameter. * printcmd.c (print_address): Add GDBARCH parameter. (print_scalar_formatted, do_examine): Update call. * findcmd.c (find_command): Update call. * tracepoint.c: Include "arch-utils.h". (trace_find_line_command): Update call. * tui/tui-disasm.c (tui_disassemble): Update call. * value.h (print_address_demangle): Add GDBARCH parameter. * printcmd.c (print_address_demangle): Add GDBARCH parameter. * c-valprint.c (print_function_pointer_address, c_val_print): Update call. * f-valprint.c (f_val_print): Update call. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update call. * jv-valprint.c (java_val_print): Update call. * m2-valprint.c (print_function_pointer_address, m2_val_print): Update call. * p-valprint.c (pascal_val_print): Update call. * disasm.c (gdb_disassemble_info): Install architecture into di.application_data field. testsuite/ChangeLog: * gdb.threads/tls-shared.exp: Update to locexpr_describe_location change to prefix TLS offset in hex with 0x. doc/ChangeLog: * gdbint.texinfo (Item Output Functions): Update signature for ui_out_field_core_addr.
2009-07-02 19:21:10 +02:00
printf_filtered ("%s is in %s (%s:%d).\n",
paddress (gdbarch, sal.pc),
Replace SYMBOL_*_NAME accessors with member functions Similar to the MSYMBOL version of this patch, improves readability and will eventually allow making name private. gdb/ChangeLog: 2019-11-22 Christian Biesinger <cbiesinger@google.com> * ada-exp.y: Update. * ada-lang.c (sort_choices): Update. (ada_print_symbol_signature): Update. (resolve_subexp): Update. (ada_parse_renaming): Update. (ada_read_renaming_var_value): Update. (lesseq_defined_than): Update. (remove_extra_symbols): Update. (remove_irrelevant_renamings): Update. (ada_add_block_symbols): Update. (ada_collect_symbol_completion_matches): Update. (ada_is_renaming_symbol): Update. (aggregate_assign_from_choices): Update. (ada_evaluate_subexp): Update. (ada_has_this_exception_support): Update. (ada_is_non_standard_exception_sym): Update. (ada_add_exceptions_from_frame): Update. (ada_add_global_exceptions): Update. (ada_print_subexp): Update. * ax-gdb.c (gen_var_ref): Update. (gen_maybe_namespace_elt): Update. (gen_expr_for_cast): Update. (gen_expr): Update. * block.h: Update. * blockframe.c (find_pc_partial_function): Update. * breakpoint.c (print_breakpoint_location): Update. (update_static_tracepoint): Update. * btrace.c (ftrace_print_function_name): Update. (ftrace_function_switched): Update. * buildsym.c (find_symbol_in_list): Update. * c-exp.y: Update. * c-typeprint.c (c_print_typedef): Update. (c_type_print_template_args): Update. * cli/cli-cmds.c (edit_command): Update. (list_command): Update. (print_sal_location): Update. * coffread.c (patch_opaque_types): Update. (process_coff_symbol): Update. (coff_read_enum_type): Update. * compile/compile-c-symbols.c (c_symbol_substitution_name): Update. (convert_one_symbol): Update. (hash_symname): Update. (eq_symname): Update. * compile/compile-cplus-symbols.c (convert_one_symbol): Update. * compile/compile-cplus-types.c (debug_print_scope): Update. * compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Update. * compile/compile-object-load.c (get_out_value_type): Update. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Update. (search_symbol_list): Update. (cp_lookup_symbol_imports_or_template): Update. * cp-support.c (overload_list_add_symbol): Update. * ctfread.c (psymtab_to_symtab): Update. * dbxread.c (cp_set_block_scope): Update. * dictionary.c (iter_match_first_hashed): Update. (iter_match_next_hashed): Update. (insert_symbol_hashed): Update. (iter_match_next_linear): Update. * dictionary.h: Update. * dwarf2loc.c (func_get_frame_base_dwarf_block): Update. (locexpr_describe_location_piece): Update. (locexpr_describe_location_1): Update. (locexpr_generate_c_location): Update. (loclist_describe_location): Update. (loclist_generate_c_location): Update. * dwarf2read.c (dw2_debug_names_lookup_symbol): Update. (read_func_scope): Update. (process_enumeration_scope): Update. (new_symbol): Update. (dwarf2_const_value): Update. (dwarf2_symbol_mark_computed): Update. * eval.c (evaluate_funcall): Update. (evaluate_subexp_standard): Update. * expprint.c (print_subexp_standard): Update. (dump_subexp_body_standard): Update. * f-valprint.c (info_common_command_for_block): Update. * findvar.c (get_hosting_frame): Update. (default_read_var_value): Update. * go-lang.c (go_symbol_package_name): Update. * guile/scm-block.c (bkscm_print_block_smob): Update. * guile/scm-symbol.c (syscm_print_symbol_smob): Update. (gdbscm_symbol_name): Update. (gdbscm_symbol_linkage_name): Update. (gdbscm_symbol_print_name): Update. * infcall.c (get_function_name): Update. * infcmd.c (jump_command): Update. (finish_command): Update. * infrun.c (insert_exception_resume_breakpoint): Update. * linespec.c (canonicalize_linespec): Update. (create_sals_line_offset): Update. (convert_linespec_to_sals): Update. (complete_label): Update. (find_label_symbols_in_block): Update. * m2-typeprint.c (m2_print_typedef): Update. * mdebugread.c (mdebug_reg_to_regnum): Update. (parse_symbol): Update. (mylookup_symbol): Update. * mi/mi-cmd-stack.c (list_arg_or_local): Update. (list_args_or_locals): Update. * objc-lang.c (compare_selectors): Update. (info_selectors_command): Update. (compare_classes): Update. (info_classes_command): Update. (find_imps): Update. * p-typeprint.c (pascal_print_typedef): Update. * printcmd.c (build_address_symbolic): Update. (info_address_command): Update. (print_variable_and_value): Update. * python/py-framefilter.c (extract_sym): Update. (py_print_single_arg): Update. * python/py-symbol.c (sympy_str): Update. (sympy_get_name): Update. (sympy_get_linkage_name): Update. * python/python.c (gdbpy_rbreak): Update. * record-btrace.c (btrace_get_bfun_name): Update. (btrace_call_history): Update. * rust-lang.c (rust_print_typedef): Update. * solib-frv.c (frv_fdpic_find_canonical_descriptor): Update. * stabsread.c (stab_reg_to_regnum): Update. (define_symbol): Update. (read_enum_type): Update. (common_block_end): Update. (cleanup_undefined_types_1): Update. (scan_file_globals): Update. * stack.c (print_frame_arg): Update. (print_frame_args): Update. (find_frame_funname): Update. (info_frame_command_core): Update. (iterate_over_block_locals): Update. (print_block_frame_labels): Update. (do_print_variable_and_value): Update. (iterate_over_block_arg_vars): Update. (return_command): Update. * symmisc.c (dump_symtab_1): Update. (print_symbol): Update. * symtab.c (eq_symbol_entry): Update. (symbol_cache_dump): Update. (lookup_language_this): Update. (find_pc_sect_line): Update. (skip_prologue_sal): Update. (symbol_search::compare_search_syms): Update. (treg_matches_sym_type_name): Update. (search_symbols): Update. (print_symbol_info): Update. (rbreak_command): Update. (completion_list_add_symbol): Update. (find_gnu_ifunc): Update. (get_symbol_address): Update. (search_module_symbols): Update. (info_module_subcommand): Update. * symtab.h (SYMBOL_NATURAL_NAME): Remove. (SYMBOL_LINKAGE_NAME): Remove. (SYMBOL_DEMANGLED_NAME): Remove. (SYMBOL_PRINT_NAME): Remove. (SYMBOL_SEARCH_NAME): Remove. * tracepoint.c (set_traceframe_context): Update. (validate_actionline): Update. (collection_list::collect_symbol): Update. (encode_actions_1): Update. (info_scope_command): Update. (print_one_static_tracepoint_marker): Update. * typeprint.c (typedef_hash_table::add_template_parameters): Update. * valops.c (address_of_variable): Update. (find_overload_match): Update. (find_oload_champ): Update. Change-Id: I76bdc8b44eea6876bf03af9d351f8e90cc0154b2
2019-11-22 19:05:14 +01:00
sym->print_name (),
gdb/ * ada-lang.c (user_select_syms): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * breakpoint.c (print_breakpoint_location, resolve_sal_pc): Likewise. (clear_command): New variable sal_fullname, initialize it. Replace compare_filenames_for_search by filename_cmp with sal_fullname. (say_where, update_static_tracepoint): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * cli/cli-cmds.c (edit_command, list_command, ambiguous_line_spec): Likewise. * dwarf2read.c: Include source.h. (fixup_go_packaging): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * linespec.c (add_sal_to_sals): Rename variable filename to fullname. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (create_sals_line_offset, convert_linespec_to_sals): New variable fullname, initialize it, replace symtab->filename reference by the variable. * linux-fork.c: Include source.h. (info_checkpoints_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * macroscope.c (sal_macro_scope): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * mdebugread.c: Include source.h. (psymtab_to_symtab_1): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) (mi_cmd_file_list_exec_source_files): Likewise. * printcmd.c: Include source.h. (build_address_symbolic): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * psymtab.c (partial_map_symtabs_matching_filename) (read_psymtabs_with_fullname): Call compare_filenames_for_search also with psymtab_to_fullname. * python/py-symtab.c (stpy_str): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (stpy_get_filename): New variable filename, initialize it, use instead of symtab->filename refererences. (salpy_str): Make variable filename const char *. Replace symtab->filename refererences by symtab_to_filename_for_display calls. * skip.c: Include source.h and filenames.h. (skip_file_command): Remove const from the symtab variable. Replace symtab->filename refererences by symtab_to_fullname call. (function_name_is_marked_for_skip): New variables searched_for_fullname and fullname. Use them to search also with symtab's fullname. * source.c (find_source_lines): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (print_source_lines_base): New variable filename, use it instead of symtab->filename. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (line_info, forward_search_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (reverse_search_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. New variable filename for it. * stack.c (frame_info): Likewise. * symmisc.c: Include source.h. (dump_objfile, dump_symtab_1, maintenance_print_symbols) (maintenance_info_symtabs): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * symtab.c (iterate_over_some_symtabs): Call compare_filenames_for_search also with symtab_to_fullname. (lookup_symbol_aux_quick, basic_lookup_transparent_type_quick): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (find_line_symtab): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (file_matches): Replace filename_cmp by compare_filenames_for_search. (print_symbol_info): Make the last parameter const char *. New variable s_filename. Use it in the function. (symtab_symbol_info): Make the last_filename variable const char *. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (rbreak_command): New variable fullname. Use it. Replace symtab->filename refererence by symtab_to_filename_for_display call. * tracepoint.c (set_traceframe_context, trace_find_line_command) (print_one_static_tracepoint_marker): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * tui/tui-source.c (tui_set_source_content): New variables filename and s_filename. Replace symtab->filename refererences by this variable. Replace other symtab->filename refererences by symtab_to_filename_for_display calls.
2013-02-03 17:13:31 +01:00
symtab_to_filename_for_display (sal.symtab),
sal.line);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
else
* defs.h (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter. * utils.c (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter, use it instead of current_gdbarch. * ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter. * ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter, use it instead of current_gdbarch. Update calls to ui_out_field_core_addr to pass architecture: * ada-lang.c (print_one_exception): Update. * breakpoint.c (print_one_breakpoint_location, print_one_exception_catchpoint): Update. * disasm.c (dump_insns): Update. * darwin-nat-info.c (darwin_debug_regions_recurse): Update. * mi/mi-main.c (mi_cmd_data_read_memory): Update. * mi/mi-symbol-cmds.c: Include "objfiles.h". (mi_cmd_symbol_list_lines): Update. * stack.c (print_frame_info, print_frame): Update. Update callers of paddress to pass architecture: * ada-tasks.c (info_task): Update. * ada-valprint.c (ada_val_print_1): Update. * annotate.c (annotate_source, annotate_frame_begin): Update. * breakpoint.c (insert_bp_location, describe_other_breakpoints, mention): Update. * cli/cli-cmds.c (edit_command, list_command, print_disassembly): Update. * corefile.c (memory_error): Update. * c-valprint.c (print_function_pointer_address, c_val_print): Update. * disasm.c (dis_asm_print_address): Update. * exec.c (print_section_info): Update. * f-valprint.c (f_val_print): Update. * infcmd.c: Include "arch-utils.h". (jump_command, program_info): Update. * linux-fork.c: Include "arch-utils.h". (info_forks_command): Update. * m2-valprint.c (print_function_pointer_address, print_unpacked_pointer, print_variable_at_address, m2_val_print): Update. * m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command): Update. * printcmd.c (print_address, print_address_demangle, address_info): Update. * p-valprint.c (pascal_val_print): Update. * source.c: Include "arch-utils.h". (line_info): Update. * stack.c (frame_info, print_block_frame_labels): Update. * symfile.c (add_symbol_file_command, list_overlays_command): Update. * symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1, print_symbol, print_partial_symbols, maintenance_info_psymtabs, maintenance_check_symtabs): Update. * symtab.c (find_pc_sect_symtab): Update. * target.c (deprecated_debug_xfer_memory): Update. * tracepoint.c (scope_info): Update. * tui/tui-stack.c (tui_make_status_line): Update. * valprint.c (val_print_string): Update. Update callers of paddr_nz to use paddress instead (keeping user-visible output identical): * alpha-tdep.c (alpha_heuristic_proc_start): Update. * amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn, amd64_displaced_step_fixup): Update. * arch-utils.c (simple_displaced_step_copy_insn): Update. * auxv.c (fprint_target_auxv): Update. * breakpoint.c (insert_single_step_breakpoint): Update. * buildsym.c (finish_block): Update. * cli/cli-dump.c (restore_section_callback): Update. * fbsd-nat.c (fbsd_find_memory_regions): Update. * frame.c (frame_unwind_register_value): Update. * gcore.c (gcore_create_callback): Update. * hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update. * i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm, i386_record_lea_modrm_addr, i386_record_lea_modrm, i386_process_record): Update. * ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id, ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id, ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update. * infrun.c (displaced_step_prepare, displaced_step_fixup, handle_inferior_event, insert_step_resume_breakpoint_at_sal, insert_longjmp_resume_breakpoint): Update. * linux-nat.c (linux_nat_find_memory_regions): Update. * linux-record.c (record_linux_system_call): Update. * mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call, mips_o32_push_dummy_call, mips_o64_push_dummy_call): Update. * monitor.c (monitor_error, monitor_remove_breakpoint): Update. * record.c (record_arch_list_add_mem, record_wait, record_xfer_partial): Update. * remote-mips.c (mips_fetch_word, mips_check_lsi_error, mips_common_breakpoint): Update. * remote-sim.c (gdbsim_xfer_inferior_memory): Update. * rs6000-tdep.c (ppc_displaced_step_fixup): Update. * solib-som.c (som_current_sos): Update. * symfile.c (load_progress, generic_load): Update. * symfile-mem.c (add_vsyscall_page): Update. * valops.c (value_fetch_lazy): Update. * windows-tdep.c (windows_xfer_shared_library): Update. Update callers of paddr_nz to use paddress instead (changing user-visible output to make it more correct): * dwarf2loc.c (locexpr_describe_location): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint, ia64_memory_remove_breakpoint): Update. * jv-valprint.c (java_value_print): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. * monitor.c (monitor_read_memory): Update. Update callers of paddr to use paddress instead (changing user-visible output to make it more correct): * arm-tdep.c (arm_push_dummy_call): Update. * breakpoint.c (insert_bp_location, create_thread_event_breakpoint, create_breakpoint): Update. * darwin-nat-info.c (darwin_debug_regions): Update. * dcache.c (dcache_info): Update. * dsrec.c (load_srec, make_srec): Update. * dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program, dwarf2_frame_cache): Update. * gcore.c (gcore_copy_callback): Update. * gnu-nat.c (gnu_xfer_memory): Update. * mips-linux-nat.c (mips_show_dr): Update. * monitor.c (monitor_write_memory, monitor_insert_breakpoint, monitor_remove_breakpoint): Update. * remote.c (compare_sections_command): Update. * remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint, m32r_remove_breakpoint, m32r_insert_watchpoint, m32r_remove_watchpoint): Update. * sol-thread.c (info_cb): Update. * symfile.c (load_progress): Update. Update callers of paddress or paddr_nz to use hex_string instead (changes output of internal/error/debug messages only): * dwarf2read.c (dump_die_shallow): Update. * frame.c (fprint_field, fprint_frame, frame_pc_unwind, get_frame_func, create_new_frame): Update. * hppa-tdep.c (find_unwind_entry, unwind_command): Update. * ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x, ia64_get_dyn_info_list): Update. * maint.c (maintenance_translate_address): Update. * mi/mi-cmd-var.c (mi_cmd_var_create): Update. * target.c (target_flash_erase): Update. Update callers of paddr/paddr_nz to use phex/phex_nz instead, using an appropriate address size. Remove use of strlen_paddr. * exec.c (exec_files_info): Update. * i386-nat.c (i386_show_dr): Update. * remote.c (remote_flash_erase): Update. * m32r-rom.c (m32r_load_section): Update. * monitor.c (monitor_vsprintf, monitor_store_register): Update. * remote.c (remote_check_symbols, remote_search_memory): Update. * remote-mips.c (mips_request, mips_common_breakpoint): Update. * scm-valprint.c (scm_ipruk, scm_scmval_print): Update. * sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update. * sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs, sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs, sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs, sh_dsp_show_regs): Update. * xcoffsolib.c (sharedlibrary_command): Update. * maint.c (maint_print_section_info): Add ADDR_SIZE parameter. Use hex_string_custom instead of paddr. (print_bfd_section_info): Pass address size. (print_objfile_section_info): Likewise. * annotate.h (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * annotate.c (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * source.c (identify_source_line): Update call to annotate_source. * stack.c (print_frame_info, print_frame): Update call to annotate_frame_begin. * breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter. (create_breakpoint, create_ada_exception_breakpoint): Update call. * stack.c (print_block_frame_labels): Add GDBARCH parameter. (print_frame_label_vars): Update call. * symmisc.c (print_partial_symbols): Add GDBARCH parameter. (dump_psymtab): Update call to print_partial_symbols. (struct print_symbol_args): Add GDBARCH member. (dump_symtab_1): Set print_symbol_args architecture member. (print_symbol): Use it. * windows-tdep.h (windows_xfer_shared_library): Add GDBARCH parameter. * windows-tdep.c (windows_xfer_shared_library): Likewise. * i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member. (core_process_module_section): Pass architecture from cpms_data to windows_xfer_shared_library. (windows_core_xfer_shared_libraries): Initialize cmps_data architecture member. * windows-nat.c (windows_xfer_shared_libraries): Pass architecture to windows_xfer_shared_library. * defs.h (print_address): Add GDBARCH parameter. * printcmd.c (print_address): Add GDBARCH parameter. (print_scalar_formatted, do_examine): Update call. * findcmd.c (find_command): Update call. * tracepoint.c: Include "arch-utils.h". (trace_find_line_command): Update call. * tui/tui-disasm.c (tui_disassemble): Update call. * value.h (print_address_demangle): Add GDBARCH parameter. * printcmd.c (print_address_demangle): Add GDBARCH parameter. * c-valprint.c (print_function_pointer_address, c_val_print): Update call. * f-valprint.c (f_val_print): Update call. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update call. * jv-valprint.c (java_val_print): Update call. * m2-valprint.c (print_function_pointer_address, m2_val_print): Update call. * p-valprint.c (pascal_val_print): Update call. * disasm.c (gdb_disassemble_info): Install architecture into di.application_data field. testsuite/ChangeLog: * gdb.threads/tls-shared.exp: Update to locexpr_describe_location change to prefix TLS offset in hex with 0x. doc/ChangeLog: * gdbint.texinfo (Item Output Functions): Update signature for ui_out_field_core_addr.
2009-07-02 19:21:10 +02:00
printf_filtered ("%s is at %s:%d.\n",
paddress (gdbarch, sal.pc),
gdb/ * ada-lang.c (user_select_syms): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * breakpoint.c (print_breakpoint_location, resolve_sal_pc): Likewise. (clear_command): New variable sal_fullname, initialize it. Replace compare_filenames_for_search by filename_cmp with sal_fullname. (say_where, update_static_tracepoint): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * cli/cli-cmds.c (edit_command, list_command, ambiguous_line_spec): Likewise. * dwarf2read.c: Include source.h. (fixup_go_packaging): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * linespec.c (add_sal_to_sals): Rename variable filename to fullname. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (create_sals_line_offset, convert_linespec_to_sals): New variable fullname, initialize it, replace symtab->filename reference by the variable. * linux-fork.c: Include source.h. (info_checkpoints_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * macroscope.c (sal_macro_scope): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * mdebugread.c: Include source.h. (psymtab_to_symtab_1): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) (mi_cmd_file_list_exec_source_files): Likewise. * printcmd.c: Include source.h. (build_address_symbolic): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * psymtab.c (partial_map_symtabs_matching_filename) (read_psymtabs_with_fullname): Call compare_filenames_for_search also with psymtab_to_fullname. * python/py-symtab.c (stpy_str): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (stpy_get_filename): New variable filename, initialize it, use instead of symtab->filename refererences. (salpy_str): Make variable filename const char *. Replace symtab->filename refererences by symtab_to_filename_for_display calls. * skip.c: Include source.h and filenames.h. (skip_file_command): Remove const from the symtab variable. Replace symtab->filename refererences by symtab_to_fullname call. (function_name_is_marked_for_skip): New variables searched_for_fullname and fullname. Use them to search also with symtab's fullname. * source.c (find_source_lines): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (print_source_lines_base): New variable filename, use it instead of symtab->filename. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (line_info, forward_search_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (reverse_search_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. New variable filename for it. * stack.c (frame_info): Likewise. * symmisc.c: Include source.h. (dump_objfile, dump_symtab_1, maintenance_print_symbols) (maintenance_info_symtabs): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * symtab.c (iterate_over_some_symtabs): Call compare_filenames_for_search also with symtab_to_fullname. (lookup_symbol_aux_quick, basic_lookup_transparent_type_quick): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (find_line_symtab): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (file_matches): Replace filename_cmp by compare_filenames_for_search. (print_symbol_info): Make the last parameter const char *. New variable s_filename. Use it in the function. (symtab_symbol_info): Make the last_filename variable const char *. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (rbreak_command): New variable fullname. Use it. Replace symtab->filename refererence by symtab_to_filename_for_display call. * tracepoint.c (set_traceframe_context, trace_find_line_command) (print_one_static_tracepoint_marker): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * tui/tui-source.c (tui_set_source_content): New variables filename and s_filename. Replace symtab->filename refererences by this variable. Replace other symtab->filename refererences by symtab_to_filename_for_display calls.
2013-02-03 17:13:31 +01:00
symtab_to_filename_for_display (sal.symtab),
sal.line);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
}
/* If what was given does not imply a symtab, it must be an
undebuggable symbol which means no source code. */
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
if (sal.symtab == 0)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("No line number known for %s."), arg);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
}
if ((editor = getenv ("EDITOR")) == NULL)
editor = "/bin/ex";
fn = symtab_to_fullname (sal.symtab);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
/* Quote the file name, in case it has whitespace or other special
characters. */
p = xstrprintf ("%s +%d \"%s\"", editor, sal.line, fn);
shell_escape (p, from_tty);
xfree (p);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
}
/* The options for the "pipe" command. */
struct pipe_cmd_opts
{
/* For "-d". */
char *delimiter = nullptr;
~pipe_cmd_opts ()
{
xfree (delimiter);
}
};
static const gdb::option::option_def pipe_cmd_option_defs[] = {
gdb::option::string_option_def<pipe_cmd_opts> {
"d",
[] (pipe_cmd_opts *opts) { return &opts->delimiter; },
nullptr,
N_("Indicates to use the specified delimiter string to separate\n\
COMMAND from SHELL_COMMAND, in alternative to |. This is useful in\n\
case COMMAND contains a | character."),
},
};
/* Create an option_def_group for the "pipe" command's options, with
OPTS as context. */
static inline gdb::option::option_def_group
make_pipe_cmd_options_def_group (pipe_cmd_opts *opts)
{
return {{pipe_cmd_option_defs}, opts};
}
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
/* Implementation of the "pipe" command. */
static void
pipe_command (const char *arg, int from_tty)
{
pipe_cmd_opts opts;
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
auto grp = make_pipe_cmd_options_def_group (&opts);
gdb::option::process_options
(&arg, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp);
const char *delim = "|";
if (opts.delimiter != nullptr)
delim = opts.delimiter;
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
const char *command = arg;
if (command == nullptr)
error (_("Missing COMMAND"));
arg = strstr (arg, delim);
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
if (arg == nullptr)
error (_("Missing delimiter before SHELL_COMMAND"));
std::string gdb_cmd (command, arg - command);
arg += strlen (delim); /* Skip the delimiter. */
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
if (gdb_cmd.empty ())
Introduce the "with" command ( See original discussion and prototype here: https://sourceware.org/ml/gdb-patches/2019-05/msg00570.html ) (gdb) help with Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING. Usage: with SETTING [VALUE] [-- COMMAND] Usage: w SETTING [VALUE] [-- COMMAND] With no COMMAND, repeats the last executed command. SETTING is any setting you can change with the "set" subcommands. E.g.: with language pascal -- print obj with print elements unlimited -- print obj As can be seen above, the "with" command is just like "set", but instead of setting the setting permanently, it sets the setting, runs a command and then restores the setting. (gdb) p g_s $1 = {a = 1, b = 2, c = 3} (gdb) with language ada -- print g_s $2 = (a => 1, b => 2, c => 3) Warning: the current language does not match this frame. (gdb) show language The current source language is "auto; currently c". (gdb) with print elements 100 -- with print object on -- print 1 $3 = 1 You can shorten things a bit though, as long as unambiguous. So this: (gdb) with print elements 100 -- with print object off -- print 1 is the same as: (gdb) w p el 100 -- w p o 0 -- p 1 Note that the patch adds a "w" alias for "with", as "w" is not currently taken: (gdb) w Ambiguous command "w": watch, wh, whatis, where, while, while-stepping, winheight, ws. Let me know if you'd prefer to reserve "w" for one of the other commands above. IMHO, this command will end up being used frequently enough that it deserves the "w" shorthand. A nice feature is that this is fully integrated with TAB-completion: (gdb) with p[TAB] pagination print prompt python (gdb) with print [TAB] address max-depth static-members array max-symbolic-offset symbol array-indexes null-stop symbol-filename asm-demangle object symbol-loading demangle pascal_static-members thread-events elements pretty type entry-values raw union frame-arguments repeats vtbl inferior-events sevenbit-strings (gdb) with print [TAB] (gdb) with print elements unlimited -- thread apply all -[TAB] -ascending -c -q -s (gdb) with print elements unlimited -- print -[TAB] -address -max-depth -repeats -vtbl -array -null-stop -static-members -array-indexes -object -symbol -elements -pretty -union The main advantage of this new command compared to command options, like the new "print -OPT", is that this command works with any setting, and, it works nicely when you want to override a setting while running a user-defined command, like: (gdb) with print pretty -- usercmd The disadvantage is that it isn't as compact or easy to type. I think of command options and this command as complementary. I think that even with this new command, it makes sense to continue developing the command options in the direction of exposing most-oft-used settings as command options. Inspired by Philippe's "/" command proposal, if no command is specified, then the last command is re-invoked, under the overridden setting: (gdb) p g_s $1 = {a = 1, b = 2, c = 3} (gdb) with language ada $2 = (a => 1, b => 2, c => 3) Warning: the current language does not match this frame. Note: "with" requires "--" to separate the setting from the command. It might be possible to do without that, but, I haven't tried it yet, and I think that this can go in without it. We can always downgrade to making "--" optional if we manage to make it work. On to the patch itself, the implementation of the command is simpler than one might expect. A few details: - I factored out a bit from pipe_command into repeat_previous directly, because otherwise I'd need to copy&paste the same code and same error message in the with command. - The parse_cli_var_uinteger / parse_cli_var_zuinteger_unlimited / do_set_command changes are necessary since we can now pass an empty string as argument. - do_show_command was split in two, as a FIXME comment suggests, but for a different reason: we need to get a string version of a "set" command's value, and we already had code for that in do_show_command. That code is now factored out to the new get_setshow_command_value_string function. - There's a new "maint with" command added too: (gdb) help maint with Like "with", but works with "maintenance set" variables. Usage: maintenance with SETTING [VALUE] [-- COMMAND] With no COMMAND, repeats the last executed command. SETTING is any setting you can change with the "maintenance set" subcommands. "with" and "maint with" share 99% of the implementation. This might be useful on its own, but it's also useful for testing, since with this, we can use the "maint set/show test-settings" settings for exercising the "with" machinery with all the command type variants (all enum var_types). This is done in the new gdb/base/with.exp testcase. The documentation bits are originally based on Philippe's docs for the "/" command, hence the attribution in the ChangeLog. gdb/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> * NEWS (New commands): Mention "with" and "maint with". * cli/cli-cmds.c (with_command_1, with_command_completer_1) (with_command, with_command_completer): New. (pipe_command): Adjust to new repeat_previous interface. (_initialize_cli_cmds): Install the "with" command and its "w" alias. * cli/cli-cmds.h (with_command_1, with_command_completer_1): New declarations. * cli/cli-setshow.c (parse_cli_var_uinteger) (parse_cli_var_zuinteger_unlimited, do_set_command): Handle empty argument strings for all var_types. (get_setshow_command_value_string): New, factored out from ... (do_show_command): ... this. * cli/cli-setshow.h: Include <string>. (get_setshow_command_value_string): Declare. * command.h (repeat_previous): Now returns const char *. Adjust comment. * maint.c: Include "cli/cli-cmds.h". (maintenance_with_cmd, maintenance_with_cmd_completer): New. (_initialize_maint_cmds): Register the "maintenance with" command. * top.c (repeat_previous): Move bits from pipe_command here: Return the saved command line, if any; error out if there's no command to relaunch. gdb/doc/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.texinfo (Command Settings): New node documenting the general concept of settings, how to change them, and the new "with" command. (Maintenance Commands): Document "maint with". gdb/testsuite/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> * gdb.base/with.c: New file. * gdb.base/with.exp: New file.
2019-07-03 14:34:20 +02:00
gdb_cmd = repeat_previous ();
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
const char *shell_command = skip_spaces (arg);
if (*shell_command == '\0')
error (_("Missing SHELL_COMMAND"));
FILE *to_shell_command = popen (shell_command, "w");
if (to_shell_command == nullptr)
error (_("Error launching \"%s\""), shell_command);
try
{
stdio_file pipe_file (to_shell_command);
execute_command_to_ui_file (&pipe_file, gdb_cmd.c_str (), from_tty);
}
catch (...)
{
pclose (to_shell_command);
throw;
}
int exit_status = pclose (to_shell_command);
if (exit_status < 0)
error (_("shell command \"%s\" failed: %s"), shell_command,
safe_strerror (errno));
exit_status_set_internal_vars (exit_status);
}
/* Completer for the pipe command. */
static void
pipe_command_completer (struct cmd_list_element *ignore,
completion_tracker &tracker,
const char *text, const char *word_ignored)
{
pipe_cmd_opts opts;
const char *org_text = text;
auto grp = make_pipe_cmd_options_def_group (&opts);
if (gdb::option::complete_options
(tracker, &text, gdb::option::PROCESS_OPTIONS_UNKNOWN_IS_OPERAND, grp))
return;
const char *delimiter = "|";
if (opts.delimiter != nullptr)
delimiter = opts.delimiter;
/* Check if we're past option values already. */
if (text > org_text && !isspace (text[-1]))
return;
const char *delim = strstr (text, delimiter);
/* If we're still not past the delimiter, complete the gdb
command. */
if (delim == nullptr || delim == text)
{
complete_nested_command_line (tracker, text);
return;
}
/* We're past the delimiter. What follows is a shell command, which
we don't know how to complete. */
}
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
list_command (const char *arg, int from_tty)
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
{
struct symbol *sym;
Constify some linespec functions This changes a few linespec functions to work on "const char *" and then fixes up all the callers. This allows further constification elsewhere. gdb/ChangeLog 2017-09-27 Tom Tromey <tom@tromey.com> * tracepoint.c (info_scope_command): Constify. * python/python.c (gdbpy_decode_line): Constify. * python/py-breakpoint.c (bppy_init): Constify. * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Constify. * location.h: (new_linespec_location) (string_to_event_location_basic, string_to_event_location): Constify. * location.c (new_linespec_location) (string_to_event_location_basic, string_to_event_location): Constify. * linespec.h (decode_line_with_current_source) (decode_line_with_last_displayed, linespec_lex_to_end): Constify. * linespec.c (linespec_lex_to_end) (decode_line_with_current_source) (decode_line_with_last_displayed): Constify. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Constify. * cli/cli-cmds.c (edit_command, list_command): Constify. * breakpoint.h (until_break_command, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (init_ada_exception_breakpoint): Constify. * breakpoint.c (break_command_1, dprintf_command) (break_range_command, watch_command_wrapper) (rwatch_command_wrapper, awatch_command_wrapper) (until_break_command, init_ada_exception_breakpoint) (strace_marker_create_sals_from_location, trace_command) (ftrace_command, strace_command, struct tracepoint): Constify. * ax-gdb.c (agent_command_1): Constify. * ada-lang.c (ada_exception_sal): Constify.
2017-09-13 02:32:41 +02:00
const char *arg1;
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
int no_end = 1;
int dummy_end = 0;
int dummy_beg = 0;
int linenum_beg = 0;
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
const char *p;
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
/* Pull in the current default source line if necessary. */
if (arg == NULL || ((arg[0] == '+' || arg[0] == '-') && arg[1] == '\0'))
{
set_default_source_symtab_and_line ();
Kill init_sal Instead, make symtab_and_line initialize its members itself. Many symtab_and_line declarations are moved to where the object is initialized at the same time both for clarity and to avoid double initialization. A few functions, like e.g., find_frame_sal are adjusted to return the sal using normal function return instead of an output parameter likewise to avoid having to default-construct a sal and then immediately have the object overwritten. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ada-lang.c (is_known_support_routine): Move sal declaration to where it is initialized. * breakpoint.c (create_internal_breakpoint, init_catchpoint) (parse_breakpoint_sals, decode_static_tracepoint_spec) (clear_command, update_static_tracepoint): Remove init_sal references. Move declarations closer to initializations. * cli/cli-cmds.c (list_command): Move sal declarations closer to initializations. * elfread.c (elf_gnu_ifunc_resolver_stop): Remove init_sal references. Move sal declarations closer to initializations. * frame.c (find_frame_sal): Return a symtab_and_line via function return instead of output parameter. Remove init_sal references. * frame.h (find_frame_sal): Return a symtab_and_line via function return instead of output parameter. * guile/scm-frame.c (gdbscm_frame_sal): Adjust. * guile/scm-symtab.c (stscm_make_sal_smob): Use in-place new instead of memset. (gdbscm_find_pc_line): Remove init_sal reference. * infcall.c (call_function_by_hand_dummy): Remove init_sal references. Move declarations closer to initializations. * infcmd.c (set_step_frame): Update. Move declarations closer to initializations. (finish_backward): Remove init_sal references. Move declarations closer to initializations. * infrun.c (process_event_stop_test, handle_step_into_function) (insert_hp_step_resume_breakpoint_at_frame) (insert_step_resume_breakpoint_at_caller): Likewise. * linespec.c (create_sals_line_offset, decode_digits_ordinary) (symbol_to_sal): Likewise. * probe.c (parse_probes_in_pspace): Remove init_sal reference. * python/py-frame.c (frapy_find_sal): Move sal declaration closer to its initialization. * reverse.c (save_bookmark_command): Use new/delete. Remove init_sal references. Move declarations closer to initializations. * source.c (get_current_source_symtab_and_line): Remove brace initialization. (set_current_source_symtab_and_line): Now takes the sal by const reference. Remove brace initialization. (line_info): Remove init_sal reference. * source.h (set_current_source_symtab_and_line): Now takes a symtab_and_line via const reference. * stack.c (set_current_sal_from_frame): Adjust. (print_frame_info): Adjust. (get_last_displayed_sal): Return the sal via function return instead of via output parameter. Simplify. (frame_info): Adjust. * stack.h (get_last_displayed_sal): Return the sal via function return instead of via output parameter. * symtab.c (init_sal): Delete. (find_pc_sect_line): Remove init_sal references. Move declarations closer to initializations. (find_function_start_sal): Remove init_sal references. Move declarations closer to initializations. * symtab.h (struct symtab_and_line): In-class initialize all fields. * tracepoint.c (set_traceframe_context) (print_one_static_tracepoint_marker): Remove init_sal references. Move declarations closer to initializations. * tui/tui-disasm.c (tui_show_disassem_and_update_source): Adjust. * tui/tui-stack.c (tui_show_frame_info): Adjust. Move declarations closer to initializations. * tui/tui-winsource.c (tui_update_source_window_as_is): Remove init_sal references. Adjust.
2017-09-04 18:10:13 +02:00
symtab_and_line cursal = get_current_source_symtab_and_line ();
PR gdb/13860: make -interpreter-exec console "list" behave more like "list". I noticed that "list" behaves differently in CLI vs MI. Particularly: $ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli...done. (gdb) start Temporary breakpoint 1 at 0x40054d: file ../../../src/gdb/testsuite/gdb.mi/basics.c, line 62. Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli Temporary breakpoint 1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62 62 callee1 (2, "A string argument.", 3.5); (gdb) list 57 { 58 } 59 60 main () 61 { 62 callee1 (2, "A string argument.", 3.5); 63 callee1 (2, "A string argument.", 3.5); 64 65 do_nothing (); /* Hello, World! */ 66 (gdb) Note the list started at line 57. IOW, the program stopped at line 62, and GDB centered the list on that. compare with: $ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli..." ~"done.\n" (gdb) start &"start\n" ... ~"\nTemporary breakpoint " ~"1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62\n" ~"62\t callee1 (2, \"A string argument.\", 3.5);\n" *stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x000000000040054d",func="main",args=[],file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/basics.c",line="62"},thread-id="1",stopped-threads="all",core="0" =breakpoint-deleted,id="1" (gdb) -interpreter-exec console list ~"62\t callee1 (2, \"A string argument.\", 3.5);\n" ~"63\t callee1 (2, \"A string argument.\", 3.5);\n" ~"64\t\n" ~"65\t do_nothing (); /* Hello, World! */\n" ~"66\t\n" ~"67\t callme (1);\n" ~"68\t callme (2);\n" ~"69\t\n" ~"70\t return 0;\n" ~"71\t}\n" ^done (gdb) Here the list starts at line 62, where the program was stopped. This happens because print_stack_frame, called from both normal_stop and mi_on_normal_stop, is the function responsible for setting the current sal from the selected frame, overrides the PRINT_WHAT argument, and only after that does it decide whether to center the current sal line or not, based on the overridden value, and it will always decide false. (The print_stack_frame call in mi_on_normal_stop is a little different from the call in normal_stop, in that it is an unconditional SRC_AND_LOC call. A future patch will make those uniform.) A previous version of this patch made MI uniform with CLI here, by making print_stack_frame also center when MI is active. That changed the output of a "list" command in mi-cli.exp, to expect line 57 instead of 62, as per the example above. However, looking deeper, that list in question is the first "list" after the program stops, and right after the stop, before the "list", the test did "set listsize 1". Let's try the same thing with the CLI: (gdb) start 62 callee1 (2, "A string argument.", 3.5); (gdb) set listsize 1 (gdb) list 57 { Huh, that's unexpected. Why the 57? It's because print_stack_frame, called in reaction to the breakpoint stop, expecting the next "list" to show 10 lines (the listsize at the time) around line 62, sets the lines listed range to 57-67 (62 +/- 5). If the user changes the listsize before "list", why would we still show that range? Looks bogus to me. So the fix for this whole issue should be delay trying to center the listing to until actually listing, so that the correct listsize can be taken into account. This makes MI and CLI uniform too, as it deletes the center code from print_stack_frame. A series of tests are added to list.exp to cover this. mi-cli.exp was after all correct all along, but it now gains an additional test that lists lines with listsize 10, to ensure the centering is consistent with CLI's. One related Python test changed related output -- it's a test that prints the line number after stopping for a breakpoint, similar to the new list.exp tests. Previously we'd print the stop line minus 5 (due to the premature centering), now we print the stop line. I think that's a good change. Tested on x86_64 Fedora 20. gdb/ 2014-05-21 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (list_command): Handle the first "list" after the current source line having changed. * frame.h (set_current_sal_from_frame): Remove 'center' parameter. * infrun.c (normal_stop): Adjust call to set_current_sal_from_frame. * source.c (clear_lines_listed_range): New function. (set_current_source_symtab_and_line, identify_source_line): Clear the lines listed range. (line_info): Handle the first "info line" after the current source line having changed. * stack.c (print_stack_frame): Remove center handling. (set_current_sal_from_frame): Remove 'center' parameter. Don't center sal.line. gdb/testsuite/ 2014-05-21 Pedro Alves <palves@redhat.com> * gdb.base/list.exp (build_pattern, test_list): New procedures. Use them to test variations of "list" after reaching a breakpoint. * gdb.mi/mi-cli.exp (line_main_callme_2): New global. Test "list" with listsize 10 after reaching a breakpoint. * gdb.python/python.exp (decode_line current location line number): Adjust expected line number.
2014-05-22 00:15:27 +02:00
/* If this is the first "list" since we've set the current
source line, center the listing around that line. */
if (get_first_line_listed () == 0)
{
int first;
gdb: Use std::min and std::max throughout Otherwise including <string> or some other C++ header is broken. E.g.: In file included from /opt/gcc/include/c++/7.0.0/bits/char_traits.h:39:0, from /opt/gcc/include/c++/7.0.0/string:40, from /home/pedro/gdb/mygit/cxx-convertion/src/gdb/infrun.c:68: /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:243:56: error: macro "min" passed 3 arguments, but takes just 2 min(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ /opt/gcc/include/c++/7.0.0/bits/stl_algobase.h:265:56: error: macro "max" passed 3 arguments, but takes just 2 max(const _Tp& __a, const _Tp& __b, _Compare __comp) ^ In file included from .../src/gdb/infrun.c:21:0: To the best of my grepping abilities, I believe I adjusted all min/max calls. gdb/ChangeLog: 2016-09-16 Pedro Alves <palves@redhat.com> * defs.h (min, max): Delete. * aarch64-tdep.c: Include <algorithm> and use std::min and std::max throughout. * aarch64-tdep.c: Likewise. * alpha-tdep.c: Likewise. * amd64-tdep.c: Likewise. * amd64-windows-tdep.c: Likewise. * arm-tdep.c: Likewise. * avr-tdep.c: Likewise. * breakpoint.c: Likewise. * btrace.c: Likewise. * ctf.c: Likewise. * disasm.c: Likewise. * doublest.c: Likewise. * dwarf2loc.c: Likewise. * dwarf2read.c: Likewise. * environ.c: Likewise. * exec.c: Likewise. * f-exp.y: Likewise. * findcmd.c: Likewise. * ft32-tdep.c: Likewise. * gcore.c: Likewise. * hppa-tdep.c: Likewise. * i386-darwin-tdep.c: Likewise. * i386-tdep.c: Likewise. * linux-thread-db.c: Likewise. * lm32-tdep.c: Likewise. * m32r-tdep.c: Likewise. * m88k-tdep.c: Likewise. * memrange.c: Likewise. * minidebug.c: Likewise. * mips-tdep.c: Likewise. * moxie-tdep.c: Likewise. * nds32-tdep.c: Likewise. * nios2-tdep.c: Likewise. * nto-procfs.c: Likewise. * parse.c: Likewise. * ppc-sysv-tdep.c: Likewise. * probe.c: Likewise. * record-btrace.c: Likewise. * remote.c: Likewise. * rs6000-tdep.c: Likewise. * rx-tdep.c: Likewise. * s390-linux-nat.c: Likewise. * s390-linux-tdep.c: Likewise. * ser-tcp.c: Likewise. * sh-tdep.c: Likewise. * sh64-tdep.c: Likewise. * source.c: Likewise. * sparc-tdep.c: Likewise. * symfile.c: Likewise. * target-memory.c: Likewise. * target.c: Likewise. * tic6x-tdep.c: Likewise. * tilegx-tdep.c: Likewise. * tracefile-tfile.c: Likewise. * tracepoint.c: Likewise. * valprint.c: Likewise. * value.c: Likewise. * xtensa-tdep.c: Likewise. * cli/cli-cmds.c: Likewise. * compile/compile-object-load.c: Likewise.
2016-09-16 20:55:17 +02:00
first = std::max (cursal.line - get_lines_to_list () / 2, 1);
PR gdb/13860: make -interpreter-exec console "list" behave more like "list". I noticed that "list" behaves differently in CLI vs MI. Particularly: $ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli...done. (gdb) start Temporary breakpoint 1 at 0x40054d: file ../../../src/gdb/testsuite/gdb.mi/basics.c, line 62. Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli Temporary breakpoint 1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62 62 callee1 (2, "A string argument.", 3.5); (gdb) list 57 { 58 } 59 60 main () 61 { 62 callee1 (2, "A string argument.", 3.5); 63 callee1 (2, "A string argument.", 3.5); 64 65 do_nothing (); /* Hello, World! */ 66 (gdb) Note the list started at line 57. IOW, the program stopped at line 62, and GDB centered the list on that. compare with: $ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli..." ~"done.\n" (gdb) start &"start\n" ... ~"\nTemporary breakpoint " ~"1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62\n" ~"62\t callee1 (2, \"A string argument.\", 3.5);\n" *stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x000000000040054d",func="main",args=[],file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/basics.c",line="62"},thread-id="1",stopped-threads="all",core="0" =breakpoint-deleted,id="1" (gdb) -interpreter-exec console list ~"62\t callee1 (2, \"A string argument.\", 3.5);\n" ~"63\t callee1 (2, \"A string argument.\", 3.5);\n" ~"64\t\n" ~"65\t do_nothing (); /* Hello, World! */\n" ~"66\t\n" ~"67\t callme (1);\n" ~"68\t callme (2);\n" ~"69\t\n" ~"70\t return 0;\n" ~"71\t}\n" ^done (gdb) Here the list starts at line 62, where the program was stopped. This happens because print_stack_frame, called from both normal_stop and mi_on_normal_stop, is the function responsible for setting the current sal from the selected frame, overrides the PRINT_WHAT argument, and only after that does it decide whether to center the current sal line or not, based on the overridden value, and it will always decide false. (The print_stack_frame call in mi_on_normal_stop is a little different from the call in normal_stop, in that it is an unconditional SRC_AND_LOC call. A future patch will make those uniform.) A previous version of this patch made MI uniform with CLI here, by making print_stack_frame also center when MI is active. That changed the output of a "list" command in mi-cli.exp, to expect line 57 instead of 62, as per the example above. However, looking deeper, that list in question is the first "list" after the program stops, and right after the stop, before the "list", the test did "set listsize 1". Let's try the same thing with the CLI: (gdb) start 62 callee1 (2, "A string argument.", 3.5); (gdb) set listsize 1 (gdb) list 57 { Huh, that's unexpected. Why the 57? It's because print_stack_frame, called in reaction to the breakpoint stop, expecting the next "list" to show 10 lines (the listsize at the time) around line 62, sets the lines listed range to 57-67 (62 +/- 5). If the user changes the listsize before "list", why would we still show that range? Looks bogus to me. So the fix for this whole issue should be delay trying to center the listing to until actually listing, so that the correct listsize can be taken into account. This makes MI and CLI uniform too, as it deletes the center code from print_stack_frame. A series of tests are added to list.exp to cover this. mi-cli.exp was after all correct all along, but it now gains an additional test that lists lines with listsize 10, to ensure the centering is consistent with CLI's. One related Python test changed related output -- it's a test that prints the line number after stopping for a breakpoint, similar to the new list.exp tests. Previously we'd print the stop line minus 5 (due to the premature centering), now we print the stop line. I think that's a good change. Tested on x86_64 Fedora 20. gdb/ 2014-05-21 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (list_command): Handle the first "list" after the current source line having changed. * frame.h (set_current_sal_from_frame): Remove 'center' parameter. * infrun.c (normal_stop): Adjust call to set_current_sal_from_frame. * source.c (clear_lines_listed_range): New function. (set_current_source_symtab_and_line, identify_source_line): Clear the lines listed range. (line_info): Handle the first "info line" after the current source line having changed. * stack.c (print_stack_frame): Remove center handling. (set_current_sal_from_frame): Remove 'center' parameter. Don't center sal.line. gdb/testsuite/ 2014-05-21 Pedro Alves <palves@redhat.com> * gdb.base/list.exp (build_pattern, test_list): New procedures. Use them to test variations of "list" after reaching a breakpoint. * gdb.mi/mi-cli.exp (line_main_callme_2): New global. Test "list" with listsize 10 after reaching a breakpoint. * gdb.python/python.exp (decode_line current location line number): Adjust expected line number.
2014-05-22 00:15:27 +02:00
/* A small special case --- if listing backwards, and we
should list only one line, list the preceding line,
instead of the exact line we've just shown after e.g.,
stopping for a breakpoint. */
if (arg != NULL && arg[0] == '-'
&& get_lines_to_list () == 1 && first > 1)
first -= 1;
gdb: Avoid signed integer overflow when printing source lines When printing source lines with calls to print_source_lines we need to pass a start line number and an end line number. The end line number is calculated by calling get_lines_to_list and adding this value to the start line number. For example this code from list_command: print_source_lines (cursal.symtab, first, first + get_lines_to_list (), 0); The problem is that get_lines_to_list returns a value based on the GDB setting `set listsize LISTSIZE`. By default LISTSIZE is 10, however, its also possible to set LISTSIZE to unlimited, in which case get_lines_to_list will return INT_MAX. As the parameter signature for print_source_lines is: void print_source_lines (struct symtab *, int, int, print_source_lines_flags); and `first` in the above code is an `int`, then when LISTSIZE is `unlimited` the above code will result in signed integer overflow, which is undefined. The solution in this patch is a new class source_lines_range that can be constructed from a single line number and a direction (forward or backward). The range is then constructed from the line number and the value of get_lines_to_list. gdb/ChangeLog: * cli/cli-cmds.c (list_command): Pass a source_lines_range to print_source_lines. * source.c (print_source_lines_base): Update line number check. (print_source_lines): New function. (source_lines_range::source_lines_range): New function. * source.h (class source_lines_range): New class. (print_source_lines): New declaration.
2019-01-07 08:26:35 +01:00
print_source_lines (cursal.symtab, source_lines_range (first), 0);
PR gdb/13860: make -interpreter-exec console "list" behave more like "list". I noticed that "list" behaves differently in CLI vs MI. Particularly: $ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli...done. (gdb) start Temporary breakpoint 1 at 0x40054d: file ../../../src/gdb/testsuite/gdb.mi/basics.c, line 62. Starting program: /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli Temporary breakpoint 1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62 62 callee1 (2, "A string argument.", 3.5); (gdb) list 57 { 58 } 59 60 main () 61 { 62 callee1 (2, "A string argument.", 3.5); 63 callee1 (2, "A string argument.", 3.5); 64 65 do_nothing (); /* Hello, World! */ 66 (gdb) Note the list started at line 57. IOW, the program stopped at line 62, and GDB centered the list on that. compare with: $ ./gdb -nx -q ./testsuite/gdb.mi/mi-cli -i=mi =thread-group-added,id="i1" ~"Reading symbols from /home/pedro/gdb/mygit/build/gdb/testsuite/gdb.mi/mi-cli..." ~"done.\n" (gdb) start &"start\n" ... ~"\nTemporary breakpoint " ~"1, main () at ../../../src/gdb/testsuite/gdb.mi/basics.c:62\n" ~"62\t callee1 (2, \"A string argument.\", 3.5);\n" *stopped,reason="breakpoint-hit",disp="del",bkptno="1",frame={addr="0x000000000040054d",func="main",args=[],file="../../../src/gdb/testsuite/gdb.mi/basics.c",fullname="/home/pedro/gdb/mygit/src/gdb/testsuite/gdb.mi/basics.c",line="62"},thread-id="1",stopped-threads="all",core="0" =breakpoint-deleted,id="1" (gdb) -interpreter-exec console list ~"62\t callee1 (2, \"A string argument.\", 3.5);\n" ~"63\t callee1 (2, \"A string argument.\", 3.5);\n" ~"64\t\n" ~"65\t do_nothing (); /* Hello, World! */\n" ~"66\t\n" ~"67\t callme (1);\n" ~"68\t callme (2);\n" ~"69\t\n" ~"70\t return 0;\n" ~"71\t}\n" ^done (gdb) Here the list starts at line 62, where the program was stopped. This happens because print_stack_frame, called from both normal_stop and mi_on_normal_stop, is the function responsible for setting the current sal from the selected frame, overrides the PRINT_WHAT argument, and only after that does it decide whether to center the current sal line or not, based on the overridden value, and it will always decide false. (The print_stack_frame call in mi_on_normal_stop is a little different from the call in normal_stop, in that it is an unconditional SRC_AND_LOC call. A future patch will make those uniform.) A previous version of this patch made MI uniform with CLI here, by making print_stack_frame also center when MI is active. That changed the output of a "list" command in mi-cli.exp, to expect line 57 instead of 62, as per the example above. However, looking deeper, that list in question is the first "list" after the program stops, and right after the stop, before the "list", the test did "set listsize 1". Let's try the same thing with the CLI: (gdb) start 62 callee1 (2, "A string argument.", 3.5); (gdb) set listsize 1 (gdb) list 57 { Huh, that's unexpected. Why the 57? It's because print_stack_frame, called in reaction to the breakpoint stop, expecting the next "list" to show 10 lines (the listsize at the time) around line 62, sets the lines listed range to 57-67 (62 +/- 5). If the user changes the listsize before "list", why would we still show that range? Looks bogus to me. So the fix for this whole issue should be delay trying to center the listing to until actually listing, so that the correct listsize can be taken into account. This makes MI and CLI uniform too, as it deletes the center code from print_stack_frame. A series of tests are added to list.exp to cover this. mi-cli.exp was after all correct all along, but it now gains an additional test that lists lines with listsize 10, to ensure the centering is consistent with CLI's. One related Python test changed related output -- it's a test that prints the line number after stopping for a breakpoint, similar to the new list.exp tests. Previously we'd print the stop line minus 5 (due to the premature centering), now we print the stop line. I think that's a good change. Tested on x86_64 Fedora 20. gdb/ 2014-05-21 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (list_command): Handle the first "list" after the current source line having changed. * frame.h (set_current_sal_from_frame): Remove 'center' parameter. * infrun.c (normal_stop): Adjust call to set_current_sal_from_frame. * source.c (clear_lines_listed_range): New function. (set_current_source_symtab_and_line, identify_source_line): Clear the lines listed range. (line_info): Handle the first "info line" after the current source line having changed. * stack.c (print_stack_frame): Remove center handling. (set_current_sal_from_frame): Remove 'center' parameter. Don't center sal.line. gdb/testsuite/ 2014-05-21 Pedro Alves <palves@redhat.com> * gdb.base/list.exp (build_pattern, test_list): New procedures. Use them to test variations of "list" after reaching a breakpoint. * gdb.mi/mi-cli.exp (line_main_callme_2): New global. Test "list" with listsize 10 after reaching a breakpoint. * gdb.python/python.exp (decode_line current location line number): Adjust expected line number.
2014-05-22 00:15:27 +02:00
}
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
/* "l" or "l +" lists next ten lines. */
else if (arg == NULL || arg[0] == '+')
gdb: Avoid signed integer overflow when printing source lines When printing source lines with calls to print_source_lines we need to pass a start line number and an end line number. The end line number is calculated by calling get_lines_to_list and adding this value to the start line number. For example this code from list_command: print_source_lines (cursal.symtab, first, first + get_lines_to_list (), 0); The problem is that get_lines_to_list returns a value based on the GDB setting `set listsize LISTSIZE`. By default LISTSIZE is 10, however, its also possible to set LISTSIZE to unlimited, in which case get_lines_to_list will return INT_MAX. As the parameter signature for print_source_lines is: void print_source_lines (struct symtab *, int, int, print_source_lines_flags); and `first` in the above code is an `int`, then when LISTSIZE is `unlimited` the above code will result in signed integer overflow, which is undefined. The solution in this patch is a new class source_lines_range that can be constructed from a single line number and a direction (forward or backward). The range is then constructed from the line number and the value of get_lines_to_list. gdb/ChangeLog: * cli/cli-cmds.c (list_command): Pass a source_lines_range to print_source_lines. * source.c (print_source_lines_base): Update line number check. (print_source_lines): New function. (source_lines_range::source_lines_range): New function. * source.h (class source_lines_range): New class. (print_source_lines): New declaration.
2019-01-07 08:26:35 +01:00
print_source_lines (cursal.symtab,
source_lines_range (cursal.line), 0);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
/* "l -" lists previous ten lines, the ones before the ten just
listed. */
else if (arg[0] == '-')
{
if (get_first_line_listed () == 1)
error (_("Already at the start of %s."),
symtab_to_filename_for_display (cursal.symtab));
gdb: Avoid signed integer overflow when printing source lines When printing source lines with calls to print_source_lines we need to pass a start line number and an end line number. The end line number is calculated by calling get_lines_to_list and adding this value to the start line number. For example this code from list_command: print_source_lines (cursal.symtab, first, first + get_lines_to_list (), 0); The problem is that get_lines_to_list returns a value based on the GDB setting `set listsize LISTSIZE`. By default LISTSIZE is 10, however, its also possible to set LISTSIZE to unlimited, in which case get_lines_to_list will return INT_MAX. As the parameter signature for print_source_lines is: void print_source_lines (struct symtab *, int, int, print_source_lines_flags); and `first` in the above code is an `int`, then when LISTSIZE is `unlimited` the above code will result in signed integer overflow, which is undefined. The solution in this patch is a new class source_lines_range that can be constructed from a single line number and a direction (forward or backward). The range is then constructed from the line number and the value of get_lines_to_list. gdb/ChangeLog: * cli/cli-cmds.c (list_command): Pass a source_lines_range to print_source_lines. * source.c (print_source_lines_base): Update line number check. (print_source_lines): New function. (source_lines_range::source_lines_range): New function. * source.h (class source_lines_range): New class. (print_source_lines): New declaration.
2019-01-07 08:26:35 +01:00
source_lines_range range (get_first_line_listed (),
source_lines_range::BACKWARD);
print_source_lines (cursal.symtab, range, 0);
}
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
return;
}
/* Now if there is only one argument, decode it in SAL
and set NO_END.
If there are two arguments, decode them in SAL and SAL_END
and clear NO_END; however, if one of the arguments is blank,
set DUMMY_BEG or DUMMY_END to record that fact. */
if (!have_full_symbols () && !have_partial_symbols ())
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("No symbol table is loaded. Use the \"file\" command."));
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
std::vector<symtab_and_line> sals;
Kill init_sal Instead, make symtab_and_line initialize its members itself. Many symtab_and_line declarations are moved to where the object is initialized at the same time both for clarity and to avoid double initialization. A few functions, like e.g., find_frame_sal are adjusted to return the sal using normal function return instead of an output parameter likewise to avoid having to default-construct a sal and then immediately have the object overwritten. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ada-lang.c (is_known_support_routine): Move sal declaration to where it is initialized. * breakpoint.c (create_internal_breakpoint, init_catchpoint) (parse_breakpoint_sals, decode_static_tracepoint_spec) (clear_command, update_static_tracepoint): Remove init_sal references. Move declarations closer to initializations. * cli/cli-cmds.c (list_command): Move sal declarations closer to initializations. * elfread.c (elf_gnu_ifunc_resolver_stop): Remove init_sal references. Move sal declarations closer to initializations. * frame.c (find_frame_sal): Return a symtab_and_line via function return instead of output parameter. Remove init_sal references. * frame.h (find_frame_sal): Return a symtab_and_line via function return instead of output parameter. * guile/scm-frame.c (gdbscm_frame_sal): Adjust. * guile/scm-symtab.c (stscm_make_sal_smob): Use in-place new instead of memset. (gdbscm_find_pc_line): Remove init_sal reference. * infcall.c (call_function_by_hand_dummy): Remove init_sal references. Move declarations closer to initializations. * infcmd.c (set_step_frame): Update. Move declarations closer to initializations. (finish_backward): Remove init_sal references. Move declarations closer to initializations. * infrun.c (process_event_stop_test, handle_step_into_function) (insert_hp_step_resume_breakpoint_at_frame) (insert_step_resume_breakpoint_at_caller): Likewise. * linespec.c (create_sals_line_offset, decode_digits_ordinary) (symbol_to_sal): Likewise. * probe.c (parse_probes_in_pspace): Remove init_sal reference. * python/py-frame.c (frapy_find_sal): Move sal declaration closer to its initialization. * reverse.c (save_bookmark_command): Use new/delete. Remove init_sal references. Move declarations closer to initializations. * source.c (get_current_source_symtab_and_line): Remove brace initialization. (set_current_source_symtab_and_line): Now takes the sal by const reference. Remove brace initialization. (line_info): Remove init_sal reference. * source.h (set_current_source_symtab_and_line): Now takes a symtab_and_line via const reference. * stack.c (set_current_sal_from_frame): Adjust. (print_frame_info): Adjust. (get_last_displayed_sal): Return the sal via function return instead of via output parameter. Simplify. (frame_info): Adjust. * stack.h (get_last_displayed_sal): Return the sal via function return instead of via output parameter. * symtab.c (init_sal): Delete. (find_pc_sect_line): Remove init_sal references. Move declarations closer to initializations. (find_function_start_sal): Remove init_sal references. Move declarations closer to initializations. * symtab.h (struct symtab_and_line): In-class initialize all fields. * tracepoint.c (set_traceframe_context) (print_one_static_tracepoint_marker): Remove init_sal references. Move declarations closer to initializations. * tui/tui-disasm.c (tui_show_disassem_and_update_source): Adjust. * tui/tui-stack.c (tui_show_frame_info): Adjust. Move declarations closer to initializations. * tui/tui-winsource.c (tui_update_source_window_as_is): Remove init_sal references. Adjust.
2017-09-04 18:10:13 +02:00
symtab_and_line sal, sal_end;
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
arg1 = arg;
if (*arg1 == ',')
dummy_beg = 1;
else
{
Introduce event_location_up This removes make_cleanup_delete_event_location and instead changes the various location functions to return an event_location_up, a new unique_ptr typedef. This is largely straightforward, but be sure to examine the init_breakpoint_sal change. I believe the code I deleted there is dead, because "location != NULL" can never be true in that branch; but you should double-check. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * tracepoint.c (scope_info): Update. * spu-tdep.c (spu_catch_start): Update. * python/python.c (gdbpy_decode_line): Update. * python/py-finishbreakpoint.c (bpfinishpy_init): Update. * python/py-breakpoint.c (bppy_init): Update. * probe.c (parse_probes): Update. * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Update. * location.h (event_location_deleter): New struct. (event_location_up): New typedef. (new_linespec_location, new_address_location, new_probe_location) (new_explicit_location, copy_event_location) (string_to_event_location, string_to_event_location_basic) (string_to_explicit_location): Update return type. (make_cleanup_delete_event_location): Remove. * location.c (new_linespec_location, new_address_location) (new_probe_location, new_explicit_location, copy_event_location): Return event_location_up. (delete_event_location_cleanup) (make_cleanup_delete_event_location): Remove. (string_to_explicit_location, string_to_event_location_basic) (string_to_event_location): Return event_location_up. * linespec.c (canonicalize_linespec, event_location_to_sals) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc): Update. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Update. * completer.c (location_completer): Update. * cli/cli-cmds.c (edit_command, list_command): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint) (create_thread_event_breakpoint): Update. (init_breakpoint_sal): Update. Remove some dead code. (create_breakpoint_sal): Change type of "location". Update. (create_breakpoints_sal, create_breakpoint, break_command_1) (dprintf_command, break_range_command, until_break_command) (init_ada_exception_breakpoint) (strace_marker_create_sals_from_location) (update_static_tracepoint, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Update. * break-catch-throw.c (re_set_exception_catchpoint): Update. * ax-gdb.c (agent_command_1): Update.
2017-04-06 04:44:01 +02:00
event_location_up location = string_to_event_location (&arg1,
current_language);
sals = decode_line_1 (location.get (), DECODE_LINE_LIST_MODE,
NULL, NULL, 0);
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
filter_sals (sals);
if (sals.empty ())
Explicit locations: use new location API This patch converts the code base to use the new struct event_location API being introduced. This patch preserves the current functionality and adds no new features. The "big picture" API usage introduced by this patch may be illustrated with a simple exmaple. Where previously developers would write: void my_command (char *arg, int from_tty) { create_breakpoint (..., arg, ...); ... } one now uses: void my_command (char *arg, int from_tty) { struct event_locaiton *location; struct cleanup *back_to; location = string_to_event_locaiton (&arg, ...); back_to = make_cleanup_delete_event_location (location); create_breakpoint (..., location, ...); do_cleanups (back_to); } Linespec-decoding functions (now called location-decoding) such as decode_line_full no longer skip argument pointers over processed input. That functionality has been moved into string_to_event_location as demonstrated above. gdb/ChangeLog * ax-gdb.c: Include location.h. (agent_command_1) Use linespec location instead of address string. * break-catch-throw.c: Include location.h. (re_set_exception_catchpoint): Use linespec locations instead of address strings. * breakpoint.c: Include location.h. (create_overlay_event_breakpoint, create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_breakpoints_after_exec): Use linespec location instead of address string. (print_breakpoint_location): Use locations and event_location_to_string. Print extra_string for pending locations for non-MI streams. (print_one_breakpoint_location): Use locations and event_location_to_string. (init_raw_breakpoint_without_location): Initialize b->location. (create_thread_event_breakpoint): Use linespec location instead of address string. (init_breakpoint_sal): Likewise. Only save extra_string if it is non-NULL and not the empty string. Use event_location_to_string instead of `addr_string'. Constify `p' and `endp'. Use skip_spaces_const/skip_space_const instead of non-const versions. Copy the location into the breakpoint. If LOCATION is NULL, save the breakpoint address as a linespec location instead of an address string. (create_breakpoint_sal): Change `addr_string' parameter to a struct event_location. All uses updated. (create_breakpoints_sal): Likewise for local variable `addr_string'. (parse_breakpoint_sals): Use locations instead of address strings. Remove check for empty linespec with conditional. Refactor. (decode_static_tracepoint_spec): Make argument const and update function. (create_breakpoint): Change `arg' to a struct event_location and rename. Remove `copy_arg' and `addr_start'. If EXTRA_STRING is empty, set it to NULL. Don't populate `canonical' for pending breakpoints. Pass `extra_string' to find_condition_and_thread. Clear `extra_string' if `rest' was NULL. Do not error with "garbage after location" if setting a dprintf breakpoint. Copy the location into the breakpoint instead of an address string. (break_command_1): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Check against `arg_cp' for a probe linespec. (dprintf_command): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Throw an exception if no format string was specified. (print_recreate_ranged_breakpoint): Use event_location_to_string instead of address strings. (break_range_command, until_break_command) (init_ada_exception_breakpoint): Use locations instead of address strings. (say_where): Print out extra_string for pending locations. (base_breakpoint_dtor): Delete `location' and `location_range_end' of the breakpoint. (base_breakpoint_create_sals_from_location): Use struct event_location instead of address string. Remove `addr_start' and `copy_arg' parameters. (base_breakpoint_decode_location): Use struct event_location instead of address string. (bkpt_re_set): Use locations instead of address strings. Use event_location_empty_p to check for unset location. (bkpt_print_recreate): Use event_location_to_string instead of an address string. Print out extra_string for pending locations. (bkpt_create_sals_from_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location): Use struct event_location instead of address string. (bkpt_probe_decode_location): Use struct event_location instead of address string. (tracepoint_print_recreate): Use event_location_to_string to recreate the tracepoint. (tracepoint_create_sals_from_location, tracepoint_decode_location) (tracepoint_probe_create_sals_from_location) (tracepoint_probe_decode_location): Use struct event_location instead of address string. (dprintf_print_recreate): Use event_location_to_string to recreate the dprintf. (dprintf_re_set): Remove check for valid/missing format string. (strace_marker_create_sals_from_location) (strace_marker_create_breakpoints_sal, strace_marker_decode_location) (update_static_tracepoint): Use struct event_location instead of address string. (location_to_sals): Likewise. Pass `extra_string' to find_condition_and_thread. For newly resolved pending breakpoint locations, clear the location's string representation. Assert that the breakpoint's condition string is NULL when condition_not_parsed. (breakpoint_re_set_default, create_sals_from_location_default) (decode_location_default, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Use locations instead of address strings. * breakpoint.h (struct breakpoint_ops) <create_sals_from_location>: Use struct event_location instead of address string. Update all uses. <decode_location>: Likewise. (struct breakpoint) <addr_string>: Change to struct event_location and rename `location'. <addr_string_range_end>: Change to struct event_location and rename `location_range_end'. (create_breakpoint): Use struct event_location instead of address string. * cli/cli-cmds.c: Include location.h. (edit_command, list_command): Use locations instead of address strings. * elfread.c: Include location.h. (elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string. * guile/scm-breakpoint.c: Include location.h. (bpscm_print_breakpoint_smob): Use event_location_to_string. (gdbscm_register_breakpoint): Use locations instead of address strings. * linespec.c: Include location.h. (struct ls_parser) <stream>: Change to const char *. (PARSER_STREAM): Update. (lionespec_lexer_lex_keyword): According to find_condition_and_thread, keywords must be followed by whitespace. (canonicalize_linespec): Save a linespec location into `canonical'. Save a canonical linespec into `canonical'. (parse_linespec): Change `argptr' to const char * and rename `arg'. All uses updated. Update function description. (linespec_parser_new): Initialize `parser'. Update initialization of parsing stream. (event_location_to_sals): New function. (decode_line_full): Change `argptr' to a struct event_location and rename it `location'. Use locations instead of address strings. Call event_location_to_sals instead of parse_linespec. (decode_line_1): Likewise. (decode_line_with_current_source, decode_line_with_last_displayed) Use locations instead of address strings. (decode_objc): Likewise. Change `argptr' to const char * and rename `arg'. (destroy_linespec_result): Delete the linespec result's location instead of freeing the address string. * linespec.h (struct linespec_result) <addr_string>: Change to struct event_location and rename to ... <location>: ... this. (decode_line_1, decode_line_full): Change `argptr' to struct event_location. All callers updated. * mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h. (mi_cmd_break_insert_1): Use locations instead of address strings. Throw an error if there was "garbage" at the end of the specified linespec. * probe.c: Include location.h. (parse_probes): Change `argptr' to struct event_location. Use event locations instead of address strings. * probe.h (parse_probes): Change `argptr' to struct event_location. * python/py-breakpoint.c: Include location.h. (bppy_get_location): Constify local variable `str'. Use event_location_to_string. (bppy_init): Use locations instead of address strings. * python/py-finishbreakpoint.c: Include location.h. (bpfinishpy_init): Remove local variable `addr_str'. Use locations instead of address strings. * python/python.c: Include location.h. (gdbpy_decode_line): Use locations instead of address strings. * remote.c: Include location.h. (remote_download_tracepoint): Use locations instead of address strings. * spu-tdep.c: Include location.h. (spu_catch_start): Remove local variable `buf'. Use locations instead of address strings. * tracepoint.c: Include location.h. (scope_info): Use locations instead of address strings. (encode_source_string): Constify parameter `src'. * tracepoint.h (encode_source_string): Likewise. gdb/testsuite/ChangeLog * gdb.base/dprintf-pending.exp: Update dprintf "without format" test. Add tests for missing ",FMT" and ",".
2015-08-12 02:09:35 +02:00
{
/* C++ */
return;
}
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
sal = sals[0];
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
}
/* Record whether the BEG arg is all digits. */
for (p = arg; p != arg1 && *p >= '0' && *p <= '9'; p++);
linenum_beg = (p == arg1);
Clarify "list" output when specified lines are ambiguous Currently, with "list LINESPEC1,LINESPEC2", if one of the linespecs is ambiguous, i.e., if it expands to multiple locations, you get this seemingly odd output: (gdb) list foo,bar file: "file0.c", line number: 26 file: "file1.c", line number: 29 Since "foo" above expands to multiple locations, the specified range is indeterminate, and GDB is trying to be helpful by showing you what was ambiguous. It looks confusing to me, though. I think it'd be much more user friendly if GDB actually told you that, like this: (gdb) list foo,bar Specified first line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 (gdb) list bar,foo Specified last line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 Note, I'm using "first" and "last" in the output because that's what the manual uses: ~~~ list first,last Print lines from first to last. [...] ~~~ Tested on x86-64 GNU/Linux. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (edit_command): Pass message to ambiguous_line_spec. (list_command): Pass message to ambiguous_line_spec. Say "first"/"last" instead of "start" and "end" to be consistent with the manual. (ambiguous_line_spec): Add 'format' and vararg parameters. Use them to print formatted message. gdb/testsuite/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * gdb.base/list-ambiguous.exp: New file. * gdb.base/list-ambiguous0.c: New file. * gdb.base/list-ambiguous1.c: New file. * gdb.base/list.exp (test_list_range): Adjust expected output.
2017-09-04 17:49:29 +02:00
/* Save the range of the first argument, in case we need to let the
user know it was ambiguous. */
const char *beg = arg;
size_t beg_len = arg1 - beg;
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
while (*arg1 == ' ' || *arg1 == '\t')
arg1++;
if (*arg1 == ',')
{
no_end = 0;
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
if (sals.size () > 1)
{
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
ambiguous_line_spec (sals,
Clarify "list" output when specified lines are ambiguous Currently, with "list LINESPEC1,LINESPEC2", if one of the linespecs is ambiguous, i.e., if it expands to multiple locations, you get this seemingly odd output: (gdb) list foo,bar file: "file0.c", line number: 26 file: "file1.c", line number: 29 Since "foo" above expands to multiple locations, the specified range is indeterminate, and GDB is trying to be helpful by showing you what was ambiguous. It looks confusing to me, though. I think it'd be much more user friendly if GDB actually told you that, like this: (gdb) list foo,bar Specified first line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 (gdb) list bar,foo Specified last line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 Note, I'm using "first" and "last" in the output because that's what the manual uses: ~~~ list first,last Print lines from first to last. [...] ~~~ Tested on x86-64 GNU/Linux. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (edit_command): Pass message to ambiguous_line_spec. (list_command): Pass message to ambiguous_line_spec. Say "first"/"last" instead of "start" and "end" to be consistent with the manual. (ambiguous_line_spec): Add 'format' and vararg parameters. Use them to print formatted message. gdb/testsuite/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * gdb.base/list-ambiguous.exp: New file. * gdb.base/list-ambiguous0.c: New file. * gdb.base/list-ambiguous1.c: New file. * gdb.base/list.exp (test_list_range): Adjust expected output.
2017-09-04 17:49:29 +02:00
_("Specified first line '%.*s' is ambiguous:\n"),
(int) beg_len, beg);
return;
}
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
arg1++;
while (*arg1 == ' ' || *arg1 == '\t')
arg1++;
if (*arg1 == 0)
dummy_end = 1;
else
{
Clarify "list" output when specified lines are ambiguous Currently, with "list LINESPEC1,LINESPEC2", if one of the linespecs is ambiguous, i.e., if it expands to multiple locations, you get this seemingly odd output: (gdb) list foo,bar file: "file0.c", line number: 26 file: "file1.c", line number: 29 Since "foo" above expands to multiple locations, the specified range is indeterminate, and GDB is trying to be helpful by showing you what was ambiguous. It looks confusing to me, though. I think it'd be much more user friendly if GDB actually told you that, like this: (gdb) list foo,bar Specified first line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 (gdb) list bar,foo Specified last line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 Note, I'm using "first" and "last" in the output because that's what the manual uses: ~~~ list first,last Print lines from first to last. [...] ~~~ Tested on x86-64 GNU/Linux. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (edit_command): Pass message to ambiguous_line_spec. (list_command): Pass message to ambiguous_line_spec. Say "first"/"last" instead of "start" and "end" to be consistent with the manual. (ambiguous_line_spec): Add 'format' and vararg parameters. Use them to print formatted message. gdb/testsuite/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * gdb.base/list-ambiguous.exp: New file. * gdb.base/list-ambiguous0.c: New file. * gdb.base/list-ambiguous1.c: New file. * gdb.base/list.exp (test_list_range): Adjust expected output.
2017-09-04 17:49:29 +02:00
/* Save the last argument, in case we need to let the user
know it was ambiguous. */
const char *end_arg = arg1;
Introduce event_location_up This removes make_cleanup_delete_event_location and instead changes the various location functions to return an event_location_up, a new unique_ptr typedef. This is largely straightforward, but be sure to examine the init_breakpoint_sal change. I believe the code I deleted there is dead, because "location != NULL" can never be true in that branch; but you should double-check. gdb/ChangeLog 2017-04-12 Tom Tromey <tom@tromey.com> * tracepoint.c (scope_info): Update. * spu-tdep.c (spu_catch_start): Update. * python/python.c (gdbpy_decode_line): Update. * python/py-finishbreakpoint.c (bpfinishpy_init): Update. * python/py-breakpoint.c (bppy_init): Update. * probe.c (parse_probes): Update. * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Update. * location.h (event_location_deleter): New struct. (event_location_up): New typedef. (new_linespec_location, new_address_location, new_probe_location) (new_explicit_location, copy_event_location) (string_to_event_location, string_to_event_location_basic) (string_to_explicit_location): Update return type. (make_cleanup_delete_event_location): Remove. * location.c (new_linespec_location, new_address_location) (new_probe_location, new_explicit_location, copy_event_location): Return event_location_up. (delete_event_location_cleanup) (make_cleanup_delete_event_location): Remove. (string_to_explicit_location, string_to_event_location_basic) (string_to_event_location): Return event_location_up. * linespec.c (canonicalize_linespec, event_location_to_sals) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc): Update. * guile/scm-breakpoint.c (gdbscm_register_breakpoint_x): Update. * completer.c (location_completer): Update. * cli/cli-cmds.c (edit_command, list_command): Update. * breakpoint.c (create_overlay_event_breakpoint) (create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint) (create_thread_event_breakpoint): Update. (init_breakpoint_sal): Update. Remove some dead code. (create_breakpoint_sal): Change type of "location". Update. (create_breakpoints_sal, create_breakpoint, break_command_1) (dprintf_command, break_range_command, until_break_command) (init_ada_exception_breakpoint) (strace_marker_create_sals_from_location) (update_static_tracepoint, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Update. * break-catch-throw.c (re_set_exception_catchpoint): Update. * ax-gdb.c (agent_command_1): Update.
2017-04-06 04:44:01 +02:00
event_location_up location
= string_to_event_location (&arg1, current_language);
Explicit locations: use new location API This patch converts the code base to use the new struct event_location API being introduced. This patch preserves the current functionality and adds no new features. The "big picture" API usage introduced by this patch may be illustrated with a simple exmaple. Where previously developers would write: void my_command (char *arg, int from_tty) { create_breakpoint (..., arg, ...); ... } one now uses: void my_command (char *arg, int from_tty) { struct event_locaiton *location; struct cleanup *back_to; location = string_to_event_locaiton (&arg, ...); back_to = make_cleanup_delete_event_location (location); create_breakpoint (..., location, ...); do_cleanups (back_to); } Linespec-decoding functions (now called location-decoding) such as decode_line_full no longer skip argument pointers over processed input. That functionality has been moved into string_to_event_location as demonstrated above. gdb/ChangeLog * ax-gdb.c: Include location.h. (agent_command_1) Use linespec location instead of address string. * break-catch-throw.c: Include location.h. (re_set_exception_catchpoint): Use linespec locations instead of address strings. * breakpoint.c: Include location.h. (create_overlay_event_breakpoint, create_longjmp_master_breakpoint) (create_std_terminate_master_breakpoint) (create_exception_master_breakpoint, update_breakpoints_after_exec): Use linespec location instead of address string. (print_breakpoint_location): Use locations and event_location_to_string. Print extra_string for pending locations for non-MI streams. (print_one_breakpoint_location): Use locations and event_location_to_string. (init_raw_breakpoint_without_location): Initialize b->location. (create_thread_event_breakpoint): Use linespec location instead of address string. (init_breakpoint_sal): Likewise. Only save extra_string if it is non-NULL and not the empty string. Use event_location_to_string instead of `addr_string'. Constify `p' and `endp'. Use skip_spaces_const/skip_space_const instead of non-const versions. Copy the location into the breakpoint. If LOCATION is NULL, save the breakpoint address as a linespec location instead of an address string. (create_breakpoint_sal): Change `addr_string' parameter to a struct event_location. All uses updated. (create_breakpoints_sal): Likewise for local variable `addr_string'. (parse_breakpoint_sals): Use locations instead of address strings. Remove check for empty linespec with conditional. Refactor. (decode_static_tracepoint_spec): Make argument const and update function. (create_breakpoint): Change `arg' to a struct event_location and rename. Remove `copy_arg' and `addr_start'. If EXTRA_STRING is empty, set it to NULL. Don't populate `canonical' for pending breakpoints. Pass `extra_string' to find_condition_and_thread. Clear `extra_string' if `rest' was NULL. Do not error with "garbage after location" if setting a dprintf breakpoint. Copy the location into the breakpoint instead of an address string. (break_command_1): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Check against `arg_cp' for a probe linespec. (dprintf_command): Use string_to_event_location and pass this to create_breakpoint instead of an address string. Throw an exception if no format string was specified. (print_recreate_ranged_breakpoint): Use event_location_to_string instead of address strings. (break_range_command, until_break_command) (init_ada_exception_breakpoint): Use locations instead of address strings. (say_where): Print out extra_string for pending locations. (base_breakpoint_dtor): Delete `location' and `location_range_end' of the breakpoint. (base_breakpoint_create_sals_from_location): Use struct event_location instead of address string. Remove `addr_start' and `copy_arg' parameters. (base_breakpoint_decode_location): Use struct event_location instead of address string. (bkpt_re_set): Use locations instead of address strings. Use event_location_empty_p to check for unset location. (bkpt_print_recreate): Use event_location_to_string instead of an address string. Print out extra_string for pending locations. (bkpt_create_sals_from_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location): Use struct event_location instead of address string. (bkpt_probe_decode_location): Use struct event_location instead of address string. (tracepoint_print_recreate): Use event_location_to_string to recreate the tracepoint. (tracepoint_create_sals_from_location, tracepoint_decode_location) (tracepoint_probe_create_sals_from_location) (tracepoint_probe_decode_location): Use struct event_location instead of address string. (dprintf_print_recreate): Use event_location_to_string to recreate the dprintf. (dprintf_re_set): Remove check for valid/missing format string. (strace_marker_create_sals_from_location) (strace_marker_create_breakpoints_sal, strace_marker_decode_location) (update_static_tracepoint): Use struct event_location instead of address string. (location_to_sals): Likewise. Pass `extra_string' to find_condition_and_thread. For newly resolved pending breakpoint locations, clear the location's string representation. Assert that the breakpoint's condition string is NULL when condition_not_parsed. (breakpoint_re_set_default, create_sals_from_location_default) (decode_location_default, trace_command, ftrace_command) (strace_command, create_tracepoint_from_upload): Use locations instead of address strings. * breakpoint.h (struct breakpoint_ops) <create_sals_from_location>: Use struct event_location instead of address string. Update all uses. <decode_location>: Likewise. (struct breakpoint) <addr_string>: Change to struct event_location and rename `location'. <addr_string_range_end>: Change to struct event_location and rename `location_range_end'. (create_breakpoint): Use struct event_location instead of address string. * cli/cli-cmds.c: Include location.h. (edit_command, list_command): Use locations instead of address strings. * elfread.c: Include location.h. (elf_gnu_ifunc_resolver_return_stop): Use event_location_to_string. * guile/scm-breakpoint.c: Include location.h. (bpscm_print_breakpoint_smob): Use event_location_to_string. (gdbscm_register_breakpoint): Use locations instead of address strings. * linespec.c: Include location.h. (struct ls_parser) <stream>: Change to const char *. (PARSER_STREAM): Update. (lionespec_lexer_lex_keyword): According to find_condition_and_thread, keywords must be followed by whitespace. (canonicalize_linespec): Save a linespec location into `canonical'. Save a canonical linespec into `canonical'. (parse_linespec): Change `argptr' to const char * and rename `arg'. All uses updated. Update function description. (linespec_parser_new): Initialize `parser'. Update initialization of parsing stream. (event_location_to_sals): New function. (decode_line_full): Change `argptr' to a struct event_location and rename it `location'. Use locations instead of address strings. Call event_location_to_sals instead of parse_linespec. (decode_line_1): Likewise. (decode_line_with_current_source, decode_line_with_last_displayed) Use locations instead of address strings. (decode_objc): Likewise. Change `argptr' to const char * and rename `arg'. (destroy_linespec_result): Delete the linespec result's location instead of freeing the address string. * linespec.h (struct linespec_result) <addr_string>: Change to struct event_location and rename to ... <location>: ... this. (decode_line_1, decode_line_full): Change `argptr' to struct event_location. All callers updated. * mi/mi-cmd-break.c: Include language.h, location.h, and linespec.h. (mi_cmd_break_insert_1): Use locations instead of address strings. Throw an error if there was "garbage" at the end of the specified linespec. * probe.c: Include location.h. (parse_probes): Change `argptr' to struct event_location. Use event locations instead of address strings. * probe.h (parse_probes): Change `argptr' to struct event_location. * python/py-breakpoint.c: Include location.h. (bppy_get_location): Constify local variable `str'. Use event_location_to_string. (bppy_init): Use locations instead of address strings. * python/py-finishbreakpoint.c: Include location.h. (bpfinishpy_init): Remove local variable `addr_str'. Use locations instead of address strings. * python/python.c: Include location.h. (gdbpy_decode_line): Use locations instead of address strings. * remote.c: Include location.h. (remote_download_tracepoint): Use locations instead of address strings. * spu-tdep.c: Include location.h. (spu_catch_start): Remove local variable `buf'. Use locations instead of address strings. * tracepoint.c: Include location.h. (scope_info): Use locations instead of address strings. (encode_source_string): Constify parameter `src'. * tracepoint.h (encode_source_string): Likewise. gdb/testsuite/ChangeLog * gdb.base/dprintf-pending.exp: Update dprintf "without format" test. Add tests for missing ",FMT" and ",".
2015-08-12 02:09:35 +02:00
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
std::vector<symtab_and_line> sals_end
= (dummy_beg
? decode_line_1 (location.get (), DECODE_LINE_LIST_MODE,
NULL, NULL, 0)
: decode_line_1 (location.get (), DECODE_LINE_LIST_MODE,
NULL, sal.symtab, sal.line));
filter_sals (sals_end);
if (sals_end.empty ())
return;
if (sals_end.size () > 1)
{
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
ambiguous_line_spec (sals_end,
Clarify "list" output when specified lines are ambiguous Currently, with "list LINESPEC1,LINESPEC2", if one of the linespecs is ambiguous, i.e., if it expands to multiple locations, you get this seemingly odd output: (gdb) list foo,bar file: "file0.c", line number: 26 file: "file1.c", line number: 29 Since "foo" above expands to multiple locations, the specified range is indeterminate, and GDB is trying to be helpful by showing you what was ambiguous. It looks confusing to me, though. I think it'd be much more user friendly if GDB actually told you that, like this: (gdb) list foo,bar Specified first line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 (gdb) list bar,foo Specified last line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 Note, I'm using "first" and "last" in the output because that's what the manual uses: ~~~ list first,last Print lines from first to last. [...] ~~~ Tested on x86-64 GNU/Linux. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (edit_command): Pass message to ambiguous_line_spec. (list_command): Pass message to ambiguous_line_spec. Say "first"/"last" instead of "start" and "end" to be consistent with the manual. (ambiguous_line_spec): Add 'format' and vararg parameters. Use them to print formatted message. gdb/testsuite/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * gdb.base/list-ambiguous.exp: New file. * gdb.base/list-ambiguous0.c: New file. * gdb.base/list-ambiguous1.c: New file. * gdb.base/list.exp (test_list_range): Adjust expected output.
2017-09-04 17:49:29 +02:00
_("Specified last line '%s' is ambiguous:\n"),
end_arg);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
return;
}
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
sal_end = sals_end[0];
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
}
}
if (*arg1)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Junk at end of line specification."));
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
if (!no_end && !dummy_beg && !dummy_end
&& sal.symtab != sal_end.symtab)
Clarify "list" output when specified lines are ambiguous Currently, with "list LINESPEC1,LINESPEC2", if one of the linespecs is ambiguous, i.e., if it expands to multiple locations, you get this seemingly odd output: (gdb) list foo,bar file: "file0.c", line number: 26 file: "file1.c", line number: 29 Since "foo" above expands to multiple locations, the specified range is indeterminate, and GDB is trying to be helpful by showing you what was ambiguous. It looks confusing to me, though. I think it'd be much more user friendly if GDB actually told you that, like this: (gdb) list foo,bar Specified first line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 (gdb) list bar,foo Specified last line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 Note, I'm using "first" and "last" in the output because that's what the manual uses: ~~~ list first,last Print lines from first to last. [...] ~~~ Tested on x86-64 GNU/Linux. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (edit_command): Pass message to ambiguous_line_spec. (list_command): Pass message to ambiguous_line_spec. Say "first"/"last" instead of "start" and "end" to be consistent with the manual. (ambiguous_line_spec): Add 'format' and vararg parameters. Use them to print formatted message. gdb/testsuite/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * gdb.base/list-ambiguous.exp: New file. * gdb.base/list-ambiguous0.c: New file. * gdb.base/list-ambiguous1.c: New file. * gdb.base/list.exp (test_list_range): Adjust expected output.
2017-09-04 17:49:29 +02:00
error (_("Specified first and last lines are in different files."));
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
if (dummy_beg && dummy_end)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Two empty args do not say what lines to list."));
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
/* If line was specified by address,
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
first print exactly which line, and which file.
In this case, sal.symtab == 0 means address is outside of all
known source files, not that user failed to give a filename. */
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
if (*arg == '*')
{
* defs.h (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter. * utils.c (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter, use it instead of current_gdbarch. * ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter. * ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter, use it instead of current_gdbarch. Update calls to ui_out_field_core_addr to pass architecture: * ada-lang.c (print_one_exception): Update. * breakpoint.c (print_one_breakpoint_location, print_one_exception_catchpoint): Update. * disasm.c (dump_insns): Update. * darwin-nat-info.c (darwin_debug_regions_recurse): Update. * mi/mi-main.c (mi_cmd_data_read_memory): Update. * mi/mi-symbol-cmds.c: Include "objfiles.h". (mi_cmd_symbol_list_lines): Update. * stack.c (print_frame_info, print_frame): Update. Update callers of paddress to pass architecture: * ada-tasks.c (info_task): Update. * ada-valprint.c (ada_val_print_1): Update. * annotate.c (annotate_source, annotate_frame_begin): Update. * breakpoint.c (insert_bp_location, describe_other_breakpoints, mention): Update. * cli/cli-cmds.c (edit_command, list_command, print_disassembly): Update. * corefile.c (memory_error): Update. * c-valprint.c (print_function_pointer_address, c_val_print): Update. * disasm.c (dis_asm_print_address): Update. * exec.c (print_section_info): Update. * f-valprint.c (f_val_print): Update. * infcmd.c: Include "arch-utils.h". (jump_command, program_info): Update. * linux-fork.c: Include "arch-utils.h". (info_forks_command): Update. * m2-valprint.c (print_function_pointer_address, print_unpacked_pointer, print_variable_at_address, m2_val_print): Update. * m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command): Update. * printcmd.c (print_address, print_address_demangle, address_info): Update. * p-valprint.c (pascal_val_print): Update. * source.c: Include "arch-utils.h". (line_info): Update. * stack.c (frame_info, print_block_frame_labels): Update. * symfile.c (add_symbol_file_command, list_overlays_command): Update. * symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1, print_symbol, print_partial_symbols, maintenance_info_psymtabs, maintenance_check_symtabs): Update. * symtab.c (find_pc_sect_symtab): Update. * target.c (deprecated_debug_xfer_memory): Update. * tracepoint.c (scope_info): Update. * tui/tui-stack.c (tui_make_status_line): Update. * valprint.c (val_print_string): Update. Update callers of paddr_nz to use paddress instead (keeping user-visible output identical): * alpha-tdep.c (alpha_heuristic_proc_start): Update. * amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn, amd64_displaced_step_fixup): Update. * arch-utils.c (simple_displaced_step_copy_insn): Update. * auxv.c (fprint_target_auxv): Update. * breakpoint.c (insert_single_step_breakpoint): Update. * buildsym.c (finish_block): Update. * cli/cli-dump.c (restore_section_callback): Update. * fbsd-nat.c (fbsd_find_memory_regions): Update. * frame.c (frame_unwind_register_value): Update. * gcore.c (gcore_create_callback): Update. * hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update. * i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm, i386_record_lea_modrm_addr, i386_record_lea_modrm, i386_process_record): Update. * ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id, ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id, ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update. * infrun.c (displaced_step_prepare, displaced_step_fixup, handle_inferior_event, insert_step_resume_breakpoint_at_sal, insert_longjmp_resume_breakpoint): Update. * linux-nat.c (linux_nat_find_memory_regions): Update. * linux-record.c (record_linux_system_call): Update. * mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call, mips_o32_push_dummy_call, mips_o64_push_dummy_call): Update. * monitor.c (monitor_error, monitor_remove_breakpoint): Update. * record.c (record_arch_list_add_mem, record_wait, record_xfer_partial): Update. * remote-mips.c (mips_fetch_word, mips_check_lsi_error, mips_common_breakpoint): Update. * remote-sim.c (gdbsim_xfer_inferior_memory): Update. * rs6000-tdep.c (ppc_displaced_step_fixup): Update. * solib-som.c (som_current_sos): Update. * symfile.c (load_progress, generic_load): Update. * symfile-mem.c (add_vsyscall_page): Update. * valops.c (value_fetch_lazy): Update. * windows-tdep.c (windows_xfer_shared_library): Update. Update callers of paddr_nz to use paddress instead (changing user-visible output to make it more correct): * dwarf2loc.c (locexpr_describe_location): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint, ia64_memory_remove_breakpoint): Update. * jv-valprint.c (java_value_print): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. * monitor.c (monitor_read_memory): Update. Update callers of paddr to use paddress instead (changing user-visible output to make it more correct): * arm-tdep.c (arm_push_dummy_call): Update. * breakpoint.c (insert_bp_location, create_thread_event_breakpoint, create_breakpoint): Update. * darwin-nat-info.c (darwin_debug_regions): Update. * dcache.c (dcache_info): Update. * dsrec.c (load_srec, make_srec): Update. * dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program, dwarf2_frame_cache): Update. * gcore.c (gcore_copy_callback): Update. * gnu-nat.c (gnu_xfer_memory): Update. * mips-linux-nat.c (mips_show_dr): Update. * monitor.c (monitor_write_memory, monitor_insert_breakpoint, monitor_remove_breakpoint): Update. * remote.c (compare_sections_command): Update. * remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint, m32r_remove_breakpoint, m32r_insert_watchpoint, m32r_remove_watchpoint): Update. * sol-thread.c (info_cb): Update. * symfile.c (load_progress): Update. Update callers of paddress or paddr_nz to use hex_string instead (changes output of internal/error/debug messages only): * dwarf2read.c (dump_die_shallow): Update. * frame.c (fprint_field, fprint_frame, frame_pc_unwind, get_frame_func, create_new_frame): Update. * hppa-tdep.c (find_unwind_entry, unwind_command): Update. * ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x, ia64_get_dyn_info_list): Update. * maint.c (maintenance_translate_address): Update. * mi/mi-cmd-var.c (mi_cmd_var_create): Update. * target.c (target_flash_erase): Update. Update callers of paddr/paddr_nz to use phex/phex_nz instead, using an appropriate address size. Remove use of strlen_paddr. * exec.c (exec_files_info): Update. * i386-nat.c (i386_show_dr): Update. * remote.c (remote_flash_erase): Update. * m32r-rom.c (m32r_load_section): Update. * monitor.c (monitor_vsprintf, monitor_store_register): Update. * remote.c (remote_check_symbols, remote_search_memory): Update. * remote-mips.c (mips_request, mips_common_breakpoint): Update. * scm-valprint.c (scm_ipruk, scm_scmval_print): Update. * sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update. * sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs, sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs, sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs, sh_dsp_show_regs): Update. * xcoffsolib.c (sharedlibrary_command): Update. * maint.c (maint_print_section_info): Add ADDR_SIZE parameter. Use hex_string_custom instead of paddr. (print_bfd_section_info): Pass address size. (print_objfile_section_info): Likewise. * annotate.h (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * annotate.c (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * source.c (identify_source_line): Update call to annotate_source. * stack.c (print_frame_info, print_frame): Update call to annotate_frame_begin. * breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter. (create_breakpoint, create_ada_exception_breakpoint): Update call. * stack.c (print_block_frame_labels): Add GDBARCH parameter. (print_frame_label_vars): Update call. * symmisc.c (print_partial_symbols): Add GDBARCH parameter. (dump_psymtab): Update call to print_partial_symbols. (struct print_symbol_args): Add GDBARCH member. (dump_symtab_1): Set print_symbol_args architecture member. (print_symbol): Use it. * windows-tdep.h (windows_xfer_shared_library): Add GDBARCH parameter. * windows-tdep.c (windows_xfer_shared_library): Likewise. * i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member. (core_process_module_section): Pass architecture from cpms_data to windows_xfer_shared_library. (windows_core_xfer_shared_libraries): Initialize cmps_data architecture member. * windows-nat.c (windows_xfer_shared_libraries): Pass architecture to windows_xfer_shared_library. * defs.h (print_address): Add GDBARCH parameter. * printcmd.c (print_address): Add GDBARCH parameter. (print_scalar_formatted, do_examine): Update call. * findcmd.c (find_command): Update call. * tracepoint.c: Include "arch-utils.h". (trace_find_line_command): Update call. * tui/tui-disasm.c (tui_disassemble): Update call. * value.h (print_address_demangle): Add GDBARCH parameter. * printcmd.c (print_address_demangle): Add GDBARCH parameter. * c-valprint.c (print_function_pointer_address, c_val_print): Update call. * f-valprint.c (f_val_print): Update call. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update call. * jv-valprint.c (java_val_print): Update call. * m2-valprint.c (print_function_pointer_address, m2_val_print): Update call. * p-valprint.c (pascal_val_print): Update call. * disasm.c (gdb_disassemble_info): Install architecture into di.application_data field. testsuite/ChangeLog: * gdb.threads/tls-shared.exp: Update to locexpr_describe_location change to prefix TLS offset in hex with 0x. doc/ChangeLog: * gdbint.texinfo (Item Output Functions): Update signature for ui_out_field_core_addr.
2009-07-02 19:21:10 +02:00
struct gdbarch *gdbarch;
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
if (sal.symtab == 0)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("No source file for address %s."),
paddress (get_current_arch (), sal.pc));
* defs.h (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter. * utils.c (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter, use it instead of current_gdbarch. * ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter. * ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter, use it instead of current_gdbarch. Update calls to ui_out_field_core_addr to pass architecture: * ada-lang.c (print_one_exception): Update. * breakpoint.c (print_one_breakpoint_location, print_one_exception_catchpoint): Update. * disasm.c (dump_insns): Update. * darwin-nat-info.c (darwin_debug_regions_recurse): Update. * mi/mi-main.c (mi_cmd_data_read_memory): Update. * mi/mi-symbol-cmds.c: Include "objfiles.h". (mi_cmd_symbol_list_lines): Update. * stack.c (print_frame_info, print_frame): Update. Update callers of paddress to pass architecture: * ada-tasks.c (info_task): Update. * ada-valprint.c (ada_val_print_1): Update. * annotate.c (annotate_source, annotate_frame_begin): Update. * breakpoint.c (insert_bp_location, describe_other_breakpoints, mention): Update. * cli/cli-cmds.c (edit_command, list_command, print_disassembly): Update. * corefile.c (memory_error): Update. * c-valprint.c (print_function_pointer_address, c_val_print): Update. * disasm.c (dis_asm_print_address): Update. * exec.c (print_section_info): Update. * f-valprint.c (f_val_print): Update. * infcmd.c: Include "arch-utils.h". (jump_command, program_info): Update. * linux-fork.c: Include "arch-utils.h". (info_forks_command): Update. * m2-valprint.c (print_function_pointer_address, print_unpacked_pointer, print_variable_at_address, m2_val_print): Update. * m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command): Update. * printcmd.c (print_address, print_address_demangle, address_info): Update. * p-valprint.c (pascal_val_print): Update. * source.c: Include "arch-utils.h". (line_info): Update. * stack.c (frame_info, print_block_frame_labels): Update. * symfile.c (add_symbol_file_command, list_overlays_command): Update. * symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1, print_symbol, print_partial_symbols, maintenance_info_psymtabs, maintenance_check_symtabs): Update. * symtab.c (find_pc_sect_symtab): Update. * target.c (deprecated_debug_xfer_memory): Update. * tracepoint.c (scope_info): Update. * tui/tui-stack.c (tui_make_status_line): Update. * valprint.c (val_print_string): Update. Update callers of paddr_nz to use paddress instead (keeping user-visible output identical): * alpha-tdep.c (alpha_heuristic_proc_start): Update. * amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn, amd64_displaced_step_fixup): Update. * arch-utils.c (simple_displaced_step_copy_insn): Update. * auxv.c (fprint_target_auxv): Update. * breakpoint.c (insert_single_step_breakpoint): Update. * buildsym.c (finish_block): Update. * cli/cli-dump.c (restore_section_callback): Update. * fbsd-nat.c (fbsd_find_memory_regions): Update. * frame.c (frame_unwind_register_value): Update. * gcore.c (gcore_create_callback): Update. * hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update. * i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm, i386_record_lea_modrm_addr, i386_record_lea_modrm, i386_process_record): Update. * ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id, ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id, ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update. * infrun.c (displaced_step_prepare, displaced_step_fixup, handle_inferior_event, insert_step_resume_breakpoint_at_sal, insert_longjmp_resume_breakpoint): Update. * linux-nat.c (linux_nat_find_memory_regions): Update. * linux-record.c (record_linux_system_call): Update. * mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call, mips_o32_push_dummy_call, mips_o64_push_dummy_call): Update. * monitor.c (monitor_error, monitor_remove_breakpoint): Update. * record.c (record_arch_list_add_mem, record_wait, record_xfer_partial): Update. * remote-mips.c (mips_fetch_word, mips_check_lsi_error, mips_common_breakpoint): Update. * remote-sim.c (gdbsim_xfer_inferior_memory): Update. * rs6000-tdep.c (ppc_displaced_step_fixup): Update. * solib-som.c (som_current_sos): Update. * symfile.c (load_progress, generic_load): Update. * symfile-mem.c (add_vsyscall_page): Update. * valops.c (value_fetch_lazy): Update. * windows-tdep.c (windows_xfer_shared_library): Update. Update callers of paddr_nz to use paddress instead (changing user-visible output to make it more correct): * dwarf2loc.c (locexpr_describe_location): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint, ia64_memory_remove_breakpoint): Update. * jv-valprint.c (java_value_print): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. * monitor.c (monitor_read_memory): Update. Update callers of paddr to use paddress instead (changing user-visible output to make it more correct): * arm-tdep.c (arm_push_dummy_call): Update. * breakpoint.c (insert_bp_location, create_thread_event_breakpoint, create_breakpoint): Update. * darwin-nat-info.c (darwin_debug_regions): Update. * dcache.c (dcache_info): Update. * dsrec.c (load_srec, make_srec): Update. * dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program, dwarf2_frame_cache): Update. * gcore.c (gcore_copy_callback): Update. * gnu-nat.c (gnu_xfer_memory): Update. * mips-linux-nat.c (mips_show_dr): Update. * monitor.c (monitor_write_memory, monitor_insert_breakpoint, monitor_remove_breakpoint): Update. * remote.c (compare_sections_command): Update. * remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint, m32r_remove_breakpoint, m32r_insert_watchpoint, m32r_remove_watchpoint): Update. * sol-thread.c (info_cb): Update. * symfile.c (load_progress): Update. Update callers of paddress or paddr_nz to use hex_string instead (changes output of internal/error/debug messages only): * dwarf2read.c (dump_die_shallow): Update. * frame.c (fprint_field, fprint_frame, frame_pc_unwind, get_frame_func, create_new_frame): Update. * hppa-tdep.c (find_unwind_entry, unwind_command): Update. * ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x, ia64_get_dyn_info_list): Update. * maint.c (maintenance_translate_address): Update. * mi/mi-cmd-var.c (mi_cmd_var_create): Update. * target.c (target_flash_erase): Update. Update callers of paddr/paddr_nz to use phex/phex_nz instead, using an appropriate address size. Remove use of strlen_paddr. * exec.c (exec_files_info): Update. * i386-nat.c (i386_show_dr): Update. * remote.c (remote_flash_erase): Update. * m32r-rom.c (m32r_load_section): Update. * monitor.c (monitor_vsprintf, monitor_store_register): Update. * remote.c (remote_check_symbols, remote_search_memory): Update. * remote-mips.c (mips_request, mips_common_breakpoint): Update. * scm-valprint.c (scm_ipruk, scm_scmval_print): Update. * sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update. * sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs, sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs, sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs, sh_dsp_show_regs): Update. * xcoffsolib.c (sharedlibrary_command): Update. * maint.c (maint_print_section_info): Add ADDR_SIZE parameter. Use hex_string_custom instead of paddr. (print_bfd_section_info): Pass address size. (print_objfile_section_info): Likewise. * annotate.h (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * annotate.c (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * source.c (identify_source_line): Update call to annotate_source. * stack.c (print_frame_info, print_frame): Update call to annotate_frame_begin. * breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter. (create_breakpoint, create_ada_exception_breakpoint): Update call. * stack.c (print_block_frame_labels): Add GDBARCH parameter. (print_frame_label_vars): Update call. * symmisc.c (print_partial_symbols): Add GDBARCH parameter. (dump_psymtab): Update call to print_partial_symbols. (struct print_symbol_args): Add GDBARCH member. (dump_symtab_1): Set print_symbol_args architecture member. (print_symbol): Use it. * windows-tdep.h (windows_xfer_shared_library): Add GDBARCH parameter. * windows-tdep.c (windows_xfer_shared_library): Likewise. * i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member. (core_process_module_section): Pass architecture from cpms_data to windows_xfer_shared_library. (windows_core_xfer_shared_libraries): Initialize cmps_data architecture member. * windows-nat.c (windows_xfer_shared_libraries): Pass architecture to windows_xfer_shared_library. * defs.h (print_address): Add GDBARCH parameter. * printcmd.c (print_address): Add GDBARCH parameter. (print_scalar_formatted, do_examine): Update call. * findcmd.c (find_command): Update call. * tracepoint.c: Include "arch-utils.h". (trace_find_line_command): Update call. * tui/tui-disasm.c (tui_disassemble): Update call. * value.h (print_address_demangle): Add GDBARCH parameter. * printcmd.c (print_address_demangle): Add GDBARCH parameter. * c-valprint.c (print_function_pointer_address, c_val_print): Update call. * f-valprint.c (f_val_print): Update call. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update call. * jv-valprint.c (java_val_print): Update call. * m2-valprint.c (print_function_pointer_address, m2_val_print): Update call. * p-valprint.c (pascal_val_print): Update call. * disasm.c (gdb_disassemble_info): Install architecture into di.application_data field. testsuite/ChangeLog: * gdb.threads/tls-shared.exp: Update to locexpr_describe_location change to prefix TLS offset in hex with 0x. doc/ChangeLog: * gdbint.texinfo (Item Output Functions): Update signature for ui_out_field_core_addr.
2009-07-02 19:21:10 +02:00
gdbarch = get_objfile_arch (SYMTAB_OBJFILE (sal.symtab));
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
sym = find_pc_function (sal.pc);
if (sym)
printf_filtered ("%s is in %s (%s:%d).\n",
* defs.h (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter. * utils.c (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter, use it instead of current_gdbarch. * ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter. * ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter, use it instead of current_gdbarch. Update calls to ui_out_field_core_addr to pass architecture: * ada-lang.c (print_one_exception): Update. * breakpoint.c (print_one_breakpoint_location, print_one_exception_catchpoint): Update. * disasm.c (dump_insns): Update. * darwin-nat-info.c (darwin_debug_regions_recurse): Update. * mi/mi-main.c (mi_cmd_data_read_memory): Update. * mi/mi-symbol-cmds.c: Include "objfiles.h". (mi_cmd_symbol_list_lines): Update. * stack.c (print_frame_info, print_frame): Update. Update callers of paddress to pass architecture: * ada-tasks.c (info_task): Update. * ada-valprint.c (ada_val_print_1): Update. * annotate.c (annotate_source, annotate_frame_begin): Update. * breakpoint.c (insert_bp_location, describe_other_breakpoints, mention): Update. * cli/cli-cmds.c (edit_command, list_command, print_disassembly): Update. * corefile.c (memory_error): Update. * c-valprint.c (print_function_pointer_address, c_val_print): Update. * disasm.c (dis_asm_print_address): Update. * exec.c (print_section_info): Update. * f-valprint.c (f_val_print): Update. * infcmd.c: Include "arch-utils.h". (jump_command, program_info): Update. * linux-fork.c: Include "arch-utils.h". (info_forks_command): Update. * m2-valprint.c (print_function_pointer_address, print_unpacked_pointer, print_variable_at_address, m2_val_print): Update. * m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command): Update. * printcmd.c (print_address, print_address_demangle, address_info): Update. * p-valprint.c (pascal_val_print): Update. * source.c: Include "arch-utils.h". (line_info): Update. * stack.c (frame_info, print_block_frame_labels): Update. * symfile.c (add_symbol_file_command, list_overlays_command): Update. * symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1, print_symbol, print_partial_symbols, maintenance_info_psymtabs, maintenance_check_symtabs): Update. * symtab.c (find_pc_sect_symtab): Update. * target.c (deprecated_debug_xfer_memory): Update. * tracepoint.c (scope_info): Update. * tui/tui-stack.c (tui_make_status_line): Update. * valprint.c (val_print_string): Update. Update callers of paddr_nz to use paddress instead (keeping user-visible output identical): * alpha-tdep.c (alpha_heuristic_proc_start): Update. * amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn, amd64_displaced_step_fixup): Update. * arch-utils.c (simple_displaced_step_copy_insn): Update. * auxv.c (fprint_target_auxv): Update. * breakpoint.c (insert_single_step_breakpoint): Update. * buildsym.c (finish_block): Update. * cli/cli-dump.c (restore_section_callback): Update. * fbsd-nat.c (fbsd_find_memory_regions): Update. * frame.c (frame_unwind_register_value): Update. * gcore.c (gcore_create_callback): Update. * hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update. * i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm, i386_record_lea_modrm_addr, i386_record_lea_modrm, i386_process_record): Update. * ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id, ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id, ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update. * infrun.c (displaced_step_prepare, displaced_step_fixup, handle_inferior_event, insert_step_resume_breakpoint_at_sal, insert_longjmp_resume_breakpoint): Update. * linux-nat.c (linux_nat_find_memory_regions): Update. * linux-record.c (record_linux_system_call): Update. * mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call, mips_o32_push_dummy_call, mips_o64_push_dummy_call): Update. * monitor.c (monitor_error, monitor_remove_breakpoint): Update. * record.c (record_arch_list_add_mem, record_wait, record_xfer_partial): Update. * remote-mips.c (mips_fetch_word, mips_check_lsi_error, mips_common_breakpoint): Update. * remote-sim.c (gdbsim_xfer_inferior_memory): Update. * rs6000-tdep.c (ppc_displaced_step_fixup): Update. * solib-som.c (som_current_sos): Update. * symfile.c (load_progress, generic_load): Update. * symfile-mem.c (add_vsyscall_page): Update. * valops.c (value_fetch_lazy): Update. * windows-tdep.c (windows_xfer_shared_library): Update. Update callers of paddr_nz to use paddress instead (changing user-visible output to make it more correct): * dwarf2loc.c (locexpr_describe_location): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint, ia64_memory_remove_breakpoint): Update. * jv-valprint.c (java_value_print): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. * monitor.c (monitor_read_memory): Update. Update callers of paddr to use paddress instead (changing user-visible output to make it more correct): * arm-tdep.c (arm_push_dummy_call): Update. * breakpoint.c (insert_bp_location, create_thread_event_breakpoint, create_breakpoint): Update. * darwin-nat-info.c (darwin_debug_regions): Update. * dcache.c (dcache_info): Update. * dsrec.c (load_srec, make_srec): Update. * dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program, dwarf2_frame_cache): Update. * gcore.c (gcore_copy_callback): Update. * gnu-nat.c (gnu_xfer_memory): Update. * mips-linux-nat.c (mips_show_dr): Update. * monitor.c (monitor_write_memory, monitor_insert_breakpoint, monitor_remove_breakpoint): Update. * remote.c (compare_sections_command): Update. * remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint, m32r_remove_breakpoint, m32r_insert_watchpoint, m32r_remove_watchpoint): Update. * sol-thread.c (info_cb): Update. * symfile.c (load_progress): Update. Update callers of paddress or paddr_nz to use hex_string instead (changes output of internal/error/debug messages only): * dwarf2read.c (dump_die_shallow): Update. * frame.c (fprint_field, fprint_frame, frame_pc_unwind, get_frame_func, create_new_frame): Update. * hppa-tdep.c (find_unwind_entry, unwind_command): Update. * ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x, ia64_get_dyn_info_list): Update. * maint.c (maintenance_translate_address): Update. * mi/mi-cmd-var.c (mi_cmd_var_create): Update. * target.c (target_flash_erase): Update. Update callers of paddr/paddr_nz to use phex/phex_nz instead, using an appropriate address size. Remove use of strlen_paddr. * exec.c (exec_files_info): Update. * i386-nat.c (i386_show_dr): Update. * remote.c (remote_flash_erase): Update. * m32r-rom.c (m32r_load_section): Update. * monitor.c (monitor_vsprintf, monitor_store_register): Update. * remote.c (remote_check_symbols, remote_search_memory): Update. * remote-mips.c (mips_request, mips_common_breakpoint): Update. * scm-valprint.c (scm_ipruk, scm_scmval_print): Update. * sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update. * sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs, sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs, sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs, sh_dsp_show_regs): Update. * xcoffsolib.c (sharedlibrary_command): Update. * maint.c (maint_print_section_info): Add ADDR_SIZE parameter. Use hex_string_custom instead of paddr. (print_bfd_section_info): Pass address size. (print_objfile_section_info): Likewise. * annotate.h (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * annotate.c (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * source.c (identify_source_line): Update call to annotate_source. * stack.c (print_frame_info, print_frame): Update call to annotate_frame_begin. * breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter. (create_breakpoint, create_ada_exception_breakpoint): Update call. * stack.c (print_block_frame_labels): Add GDBARCH parameter. (print_frame_label_vars): Update call. * symmisc.c (print_partial_symbols): Add GDBARCH parameter. (dump_psymtab): Update call to print_partial_symbols. (struct print_symbol_args): Add GDBARCH member. (dump_symtab_1): Set print_symbol_args architecture member. (print_symbol): Use it. * windows-tdep.h (windows_xfer_shared_library): Add GDBARCH parameter. * windows-tdep.c (windows_xfer_shared_library): Likewise. * i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member. (core_process_module_section): Pass architecture from cpms_data to windows_xfer_shared_library. (windows_core_xfer_shared_libraries): Initialize cmps_data architecture member. * windows-nat.c (windows_xfer_shared_libraries): Pass architecture to windows_xfer_shared_library. * defs.h (print_address): Add GDBARCH parameter. * printcmd.c (print_address): Add GDBARCH parameter. (print_scalar_formatted, do_examine): Update call. * findcmd.c (find_command): Update call. * tracepoint.c: Include "arch-utils.h". (trace_find_line_command): Update call. * tui/tui-disasm.c (tui_disassemble): Update call. * value.h (print_address_demangle): Add GDBARCH parameter. * printcmd.c (print_address_demangle): Add GDBARCH parameter. * c-valprint.c (print_function_pointer_address, c_val_print): Update call. * f-valprint.c (f_val_print): Update call. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update call. * jv-valprint.c (java_val_print): Update call. * m2-valprint.c (print_function_pointer_address, m2_val_print): Update call. * p-valprint.c (pascal_val_print): Update call. * disasm.c (gdb_disassemble_info): Install architecture into di.application_data field. testsuite/ChangeLog: * gdb.threads/tls-shared.exp: Update to locexpr_describe_location change to prefix TLS offset in hex with 0x. doc/ChangeLog: * gdbint.texinfo (Item Output Functions): Update signature for ui_out_field_core_addr.
2009-07-02 19:21:10 +02:00
paddress (gdbarch, sal.pc),
Replace SYMBOL_*_NAME accessors with member functions Similar to the MSYMBOL version of this patch, improves readability and will eventually allow making name private. gdb/ChangeLog: 2019-11-22 Christian Biesinger <cbiesinger@google.com> * ada-exp.y: Update. * ada-lang.c (sort_choices): Update. (ada_print_symbol_signature): Update. (resolve_subexp): Update. (ada_parse_renaming): Update. (ada_read_renaming_var_value): Update. (lesseq_defined_than): Update. (remove_extra_symbols): Update. (remove_irrelevant_renamings): Update. (ada_add_block_symbols): Update. (ada_collect_symbol_completion_matches): Update. (ada_is_renaming_symbol): Update. (aggregate_assign_from_choices): Update. (ada_evaluate_subexp): Update. (ada_has_this_exception_support): Update. (ada_is_non_standard_exception_sym): Update. (ada_add_exceptions_from_frame): Update. (ada_add_global_exceptions): Update. (ada_print_subexp): Update. * ax-gdb.c (gen_var_ref): Update. (gen_maybe_namespace_elt): Update. (gen_expr_for_cast): Update. (gen_expr): Update. * block.h: Update. * blockframe.c (find_pc_partial_function): Update. * breakpoint.c (print_breakpoint_location): Update. (update_static_tracepoint): Update. * btrace.c (ftrace_print_function_name): Update. (ftrace_function_switched): Update. * buildsym.c (find_symbol_in_list): Update. * c-exp.y: Update. * c-typeprint.c (c_print_typedef): Update. (c_type_print_template_args): Update. * cli/cli-cmds.c (edit_command): Update. (list_command): Update. (print_sal_location): Update. * coffread.c (patch_opaque_types): Update. (process_coff_symbol): Update. (coff_read_enum_type): Update. * compile/compile-c-symbols.c (c_symbol_substitution_name): Update. (convert_one_symbol): Update. (hash_symname): Update. (eq_symname): Update. * compile/compile-cplus-symbols.c (convert_one_symbol): Update. * compile/compile-cplus-types.c (debug_print_scope): Update. * compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Update. * compile/compile-object-load.c (get_out_value_type): Update. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Update. (search_symbol_list): Update. (cp_lookup_symbol_imports_or_template): Update. * cp-support.c (overload_list_add_symbol): Update. * ctfread.c (psymtab_to_symtab): Update. * dbxread.c (cp_set_block_scope): Update. * dictionary.c (iter_match_first_hashed): Update. (iter_match_next_hashed): Update. (insert_symbol_hashed): Update. (iter_match_next_linear): Update. * dictionary.h: Update. * dwarf2loc.c (func_get_frame_base_dwarf_block): Update. (locexpr_describe_location_piece): Update. (locexpr_describe_location_1): Update. (locexpr_generate_c_location): Update. (loclist_describe_location): Update. (loclist_generate_c_location): Update. * dwarf2read.c (dw2_debug_names_lookup_symbol): Update. (read_func_scope): Update. (process_enumeration_scope): Update. (new_symbol): Update. (dwarf2_const_value): Update. (dwarf2_symbol_mark_computed): Update. * eval.c (evaluate_funcall): Update. (evaluate_subexp_standard): Update. * expprint.c (print_subexp_standard): Update. (dump_subexp_body_standard): Update. * f-valprint.c (info_common_command_for_block): Update. * findvar.c (get_hosting_frame): Update. (default_read_var_value): Update. * go-lang.c (go_symbol_package_name): Update. * guile/scm-block.c (bkscm_print_block_smob): Update. * guile/scm-symbol.c (syscm_print_symbol_smob): Update. (gdbscm_symbol_name): Update. (gdbscm_symbol_linkage_name): Update. (gdbscm_symbol_print_name): Update. * infcall.c (get_function_name): Update. * infcmd.c (jump_command): Update. (finish_command): Update. * infrun.c (insert_exception_resume_breakpoint): Update. * linespec.c (canonicalize_linespec): Update. (create_sals_line_offset): Update. (convert_linespec_to_sals): Update. (complete_label): Update. (find_label_symbols_in_block): Update. * m2-typeprint.c (m2_print_typedef): Update. * mdebugread.c (mdebug_reg_to_regnum): Update. (parse_symbol): Update. (mylookup_symbol): Update. * mi/mi-cmd-stack.c (list_arg_or_local): Update. (list_args_or_locals): Update. * objc-lang.c (compare_selectors): Update. (info_selectors_command): Update. (compare_classes): Update. (info_classes_command): Update. (find_imps): Update. * p-typeprint.c (pascal_print_typedef): Update. * printcmd.c (build_address_symbolic): Update. (info_address_command): Update. (print_variable_and_value): Update. * python/py-framefilter.c (extract_sym): Update. (py_print_single_arg): Update. * python/py-symbol.c (sympy_str): Update. (sympy_get_name): Update. (sympy_get_linkage_name): Update. * python/python.c (gdbpy_rbreak): Update. * record-btrace.c (btrace_get_bfun_name): Update. (btrace_call_history): Update. * rust-lang.c (rust_print_typedef): Update. * solib-frv.c (frv_fdpic_find_canonical_descriptor): Update. * stabsread.c (stab_reg_to_regnum): Update. (define_symbol): Update. (read_enum_type): Update. (common_block_end): Update. (cleanup_undefined_types_1): Update. (scan_file_globals): Update. * stack.c (print_frame_arg): Update. (print_frame_args): Update. (find_frame_funname): Update. (info_frame_command_core): Update. (iterate_over_block_locals): Update. (print_block_frame_labels): Update. (do_print_variable_and_value): Update. (iterate_over_block_arg_vars): Update. (return_command): Update. * symmisc.c (dump_symtab_1): Update. (print_symbol): Update. * symtab.c (eq_symbol_entry): Update. (symbol_cache_dump): Update. (lookup_language_this): Update. (find_pc_sect_line): Update. (skip_prologue_sal): Update. (symbol_search::compare_search_syms): Update. (treg_matches_sym_type_name): Update. (search_symbols): Update. (print_symbol_info): Update. (rbreak_command): Update. (completion_list_add_symbol): Update. (find_gnu_ifunc): Update. (get_symbol_address): Update. (search_module_symbols): Update. (info_module_subcommand): Update. * symtab.h (SYMBOL_NATURAL_NAME): Remove. (SYMBOL_LINKAGE_NAME): Remove. (SYMBOL_DEMANGLED_NAME): Remove. (SYMBOL_PRINT_NAME): Remove. (SYMBOL_SEARCH_NAME): Remove. * tracepoint.c (set_traceframe_context): Update. (validate_actionline): Update. (collection_list::collect_symbol): Update. (encode_actions_1): Update. (info_scope_command): Update. (print_one_static_tracepoint_marker): Update. * typeprint.c (typedef_hash_table::add_template_parameters): Update. * valops.c (address_of_variable): Update. (find_overload_match): Update. (find_oload_champ): Update. Change-Id: I76bdc8b44eea6876bf03af9d351f8e90cc0154b2
2019-11-22 19:05:14 +01:00
sym->print_name (),
gdb/ * ada-lang.c (user_select_syms): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * breakpoint.c (print_breakpoint_location, resolve_sal_pc): Likewise. (clear_command): New variable sal_fullname, initialize it. Replace compare_filenames_for_search by filename_cmp with sal_fullname. (say_where, update_static_tracepoint): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * cli/cli-cmds.c (edit_command, list_command, ambiguous_line_spec): Likewise. * dwarf2read.c: Include source.h. (fixup_go_packaging): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * linespec.c (add_sal_to_sals): Rename variable filename to fullname. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (create_sals_line_offset, convert_linespec_to_sals): New variable fullname, initialize it, replace symtab->filename reference by the variable. * linux-fork.c: Include source.h. (info_checkpoints_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * macroscope.c (sal_macro_scope): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * mdebugread.c: Include source.h. (psymtab_to_symtab_1): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) (mi_cmd_file_list_exec_source_files): Likewise. * printcmd.c: Include source.h. (build_address_symbolic): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * psymtab.c (partial_map_symtabs_matching_filename) (read_psymtabs_with_fullname): Call compare_filenames_for_search also with psymtab_to_fullname. * python/py-symtab.c (stpy_str): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (stpy_get_filename): New variable filename, initialize it, use instead of symtab->filename refererences. (salpy_str): Make variable filename const char *. Replace symtab->filename refererences by symtab_to_filename_for_display calls. * skip.c: Include source.h and filenames.h. (skip_file_command): Remove const from the symtab variable. Replace symtab->filename refererences by symtab_to_fullname call. (function_name_is_marked_for_skip): New variables searched_for_fullname and fullname. Use them to search also with symtab's fullname. * source.c (find_source_lines): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (print_source_lines_base): New variable filename, use it instead of symtab->filename. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (line_info, forward_search_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (reverse_search_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. New variable filename for it. * stack.c (frame_info): Likewise. * symmisc.c: Include source.h. (dump_objfile, dump_symtab_1, maintenance_print_symbols) (maintenance_info_symtabs): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * symtab.c (iterate_over_some_symtabs): Call compare_filenames_for_search also with symtab_to_fullname. (lookup_symbol_aux_quick, basic_lookup_transparent_type_quick): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (find_line_symtab): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (file_matches): Replace filename_cmp by compare_filenames_for_search. (print_symbol_info): Make the last parameter const char *. New variable s_filename. Use it in the function. (symtab_symbol_info): Make the last_filename variable const char *. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (rbreak_command): New variable fullname. Use it. Replace symtab->filename refererence by symtab_to_filename_for_display call. * tracepoint.c (set_traceframe_context, trace_find_line_command) (print_one_static_tracepoint_marker): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * tui/tui-source.c (tui_set_source_content): New variables filename and s_filename. Replace symtab->filename refererences by this variable. Replace other symtab->filename refererences by symtab_to_filename_for_display calls.
2013-02-03 17:13:31 +01:00
symtab_to_filename_for_display (sal.symtab), sal.line);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
else
* defs.h (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter. * utils.c (strlen_paddr, paddr, paddr_nz): Remove. (paddress): Add GDBARCH parameter, use it instead of current_gdbarch. * ui-out.h (ui_out_field_core_addr): Add GDBARCH parameter. * ui-out.c (ui_out_field_core_addr): Add GDBARCH parameter, use it instead of current_gdbarch. Update calls to ui_out_field_core_addr to pass architecture: * ada-lang.c (print_one_exception): Update. * breakpoint.c (print_one_breakpoint_location, print_one_exception_catchpoint): Update. * disasm.c (dump_insns): Update. * darwin-nat-info.c (darwin_debug_regions_recurse): Update. * mi/mi-main.c (mi_cmd_data_read_memory): Update. * mi/mi-symbol-cmds.c: Include "objfiles.h". (mi_cmd_symbol_list_lines): Update. * stack.c (print_frame_info, print_frame): Update. Update callers of paddress to pass architecture: * ada-tasks.c (info_task): Update. * ada-valprint.c (ada_val_print_1): Update. * annotate.c (annotate_source, annotate_frame_begin): Update. * breakpoint.c (insert_bp_location, describe_other_breakpoints, mention): Update. * cli/cli-cmds.c (edit_command, list_command, print_disassembly): Update. * corefile.c (memory_error): Update. * c-valprint.c (print_function_pointer_address, c_val_print): Update. * disasm.c (dis_asm_print_address): Update. * exec.c (print_section_info): Update. * f-valprint.c (f_val_print): Update. * infcmd.c: Include "arch-utils.h". (jump_command, program_info): Update. * linux-fork.c: Include "arch-utils.h". (info_forks_command): Update. * m2-valprint.c (print_function_pointer_address, print_unpacked_pointer, print_variable_at_address, m2_val_print): Update. * m32r-rom.c (m32r_load_section, m32r_load, m32r_upload_command): Update. * printcmd.c (print_address, print_address_demangle, address_info): Update. * p-valprint.c (pascal_val_print): Update. * source.c: Include "arch-utils.h". (line_info): Update. * stack.c (frame_info, print_block_frame_labels): Update. * symfile.c (add_symbol_file_command, list_overlays_command): Update. * symmisc.c (dump_msymbols, dump_psymtab, dump_symtab_1, print_symbol, print_partial_symbols, maintenance_info_psymtabs, maintenance_check_symtabs): Update. * symtab.c (find_pc_sect_symtab): Update. * target.c (deprecated_debug_xfer_memory): Update. * tracepoint.c (scope_info): Update. * tui/tui-stack.c (tui_make_status_line): Update. * valprint.c (val_print_string): Update. Update callers of paddr_nz to use paddress instead (keeping user-visible output identical): * alpha-tdep.c (alpha_heuristic_proc_start): Update. * amd64-tdep.c (fixup_riprel, amd64_displaced_step_copy_insn, amd64_displaced_step_fixup): Update. * arch-utils.c (simple_displaced_step_copy_insn): Update. * auxv.c (fprint_target_auxv): Update. * breakpoint.c (insert_single_step_breakpoint): Update. * buildsym.c (finish_block): Update. * cli/cli-dump.c (restore_section_callback): Update. * fbsd-nat.c (fbsd_find_memory_regions): Update. * frame.c (frame_unwind_register_value): Update. * gcore.c (gcore_create_callback): Update. * hppa-tdep.c (hppa_frame_cache, hppa_skip_trampoline_code): Update. * i386-tdep.c (i386_displaced_step_fixup, i386_record_modrm, i386_record_lea_modrm_addr, i386_record_lea_modrm, i386_process_record): Update. * ia64-tdep.c (ia64_frame_this_id, ia64_sigtramp_frame_this_id, ia64_libunwind_frame_this_id, ia64_libunwind_sigtramp_frame_this_id, ia64_dummy_id, ia64_access_reg, ia64_access_rse_reg): Update. * infrun.c (displaced_step_prepare, displaced_step_fixup, handle_inferior_event, insert_step_resume_breakpoint_at_sal, insert_longjmp_resume_breakpoint): Update. * linux-nat.c (linux_nat_find_memory_regions): Update. * linux-record.c (record_linux_system_call): Update. * mips-tdep.c (heuristic_proc_start, mips_eabi_push_dummy_call, mips_n32n64_push_dummy_call, mips_o32_push_dummy_call, mips_o64_push_dummy_call): Update. * monitor.c (monitor_error, monitor_remove_breakpoint): Update. * record.c (record_arch_list_add_mem, record_wait, record_xfer_partial): Update. * remote-mips.c (mips_fetch_word, mips_check_lsi_error, mips_common_breakpoint): Update. * remote-sim.c (gdbsim_xfer_inferior_memory): Update. * rs6000-tdep.c (ppc_displaced_step_fixup): Update. * solib-som.c (som_current_sos): Update. * symfile.c (load_progress, generic_load): Update. * symfile-mem.c (add_vsyscall_page): Update. * valops.c (value_fetch_lazy): Update. * windows-tdep.c (windows_xfer_shared_library): Update. Update callers of paddr_nz to use paddress instead (changing user-visible output to make it more correct): * dwarf2loc.c (locexpr_describe_location): Update. * ia64-tdep.c (ia64_memory_insert_breakpoint, ia64_memory_remove_breakpoint): Update. * jv-valprint.c (java_value_print): Update. * m32c-tdep.c (m32c_m16c_address_to_pointer): Update. * monitor.c (monitor_read_memory): Update. Update callers of paddr to use paddress instead (changing user-visible output to make it more correct): * arm-tdep.c (arm_push_dummy_call): Update. * breakpoint.c (insert_bp_location, create_thread_event_breakpoint, create_breakpoint): Update. * darwin-nat-info.c (darwin_debug_regions): Update. * dcache.c (dcache_info): Update. * dsrec.c (load_srec, make_srec): Update. * dwarf2-frame.c (dwarf2_restore_rule, execute_cfa_program, dwarf2_frame_cache): Update. * gcore.c (gcore_copy_callback): Update. * gnu-nat.c (gnu_xfer_memory): Update. * mips-linux-nat.c (mips_show_dr): Update. * monitor.c (monitor_write_memory, monitor_insert_breakpoint, monitor_remove_breakpoint): Update. * remote.c (compare_sections_command): Update. * remote-m32r-sdi.c (m32r_xfer_memory, m32r_insert_breakpoint, m32r_remove_breakpoint, m32r_insert_watchpoint, m32r_remove_watchpoint): Update. * sol-thread.c (info_cb): Update. * symfile.c (load_progress): Update. Update callers of paddress or paddr_nz to use hex_string instead (changes output of internal/error/debug messages only): * dwarf2read.c (dump_die_shallow): Update. * frame.c (fprint_field, fprint_frame, frame_pc_unwind, get_frame_func, create_new_frame): Update. * hppa-tdep.c (find_unwind_entry, unwind_command): Update. * ia64-tdep.c (get_kernel_table, ia64_find_proc_info_x, ia64_get_dyn_info_list): Update. * maint.c (maintenance_translate_address): Update. * mi/mi-cmd-var.c (mi_cmd_var_create): Update. * target.c (target_flash_erase): Update. Update callers of paddr/paddr_nz to use phex/phex_nz instead, using an appropriate address size. Remove use of strlen_paddr. * exec.c (exec_files_info): Update. * i386-nat.c (i386_show_dr): Update. * remote.c (remote_flash_erase): Update. * m32r-rom.c (m32r_load_section): Update. * monitor.c (monitor_vsprintf, monitor_store_register): Update. * remote.c (remote_check_symbols, remote_search_memory): Update. * remote-mips.c (mips_request, mips_common_breakpoint): Update. * scm-valprint.c (scm_ipruk, scm_scmval_print): Update. * sh64-tdep.c (sh64_show_media_regs, sh64_show_compact_regs): Update. * sh-tdep.c (sh_generic_show_regs, sh3_show_regs, sh2e_show_regs, sh2a_show_regs, sh2a_nofpu_show_regs, sh3e_show_regs, sh3_dsp_show_regs, sh4_show_regs, sh4_nofpu_show_regs, sh_dsp_show_regs): Update. * xcoffsolib.c (sharedlibrary_command): Update. * maint.c (maint_print_section_info): Add ADDR_SIZE parameter. Use hex_string_custom instead of paddr. (print_bfd_section_info): Pass address size. (print_objfile_section_info): Likewise. * annotate.h (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * annotate.c (annotate_source): Add GDBARCH parameter. (annotate_frame_begin): Likewise. * source.c (identify_source_line): Update call to annotate_source. * stack.c (print_frame_info, print_frame): Update call to annotate_frame_begin. * breakpoint.c (describe_other_breakpoints): Add GDBARCH parameter. (create_breakpoint, create_ada_exception_breakpoint): Update call. * stack.c (print_block_frame_labels): Add GDBARCH parameter. (print_frame_label_vars): Update call. * symmisc.c (print_partial_symbols): Add GDBARCH parameter. (dump_psymtab): Update call to print_partial_symbols. (struct print_symbol_args): Add GDBARCH member. (dump_symtab_1): Set print_symbol_args architecture member. (print_symbol): Use it. * windows-tdep.h (windows_xfer_shared_library): Add GDBARCH parameter. * windows-tdep.c (windows_xfer_shared_library): Likewise. * i386-cygwin-tdep.c (struct cpms_data): Add GDBARCH member. (core_process_module_section): Pass architecture from cpms_data to windows_xfer_shared_library. (windows_core_xfer_shared_libraries): Initialize cmps_data architecture member. * windows-nat.c (windows_xfer_shared_libraries): Pass architecture to windows_xfer_shared_library. * defs.h (print_address): Add GDBARCH parameter. * printcmd.c (print_address): Add GDBARCH parameter. (print_scalar_formatted, do_examine): Update call. * findcmd.c (find_command): Update call. * tracepoint.c: Include "arch-utils.h". (trace_find_line_command): Update call. * tui/tui-disasm.c (tui_disassemble): Update call. * value.h (print_address_demangle): Add GDBARCH parameter. * printcmd.c (print_address_demangle): Add GDBARCH parameter. * c-valprint.c (print_function_pointer_address, c_val_print): Update call. * f-valprint.c (f_val_print): Update call. * gnu-v3-abi.c (gnuv3_print_method_ptr): Update call. * jv-valprint.c (java_val_print): Update call. * m2-valprint.c (print_function_pointer_address, m2_val_print): Update call. * p-valprint.c (pascal_val_print): Update call. * disasm.c (gdb_disassemble_info): Install architecture into di.application_data field. testsuite/ChangeLog: * gdb.threads/tls-shared.exp: Update to locexpr_describe_location change to prefix TLS offset in hex with 0x. doc/ChangeLog: * gdbint.texinfo (Item Output Functions): Update signature for ui_out_field_core_addr.
2009-07-02 19:21:10 +02:00
printf_filtered ("%s is at %s:%d.\n",
paddress (gdbarch, sal.pc),
gdb/ * ada-lang.c (user_select_syms): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * breakpoint.c (print_breakpoint_location, resolve_sal_pc): Likewise. (clear_command): New variable sal_fullname, initialize it. Replace compare_filenames_for_search by filename_cmp with sal_fullname. (say_where, update_static_tracepoint): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * cli/cli-cmds.c (edit_command, list_command, ambiguous_line_spec): Likewise. * dwarf2read.c: Include source.h. (fixup_go_packaging): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * linespec.c (add_sal_to_sals): Rename variable filename to fullname. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (create_sals_line_offset, convert_linespec_to_sals): New variable fullname, initialize it, replace symtab->filename reference by the variable. * linux-fork.c: Include source.h. (info_checkpoints_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * macroscope.c (sal_macro_scope): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * mdebugread.c: Include source.h. (psymtab_to_symtab_1): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * mi/mi-cmd-file.c (mi_cmd_file_list_exec_source_file) (mi_cmd_file_list_exec_source_files): Likewise. * printcmd.c: Include source.h. (build_address_symbolic): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * psymtab.c (partial_map_symtabs_matching_filename) (read_psymtabs_with_fullname): Call compare_filenames_for_search also with psymtab_to_fullname. * python/py-symtab.c (stpy_str): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (stpy_get_filename): New variable filename, initialize it, use instead of symtab->filename refererences. (salpy_str): Make variable filename const char *. Replace symtab->filename refererences by symtab_to_filename_for_display calls. * skip.c: Include source.h and filenames.h. (skip_file_command): Remove const from the symtab variable. Replace symtab->filename refererences by symtab_to_fullname call. (function_name_is_marked_for_skip): New variables searched_for_fullname and fullname. Use them to search also with symtab's fullname. * source.c (find_source_lines): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (print_source_lines_base): New variable filename, use it instead of symtab->filename. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (line_info, forward_search_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (reverse_search_command): Replace symtab->filename refererences by symtab_to_filename_for_display calls. New variable filename for it. * stack.c (frame_info): Likewise. * symmisc.c: Include source.h. (dump_objfile, dump_symtab_1, maintenance_print_symbols) (maintenance_info_symtabs): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * symtab.c (iterate_over_some_symtabs): Call compare_filenames_for_search also with symtab_to_fullname. (lookup_symbol_aux_quick, basic_lookup_transparent_type_quick): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (find_line_symtab): Replace symtab->filename refererences by symtab_to_filename_for_display calls. (file_matches): Replace filename_cmp by compare_filenames_for_search. (print_symbol_info): Make the last parameter const char *. New variable s_filename. Use it in the function. (symtab_symbol_info): Make the last_filename variable const char *. Replace symtab->filename refererences by symtab_to_filename_for_display calls. (rbreak_command): New variable fullname. Use it. Replace symtab->filename refererence by symtab_to_filename_for_display call. * tracepoint.c (set_traceframe_context, trace_find_line_command) (print_one_static_tracepoint_marker): Replace symtab->filename refererences by symtab_to_filename_for_display calls. * tui/tui-source.c (tui_set_source_content): New variables filename and s_filename. Replace symtab->filename refererences by this variable. Replace other symtab->filename refererences by symtab_to_filename_for_display calls.
2013-02-03 17:13:31 +01:00
symtab_to_filename_for_display (sal.symtab), sal.line);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
}
/* If line was not specified by just a line number, and it does not
imply a symtab, it must be an undebuggable symbol which means no
source code. */
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
if (!linenum_beg && sal.symtab == 0)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("No line number known for %s."), arg);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
/* If this command is repeated with RET,
turn it into the no-arg variant. */
if (from_tty)
set_repeat_arguments ("");
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
if (dummy_beg && sal_end.symtab == 0)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("No default source file yet. Do \"help list\"."));
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
if (dummy_beg)
gdb: Avoid signed integer overflow when printing source lines When printing source lines with calls to print_source_lines we need to pass a start line number and an end line number. The end line number is calculated by calling get_lines_to_list and adding this value to the start line number. For example this code from list_command: print_source_lines (cursal.symtab, first, first + get_lines_to_list (), 0); The problem is that get_lines_to_list returns a value based on the GDB setting `set listsize LISTSIZE`. By default LISTSIZE is 10, however, its also possible to set LISTSIZE to unlimited, in which case get_lines_to_list will return INT_MAX. As the parameter signature for print_source_lines is: void print_source_lines (struct symtab *, int, int, print_source_lines_flags); and `first` in the above code is an `int`, then when LISTSIZE is `unlimited` the above code will result in signed integer overflow, which is undefined. The solution in this patch is a new class source_lines_range that can be constructed from a single line number and a direction (forward or backward). The range is then constructed from the line number and the value of get_lines_to_list. gdb/ChangeLog: * cli/cli-cmds.c (list_command): Pass a source_lines_range to print_source_lines. * source.c (print_source_lines_base): Update line number check. (print_source_lines): New function. (source_lines_range::source_lines_range): New function. * source.h (class source_lines_range): New class. (print_source_lines): New declaration.
2019-01-07 08:26:35 +01:00
{
source_lines_range range (sal_end.line + 1,
source_lines_range::BACKWARD);
print_source_lines (sal_end.symtab, range, 0);
}
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
else if (sal.symtab == 0)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("No default source file yet. Do \"help list\"."));
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
else if (no_end)
{
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
for (int i = 0; i < sals.size (); i++)
{
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
sal = sals[i];
int first_line = sal.line - get_lines_to_list () / 2;
if (first_line < 1)
first_line = 1;
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
if (sals.size () > 1)
Make "list ambiguous" show symbol names too Currently, with an ambiguous "list first,last", we get: (gdb) list bar,main Specified first line 'bar' is ambiguous: file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97 file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98 This commit makes gdb's output above a bit clearer by printing the symbol name as well: (gdb) list bar,main Specified first line 'bar' is ambiguous: file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)" file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)" And while at it, makes gdb print the symbol name when actually listing multiple locations too. I.e., before (with "set listsize 2"): (gdb) list bar file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97 96 97 int bar (A) { return 11; } file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98 97 int bar (A) { return 11; } 98 int bar (B) { return 22; } After: (gdb) list bar file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)" 96 97 int bar (A) { return 11; } file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)" 97 int bar (A) { return 11; } 98 int bar (B) { return 22; } Currently, the result of decoding a linespec loses information about the original symbol that was found. All we end up with is an address. This makes it difficult to find the original symbol again to get at its print name. Fix that by storing a pointer to the symbol in the sal. We already store the symtab and obj_section, so it feels like a natural progression to me. This avoids having to do any extra symbol lookup too. gdb/ChangeLog: 2017-09-20 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (list_command): Use print_sal_location. (print_sal_location): New function. (ambiguous_line_spec): Use print_sal_location. * linespec.c (symbol_to_sal): Record the symbol in the sal. * symtab.c (find_function_start_sal): Likewise. * symtab.h (symtab_and_line::symbol): New field. gdb/testsuite/ChangeLog: 2017-09-20 Pedro Alves <palves@redhat.com> * gdb.base/list-ambiguous.exp (test_list_ambiguous_symbol): Expect symbol names in gdb's output. * gdb.cp/overload.exp ("list all overloads"): Likewise.
2017-09-20 17:12:54 +02:00
print_sal_location (sal);
gdb: Avoid signed integer overflow when printing source lines When printing source lines with calls to print_source_lines we need to pass a start line number and an end line number. The end line number is calculated by calling get_lines_to_list and adding this value to the start line number. For example this code from list_command: print_source_lines (cursal.symtab, first, first + get_lines_to_list (), 0); The problem is that get_lines_to_list returns a value based on the GDB setting `set listsize LISTSIZE`. By default LISTSIZE is 10, however, its also possible to set LISTSIZE to unlimited, in which case get_lines_to_list will return INT_MAX. As the parameter signature for print_source_lines is: void print_source_lines (struct symtab *, int, int, print_source_lines_flags); and `first` in the above code is an `int`, then when LISTSIZE is `unlimited` the above code will result in signed integer overflow, which is undefined. The solution in this patch is a new class source_lines_range that can be constructed from a single line number and a direction (forward or backward). The range is then constructed from the line number and the value of get_lines_to_list. gdb/ChangeLog: * cli/cli-cmds.c (list_command): Pass a source_lines_range to print_source_lines. * source.c (print_source_lines_base): Update line number check. (print_source_lines): New function. (source_lines_range::source_lines_range): New function. * source.h (class source_lines_range): New class. (print_source_lines): New declaration.
2019-01-07 08:26:35 +01:00
print_source_lines (sal.symtab, source_lines_range (first_line), 0);
}
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
}
gdb: Avoid signed integer overflow when printing source lines When printing source lines with calls to print_source_lines we need to pass a start line number and an end line number. The end line number is calculated by calling get_lines_to_list and adding this value to the start line number. For example this code from list_command: print_source_lines (cursal.symtab, first, first + get_lines_to_list (), 0); The problem is that get_lines_to_list returns a value based on the GDB setting `set listsize LISTSIZE`. By default LISTSIZE is 10, however, its also possible to set LISTSIZE to unlimited, in which case get_lines_to_list will return INT_MAX. As the parameter signature for print_source_lines is: void print_source_lines (struct symtab *, int, int, print_source_lines_flags); and `first` in the above code is an `int`, then when LISTSIZE is `unlimited` the above code will result in signed integer overflow, which is undefined. The solution in this patch is a new class source_lines_range that can be constructed from a single line number and a direction (forward or backward). The range is then constructed from the line number and the value of get_lines_to_list. gdb/ChangeLog: * cli/cli-cmds.c (list_command): Pass a source_lines_range to print_source_lines. * source.c (print_source_lines_base): Update line number check. (print_source_lines): New function. (source_lines_range::source_lines_range): New function. * source.h (class source_lines_range): New class. (print_source_lines): New declaration.
2019-01-07 08:26:35 +01:00
else if (dummy_end)
print_source_lines (sal.symtab, source_lines_range (sal.line), 0);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
else
gdb: Avoid signed integer overflow when printing source lines When printing source lines with calls to print_source_lines we need to pass a start line number and an end line number. The end line number is calculated by calling get_lines_to_list and adding this value to the start line number. For example this code from list_command: print_source_lines (cursal.symtab, first, first + get_lines_to_list (), 0); The problem is that get_lines_to_list returns a value based on the GDB setting `set listsize LISTSIZE`. By default LISTSIZE is 10, however, its also possible to set LISTSIZE to unlimited, in which case get_lines_to_list will return INT_MAX. As the parameter signature for print_source_lines is: void print_source_lines (struct symtab *, int, int, print_source_lines_flags); and `first` in the above code is an `int`, then when LISTSIZE is `unlimited` the above code will result in signed integer overflow, which is undefined. The solution in this patch is a new class source_lines_range that can be constructed from a single line number and a direction (forward or backward). The range is then constructed from the line number and the value of get_lines_to_list. gdb/ChangeLog: * cli/cli-cmds.c (list_command): Pass a source_lines_range to print_source_lines. * source.c (print_source_lines_base): Update line number check. (print_source_lines): New function. (source_lines_range::source_lines_range): New function. * source.h (class source_lines_range): New class. (print_source_lines): New declaration.
2019-01-07 08:26:35 +01:00
print_source_lines (sal.symtab,
source_lines_range (sal.line, (sal_end.line + 1)),
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
0);
}
/* Subroutine of disassemble_command to simplify it.
Perform the disassembly.
NAME is the name of the function if known, or NULL.
[LOW,HIGH) are the range of addresses to disassemble.
Disassemble blocks with non-contiguous ranges This patch adds support for disassembly of blocks with non-contiguous ranges. These blocks are printed as follows: (gdb) disassemble foo Dump of assembler code for function foo: Address range 0x401136 to 0x401151: 0x0000000000401136 <+0>: push %rbp 0x0000000000401137 <+1>: mov %rsp,%rbp 0x000000000040113a <+4>: callq 0x401134 <bar> 0x000000000040113f <+9>: mov 0x2eef(%rip),%eax # 0x404034 <e> 0x0000000000401145 <+15>: test %eax,%eax 0x0000000000401147 <+17>: je 0x40114e <foo+24> 0x0000000000401149 <+19>: callq 0x401128 <foo+4294967282> 0x000000000040114e <+24>: nop 0x000000000040114f <+25>: pop %rbp 0x0000000000401150 <+26>: retq Address range 0x401128 to 0x401134: 0x0000000000401128 <+-14>: push %rbp 0x0000000000401129 <+-13>: mov %rsp,%rbp 0x000000000040112c <+-10>: callq 0x401126 <baz> 0x0000000000401131 <+-5>: nop 0x0000000000401132 <+-4>: pop %rbp 0x0000000000401133 <+-3>: retq End of assembler dump. This is an actual dump from the test case that I constructed for this work. The ranges are printed in the order encountered in the debug info. For the above example, note that the second range occupies lower addresses than the first range. Functions with contiguous ranges are still printed as follows: (gdb) disassemble main Dump of assembler code for function main: 0x0000000000401151 <+0>: push %rbp 0x0000000000401152 <+1>: mov %rsp,%rbp 0x0000000000401155 <+4>: callq 0x401136 <foo> 0x000000000040115a <+9>: mov $0x0,%eax 0x000000000040115f <+14>: pop %rbp 0x0000000000401160 <+15>: retq End of assembler dump. gdb/ChangeLog: * cli/cli-cmds.c (block.h): Include. (print_disassembly): Handle printing of non-contiguous blocks. (disassemble_current_function): Likewise. (disassemble_command): Likewise.
2018-08-24 01:00:49 +02:00
BLOCK is the block to disassemble; it needs to be provided
when non-contiguous blocks are disassembled; otherwise
it can be NULL.
MIXED is non-zero to print source with the assembler. */
static void
* disasm.h (gdb_disassembly): Add GDBARCH parameter. (gdb_print_insn): Likewise. * disasm.c (dump_insns): Add GDBARCH parameter. Use it instead of current_gdbarch. (do_mixed_source_and_assembly): Add GDBARCH parameter. Pass to dump_insns. (do_assembly_only): Likewise. (gdb_disassembly): Add GDBARCH parameter. Use it instead of current_gdbarch. Pass to subroutines. (gdb_print_insn): Add GDBARCH parameter. Use it instead of current_gdbarch. * stack.c (struct gdb_disassembly_stub_args): Add GDBARCH member. (gdb_disassembly_stub): Pass architecture to gdb_disassembly. (do_gdb_disassembly): Add GDBARCH argument. Store into args. (print_frame_info): Pass architecture to do_gdb_disassembly. * printcmd.c (print_formatted): Pass architecture to gdb_print_insn. * mi/mi-cmd-disas.c: Include "arch-utils.h" (mi_cmd_disassemble): Pass architecture to gdb_disassembly. * cli/cli-cmds.c: Include "arch-utils.h". (print_disassembly): Add GDBARCH parameter. Pass to gdb_disassembly and tui_show_assembly. (disassemble_current_function): Pass architecture to tui_get_low_disassembly_address and print_disassembly. (disassemble_command): Pass architecture to tui_get_low_disassembly_address and print_disassembly. * tui/tui.c (tui_show_assembly): Add GDBARCH parameter. Pass to tui_update_source_windows_with_addr. * tui/tui-data.h (struct tui_locator_element): Add GDBARCH member. (struct tui_source_info): Likewise. * tui/tui-data.c (tui_clear_win_detail): Clear source_info.gdbarch. * tui/tui-disasm.c (tui_disassemble): Add GDBARCH parameter. Pass to gdb_print_insn. (tui_find_disassembly_address): Add GDBARCH parameter. Pass to tui_disassemble. (tui_set_disassem_content): Add GDBARCH parameter. Install into source_info.gdbarch. Pass to tui_disassemble. (tui_show_disassem): Add GDBARCH parameter. Pass to tui_update_source_window. (tui_show_disassem_and_update_source): Add GDBARCH parameter. Pass to tui_show_disassem and tui_update_source_window. (tui_get_begin_asm_address): Return locator architecture in addition to locator PC value. (tui_get_low_disassembly_address): Add GDBARCH parameter. Pass to tui_get_low_disassembly_address. (tui_vertical_disassem_scroll): Pass architecture to subroutines. * tui/tui-disasm.h (tui_set_disassem_content): Add GDBARCH parameter. (tui_show_disassem): Likewise. (tui_show_disassem_and_update_source): Likewise. (tui_get_begin_asm_address): Return architecture and PC value. * tui/tui.h (tui_get_low_disassembly_address): Add GDBARCH parameter. (tui_show_assembly): Add GDBARCH parameter. * tui/tui-layout.c (extract_display_start_addr): Return current window architecture in addition to current PC value. (tui_set_layout): Update calls to tui_get_low_disassembly_address and extract_display_start_addr. Pass architecture to tui_update_source_windows_with_addr. * tui/tui-source.c: Include "objfiles.h". (tui_set_source_content): Initialize window architecture. (tui_show_symtab_source): Add GDBARCH parameter. Pass to tui_update_source_window_as_is * tui/tui-source.h (tui_show_symtab_source): Add GDBARCH parameter. * tui/tui-stack.c (tui_set_locator_info): Add GDBARCH parameter. Install locator architecture. (tui_set_locator_filename): Update call. (tui_show_frame_info): Pass architecture to tui_set_locator_info and subroutines. * tui/tui-win.c (make_visible_with_new_height): Pass architecture to tui_update_source_window. * tui/tui-winsource.c: Include "objfiles.h". (tui_display_main): Update call to tui_get_begin_asm_address. Pass architecture to tui_update_source_windows_with_addr. (tui_update_source_window): Add GDBARCH parameter. Pass to tui_update_source_window_as_is. (tui_update_source_window_as_is): Add GDBARCH parameter. Pass to tui_set_disassem_content. (tui_update_source_windows_with_addr): Add GDBARCH parameter. Pass to subroutines. (tui_update_source_windows_with_line): Pass objfile architecture to subroutines. (tui_horizontal_source_scroll): Pass architecture to tui_update_source_window_as_is. * tui/tui-winsource.h (tui_update_source_window): Add GDBARCH parameter. (tui_update_source_window_as_is): Likewise. (tui_update_source_windows_with_addr): Likewise.
2009-07-02 19:17:42 +02:00
print_disassembly (struct gdbarch *gdbarch, const char *name,
Introduce gdb_disassembly_flags For some reason I ended up staring at some of the "int flags" in btrace-related code, and I got confused because I had no clue what the flags where supposed to indicate. Fix that by using enum_flags, so that: #1 - it's clear from the type what the flags are about, and #2 - the compiler can catch mismatching mistakes gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (print_disassembly, disassemble_current_function) (disassemble_command): Use gdb_disassembly_flags instead of bare int. * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn) (dump_insns, do_mixed_source_and_assembly_deprecated) (do_mixed_source_and_assembly, do_assembly_only, gdb_disassembly): Use gdb_disassembly_flags instead of bare int. * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED, DISASSEMBLY_RAW_INSN) (DISASSEMBLY_OMIT_FNAME, DISASSEMBLY_FILENAME) (DISASSEMBLY_OMIT_PC, DISASSEMBLY_SOURCE) (DISASSEMBLY_SPECULATIVE): No longer macros. Instead they're... (enum gdb_disassembly_flag): ... values of this new enumeration. (gdb_disassembly_flags): Define. (gdb_disassembly) (gdb_pretty_print_disassembler::pretty_print_insn): Use it. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Use gdb_disassembly_flags instead of bare int. * record-btrace.c (btrace_insn_history) (record_btrace_insn_history, record_btrace_insn_history_range) (record_btrace_insn_history_from): Use gdb_disassembly_flags instead of bare int. * record.c (get_insn_history_modifiers, cmd_record_insn_history): Use gdb_disassembly_flags instead of bare int. * target-debug.h (target_debug_print_gdb_disassembly_flags): Define. * target-delegates.c: Regenerate. * target.c (target_insn_history, target_insn_history_from) (target_insn_history_range): Use gdb_disassembly_flags instead of bare int. * target.h: Include "disasm.h". (struct target_ops) <to_insn_history, to_insn_history_from, to_insn_history_range>: Use gdb_disassembly_flags instead of bare int. (target_insn_history, target_insn_history_from) (target_insn_history_range): Use gdb_disassembly_flags instead of bare int.
2017-09-04 19:23:22 +02:00
CORE_ADDR low, CORE_ADDR high,
Disassemble blocks with non-contiguous ranges This patch adds support for disassembly of blocks with non-contiguous ranges. These blocks are printed as follows: (gdb) disassemble foo Dump of assembler code for function foo: Address range 0x401136 to 0x401151: 0x0000000000401136 <+0>: push %rbp 0x0000000000401137 <+1>: mov %rsp,%rbp 0x000000000040113a <+4>: callq 0x401134 <bar> 0x000000000040113f <+9>: mov 0x2eef(%rip),%eax # 0x404034 <e> 0x0000000000401145 <+15>: test %eax,%eax 0x0000000000401147 <+17>: je 0x40114e <foo+24> 0x0000000000401149 <+19>: callq 0x401128 <foo+4294967282> 0x000000000040114e <+24>: nop 0x000000000040114f <+25>: pop %rbp 0x0000000000401150 <+26>: retq Address range 0x401128 to 0x401134: 0x0000000000401128 <+-14>: push %rbp 0x0000000000401129 <+-13>: mov %rsp,%rbp 0x000000000040112c <+-10>: callq 0x401126 <baz> 0x0000000000401131 <+-5>: nop 0x0000000000401132 <+-4>: pop %rbp 0x0000000000401133 <+-3>: retq End of assembler dump. This is an actual dump from the test case that I constructed for this work. The ranges are printed in the order encountered in the debug info. For the above example, note that the second range occupies lower addresses than the first range. Functions with contiguous ranges are still printed as follows: (gdb) disassemble main Dump of assembler code for function main: 0x0000000000401151 <+0>: push %rbp 0x0000000000401152 <+1>: mov %rsp,%rbp 0x0000000000401155 <+4>: callq 0x401136 <foo> 0x000000000040115a <+9>: mov $0x0,%eax 0x000000000040115f <+14>: pop %rbp 0x0000000000401160 <+15>: retq End of assembler dump. gdb/ChangeLog: * cli/cli-cmds.c (block.h): Include. (print_disassembly): Handle printing of non-contiguous blocks. (disassemble_current_function): Likewise. (disassemble_command): Likewise.
2018-08-24 01:00:49 +02:00
const struct block *block,
Introduce gdb_disassembly_flags For some reason I ended up staring at some of the "int flags" in btrace-related code, and I got confused because I had no clue what the flags where supposed to indicate. Fix that by using enum_flags, so that: #1 - it's clear from the type what the flags are about, and #2 - the compiler can catch mismatching mistakes gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (print_disassembly, disassemble_current_function) (disassemble_command): Use gdb_disassembly_flags instead of bare int. * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn) (dump_insns, do_mixed_source_and_assembly_deprecated) (do_mixed_source_and_assembly, do_assembly_only, gdb_disassembly): Use gdb_disassembly_flags instead of bare int. * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED, DISASSEMBLY_RAW_INSN) (DISASSEMBLY_OMIT_FNAME, DISASSEMBLY_FILENAME) (DISASSEMBLY_OMIT_PC, DISASSEMBLY_SOURCE) (DISASSEMBLY_SPECULATIVE): No longer macros. Instead they're... (enum gdb_disassembly_flag): ... values of this new enumeration. (gdb_disassembly_flags): Define. (gdb_disassembly) (gdb_pretty_print_disassembler::pretty_print_insn): Use it. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Use gdb_disassembly_flags instead of bare int. * record-btrace.c (btrace_insn_history) (record_btrace_insn_history, record_btrace_insn_history_range) (record_btrace_insn_history_from): Use gdb_disassembly_flags instead of bare int. * record.c (get_insn_history_modifiers, cmd_record_insn_history): Use gdb_disassembly_flags instead of bare int. * target-debug.h (target_debug_print_gdb_disassembly_flags): Define. * target-delegates.c: Regenerate. * target.c (target_insn_history, target_insn_history_from) (target_insn_history_range): Use gdb_disassembly_flags instead of bare int. * target.h: Include "disasm.h". (struct target_ops) <to_insn_history, to_insn_history_from, to_insn_history_range>: Use gdb_disassembly_flags instead of bare int. (target_insn_history, target_insn_history_from) (target_insn_history_range): Use gdb_disassembly_flags instead of bare int.
2017-09-04 19:23:22 +02:00
gdb_disassembly_flags flags)
{
#if defined(TUI)
if (tui_is_window_visible (DISASSEM_WIN))
tui_show_assembly (gdbarch, low);
else
#endif
{
printf_filtered ("Dump of assembler code ");
if (name != NULL)
Disassemble blocks with non-contiguous ranges This patch adds support for disassembly of blocks with non-contiguous ranges. These blocks are printed as follows: (gdb) disassemble foo Dump of assembler code for function foo: Address range 0x401136 to 0x401151: 0x0000000000401136 <+0>: push %rbp 0x0000000000401137 <+1>: mov %rsp,%rbp 0x000000000040113a <+4>: callq 0x401134 <bar> 0x000000000040113f <+9>: mov 0x2eef(%rip),%eax # 0x404034 <e> 0x0000000000401145 <+15>: test %eax,%eax 0x0000000000401147 <+17>: je 0x40114e <foo+24> 0x0000000000401149 <+19>: callq 0x401128 <foo+4294967282> 0x000000000040114e <+24>: nop 0x000000000040114f <+25>: pop %rbp 0x0000000000401150 <+26>: retq Address range 0x401128 to 0x401134: 0x0000000000401128 <+-14>: push %rbp 0x0000000000401129 <+-13>: mov %rsp,%rbp 0x000000000040112c <+-10>: callq 0x401126 <baz> 0x0000000000401131 <+-5>: nop 0x0000000000401132 <+-4>: pop %rbp 0x0000000000401133 <+-3>: retq End of assembler dump. This is an actual dump from the test case that I constructed for this work. The ranges are printed in the order encountered in the debug info. For the above example, note that the second range occupies lower addresses than the first range. Functions with contiguous ranges are still printed as follows: (gdb) disassemble main Dump of assembler code for function main: 0x0000000000401151 <+0>: push %rbp 0x0000000000401152 <+1>: mov %rsp,%rbp 0x0000000000401155 <+4>: callq 0x401136 <foo> 0x000000000040115a <+9>: mov $0x0,%eax 0x000000000040115f <+14>: pop %rbp 0x0000000000401160 <+15>: retq End of assembler dump. gdb/ChangeLog: * cli/cli-cmds.c (block.h): Include. (print_disassembly): Handle printing of non-contiguous blocks. (disassemble_current_function): Likewise. (disassemble_command): Likewise.
2018-08-24 01:00:49 +02:00
printf_filtered ("for function %s:\n", name);
if (block == nullptr || BLOCK_CONTIGUOUS_P (block))
{
if (name == NULL)
printf_filtered ("from %s to %s:\n",
paddress (gdbarch, low), paddress (gdbarch, high));
Disassemble blocks with non-contiguous ranges This patch adds support for disassembly of blocks with non-contiguous ranges. These blocks are printed as follows: (gdb) disassemble foo Dump of assembler code for function foo: Address range 0x401136 to 0x401151: 0x0000000000401136 <+0>: push %rbp 0x0000000000401137 <+1>: mov %rsp,%rbp 0x000000000040113a <+4>: callq 0x401134 <bar> 0x000000000040113f <+9>: mov 0x2eef(%rip),%eax # 0x404034 <e> 0x0000000000401145 <+15>: test %eax,%eax 0x0000000000401147 <+17>: je 0x40114e <foo+24> 0x0000000000401149 <+19>: callq 0x401128 <foo+4294967282> 0x000000000040114e <+24>: nop 0x000000000040114f <+25>: pop %rbp 0x0000000000401150 <+26>: retq Address range 0x401128 to 0x401134: 0x0000000000401128 <+-14>: push %rbp 0x0000000000401129 <+-13>: mov %rsp,%rbp 0x000000000040112c <+-10>: callq 0x401126 <baz> 0x0000000000401131 <+-5>: nop 0x0000000000401132 <+-4>: pop %rbp 0x0000000000401133 <+-3>: retq End of assembler dump. This is an actual dump from the test case that I constructed for this work. The ranges are printed in the order encountered in the debug info. For the above example, note that the second range occupies lower addresses than the first range. Functions with contiguous ranges are still printed as follows: (gdb) disassemble main Dump of assembler code for function main: 0x0000000000401151 <+0>: push %rbp 0x0000000000401152 <+1>: mov %rsp,%rbp 0x0000000000401155 <+4>: callq 0x401136 <foo> 0x000000000040115a <+9>: mov $0x0,%eax 0x000000000040115f <+14>: pop %rbp 0x0000000000401160 <+15>: retq End of assembler dump. gdb/ChangeLog: * cli/cli-cmds.c (block.h): Include. (print_disassembly): Handle printing of non-contiguous blocks. (disassemble_current_function): Likewise. (disassemble_command): Likewise.
2018-08-24 01:00:49 +02:00
/* Dump the specified range. */
gdb_disassembly (gdbarch, current_uiout, flags, -1, low, high);
}
else
{
for (int i = 0; i < BLOCK_NRANGES (block); i++)
{
Simple -Wshadow=local fixes This fixes all the straightforward -Wshadow=local warnings in gdb. A few standard approaches are used here: * Renaming an inner (or outer, but more commonly inner) variable; * Lowering a declaration to avoid a clash; * Moving a declaration into a more inner scope to avoid a clash, including the special case of moving a declaration into a loop header. I did not consider any of the changes in this patch to be particularly noteworthy, though of course they should all still be examined. gdb/ChangeLog 2018-10-04 Tom Tromey <tom@tromey.com> * ctf.c (SET_ARRAY_FIELD): Rename "u32". * p-valprint.c (pascal_val_print): Split inner "i" variable. * xtensa-tdep.c (xtensa_push_dummy_call): Declare "i" in loop header. * xstormy16-tdep.c (xstormy16_push_dummy_call): Declare "val" in more inner scope. * xcoffread.c (read_xcoff_symtab): Rename inner "symbol". * varobj.c (varobj_update): Rename inner "newobj", "type_changed". * valprint.c (generic_emit_char): Rename inner "buf". * valops.c (find_overload_match): Rename inner "temp". (value_struct_elt_for_reference): Declare "v" in more inner scope. * v850-tdep.c (v850_push_dummy_call): Rename "len". * unittests/array-view-selftests.c (run_tests): Rename inner "vec". * tui/tui-stack.c (tui_show_frame_info): Declare "i" in loop header. * tracepoint.c (merge_uploaded_trace_state_variables): Declare "tsv" in more inner scope. (print_one_static_tracepoint_marker): Rename inner "tuple_emitter". * tic6x-tdep.c (tic6x_analyze_prologue): Declare "inst" lower. (tic6x_push_dummy_call): Don't redeclare "addr". * target-float.c: Declare "dto" lower. * symtab.c (lookup_local_symbol): Rename inner "sym". (find_pc_sect_line): Rename inner "pc". * stack.c (print_frame): Don't redeclare "gdbarch". (return_command): Rename inner "gdbarch". * s390-tdep.c (s390_prologue_frame_unwind_cache): Renam inner "sp". * rust-lang.c (rust_internal_print_type): Declare "i" in loop header. * rs6000-tdep.c (ppc_process_record): Rename inner "addr". * riscv-tdep.c (riscv_push_dummy_call): Declare "info" in inner scope. * remote.c (remote_target::update_thread_list): Don't redeclare "tp". (remote_target::process_initial_stop_replies): Rename inner "thread". (remote_target::remote_parse_stop_reply): Don't redeclare "p". (remote_target::wait_as): Don't redeclare "stop_reply". (remote_target::get_thread_local_address): Rename inner "result". (remote_target::get_tib_address): Likewise.
2018-04-22 00:16:27 +02:00
CORE_ADDR range_low = BLOCK_RANGE_START (block, i);
CORE_ADDR range_high = BLOCK_RANGE_END (block, i);
Disassemble blocks with non-contiguous ranges This patch adds support for disassembly of blocks with non-contiguous ranges. These blocks are printed as follows: (gdb) disassemble foo Dump of assembler code for function foo: Address range 0x401136 to 0x401151: 0x0000000000401136 <+0>: push %rbp 0x0000000000401137 <+1>: mov %rsp,%rbp 0x000000000040113a <+4>: callq 0x401134 <bar> 0x000000000040113f <+9>: mov 0x2eef(%rip),%eax # 0x404034 <e> 0x0000000000401145 <+15>: test %eax,%eax 0x0000000000401147 <+17>: je 0x40114e <foo+24> 0x0000000000401149 <+19>: callq 0x401128 <foo+4294967282> 0x000000000040114e <+24>: nop 0x000000000040114f <+25>: pop %rbp 0x0000000000401150 <+26>: retq Address range 0x401128 to 0x401134: 0x0000000000401128 <+-14>: push %rbp 0x0000000000401129 <+-13>: mov %rsp,%rbp 0x000000000040112c <+-10>: callq 0x401126 <baz> 0x0000000000401131 <+-5>: nop 0x0000000000401132 <+-4>: pop %rbp 0x0000000000401133 <+-3>: retq End of assembler dump. This is an actual dump from the test case that I constructed for this work. The ranges are printed in the order encountered in the debug info. For the above example, note that the second range occupies lower addresses than the first range. Functions with contiguous ranges are still printed as follows: (gdb) disassemble main Dump of assembler code for function main: 0x0000000000401151 <+0>: push %rbp 0x0000000000401152 <+1>: mov %rsp,%rbp 0x0000000000401155 <+4>: callq 0x401136 <foo> 0x000000000040115a <+9>: mov $0x0,%eax 0x000000000040115f <+14>: pop %rbp 0x0000000000401160 <+15>: retq End of assembler dump. gdb/ChangeLog: * cli/cli-cmds.c (block.h): Include. (print_disassembly): Handle printing of non-contiguous blocks. (disassemble_current_function): Likewise. (disassemble_command): Likewise.
2018-08-24 01:00:49 +02:00
printf_filtered (_("Address range %s to %s:\n"),
Simple -Wshadow=local fixes This fixes all the straightforward -Wshadow=local warnings in gdb. A few standard approaches are used here: * Renaming an inner (or outer, but more commonly inner) variable; * Lowering a declaration to avoid a clash; * Moving a declaration into a more inner scope to avoid a clash, including the special case of moving a declaration into a loop header. I did not consider any of the changes in this patch to be particularly noteworthy, though of course they should all still be examined. gdb/ChangeLog 2018-10-04 Tom Tromey <tom@tromey.com> * ctf.c (SET_ARRAY_FIELD): Rename "u32". * p-valprint.c (pascal_val_print): Split inner "i" variable. * xtensa-tdep.c (xtensa_push_dummy_call): Declare "i" in loop header. * xstormy16-tdep.c (xstormy16_push_dummy_call): Declare "val" in more inner scope. * xcoffread.c (read_xcoff_symtab): Rename inner "symbol". * varobj.c (varobj_update): Rename inner "newobj", "type_changed". * valprint.c (generic_emit_char): Rename inner "buf". * valops.c (find_overload_match): Rename inner "temp". (value_struct_elt_for_reference): Declare "v" in more inner scope. * v850-tdep.c (v850_push_dummy_call): Rename "len". * unittests/array-view-selftests.c (run_tests): Rename inner "vec". * tui/tui-stack.c (tui_show_frame_info): Declare "i" in loop header. * tracepoint.c (merge_uploaded_trace_state_variables): Declare "tsv" in more inner scope. (print_one_static_tracepoint_marker): Rename inner "tuple_emitter". * tic6x-tdep.c (tic6x_analyze_prologue): Declare "inst" lower. (tic6x_push_dummy_call): Don't redeclare "addr". * target-float.c: Declare "dto" lower. * symtab.c (lookup_local_symbol): Rename inner "sym". (find_pc_sect_line): Rename inner "pc". * stack.c (print_frame): Don't redeclare "gdbarch". (return_command): Rename inner "gdbarch". * s390-tdep.c (s390_prologue_frame_unwind_cache): Renam inner "sp". * rust-lang.c (rust_internal_print_type): Declare "i" in loop header. * rs6000-tdep.c (ppc_process_record): Rename inner "addr". * riscv-tdep.c (riscv_push_dummy_call): Declare "info" in inner scope. * remote.c (remote_target::update_thread_list): Don't redeclare "tp". (remote_target::process_initial_stop_replies): Rename inner "thread". (remote_target::remote_parse_stop_reply): Don't redeclare "p". (remote_target::wait_as): Don't redeclare "stop_reply". (remote_target::get_thread_local_address): Rename inner "result". (remote_target::get_tib_address): Likewise.
2018-04-22 00:16:27 +02:00
paddress (gdbarch, range_low),
paddress (gdbarch, range_high));
gdb_disassembly (gdbarch, current_uiout, flags, -1,
range_low, range_high);
Disassemble blocks with non-contiguous ranges This patch adds support for disassembly of blocks with non-contiguous ranges. These blocks are printed as follows: (gdb) disassemble foo Dump of assembler code for function foo: Address range 0x401136 to 0x401151: 0x0000000000401136 <+0>: push %rbp 0x0000000000401137 <+1>: mov %rsp,%rbp 0x000000000040113a <+4>: callq 0x401134 <bar> 0x000000000040113f <+9>: mov 0x2eef(%rip),%eax # 0x404034 <e> 0x0000000000401145 <+15>: test %eax,%eax 0x0000000000401147 <+17>: je 0x40114e <foo+24> 0x0000000000401149 <+19>: callq 0x401128 <foo+4294967282> 0x000000000040114e <+24>: nop 0x000000000040114f <+25>: pop %rbp 0x0000000000401150 <+26>: retq Address range 0x401128 to 0x401134: 0x0000000000401128 <+-14>: push %rbp 0x0000000000401129 <+-13>: mov %rsp,%rbp 0x000000000040112c <+-10>: callq 0x401126 <baz> 0x0000000000401131 <+-5>: nop 0x0000000000401132 <+-4>: pop %rbp 0x0000000000401133 <+-3>: retq End of assembler dump. This is an actual dump from the test case that I constructed for this work. The ranges are printed in the order encountered in the debug info. For the above example, note that the second range occupies lower addresses than the first range. Functions with contiguous ranges are still printed as follows: (gdb) disassemble main Dump of assembler code for function main: 0x0000000000401151 <+0>: push %rbp 0x0000000000401152 <+1>: mov %rsp,%rbp 0x0000000000401155 <+4>: callq 0x401136 <foo> 0x000000000040115a <+9>: mov $0x0,%eax 0x000000000040115f <+14>: pop %rbp 0x0000000000401160 <+15>: retq End of assembler dump. gdb/ChangeLog: * cli/cli-cmds.c (block.h): Include. (print_disassembly): Handle printing of non-contiguous blocks. (disassemble_current_function): Likewise. (disassemble_command): Likewise.
2018-08-24 01:00:49 +02:00
}
}
printf_filtered ("End of assembler dump.\n");
}
}
/* Subroutine of disassemble_command to simplify it.
Print a disassembly of the current function according to FLAGS. */
static void
Introduce gdb_disassembly_flags For some reason I ended up staring at some of the "int flags" in btrace-related code, and I got confused because I had no clue what the flags where supposed to indicate. Fix that by using enum_flags, so that: #1 - it's clear from the type what the flags are about, and #2 - the compiler can catch mismatching mistakes gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (print_disassembly, disassemble_current_function) (disassemble_command): Use gdb_disassembly_flags instead of bare int. * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn) (dump_insns, do_mixed_source_and_assembly_deprecated) (do_mixed_source_and_assembly, do_assembly_only, gdb_disassembly): Use gdb_disassembly_flags instead of bare int. * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED, DISASSEMBLY_RAW_INSN) (DISASSEMBLY_OMIT_FNAME, DISASSEMBLY_FILENAME) (DISASSEMBLY_OMIT_PC, DISASSEMBLY_SOURCE) (DISASSEMBLY_SPECULATIVE): No longer macros. Instead they're... (enum gdb_disassembly_flag): ... values of this new enumeration. (gdb_disassembly_flags): Define. (gdb_disassembly) (gdb_pretty_print_disassembler::pretty_print_insn): Use it. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Use gdb_disassembly_flags instead of bare int. * record-btrace.c (btrace_insn_history) (record_btrace_insn_history, record_btrace_insn_history_range) (record_btrace_insn_history_from): Use gdb_disassembly_flags instead of bare int. * record.c (get_insn_history_modifiers, cmd_record_insn_history): Use gdb_disassembly_flags instead of bare int. * target-debug.h (target_debug_print_gdb_disassembly_flags): Define. * target-delegates.c: Regenerate. * target.c (target_insn_history, target_insn_history_from) (target_insn_history_range): Use gdb_disassembly_flags instead of bare int. * target.h: Include "disasm.h". (struct target_ops) <to_insn_history, to_insn_history_from, to_insn_history_range>: Use gdb_disassembly_flags instead of bare int. (target_insn_history, target_insn_history_from) (target_insn_history_range): Use gdb_disassembly_flags instead of bare int.
2017-09-04 19:23:22 +02:00
disassemble_current_function (gdb_disassembly_flags flags)
{
* disasm.h (gdb_disassembly): Add GDBARCH parameter. (gdb_print_insn): Likewise. * disasm.c (dump_insns): Add GDBARCH parameter. Use it instead of current_gdbarch. (do_mixed_source_and_assembly): Add GDBARCH parameter. Pass to dump_insns. (do_assembly_only): Likewise. (gdb_disassembly): Add GDBARCH parameter. Use it instead of current_gdbarch. Pass to subroutines. (gdb_print_insn): Add GDBARCH parameter. Use it instead of current_gdbarch. * stack.c (struct gdb_disassembly_stub_args): Add GDBARCH member. (gdb_disassembly_stub): Pass architecture to gdb_disassembly. (do_gdb_disassembly): Add GDBARCH argument. Store into args. (print_frame_info): Pass architecture to do_gdb_disassembly. * printcmd.c (print_formatted): Pass architecture to gdb_print_insn. * mi/mi-cmd-disas.c: Include "arch-utils.h" (mi_cmd_disassemble): Pass architecture to gdb_disassembly. * cli/cli-cmds.c: Include "arch-utils.h". (print_disassembly): Add GDBARCH parameter. Pass to gdb_disassembly and tui_show_assembly. (disassemble_current_function): Pass architecture to tui_get_low_disassembly_address and print_disassembly. (disassemble_command): Pass architecture to tui_get_low_disassembly_address and print_disassembly. * tui/tui.c (tui_show_assembly): Add GDBARCH parameter. Pass to tui_update_source_windows_with_addr. * tui/tui-data.h (struct tui_locator_element): Add GDBARCH member. (struct tui_source_info): Likewise. * tui/tui-data.c (tui_clear_win_detail): Clear source_info.gdbarch. * tui/tui-disasm.c (tui_disassemble): Add GDBARCH parameter. Pass to gdb_print_insn. (tui_find_disassembly_address): Add GDBARCH parameter. Pass to tui_disassemble. (tui_set_disassem_content): Add GDBARCH parameter. Install into source_info.gdbarch. Pass to tui_disassemble. (tui_show_disassem): Add GDBARCH parameter. Pass to tui_update_source_window. (tui_show_disassem_and_update_source): Add GDBARCH parameter. Pass to tui_show_disassem and tui_update_source_window. (tui_get_begin_asm_address): Return locator architecture in addition to locator PC value. (tui_get_low_disassembly_address): Add GDBARCH parameter. Pass to tui_get_low_disassembly_address. (tui_vertical_disassem_scroll): Pass architecture to subroutines. * tui/tui-disasm.h (tui_set_disassem_content): Add GDBARCH parameter. (tui_show_disassem): Likewise. (tui_show_disassem_and_update_source): Likewise. (tui_get_begin_asm_address): Return architecture and PC value. * tui/tui.h (tui_get_low_disassembly_address): Add GDBARCH parameter. (tui_show_assembly): Add GDBARCH parameter. * tui/tui-layout.c (extract_display_start_addr): Return current window architecture in addition to current PC value. (tui_set_layout): Update calls to tui_get_low_disassembly_address and extract_display_start_addr. Pass architecture to tui_update_source_windows_with_addr. * tui/tui-source.c: Include "objfiles.h". (tui_set_source_content): Initialize window architecture. (tui_show_symtab_source): Add GDBARCH parameter. Pass to tui_update_source_window_as_is * tui/tui-source.h (tui_show_symtab_source): Add GDBARCH parameter. * tui/tui-stack.c (tui_set_locator_info): Add GDBARCH parameter. Install locator architecture. (tui_set_locator_filename): Update call. (tui_show_frame_info): Pass architecture to tui_set_locator_info and subroutines. * tui/tui-win.c (make_visible_with_new_height): Pass architecture to tui_update_source_window. * tui/tui-winsource.c: Include "objfiles.h". (tui_display_main): Update call to tui_get_begin_asm_address. Pass architecture to tui_update_source_windows_with_addr. (tui_update_source_window): Add GDBARCH parameter. Pass to tui_update_source_window_as_is. (tui_update_source_window_as_is): Add GDBARCH parameter. Pass to tui_set_disassem_content. (tui_update_source_windows_with_addr): Add GDBARCH parameter. Pass to subroutines. (tui_update_source_windows_with_line): Pass objfile architecture to subroutines. (tui_horizontal_source_scroll): Pass architecture to tui_update_source_window_as_is. * tui/tui-winsource.h (tui_update_source_window): Add GDBARCH parameter. (tui_update_source_window_as_is): Likewise. (tui_update_source_windows_with_addr): Likewise.
2009-07-02 19:17:42 +02:00
struct frame_info *frame;
struct gdbarch *gdbarch;
CORE_ADDR low, high, pc;
* blockframe.c (find_pc_partial_function_gnu_ifunc): Change type of "name" parameter to const char ** from char **. All callers updated. (find_pc_partial_function): Ditto. (cache_pc_function_name): Change type to const char * from char *. * symtab.h ((find_pc_partial_function_gnu_ifunc): Update. (find_pc_partial_function): Update. * alpha-tdep.h (struct gdbarch_tdep, member pc_in_sigtramp): Change type of "name" parameter to const char * from char *. All uses updated. * arch-utils.c (generic_in_solib_return_trampoline): Change type of "name" parameter to const char * from char *. * arch-utils.h (generic_in_solib_return_trampoline): Update. * frv-linux-tdep.c (frv_linux_pc_in_sigtramp): Change type of "name" parameter to const char * from char *. * gdbarch.sh (in_solib_return_trampoline): Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * hppa-hpux-tdep.c (hppa_hpux_in_solib_return_trampoline): Update. * rs6000-tdep.c (rs6000_in_solib_return_trampoline): Update. * m32r-linux-tdep.c (m32r_linux_pc_in_sigtramp): Change type of "name" parameter to const char * from char *. * skip.c (skip_function_pc): Ditto. * sparc-sol2-tdep.c (sparc_sol2_pc_in_sigtramp): Ditto. * sparc-tdep.h (sparc_sol2_pc_in_sigtramp): Update. * sparc64fbsd-tdep.c (sparc64fbsd_pc_in_sigtramp): Ditto. * sparc64nbsd-tdep.c (sparc64nbsd_pc_in_sigtramp): Ditto. * sparc64obsd-tdep.c (sparc64obsd_pc_in_sigtramp): Ditto. * sparcnbsd-tdep.c (sparc32nbsd_pc_in_sigtramp): Ditto. * sparcobsd-tdep.c (sparc32obsd_pc_in_sigtramp): Ditto. * nbsd-tdep.c (nbsd_pc_in_sigtramp): Similary for "func_name". * nbsd-tdep.h (nbsd_pc_in_sigtramp): Update.
2012-02-02 21:19:17 +01:00
const char *name;
Disassemble blocks with non-contiguous ranges This patch adds support for disassembly of blocks with non-contiguous ranges. These blocks are printed as follows: (gdb) disassemble foo Dump of assembler code for function foo: Address range 0x401136 to 0x401151: 0x0000000000401136 <+0>: push %rbp 0x0000000000401137 <+1>: mov %rsp,%rbp 0x000000000040113a <+4>: callq 0x401134 <bar> 0x000000000040113f <+9>: mov 0x2eef(%rip),%eax # 0x404034 <e> 0x0000000000401145 <+15>: test %eax,%eax 0x0000000000401147 <+17>: je 0x40114e <foo+24> 0x0000000000401149 <+19>: callq 0x401128 <foo+4294967282> 0x000000000040114e <+24>: nop 0x000000000040114f <+25>: pop %rbp 0x0000000000401150 <+26>: retq Address range 0x401128 to 0x401134: 0x0000000000401128 <+-14>: push %rbp 0x0000000000401129 <+-13>: mov %rsp,%rbp 0x000000000040112c <+-10>: callq 0x401126 <baz> 0x0000000000401131 <+-5>: nop 0x0000000000401132 <+-4>: pop %rbp 0x0000000000401133 <+-3>: retq End of assembler dump. This is an actual dump from the test case that I constructed for this work. The ranges are printed in the order encountered in the debug info. For the above example, note that the second range occupies lower addresses than the first range. Functions with contiguous ranges are still printed as follows: (gdb) disassemble main Dump of assembler code for function main: 0x0000000000401151 <+0>: push %rbp 0x0000000000401152 <+1>: mov %rsp,%rbp 0x0000000000401155 <+4>: callq 0x401136 <foo> 0x000000000040115a <+9>: mov $0x0,%eax 0x000000000040115f <+14>: pop %rbp 0x0000000000401160 <+15>: retq End of assembler dump. gdb/ChangeLog: * cli/cli-cmds.c (block.h): Include. (print_disassembly): Handle printing of non-contiguous blocks. (disassemble_current_function): Likewise. (disassemble_command): Likewise.
2018-08-24 01:00:49 +02:00
const struct block *block;
* disasm.h (gdb_disassembly): Add GDBARCH parameter. (gdb_print_insn): Likewise. * disasm.c (dump_insns): Add GDBARCH parameter. Use it instead of current_gdbarch. (do_mixed_source_and_assembly): Add GDBARCH parameter. Pass to dump_insns. (do_assembly_only): Likewise. (gdb_disassembly): Add GDBARCH parameter. Use it instead of current_gdbarch. Pass to subroutines. (gdb_print_insn): Add GDBARCH parameter. Use it instead of current_gdbarch. * stack.c (struct gdb_disassembly_stub_args): Add GDBARCH member. (gdb_disassembly_stub): Pass architecture to gdb_disassembly. (do_gdb_disassembly): Add GDBARCH argument. Store into args. (print_frame_info): Pass architecture to do_gdb_disassembly. * printcmd.c (print_formatted): Pass architecture to gdb_print_insn. * mi/mi-cmd-disas.c: Include "arch-utils.h" (mi_cmd_disassemble): Pass architecture to gdb_disassembly. * cli/cli-cmds.c: Include "arch-utils.h". (print_disassembly): Add GDBARCH parameter. Pass to gdb_disassembly and tui_show_assembly. (disassemble_current_function): Pass architecture to tui_get_low_disassembly_address and print_disassembly. (disassemble_command): Pass architecture to tui_get_low_disassembly_address and print_disassembly. * tui/tui.c (tui_show_assembly): Add GDBARCH parameter. Pass to tui_update_source_windows_with_addr. * tui/tui-data.h (struct tui_locator_element): Add GDBARCH member. (struct tui_source_info): Likewise. * tui/tui-data.c (tui_clear_win_detail): Clear source_info.gdbarch. * tui/tui-disasm.c (tui_disassemble): Add GDBARCH parameter. Pass to gdb_print_insn. (tui_find_disassembly_address): Add GDBARCH parameter. Pass to tui_disassemble. (tui_set_disassem_content): Add GDBARCH parameter. Install into source_info.gdbarch. Pass to tui_disassemble. (tui_show_disassem): Add GDBARCH parameter. Pass to tui_update_source_window. (tui_show_disassem_and_update_source): Add GDBARCH parameter. Pass to tui_show_disassem and tui_update_source_window. (tui_get_begin_asm_address): Return locator architecture in addition to locator PC value. (tui_get_low_disassembly_address): Add GDBARCH parameter. Pass to tui_get_low_disassembly_address. (tui_vertical_disassem_scroll): Pass architecture to subroutines. * tui/tui-disasm.h (tui_set_disassem_content): Add GDBARCH parameter. (tui_show_disassem): Likewise. (tui_show_disassem_and_update_source): Likewise. (tui_get_begin_asm_address): Return architecture and PC value. * tui/tui.h (tui_get_low_disassembly_address): Add GDBARCH parameter. (tui_show_assembly): Add GDBARCH parameter. * tui/tui-layout.c (extract_display_start_addr): Return current window architecture in addition to current PC value. (tui_set_layout): Update calls to tui_get_low_disassembly_address and extract_display_start_addr. Pass architecture to tui_update_source_windows_with_addr. * tui/tui-source.c: Include "objfiles.h". (tui_set_source_content): Initialize window architecture. (tui_show_symtab_source): Add GDBARCH parameter. Pass to tui_update_source_window_as_is * tui/tui-source.h (tui_show_symtab_source): Add GDBARCH parameter. * tui/tui-stack.c (tui_set_locator_info): Add GDBARCH parameter. Install locator architecture. (tui_set_locator_filename): Update call. (tui_show_frame_info): Pass architecture to tui_set_locator_info and subroutines. * tui/tui-win.c (make_visible_with_new_height): Pass architecture to tui_update_source_window. * tui/tui-winsource.c: Include "objfiles.h". (tui_display_main): Update call to tui_get_begin_asm_address. Pass architecture to tui_update_source_windows_with_addr. (tui_update_source_window): Add GDBARCH parameter. Pass to tui_update_source_window_as_is. (tui_update_source_window_as_is): Add GDBARCH parameter. Pass to tui_set_disassem_content. (tui_update_source_windows_with_addr): Add GDBARCH parameter. Pass to subroutines. (tui_update_source_windows_with_line): Pass objfile architecture to subroutines. (tui_horizontal_source_scroll): Pass architecture to tui_update_source_window_as_is. * tui/tui-winsource.h (tui_update_source_window): Add GDBARCH parameter. (tui_update_source_window_as_is): Likewise. (tui_update_source_windows_with_addr): Likewise.
2009-07-02 19:17:42 +02:00
frame = get_selected_frame (_("No frame selected."));
gdbarch = get_frame_arch (frame);
pc = get_frame_address_in_block (frame);
Disassemble blocks with non-contiguous ranges This patch adds support for disassembly of blocks with non-contiguous ranges. These blocks are printed as follows: (gdb) disassemble foo Dump of assembler code for function foo: Address range 0x401136 to 0x401151: 0x0000000000401136 <+0>: push %rbp 0x0000000000401137 <+1>: mov %rsp,%rbp 0x000000000040113a <+4>: callq 0x401134 <bar> 0x000000000040113f <+9>: mov 0x2eef(%rip),%eax # 0x404034 <e> 0x0000000000401145 <+15>: test %eax,%eax 0x0000000000401147 <+17>: je 0x40114e <foo+24> 0x0000000000401149 <+19>: callq 0x401128 <foo+4294967282> 0x000000000040114e <+24>: nop 0x000000000040114f <+25>: pop %rbp 0x0000000000401150 <+26>: retq Address range 0x401128 to 0x401134: 0x0000000000401128 <+-14>: push %rbp 0x0000000000401129 <+-13>: mov %rsp,%rbp 0x000000000040112c <+-10>: callq 0x401126 <baz> 0x0000000000401131 <+-5>: nop 0x0000000000401132 <+-4>: pop %rbp 0x0000000000401133 <+-3>: retq End of assembler dump. This is an actual dump from the test case that I constructed for this work. The ranges are printed in the order encountered in the debug info. For the above example, note that the second range occupies lower addresses than the first range. Functions with contiguous ranges are still printed as follows: (gdb) disassemble main Dump of assembler code for function main: 0x0000000000401151 <+0>: push %rbp 0x0000000000401152 <+1>: mov %rsp,%rbp 0x0000000000401155 <+4>: callq 0x401136 <foo> 0x000000000040115a <+9>: mov $0x0,%eax 0x000000000040115f <+14>: pop %rbp 0x0000000000401160 <+15>: retq End of assembler dump. gdb/ChangeLog: * cli/cli-cmds.c (block.h): Include. (print_disassembly): Handle printing of non-contiguous blocks. (disassemble_current_function): Likewise. (disassemble_command): Likewise.
2018-08-24 01:00:49 +02:00
if (find_pc_partial_function (pc, &name, &low, &high, &block) == 0)
error (_("No function contains program counter for selected frame."));
#if defined(TUI)
/* NOTE: cagney/2003-02-13 The `tui_active' was previously
`tui_version'. */
if (tui_active)
/* FIXME: cagney/2004-02-07: This should be an observer. */
* disasm.h (gdb_disassembly): Add GDBARCH parameter. (gdb_print_insn): Likewise. * disasm.c (dump_insns): Add GDBARCH parameter. Use it instead of current_gdbarch. (do_mixed_source_and_assembly): Add GDBARCH parameter. Pass to dump_insns. (do_assembly_only): Likewise. (gdb_disassembly): Add GDBARCH parameter. Use it instead of current_gdbarch. Pass to subroutines. (gdb_print_insn): Add GDBARCH parameter. Use it instead of current_gdbarch. * stack.c (struct gdb_disassembly_stub_args): Add GDBARCH member. (gdb_disassembly_stub): Pass architecture to gdb_disassembly. (do_gdb_disassembly): Add GDBARCH argument. Store into args. (print_frame_info): Pass architecture to do_gdb_disassembly. * printcmd.c (print_formatted): Pass architecture to gdb_print_insn. * mi/mi-cmd-disas.c: Include "arch-utils.h" (mi_cmd_disassemble): Pass architecture to gdb_disassembly. * cli/cli-cmds.c: Include "arch-utils.h". (print_disassembly): Add GDBARCH parameter. Pass to gdb_disassembly and tui_show_assembly. (disassemble_current_function): Pass architecture to tui_get_low_disassembly_address and print_disassembly. (disassemble_command): Pass architecture to tui_get_low_disassembly_address and print_disassembly. * tui/tui.c (tui_show_assembly): Add GDBARCH parameter. Pass to tui_update_source_windows_with_addr. * tui/tui-data.h (struct tui_locator_element): Add GDBARCH member. (struct tui_source_info): Likewise. * tui/tui-data.c (tui_clear_win_detail): Clear source_info.gdbarch. * tui/tui-disasm.c (tui_disassemble): Add GDBARCH parameter. Pass to gdb_print_insn. (tui_find_disassembly_address): Add GDBARCH parameter. Pass to tui_disassemble. (tui_set_disassem_content): Add GDBARCH parameter. Install into source_info.gdbarch. Pass to tui_disassemble. (tui_show_disassem): Add GDBARCH parameter. Pass to tui_update_source_window. (tui_show_disassem_and_update_source): Add GDBARCH parameter. Pass to tui_show_disassem and tui_update_source_window. (tui_get_begin_asm_address): Return locator architecture in addition to locator PC value. (tui_get_low_disassembly_address): Add GDBARCH parameter. Pass to tui_get_low_disassembly_address. (tui_vertical_disassem_scroll): Pass architecture to subroutines. * tui/tui-disasm.h (tui_set_disassem_content): Add GDBARCH parameter. (tui_show_disassem): Likewise. (tui_show_disassem_and_update_source): Likewise. (tui_get_begin_asm_address): Return architecture and PC value. * tui/tui.h (tui_get_low_disassembly_address): Add GDBARCH parameter. (tui_show_assembly): Add GDBARCH parameter. * tui/tui-layout.c (extract_display_start_addr): Return current window architecture in addition to current PC value. (tui_set_layout): Update calls to tui_get_low_disassembly_address and extract_display_start_addr. Pass architecture to tui_update_source_windows_with_addr. * tui/tui-source.c: Include "objfiles.h". (tui_set_source_content): Initialize window architecture. (tui_show_symtab_source): Add GDBARCH parameter. Pass to tui_update_source_window_as_is * tui/tui-source.h (tui_show_symtab_source): Add GDBARCH parameter. * tui/tui-stack.c (tui_set_locator_info): Add GDBARCH parameter. Install locator architecture. (tui_set_locator_filename): Update call. (tui_show_frame_info): Pass architecture to tui_set_locator_info and subroutines. * tui/tui-win.c (make_visible_with_new_height): Pass architecture to tui_update_source_window. * tui/tui-winsource.c: Include "objfiles.h". (tui_display_main): Update call to tui_get_begin_asm_address. Pass architecture to tui_update_source_windows_with_addr. (tui_update_source_window): Add GDBARCH parameter. Pass to tui_update_source_window_as_is. (tui_update_source_window_as_is): Add GDBARCH parameter. Pass to tui_set_disassem_content. (tui_update_source_windows_with_addr): Add GDBARCH parameter. Pass to subroutines. (tui_update_source_windows_with_line): Pass objfile architecture to subroutines. (tui_horizontal_source_scroll): Pass architecture to tui_update_source_window_as_is. * tui/tui-winsource.h (tui_update_source_window): Add GDBARCH parameter. (tui_update_source_window_as_is): Likewise. (tui_update_source_windows_with_addr): Likewise.
2009-07-02 19:17:42 +02:00
low = tui_get_low_disassembly_address (gdbarch, low, pc);
#endif
* disasm.h (gdb_disassembly): Add GDBARCH parameter. (gdb_print_insn): Likewise. * disasm.c (dump_insns): Add GDBARCH parameter. Use it instead of current_gdbarch. (do_mixed_source_and_assembly): Add GDBARCH parameter. Pass to dump_insns. (do_assembly_only): Likewise. (gdb_disassembly): Add GDBARCH parameter. Use it instead of current_gdbarch. Pass to subroutines. (gdb_print_insn): Add GDBARCH parameter. Use it instead of current_gdbarch. * stack.c (struct gdb_disassembly_stub_args): Add GDBARCH member. (gdb_disassembly_stub): Pass architecture to gdb_disassembly. (do_gdb_disassembly): Add GDBARCH argument. Store into args. (print_frame_info): Pass architecture to do_gdb_disassembly. * printcmd.c (print_formatted): Pass architecture to gdb_print_insn. * mi/mi-cmd-disas.c: Include "arch-utils.h" (mi_cmd_disassemble): Pass architecture to gdb_disassembly. * cli/cli-cmds.c: Include "arch-utils.h". (print_disassembly): Add GDBARCH parameter. Pass to gdb_disassembly and tui_show_assembly. (disassemble_current_function): Pass architecture to tui_get_low_disassembly_address and print_disassembly. (disassemble_command): Pass architecture to tui_get_low_disassembly_address and print_disassembly. * tui/tui.c (tui_show_assembly): Add GDBARCH parameter. Pass to tui_update_source_windows_with_addr. * tui/tui-data.h (struct tui_locator_element): Add GDBARCH member. (struct tui_source_info): Likewise. * tui/tui-data.c (tui_clear_win_detail): Clear source_info.gdbarch. * tui/tui-disasm.c (tui_disassemble): Add GDBARCH parameter. Pass to gdb_print_insn. (tui_find_disassembly_address): Add GDBARCH parameter. Pass to tui_disassemble. (tui_set_disassem_content): Add GDBARCH parameter. Install into source_info.gdbarch. Pass to tui_disassemble. (tui_show_disassem): Add GDBARCH parameter. Pass to tui_update_source_window. (tui_show_disassem_and_update_source): Add GDBARCH parameter. Pass to tui_show_disassem and tui_update_source_window. (tui_get_begin_asm_address): Return locator architecture in addition to locator PC value. (tui_get_low_disassembly_address): Add GDBARCH parameter. Pass to tui_get_low_disassembly_address. (tui_vertical_disassem_scroll): Pass architecture to subroutines. * tui/tui-disasm.h (tui_set_disassem_content): Add GDBARCH parameter. (tui_show_disassem): Likewise. (tui_show_disassem_and_update_source): Likewise. (tui_get_begin_asm_address): Return architecture and PC value. * tui/tui.h (tui_get_low_disassembly_address): Add GDBARCH parameter. (tui_show_assembly): Add GDBARCH parameter. * tui/tui-layout.c (extract_display_start_addr): Return current window architecture in addition to current PC value. (tui_set_layout): Update calls to tui_get_low_disassembly_address and extract_display_start_addr. Pass architecture to tui_update_source_windows_with_addr. * tui/tui-source.c: Include "objfiles.h". (tui_set_source_content): Initialize window architecture. (tui_show_symtab_source): Add GDBARCH parameter. Pass to tui_update_source_window_as_is * tui/tui-source.h (tui_show_symtab_source): Add GDBARCH parameter. * tui/tui-stack.c (tui_set_locator_info): Add GDBARCH parameter. Install locator architecture. (tui_set_locator_filename): Update call. (tui_show_frame_info): Pass architecture to tui_set_locator_info and subroutines. * tui/tui-win.c (make_visible_with_new_height): Pass architecture to tui_update_source_window. * tui/tui-winsource.c: Include "objfiles.h". (tui_display_main): Update call to tui_get_begin_asm_address. Pass architecture to tui_update_source_windows_with_addr. (tui_update_source_window): Add GDBARCH parameter. Pass to tui_update_source_window_as_is. (tui_update_source_window_as_is): Add GDBARCH parameter. Pass to tui_set_disassem_content. (tui_update_source_windows_with_addr): Add GDBARCH parameter. Pass to subroutines. (tui_update_source_windows_with_line): Pass objfile architecture to subroutines. (tui_horizontal_source_scroll): Pass architecture to tui_update_source_window_as_is. * tui/tui-winsource.h (tui_update_source_window): Add GDBARCH parameter. (tui_update_source_window_as_is): Likewise. (tui_update_source_windows_with_addr): Likewise.
2009-07-02 19:17:42 +02:00
low += gdbarch_deprecated_function_start_offset (gdbarch);
Disassemble blocks with non-contiguous ranges This patch adds support for disassembly of blocks with non-contiguous ranges. These blocks are printed as follows: (gdb) disassemble foo Dump of assembler code for function foo: Address range 0x401136 to 0x401151: 0x0000000000401136 <+0>: push %rbp 0x0000000000401137 <+1>: mov %rsp,%rbp 0x000000000040113a <+4>: callq 0x401134 <bar> 0x000000000040113f <+9>: mov 0x2eef(%rip),%eax # 0x404034 <e> 0x0000000000401145 <+15>: test %eax,%eax 0x0000000000401147 <+17>: je 0x40114e <foo+24> 0x0000000000401149 <+19>: callq 0x401128 <foo+4294967282> 0x000000000040114e <+24>: nop 0x000000000040114f <+25>: pop %rbp 0x0000000000401150 <+26>: retq Address range 0x401128 to 0x401134: 0x0000000000401128 <+-14>: push %rbp 0x0000000000401129 <+-13>: mov %rsp,%rbp 0x000000000040112c <+-10>: callq 0x401126 <baz> 0x0000000000401131 <+-5>: nop 0x0000000000401132 <+-4>: pop %rbp 0x0000000000401133 <+-3>: retq End of assembler dump. This is an actual dump from the test case that I constructed for this work. The ranges are printed in the order encountered in the debug info. For the above example, note that the second range occupies lower addresses than the first range. Functions with contiguous ranges are still printed as follows: (gdb) disassemble main Dump of assembler code for function main: 0x0000000000401151 <+0>: push %rbp 0x0000000000401152 <+1>: mov %rsp,%rbp 0x0000000000401155 <+4>: callq 0x401136 <foo> 0x000000000040115a <+9>: mov $0x0,%eax 0x000000000040115f <+14>: pop %rbp 0x0000000000401160 <+15>: retq End of assembler dump. gdb/ChangeLog: * cli/cli-cmds.c (block.h): Include. (print_disassembly): Handle printing of non-contiguous blocks. (disassemble_current_function): Likewise. (disassemble_command): Likewise.
2018-08-24 01:00:49 +02:00
print_disassembly (gdbarch, name, low, high, block, flags);
}
/* Dump a specified section of assembly code.
Usage:
New /s modifier for the disassemble command. The "source centric" /m option to the disassemble command is often unhelpful, e.g., in the presence of optimized code. This patch adds a /s modifier that is better. For one, /m only prints instructions from the originating source file, leaving out instructions from e.g., inlined functions from other files. gdb/ChangeLog: PR gdb/11833 * NEWS: Document new /s modifier for the disassemble command. * cli/cli-cmds.c (disassemble_command): Add support for /s. (_initialize_cli_cmds): Update online docs of disassemble command. * disasm.c: #include "source.h". (struct deprecated_dis_line_entry): Renamed from dis_line_entry. All uses updated. (dis_line_entry): New struct. (hash_dis_line_entry, eq_dis_line_entry): New functions. (allocate_dis_line_table): New functions. (maybe_add_dis_line_entry, line_has_code_p): New functions. (dump_insns): New arg end_pc. All callers updated. (do_mixed_source_and_assembly_deprecated): Renamed from do_mixed_source_and_assembly. All callers updated. (do_mixed_source_and_assembly): New function. (gdb_disassembly): Handle /s (DISASSEMBLY_SOURCE). * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED): Renamed from DISASSEMBLY_SOURCE. All uses updated. (DISASSEMBLY_SOURCE): New macro. * mi/mi-cmd-disas.c (mi_cmd_disassemble): New modes 4,5. gdb/doc/ChangeLog: * gdb.texinfo (Machine Code): Update docs for mixed source/assembly disassembly. (GDB/MI Data Manipulation): Update docs for new disassembly modes. gdb/testsuite/ChangeLog: * gdb.mi/mi-disassemble.exp: Update. * gdb.base/disasm-optim.S: New file. * gdb.base/disasm-optim.c: New file. * gdb.base/disasm-optim.h: New file. * gdb.base/disasm-optim.exp: New file.
2015-08-15 06:45:54 +02:00
disassemble [/mrs]
- dump the assembly code for the function of the current pc
New /s modifier for the disassemble command. The "source centric" /m option to the disassemble command is often unhelpful, e.g., in the presence of optimized code. This patch adds a /s modifier that is better. For one, /m only prints instructions from the originating source file, leaving out instructions from e.g., inlined functions from other files. gdb/ChangeLog: PR gdb/11833 * NEWS: Document new /s modifier for the disassemble command. * cli/cli-cmds.c (disassemble_command): Add support for /s. (_initialize_cli_cmds): Update online docs of disassemble command. * disasm.c: #include "source.h". (struct deprecated_dis_line_entry): Renamed from dis_line_entry. All uses updated. (dis_line_entry): New struct. (hash_dis_line_entry, eq_dis_line_entry): New functions. (allocate_dis_line_table): New functions. (maybe_add_dis_line_entry, line_has_code_p): New functions. (dump_insns): New arg end_pc. All callers updated. (do_mixed_source_and_assembly_deprecated): Renamed from do_mixed_source_and_assembly. All callers updated. (do_mixed_source_and_assembly): New function. (gdb_disassembly): Handle /s (DISASSEMBLY_SOURCE). * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED): Renamed from DISASSEMBLY_SOURCE. All uses updated. (DISASSEMBLY_SOURCE): New macro. * mi/mi-cmd-disas.c (mi_cmd_disassemble): New modes 4,5. gdb/doc/ChangeLog: * gdb.texinfo (Machine Code): Update docs for mixed source/assembly disassembly. (GDB/MI Data Manipulation): Update docs for new disassembly modes. gdb/testsuite/ChangeLog: * gdb.mi/mi-disassemble.exp: Update. * gdb.base/disasm-optim.S: New file. * gdb.base/disasm-optim.c: New file. * gdb.base/disasm-optim.h: New file. * gdb.base/disasm-optim.exp: New file.
2015-08-15 06:45:54 +02:00
disassemble [/mrs] addr
- dump the assembly code for the function at ADDR
New /s modifier for the disassemble command. The "source centric" /m option to the disassemble command is often unhelpful, e.g., in the presence of optimized code. This patch adds a /s modifier that is better. For one, /m only prints instructions from the originating source file, leaving out instructions from e.g., inlined functions from other files. gdb/ChangeLog: PR gdb/11833 * NEWS: Document new /s modifier for the disassemble command. * cli/cli-cmds.c (disassemble_command): Add support for /s. (_initialize_cli_cmds): Update online docs of disassemble command. * disasm.c: #include "source.h". (struct deprecated_dis_line_entry): Renamed from dis_line_entry. All uses updated. (dis_line_entry): New struct. (hash_dis_line_entry, eq_dis_line_entry): New functions. (allocate_dis_line_table): New functions. (maybe_add_dis_line_entry, line_has_code_p): New functions. (dump_insns): New arg end_pc. All callers updated. (do_mixed_source_and_assembly_deprecated): Renamed from do_mixed_source_and_assembly. All callers updated. (do_mixed_source_and_assembly): New function. (gdb_disassembly): Handle /s (DISASSEMBLY_SOURCE). * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED): Renamed from DISASSEMBLY_SOURCE. All uses updated. (DISASSEMBLY_SOURCE): New macro. * mi/mi-cmd-disas.c (mi_cmd_disassemble): New modes 4,5. gdb/doc/ChangeLog: * gdb.texinfo (Machine Code): Update docs for mixed source/assembly disassembly. (GDB/MI Data Manipulation): Update docs for new disassembly modes. gdb/testsuite/ChangeLog: * gdb.mi/mi-disassemble.exp: Update. * gdb.base/disasm-optim.S: New file. * gdb.base/disasm-optim.c: New file. * gdb.base/disasm-optim.h: New file. * gdb.base/disasm-optim.exp: New file.
2015-08-15 06:45:54 +02:00
disassemble [/mrs] low,high
disassemble [/mrs] low,+length
- dump the assembly code in the range [LOW,HIGH), or [LOW,LOW+length)
New /s modifier for the disassemble command. The "source centric" /m option to the disassemble command is often unhelpful, e.g., in the presence of optimized code. This patch adds a /s modifier that is better. For one, /m only prints instructions from the originating source file, leaving out instructions from e.g., inlined functions from other files. gdb/ChangeLog: PR gdb/11833 * NEWS: Document new /s modifier for the disassemble command. * cli/cli-cmds.c (disassemble_command): Add support for /s. (_initialize_cli_cmds): Update online docs of disassemble command. * disasm.c: #include "source.h". (struct deprecated_dis_line_entry): Renamed from dis_line_entry. All uses updated. (dis_line_entry): New struct. (hash_dis_line_entry, eq_dis_line_entry): New functions. (allocate_dis_line_table): New functions. (maybe_add_dis_line_entry, line_has_code_p): New functions. (dump_insns): New arg end_pc. All callers updated. (do_mixed_source_and_assembly_deprecated): Renamed from do_mixed_source_and_assembly. All callers updated. (do_mixed_source_and_assembly): New function. (gdb_disassembly): Handle /s (DISASSEMBLY_SOURCE). * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED): Renamed from DISASSEMBLY_SOURCE. All uses updated. (DISASSEMBLY_SOURCE): New macro. * mi/mi-cmd-disas.c (mi_cmd_disassemble): New modes 4,5. gdb/doc/ChangeLog: * gdb.texinfo (Machine Code): Update docs for mixed source/assembly disassembly. (GDB/MI Data Manipulation): Update docs for new disassembly modes. gdb/testsuite/ChangeLog: * gdb.mi/mi-disassemble.exp: Update. * gdb.base/disasm-optim.S: New file. * gdb.base/disasm-optim.c: New file. * gdb.base/disasm-optim.h: New file. * gdb.base/disasm-optim.exp: New file.
2015-08-15 06:45:54 +02:00
A /m modifier will include source code with the assembly in a
"source centric" view. This view lists only the file of the first insn,
even if other source files are involved (e.g., inlined functions), and
the output is in source order, even with optimized code. This view is
considered deprecated as it hasn't been useful in practice.
A /r modifier will include raw instructions in hex with the assembly.
A /s modifier will include source code with the assembly, like /m, with
two important differences:
1) The output is still in pc address order.
2) File names and contents for all relevant source files are displayed. */
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
disassemble_command (const char *arg, int from_tty)
{
* disasm.h (gdb_disassembly): Add GDBARCH parameter. (gdb_print_insn): Likewise. * disasm.c (dump_insns): Add GDBARCH parameter. Use it instead of current_gdbarch. (do_mixed_source_and_assembly): Add GDBARCH parameter. Pass to dump_insns. (do_assembly_only): Likewise. (gdb_disassembly): Add GDBARCH parameter. Use it instead of current_gdbarch. Pass to subroutines. (gdb_print_insn): Add GDBARCH parameter. Use it instead of current_gdbarch. * stack.c (struct gdb_disassembly_stub_args): Add GDBARCH member. (gdb_disassembly_stub): Pass architecture to gdb_disassembly. (do_gdb_disassembly): Add GDBARCH argument. Store into args. (print_frame_info): Pass architecture to do_gdb_disassembly. * printcmd.c (print_formatted): Pass architecture to gdb_print_insn. * mi/mi-cmd-disas.c: Include "arch-utils.h" (mi_cmd_disassemble): Pass architecture to gdb_disassembly. * cli/cli-cmds.c: Include "arch-utils.h". (print_disassembly): Add GDBARCH parameter. Pass to gdb_disassembly and tui_show_assembly. (disassemble_current_function): Pass architecture to tui_get_low_disassembly_address and print_disassembly. (disassemble_command): Pass architecture to tui_get_low_disassembly_address and print_disassembly. * tui/tui.c (tui_show_assembly): Add GDBARCH parameter. Pass to tui_update_source_windows_with_addr. * tui/tui-data.h (struct tui_locator_element): Add GDBARCH member. (struct tui_source_info): Likewise. * tui/tui-data.c (tui_clear_win_detail): Clear source_info.gdbarch. * tui/tui-disasm.c (tui_disassemble): Add GDBARCH parameter. Pass to gdb_print_insn. (tui_find_disassembly_address): Add GDBARCH parameter. Pass to tui_disassemble. (tui_set_disassem_content): Add GDBARCH parameter. Install into source_info.gdbarch. Pass to tui_disassemble. (tui_show_disassem): Add GDBARCH parameter. Pass to tui_update_source_window. (tui_show_disassem_and_update_source): Add GDBARCH parameter. Pass to tui_show_disassem and tui_update_source_window. (tui_get_begin_asm_address): Return locator architecture in addition to locator PC value. (tui_get_low_disassembly_address): Add GDBARCH parameter. Pass to tui_get_low_disassembly_address. (tui_vertical_disassem_scroll): Pass architecture to subroutines. * tui/tui-disasm.h (tui_set_disassem_content): Add GDBARCH parameter. (tui_show_disassem): Likewise. (tui_show_disassem_and_update_source): Likewise. (tui_get_begin_asm_address): Return architecture and PC value. * tui/tui.h (tui_get_low_disassembly_address): Add GDBARCH parameter. (tui_show_assembly): Add GDBARCH parameter. * tui/tui-layout.c (extract_display_start_addr): Return current window architecture in addition to current PC value. (tui_set_layout): Update calls to tui_get_low_disassembly_address and extract_display_start_addr. Pass architecture to tui_update_source_windows_with_addr. * tui/tui-source.c: Include "objfiles.h". (tui_set_source_content): Initialize window architecture. (tui_show_symtab_source): Add GDBARCH parameter. Pass to tui_update_source_window_as_is * tui/tui-source.h (tui_show_symtab_source): Add GDBARCH parameter. * tui/tui-stack.c (tui_set_locator_info): Add GDBARCH parameter. Install locator architecture. (tui_set_locator_filename): Update call. (tui_show_frame_info): Pass architecture to tui_set_locator_info and subroutines. * tui/tui-win.c (make_visible_with_new_height): Pass architecture to tui_update_source_window. * tui/tui-winsource.c: Include "objfiles.h". (tui_display_main): Update call to tui_get_begin_asm_address. Pass architecture to tui_update_source_windows_with_addr. (tui_update_source_window): Add GDBARCH parameter. Pass to tui_update_source_window_as_is. (tui_update_source_window_as_is): Add GDBARCH parameter. Pass to tui_set_disassem_content. (tui_update_source_windows_with_addr): Add GDBARCH parameter. Pass to subroutines. (tui_update_source_windows_with_line): Pass objfile architecture to subroutines. (tui_horizontal_source_scroll): Pass architecture to tui_update_source_window_as_is. * tui/tui-winsource.h (tui_update_source_window): Add GDBARCH parameter. (tui_update_source_window_as_is): Likewise. (tui_update_source_windows_with_addr): Likewise.
2009-07-02 19:17:42 +02:00
struct gdbarch *gdbarch = get_current_arch ();
CORE_ADDR low, high;
* blockframe.c (find_pc_partial_function_gnu_ifunc): Change type of "name" parameter to const char ** from char **. All callers updated. (find_pc_partial_function): Ditto. (cache_pc_function_name): Change type to const char * from char *. * symtab.h ((find_pc_partial_function_gnu_ifunc): Update. (find_pc_partial_function): Update. * alpha-tdep.h (struct gdbarch_tdep, member pc_in_sigtramp): Change type of "name" parameter to const char * from char *. All uses updated. * arch-utils.c (generic_in_solib_return_trampoline): Change type of "name" parameter to const char * from char *. * arch-utils.h (generic_in_solib_return_trampoline): Update. * frv-linux-tdep.c (frv_linux_pc_in_sigtramp): Change type of "name" parameter to const char * from char *. * gdbarch.sh (in_solib_return_trampoline): Ditto. * gdbarch.c: Regenerate. * gdbarch.h: Regenerate. * hppa-hpux-tdep.c (hppa_hpux_in_solib_return_trampoline): Update. * rs6000-tdep.c (rs6000_in_solib_return_trampoline): Update. * m32r-linux-tdep.c (m32r_linux_pc_in_sigtramp): Change type of "name" parameter to const char * from char *. * skip.c (skip_function_pc): Ditto. * sparc-sol2-tdep.c (sparc_sol2_pc_in_sigtramp): Ditto. * sparc-tdep.h (sparc_sol2_pc_in_sigtramp): Update. * sparc64fbsd-tdep.c (sparc64fbsd_pc_in_sigtramp): Ditto. * sparc64nbsd-tdep.c (sparc64nbsd_pc_in_sigtramp): Ditto. * sparc64obsd-tdep.c (sparc64obsd_pc_in_sigtramp): Ditto. * sparcnbsd-tdep.c (sparc32nbsd_pc_in_sigtramp): Ditto. * sparcobsd-tdep.c (sparc32obsd_pc_in_sigtramp): Ditto. * nbsd-tdep.c (nbsd_pc_in_sigtramp): Similary for "func_name". * nbsd-tdep.h (nbsd_pc_in_sigtramp): Update.
2012-02-02 21:19:17 +01:00
const char *name;
CORE_ADDR pc;
Introduce gdb_disassembly_flags For some reason I ended up staring at some of the "int flags" in btrace-related code, and I got confused because I had no clue what the flags where supposed to indicate. Fix that by using enum_flags, so that: #1 - it's clear from the type what the flags are about, and #2 - the compiler can catch mismatching mistakes gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (print_disassembly, disassemble_current_function) (disassemble_command): Use gdb_disassembly_flags instead of bare int. * disasm.c (gdb_pretty_print_disassembler::pretty_print_insn) (dump_insns, do_mixed_source_and_assembly_deprecated) (do_mixed_source_and_assembly, do_assembly_only, gdb_disassembly): Use gdb_disassembly_flags instead of bare int. * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED, DISASSEMBLY_RAW_INSN) (DISASSEMBLY_OMIT_FNAME, DISASSEMBLY_FILENAME) (DISASSEMBLY_OMIT_PC, DISASSEMBLY_SOURCE) (DISASSEMBLY_SPECULATIVE): No longer macros. Instead they're... (enum gdb_disassembly_flag): ... values of this new enumeration. (gdb_disassembly_flags): Define. (gdb_disassembly) (gdb_pretty_print_disassembler::pretty_print_insn): Use it. * mi/mi-cmd-disas.c (mi_cmd_disassemble): Use gdb_disassembly_flags instead of bare int. * record-btrace.c (btrace_insn_history) (record_btrace_insn_history, record_btrace_insn_history_range) (record_btrace_insn_history_from): Use gdb_disassembly_flags instead of bare int. * record.c (get_insn_history_modifiers, cmd_record_insn_history): Use gdb_disassembly_flags instead of bare int. * target-debug.h (target_debug_print_gdb_disassembly_flags): Define. * target-delegates.c: Regenerate. * target.c (target_insn_history, target_insn_history_from) (target_insn_history_range): Use gdb_disassembly_flags instead of bare int. * target.h: Include "disasm.h". (struct target_ops) <to_insn_history, to_insn_history_from, to_insn_history_range>: Use gdb_disassembly_flags instead of bare int. (target_insn_history, target_insn_history_from) (target_insn_history_range): Use gdb_disassembly_flags instead of bare int.
2017-09-04 19:23:22 +02:00
gdb_disassembly_flags flags;
* ada-lang.c (ada_read_renaming_var_value): Pass const pointer to expression string to parse_exp_1. (create_excep_cond_exprs): Likewise. * ax-gdb.c (agent_eval_command_one): Likewise. (maint_agent_printf_command): Likewise. Constify much of the string handling/parsing. * breakpoint.c (set_breakpoint_condition): Pass const pointer to expression string to parse_exp_1. (update_watchpoint): Likewise. (parse_cmd_to_aexpr): Constify string handling. Pass const pointer to parse_exp_1. (init_breakpoint_sal): Pass const pointer to parse_exp_1. (find_condition_and_thread): Likewise. Make TOK const. (watch_command_1): Make "arg" const. Constify string handling. Copy the expression string instead of changing the input string. (update_breakpoint_location): Pass const pointer to parse_exp_1. * eval.c (parse_and_eval_address): Make "exp" const. (parse_to_comma_and_eval): Make "expp" const. (parse_and_eval): Make "exp" const. * expression.h (parse_expression): Make argument const. (parse_exp_1): Make first argument const. * findcmd.c (parse_find_args): Treat "args" as const. * linespec.c (parse_linespec): Pass const pointer to linespec_expression_to_pc. (linespec_expression_to_pc): Make "exp_ptr" const. * parse.c (parse_exp_1): Make "stringptr" const. Make a copy of the expression to pass to parse_exp_in_context until this whole interface can be constified. (parse_expression): Make "string" const. * printcmd.c (ui_printf): Treat "arg" as const. Handle const strings. * tracepoint.c (validate_actionline): Pass const pointer to all calls to parse_exp_1. (encode_actions_1): Likewise. * value.h (parse_to_comma_and_eval): Make argument const. (parse_and_eval_address): Likewise. (parse_and_eval): Likewise. * varobj.c (varobj_create): Pass const pointer to parse_exp_1. (varobj_set_value): Likewise. * cli/cli-cmds.c (disassemble_command): Treat "arg" as const and constify string handling. Pass const pointers to parse_and_eval_address and parse_to_comman_and_eval. * cli/cli-utils.c (skip_to_space): Rename to ... (skip_to_space_const): ... this. Handle const strings. * cli/cli-utils.h (skip_to_space): Turn into macro which invokes skip_to_space_const. (skip_to_space_const): Declare. * common/format.c (parse_format_string): Make "arg" const. Handle const strings. * common/format.h (parse_format_string): Make "arg" const. * gdbserver/ax.c (ax_printf): Make "format" const. * python/python.c (gdbpy_parse_and_eval): Do not make a copy of the expression string.
2013-03-12 18:39:45 +01:00
const char *p;
Disassemble blocks with non-contiguous ranges This patch adds support for disassembly of blocks with non-contiguous ranges. These blocks are printed as follows: (gdb) disassemble foo Dump of assembler code for function foo: Address range 0x401136 to 0x401151: 0x0000000000401136 <+0>: push %rbp 0x0000000000401137 <+1>: mov %rsp,%rbp 0x000000000040113a <+4>: callq 0x401134 <bar> 0x000000000040113f <+9>: mov 0x2eef(%rip),%eax # 0x404034 <e> 0x0000000000401145 <+15>: test %eax,%eax 0x0000000000401147 <+17>: je 0x40114e <foo+24> 0x0000000000401149 <+19>: callq 0x401128 <foo+4294967282> 0x000000000040114e <+24>: nop 0x000000000040114f <+25>: pop %rbp 0x0000000000401150 <+26>: retq Address range 0x401128 to 0x401134: 0x0000000000401128 <+-14>: push %rbp 0x0000000000401129 <+-13>: mov %rsp,%rbp 0x000000000040112c <+-10>: callq 0x401126 <baz> 0x0000000000401131 <+-5>: nop 0x0000000000401132 <+-4>: pop %rbp 0x0000000000401133 <+-3>: retq End of assembler dump. This is an actual dump from the test case that I constructed for this work. The ranges are printed in the order encountered in the debug info. For the above example, note that the second range occupies lower addresses than the first range. Functions with contiguous ranges are still printed as follows: (gdb) disassemble main Dump of assembler code for function main: 0x0000000000401151 <+0>: push %rbp 0x0000000000401152 <+1>: mov %rsp,%rbp 0x0000000000401155 <+4>: callq 0x401136 <foo> 0x000000000040115a <+9>: mov $0x0,%eax 0x000000000040115f <+14>: pop %rbp 0x0000000000401160 <+15>: retq End of assembler dump. gdb/ChangeLog: * cli/cli-cmds.c (block.h): Include. (print_disassembly): Handle printing of non-contiguous blocks. (disassemble_current_function): Likewise. (disassemble_command): Likewise.
2018-08-24 01:00:49 +02:00
const struct block *block = nullptr;
* ada-lang.c (ada_read_renaming_var_value): Pass const pointer to expression string to parse_exp_1. (create_excep_cond_exprs): Likewise. * ax-gdb.c (agent_eval_command_one): Likewise. (maint_agent_printf_command): Likewise. Constify much of the string handling/parsing. * breakpoint.c (set_breakpoint_condition): Pass const pointer to expression string to parse_exp_1. (update_watchpoint): Likewise. (parse_cmd_to_aexpr): Constify string handling. Pass const pointer to parse_exp_1. (init_breakpoint_sal): Pass const pointer to parse_exp_1. (find_condition_and_thread): Likewise. Make TOK const. (watch_command_1): Make "arg" const. Constify string handling. Copy the expression string instead of changing the input string. (update_breakpoint_location): Pass const pointer to parse_exp_1. * eval.c (parse_and_eval_address): Make "exp" const. (parse_to_comma_and_eval): Make "expp" const. (parse_and_eval): Make "exp" const. * expression.h (parse_expression): Make argument const. (parse_exp_1): Make first argument const. * findcmd.c (parse_find_args): Treat "args" as const. * linespec.c (parse_linespec): Pass const pointer to linespec_expression_to_pc. (linespec_expression_to_pc): Make "exp_ptr" const. * parse.c (parse_exp_1): Make "stringptr" const. Make a copy of the expression to pass to parse_exp_in_context until this whole interface can be constified. (parse_expression): Make "string" const. * printcmd.c (ui_printf): Treat "arg" as const. Handle const strings. * tracepoint.c (validate_actionline): Pass const pointer to all calls to parse_exp_1. (encode_actions_1): Likewise. * value.h (parse_to_comma_and_eval): Make argument const. (parse_and_eval_address): Likewise. (parse_and_eval): Likewise. * varobj.c (varobj_create): Pass const pointer to parse_exp_1. (varobj_set_value): Likewise. * cli/cli-cmds.c (disassemble_command): Treat "arg" as const and constify string handling. Pass const pointers to parse_and_eval_address and parse_to_comman_and_eval. * cli/cli-utils.c (skip_to_space): Rename to ... (skip_to_space_const): ... this. Handle const strings. * cli/cli-utils.h (skip_to_space): Turn into macro which invokes skip_to_space_const. (skip_to_space_const): Declare. * common/format.c (parse_format_string): Make "arg" const. Handle const strings. * common/format.h (parse_format_string): Make "arg" const. * gdbserver/ax.c (ax_printf): Make "format" const. * python/python.c (gdbpy_parse_and_eval): Do not make a copy of the expression string.
2013-03-12 18:39:45 +01:00
p = arg;
name = NULL;
flags = 0;
* ada-lang.c (ada_read_renaming_var_value): Pass const pointer to expression string to parse_exp_1. (create_excep_cond_exprs): Likewise. * ax-gdb.c (agent_eval_command_one): Likewise. (maint_agent_printf_command): Likewise. Constify much of the string handling/parsing. * breakpoint.c (set_breakpoint_condition): Pass const pointer to expression string to parse_exp_1. (update_watchpoint): Likewise. (parse_cmd_to_aexpr): Constify string handling. Pass const pointer to parse_exp_1. (init_breakpoint_sal): Pass const pointer to parse_exp_1. (find_condition_and_thread): Likewise. Make TOK const. (watch_command_1): Make "arg" const. Constify string handling. Copy the expression string instead of changing the input string. (update_breakpoint_location): Pass const pointer to parse_exp_1. * eval.c (parse_and_eval_address): Make "exp" const. (parse_to_comma_and_eval): Make "expp" const. (parse_and_eval): Make "exp" const. * expression.h (parse_expression): Make argument const. (parse_exp_1): Make first argument const. * findcmd.c (parse_find_args): Treat "args" as const. * linespec.c (parse_linespec): Pass const pointer to linespec_expression_to_pc. (linespec_expression_to_pc): Make "exp_ptr" const. * parse.c (parse_exp_1): Make "stringptr" const. Make a copy of the expression to pass to parse_exp_in_context until this whole interface can be constified. (parse_expression): Make "string" const. * printcmd.c (ui_printf): Treat "arg" as const. Handle const strings. * tracepoint.c (validate_actionline): Pass const pointer to all calls to parse_exp_1. (encode_actions_1): Likewise. * value.h (parse_to_comma_and_eval): Make argument const. (parse_and_eval_address): Likewise. (parse_and_eval): Likewise. * varobj.c (varobj_create): Pass const pointer to parse_exp_1. (varobj_set_value): Likewise. * cli/cli-cmds.c (disassemble_command): Treat "arg" as const and constify string handling. Pass const pointers to parse_and_eval_address and parse_to_comman_and_eval. * cli/cli-utils.c (skip_to_space): Rename to ... (skip_to_space_const): ... this. Handle const strings. * cli/cli-utils.h (skip_to_space): Turn into macro which invokes skip_to_space_const. (skip_to_space_const): Declare. * common/format.c (parse_format_string): Make "arg" const. Handle const strings. * common/format.h (parse_format_string): Make "arg" const. * gdbserver/ax.c (ax_printf): Make "format" const. * python/python.c (gdbpy_parse_and_eval): Do not make a copy of the expression string.
2013-03-12 18:39:45 +01:00
if (p && *p == '/')
{
* ada-lang.c (ada_read_renaming_var_value): Pass const pointer to expression string to parse_exp_1. (create_excep_cond_exprs): Likewise. * ax-gdb.c (agent_eval_command_one): Likewise. (maint_agent_printf_command): Likewise. Constify much of the string handling/parsing. * breakpoint.c (set_breakpoint_condition): Pass const pointer to expression string to parse_exp_1. (update_watchpoint): Likewise. (parse_cmd_to_aexpr): Constify string handling. Pass const pointer to parse_exp_1. (init_breakpoint_sal): Pass const pointer to parse_exp_1. (find_condition_and_thread): Likewise. Make TOK const. (watch_command_1): Make "arg" const. Constify string handling. Copy the expression string instead of changing the input string. (update_breakpoint_location): Pass const pointer to parse_exp_1. * eval.c (parse_and_eval_address): Make "exp" const. (parse_to_comma_and_eval): Make "expp" const. (parse_and_eval): Make "exp" const. * expression.h (parse_expression): Make argument const. (parse_exp_1): Make first argument const. * findcmd.c (parse_find_args): Treat "args" as const. * linespec.c (parse_linespec): Pass const pointer to linespec_expression_to_pc. (linespec_expression_to_pc): Make "exp_ptr" const. * parse.c (parse_exp_1): Make "stringptr" const. Make a copy of the expression to pass to parse_exp_in_context until this whole interface can be constified. (parse_expression): Make "string" const. * printcmd.c (ui_printf): Treat "arg" as const. Handle const strings. * tracepoint.c (validate_actionline): Pass const pointer to all calls to parse_exp_1. (encode_actions_1): Likewise. * value.h (parse_to_comma_and_eval): Make argument const. (parse_and_eval_address): Likewise. (parse_and_eval): Likewise. * varobj.c (varobj_create): Pass const pointer to parse_exp_1. (varobj_set_value): Likewise. * cli/cli-cmds.c (disassemble_command): Treat "arg" as const and constify string handling. Pass const pointers to parse_and_eval_address and parse_to_comman_and_eval. * cli/cli-utils.c (skip_to_space): Rename to ... (skip_to_space_const): ... this. Handle const strings. * cli/cli-utils.h (skip_to_space): Turn into macro which invokes skip_to_space_const. (skip_to_space_const): Declare. * common/format.c (parse_format_string): Make "arg" const. Handle const strings. * common/format.h (parse_format_string): Make "arg" const. * gdbserver/ax.c (ax_printf): Make "format" const. * python/python.c (gdbpy_parse_and_eval): Do not make a copy of the expression string.
2013-03-12 18:39:45 +01:00
++p;
* ada-lang.c (ada_read_renaming_var_value): Pass const pointer to expression string to parse_exp_1. (create_excep_cond_exprs): Likewise. * ax-gdb.c (agent_eval_command_one): Likewise. (maint_agent_printf_command): Likewise. Constify much of the string handling/parsing. * breakpoint.c (set_breakpoint_condition): Pass const pointer to expression string to parse_exp_1. (update_watchpoint): Likewise. (parse_cmd_to_aexpr): Constify string handling. Pass const pointer to parse_exp_1. (init_breakpoint_sal): Pass const pointer to parse_exp_1. (find_condition_and_thread): Likewise. Make TOK const. (watch_command_1): Make "arg" const. Constify string handling. Copy the expression string instead of changing the input string. (update_breakpoint_location): Pass const pointer to parse_exp_1. * eval.c (parse_and_eval_address): Make "exp" const. (parse_to_comma_and_eval): Make "expp" const. (parse_and_eval): Make "exp" const. * expression.h (parse_expression): Make argument const. (parse_exp_1): Make first argument const. * findcmd.c (parse_find_args): Treat "args" as const. * linespec.c (parse_linespec): Pass const pointer to linespec_expression_to_pc. (linespec_expression_to_pc): Make "exp_ptr" const. * parse.c (parse_exp_1): Make "stringptr" const. Make a copy of the expression to pass to parse_exp_in_context until this whole interface can be constified. (parse_expression): Make "string" const. * printcmd.c (ui_printf): Treat "arg" as const. Handle const strings. * tracepoint.c (validate_actionline): Pass const pointer to all calls to parse_exp_1. (encode_actions_1): Likewise. * value.h (parse_to_comma_and_eval): Make argument const. (parse_and_eval_address): Likewise. (parse_and_eval): Likewise. * varobj.c (varobj_create): Pass const pointer to parse_exp_1. (varobj_set_value): Likewise. * cli/cli-cmds.c (disassemble_command): Treat "arg" as const and constify string handling. Pass const pointers to parse_and_eval_address and parse_to_comman_and_eval. * cli/cli-utils.c (skip_to_space): Rename to ... (skip_to_space_const): ... this. Handle const strings. * cli/cli-utils.h (skip_to_space): Turn into macro which invokes skip_to_space_const. (skip_to_space_const): Declare. * common/format.c (parse_format_string): Make "arg" const. Handle const strings. * common/format.h (parse_format_string): Make "arg" const. * gdbserver/ax.c (ax_printf): Make "format" const. * python/python.c (gdbpy_parse_and_eval): Do not make a copy of the expression string.
2013-03-12 18:39:45 +01:00
if (*p == '\0')
error (_("Missing modifier."));
* ada-lang.c (ada_read_renaming_var_value): Pass const pointer to expression string to parse_exp_1. (create_excep_cond_exprs): Likewise. * ax-gdb.c (agent_eval_command_one): Likewise. (maint_agent_printf_command): Likewise. Constify much of the string handling/parsing. * breakpoint.c (set_breakpoint_condition): Pass const pointer to expression string to parse_exp_1. (update_watchpoint): Likewise. (parse_cmd_to_aexpr): Constify string handling. Pass const pointer to parse_exp_1. (init_breakpoint_sal): Pass const pointer to parse_exp_1. (find_condition_and_thread): Likewise. Make TOK const. (watch_command_1): Make "arg" const. Constify string handling. Copy the expression string instead of changing the input string. (update_breakpoint_location): Pass const pointer to parse_exp_1. * eval.c (parse_and_eval_address): Make "exp" const. (parse_to_comma_and_eval): Make "expp" const. (parse_and_eval): Make "exp" const. * expression.h (parse_expression): Make argument const. (parse_exp_1): Make first argument const. * findcmd.c (parse_find_args): Treat "args" as const. * linespec.c (parse_linespec): Pass const pointer to linespec_expression_to_pc. (linespec_expression_to_pc): Make "exp_ptr" const. * parse.c (parse_exp_1): Make "stringptr" const. Make a copy of the expression to pass to parse_exp_in_context until this whole interface can be constified. (parse_expression): Make "string" const. * printcmd.c (ui_printf): Treat "arg" as const. Handle const strings. * tracepoint.c (validate_actionline): Pass const pointer to all calls to parse_exp_1. (encode_actions_1): Likewise. * value.h (parse_to_comma_and_eval): Make argument const. (parse_and_eval_address): Likewise. (parse_and_eval): Likewise. * varobj.c (varobj_create): Pass const pointer to parse_exp_1. (varobj_set_value): Likewise. * cli/cli-cmds.c (disassemble_command): Treat "arg" as const and constify string handling. Pass const pointers to parse_and_eval_address and parse_to_comman_and_eval. * cli/cli-utils.c (skip_to_space): Rename to ... (skip_to_space_const): ... this. Handle const strings. * cli/cli-utils.h (skip_to_space): Turn into macro which invokes skip_to_space_const. (skip_to_space_const): Declare. * common/format.c (parse_format_string): Make "arg" const. Handle const strings. * common/format.h (parse_format_string): Make "arg" const. * gdbserver/ax.c (ax_printf): Make "format" const. * python/python.c (gdbpy_parse_and_eval): Do not make a copy of the expression string.
2013-03-12 18:39:45 +01:00
while (*p && ! isspace (*p))
{
* ada-lang.c (ada_read_renaming_var_value): Pass const pointer to expression string to parse_exp_1. (create_excep_cond_exprs): Likewise. * ax-gdb.c (agent_eval_command_one): Likewise. (maint_agent_printf_command): Likewise. Constify much of the string handling/parsing. * breakpoint.c (set_breakpoint_condition): Pass const pointer to expression string to parse_exp_1. (update_watchpoint): Likewise. (parse_cmd_to_aexpr): Constify string handling. Pass const pointer to parse_exp_1. (init_breakpoint_sal): Pass const pointer to parse_exp_1. (find_condition_and_thread): Likewise. Make TOK const. (watch_command_1): Make "arg" const. Constify string handling. Copy the expression string instead of changing the input string. (update_breakpoint_location): Pass const pointer to parse_exp_1. * eval.c (parse_and_eval_address): Make "exp" const. (parse_to_comma_and_eval): Make "expp" const. (parse_and_eval): Make "exp" const. * expression.h (parse_expression): Make argument const. (parse_exp_1): Make first argument const. * findcmd.c (parse_find_args): Treat "args" as const. * linespec.c (parse_linespec): Pass const pointer to linespec_expression_to_pc. (linespec_expression_to_pc): Make "exp_ptr" const. * parse.c (parse_exp_1): Make "stringptr" const. Make a copy of the expression to pass to parse_exp_in_context until this whole interface can be constified. (parse_expression): Make "string" const. * printcmd.c (ui_printf): Treat "arg" as const. Handle const strings. * tracepoint.c (validate_actionline): Pass const pointer to all calls to parse_exp_1. (encode_actions_1): Likewise. * value.h (parse_to_comma_and_eval): Make argument const. (parse_and_eval_address): Likewise. (parse_and_eval): Likewise. * varobj.c (varobj_create): Pass const pointer to parse_exp_1. (varobj_set_value): Likewise. * cli/cli-cmds.c (disassemble_command): Treat "arg" as const and constify string handling. Pass const pointers to parse_and_eval_address and parse_to_comman_and_eval. * cli/cli-utils.c (skip_to_space): Rename to ... (skip_to_space_const): ... this. Handle const strings. * cli/cli-utils.h (skip_to_space): Turn into macro which invokes skip_to_space_const. (skip_to_space_const): Declare. * common/format.c (parse_format_string): Make "arg" const. Handle const strings. * common/format.h (parse_format_string): Make "arg" const. * gdbserver/ax.c (ax_printf): Make "format" const. * python/python.c (gdbpy_parse_and_eval): Do not make a copy of the expression string.
2013-03-12 18:39:45 +01:00
switch (*p++)
{
case 'm':
New /s modifier for the disassemble command. The "source centric" /m option to the disassemble command is often unhelpful, e.g., in the presence of optimized code. This patch adds a /s modifier that is better. For one, /m only prints instructions from the originating source file, leaving out instructions from e.g., inlined functions from other files. gdb/ChangeLog: PR gdb/11833 * NEWS: Document new /s modifier for the disassemble command. * cli/cli-cmds.c (disassemble_command): Add support for /s. (_initialize_cli_cmds): Update online docs of disassemble command. * disasm.c: #include "source.h". (struct deprecated_dis_line_entry): Renamed from dis_line_entry. All uses updated. (dis_line_entry): New struct. (hash_dis_line_entry, eq_dis_line_entry): New functions. (allocate_dis_line_table): New functions. (maybe_add_dis_line_entry, line_has_code_p): New functions. (dump_insns): New arg end_pc. All callers updated. (do_mixed_source_and_assembly_deprecated): Renamed from do_mixed_source_and_assembly. All callers updated. (do_mixed_source_and_assembly): New function. (gdb_disassembly): Handle /s (DISASSEMBLY_SOURCE). * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED): Renamed from DISASSEMBLY_SOURCE. All uses updated. (DISASSEMBLY_SOURCE): New macro. * mi/mi-cmd-disas.c (mi_cmd_disassemble): New modes 4,5. gdb/doc/ChangeLog: * gdb.texinfo (Machine Code): Update docs for mixed source/assembly disassembly. (GDB/MI Data Manipulation): Update docs for new disassembly modes. gdb/testsuite/ChangeLog: * gdb.mi/mi-disassemble.exp: Update. * gdb.base/disasm-optim.S: New file. * gdb.base/disasm-optim.c: New file. * gdb.base/disasm-optim.h: New file. * gdb.base/disasm-optim.exp: New file.
2015-08-15 06:45:54 +02:00
flags |= DISASSEMBLY_SOURCE_DEPRECATED;
break;
case 'r':
flags |= DISASSEMBLY_RAW_INSN;
break;
New /s modifier for the disassemble command. The "source centric" /m option to the disassemble command is often unhelpful, e.g., in the presence of optimized code. This patch adds a /s modifier that is better. For one, /m only prints instructions from the originating source file, leaving out instructions from e.g., inlined functions from other files. gdb/ChangeLog: PR gdb/11833 * NEWS: Document new /s modifier for the disassemble command. * cli/cli-cmds.c (disassemble_command): Add support for /s. (_initialize_cli_cmds): Update online docs of disassemble command. * disasm.c: #include "source.h". (struct deprecated_dis_line_entry): Renamed from dis_line_entry. All uses updated. (dis_line_entry): New struct. (hash_dis_line_entry, eq_dis_line_entry): New functions. (allocate_dis_line_table): New functions. (maybe_add_dis_line_entry, line_has_code_p): New functions. (dump_insns): New arg end_pc. All callers updated. (do_mixed_source_and_assembly_deprecated): Renamed from do_mixed_source_and_assembly. All callers updated. (do_mixed_source_and_assembly): New function. (gdb_disassembly): Handle /s (DISASSEMBLY_SOURCE). * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED): Renamed from DISASSEMBLY_SOURCE. All uses updated. (DISASSEMBLY_SOURCE): New macro. * mi/mi-cmd-disas.c (mi_cmd_disassemble): New modes 4,5. gdb/doc/ChangeLog: * gdb.texinfo (Machine Code): Update docs for mixed source/assembly disassembly. (GDB/MI Data Manipulation): Update docs for new disassembly modes. gdb/testsuite/ChangeLog: * gdb.mi/mi-disassemble.exp: Update. * gdb.base/disasm-optim.S: New file. * gdb.base/disasm-optim.c: New file. * gdb.base/disasm-optim.h: New file. * gdb.base/disasm-optim.exp: New file.
2015-08-15 06:45:54 +02:00
case 's':
flags |= DISASSEMBLY_SOURCE;
break;
default:
error (_("Invalid disassembly modifier."));
}
}
Rename _const functions to use overloading instead This renames a few functions -- skip_spaces_const, skip_to_space_const, get_number_const, extract_arg_const -- to drop the "_const" suffix and instead rely on overloading. This makes future const fixes simpler by reducing the number of lines that must be changed. I think it is also not any less clear, as all these functions have the same interface as their non-const versions by design. Furthermore there's an example of using an overload in-tree already, namely check_for_argument. This patch was largely created using some perl one-liners; then a few fixes were applied by hand. ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * common/common-utils.h (skip_to_space): Remove macro, redeclare as function. (skip_to_space): Rename from skip_to_space_const. * common/common-utils.c (skip_to_space): New function. (skip_to_space): Rename from skip_to_space_const. * cli/cli-utils.h (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. * cli/cli-utils.c (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. (number_or_range_parser::get_number): Use ::get_number. * aarch64-linux-tdep.c, ada-lang.c, arm-linux-tdep.c, ax-gdb.c, break-catch-throw.c, breakpoint.c, cli/cli-cmds.c, cli/cli-dump.c, cli/cli-script.c, cli/cli-setshow.c, compile/compile.c, completer.c, demangle.c, disasm.c, findcmd.c, linespec.c, linux-tdep.c, linux-thread-db.c, location.c, mi/mi-parse.c, minsyms.c, nat/linux-procfs.c, printcmd.c, probe.c, python/py-breakpoint.c, record.c, rust-exp.y, serial.c, stack.c, stap-probe.c, tid-parse.c, tracepoint.c: Update all callers.
2017-09-10 22:19:19 +02:00
p = skip_spaces (p);
}
New /s modifier for the disassemble command. The "source centric" /m option to the disassemble command is often unhelpful, e.g., in the presence of optimized code. This patch adds a /s modifier that is better. For one, /m only prints instructions from the originating source file, leaving out instructions from e.g., inlined functions from other files. gdb/ChangeLog: PR gdb/11833 * NEWS: Document new /s modifier for the disassemble command. * cli/cli-cmds.c (disassemble_command): Add support for /s. (_initialize_cli_cmds): Update online docs of disassemble command. * disasm.c: #include "source.h". (struct deprecated_dis_line_entry): Renamed from dis_line_entry. All uses updated. (dis_line_entry): New struct. (hash_dis_line_entry, eq_dis_line_entry): New functions. (allocate_dis_line_table): New functions. (maybe_add_dis_line_entry, line_has_code_p): New functions. (dump_insns): New arg end_pc. All callers updated. (do_mixed_source_and_assembly_deprecated): Renamed from do_mixed_source_and_assembly. All callers updated. (do_mixed_source_and_assembly): New function. (gdb_disassembly): Handle /s (DISASSEMBLY_SOURCE). * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED): Renamed from DISASSEMBLY_SOURCE. All uses updated. (DISASSEMBLY_SOURCE): New macro. * mi/mi-cmd-disas.c (mi_cmd_disassemble): New modes 4,5. gdb/doc/ChangeLog: * gdb.texinfo (Machine Code): Update docs for mixed source/assembly disassembly. (GDB/MI Data Manipulation): Update docs for new disassembly modes. gdb/testsuite/ChangeLog: * gdb.mi/mi-disassemble.exp: Update. * gdb.base/disasm-optim.S: New file. * gdb.base/disasm-optim.c: New file. * gdb.base/disasm-optim.h: New file. * gdb.base/disasm-optim.exp: New file.
2015-08-15 06:45:54 +02:00
if ((flags & (DISASSEMBLY_SOURCE_DEPRECATED | DISASSEMBLY_SOURCE))
== (DISASSEMBLY_SOURCE_DEPRECATED | DISASSEMBLY_SOURCE))
error (_("Cannot specify both /m and /s."));
* ada-lang.c (ada_read_renaming_var_value): Pass const pointer to expression string to parse_exp_1. (create_excep_cond_exprs): Likewise. * ax-gdb.c (agent_eval_command_one): Likewise. (maint_agent_printf_command): Likewise. Constify much of the string handling/parsing. * breakpoint.c (set_breakpoint_condition): Pass const pointer to expression string to parse_exp_1. (update_watchpoint): Likewise. (parse_cmd_to_aexpr): Constify string handling. Pass const pointer to parse_exp_1. (init_breakpoint_sal): Pass const pointer to parse_exp_1. (find_condition_and_thread): Likewise. Make TOK const. (watch_command_1): Make "arg" const. Constify string handling. Copy the expression string instead of changing the input string. (update_breakpoint_location): Pass const pointer to parse_exp_1. * eval.c (parse_and_eval_address): Make "exp" const. (parse_to_comma_and_eval): Make "expp" const. (parse_and_eval): Make "exp" const. * expression.h (parse_expression): Make argument const. (parse_exp_1): Make first argument const. * findcmd.c (parse_find_args): Treat "args" as const. * linespec.c (parse_linespec): Pass const pointer to linespec_expression_to_pc. (linespec_expression_to_pc): Make "exp_ptr" const. * parse.c (parse_exp_1): Make "stringptr" const. Make a copy of the expression to pass to parse_exp_in_context until this whole interface can be constified. (parse_expression): Make "string" const. * printcmd.c (ui_printf): Treat "arg" as const. Handle const strings. * tracepoint.c (validate_actionline): Pass const pointer to all calls to parse_exp_1. (encode_actions_1): Likewise. * value.h (parse_to_comma_and_eval): Make argument const. (parse_and_eval_address): Likewise. (parse_and_eval): Likewise. * varobj.c (varobj_create): Pass const pointer to parse_exp_1. (varobj_set_value): Likewise. * cli/cli-cmds.c (disassemble_command): Treat "arg" as const and constify string handling. Pass const pointers to parse_and_eval_address and parse_to_comman_and_eval. * cli/cli-utils.c (skip_to_space): Rename to ... (skip_to_space_const): ... this. Handle const strings. * cli/cli-utils.h (skip_to_space): Turn into macro which invokes skip_to_space_const. (skip_to_space_const): Declare. * common/format.c (parse_format_string): Make "arg" const. Handle const strings. * common/format.h (parse_format_string): Make "arg" const. * gdbserver/ax.c (ax_printf): Make "format" const. * python/python.c (gdbpy_parse_and_eval): Do not make a copy of the expression string.
2013-03-12 18:39:45 +01:00
if (! p || ! *p)
{
flags |= DISASSEMBLY_OMIT_FNAME;
disassemble_current_function (flags);
return;
}
* ada-lang.c (ada_read_renaming_var_value): Pass const pointer to expression string to parse_exp_1. (create_excep_cond_exprs): Likewise. * ax-gdb.c (agent_eval_command_one): Likewise. (maint_agent_printf_command): Likewise. Constify much of the string handling/parsing. * breakpoint.c (set_breakpoint_condition): Pass const pointer to expression string to parse_exp_1. (update_watchpoint): Likewise. (parse_cmd_to_aexpr): Constify string handling. Pass const pointer to parse_exp_1. (init_breakpoint_sal): Pass const pointer to parse_exp_1. (find_condition_and_thread): Likewise. Make TOK const. (watch_command_1): Make "arg" const. Constify string handling. Copy the expression string instead of changing the input string. (update_breakpoint_location): Pass const pointer to parse_exp_1. * eval.c (parse_and_eval_address): Make "exp" const. (parse_to_comma_and_eval): Make "expp" const. (parse_and_eval): Make "exp" const. * expression.h (parse_expression): Make argument const. (parse_exp_1): Make first argument const. * findcmd.c (parse_find_args): Treat "args" as const. * linespec.c (parse_linespec): Pass const pointer to linespec_expression_to_pc. (linespec_expression_to_pc): Make "exp_ptr" const. * parse.c (parse_exp_1): Make "stringptr" const. Make a copy of the expression to pass to parse_exp_in_context until this whole interface can be constified. (parse_expression): Make "string" const. * printcmd.c (ui_printf): Treat "arg" as const. Handle const strings. * tracepoint.c (validate_actionline): Pass const pointer to all calls to parse_exp_1. (encode_actions_1): Likewise. * value.h (parse_to_comma_and_eval): Make argument const. (parse_and_eval_address): Likewise. (parse_and_eval): Likewise. * varobj.c (varobj_create): Pass const pointer to parse_exp_1. (varobj_set_value): Likewise. * cli/cli-cmds.c (disassemble_command): Treat "arg" as const and constify string handling. Pass const pointers to parse_and_eval_address and parse_to_comman_and_eval. * cli/cli-utils.c (skip_to_space): Rename to ... (skip_to_space_const): ... this. Handle const strings. * cli/cli-utils.h (skip_to_space): Turn into macro which invokes skip_to_space_const. (skip_to_space_const): Declare. * common/format.c (parse_format_string): Make "arg" const. Handle const strings. * common/format.h (parse_format_string): Make "arg" const. * gdbserver/ax.c (ax_printf): Make "format" const. * python/python.c (gdbpy_parse_and_eval): Do not make a copy of the expression string.
2013-03-12 18:39:45 +01:00
pc = value_as_address (parse_to_comma_and_eval (&p));
if (p[0] == ',')
++p;
if (p[0] == '\0')
{
/* One argument. */
Disassemble blocks with non-contiguous ranges This patch adds support for disassembly of blocks with non-contiguous ranges. These blocks are printed as follows: (gdb) disassemble foo Dump of assembler code for function foo: Address range 0x401136 to 0x401151: 0x0000000000401136 <+0>: push %rbp 0x0000000000401137 <+1>: mov %rsp,%rbp 0x000000000040113a <+4>: callq 0x401134 <bar> 0x000000000040113f <+9>: mov 0x2eef(%rip),%eax # 0x404034 <e> 0x0000000000401145 <+15>: test %eax,%eax 0x0000000000401147 <+17>: je 0x40114e <foo+24> 0x0000000000401149 <+19>: callq 0x401128 <foo+4294967282> 0x000000000040114e <+24>: nop 0x000000000040114f <+25>: pop %rbp 0x0000000000401150 <+26>: retq Address range 0x401128 to 0x401134: 0x0000000000401128 <+-14>: push %rbp 0x0000000000401129 <+-13>: mov %rsp,%rbp 0x000000000040112c <+-10>: callq 0x401126 <baz> 0x0000000000401131 <+-5>: nop 0x0000000000401132 <+-4>: pop %rbp 0x0000000000401133 <+-3>: retq End of assembler dump. This is an actual dump from the test case that I constructed for this work. The ranges are printed in the order encountered in the debug info. For the above example, note that the second range occupies lower addresses than the first range. Functions with contiguous ranges are still printed as follows: (gdb) disassemble main Dump of assembler code for function main: 0x0000000000401151 <+0>: push %rbp 0x0000000000401152 <+1>: mov %rsp,%rbp 0x0000000000401155 <+4>: callq 0x401136 <foo> 0x000000000040115a <+9>: mov $0x0,%eax 0x000000000040115f <+14>: pop %rbp 0x0000000000401160 <+15>: retq End of assembler dump. gdb/ChangeLog: * cli/cli-cmds.c (block.h): Include. (print_disassembly): Handle printing of non-contiguous blocks. (disassemble_current_function): Likewise. (disassemble_command): Likewise.
2018-08-24 01:00:49 +02:00
if (find_pc_partial_function (pc, &name, &low, &high, &block) == 0)
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("No function contains specified address."));
#if defined(TUI)
/* NOTE: cagney/2003-02-13 The `tui_active' was previously
`tui_version'. */
if (tui_active)
/* FIXME: cagney/2004-02-07: This should be an observer. */
* disasm.h (gdb_disassembly): Add GDBARCH parameter. (gdb_print_insn): Likewise. * disasm.c (dump_insns): Add GDBARCH parameter. Use it instead of current_gdbarch. (do_mixed_source_and_assembly): Add GDBARCH parameter. Pass to dump_insns. (do_assembly_only): Likewise. (gdb_disassembly): Add GDBARCH parameter. Use it instead of current_gdbarch. Pass to subroutines. (gdb_print_insn): Add GDBARCH parameter. Use it instead of current_gdbarch. * stack.c (struct gdb_disassembly_stub_args): Add GDBARCH member. (gdb_disassembly_stub): Pass architecture to gdb_disassembly. (do_gdb_disassembly): Add GDBARCH argument. Store into args. (print_frame_info): Pass architecture to do_gdb_disassembly. * printcmd.c (print_formatted): Pass architecture to gdb_print_insn. * mi/mi-cmd-disas.c: Include "arch-utils.h" (mi_cmd_disassemble): Pass architecture to gdb_disassembly. * cli/cli-cmds.c: Include "arch-utils.h". (print_disassembly): Add GDBARCH parameter. Pass to gdb_disassembly and tui_show_assembly. (disassemble_current_function): Pass architecture to tui_get_low_disassembly_address and print_disassembly. (disassemble_command): Pass architecture to tui_get_low_disassembly_address and print_disassembly. * tui/tui.c (tui_show_assembly): Add GDBARCH parameter. Pass to tui_update_source_windows_with_addr. * tui/tui-data.h (struct tui_locator_element): Add GDBARCH member. (struct tui_source_info): Likewise. * tui/tui-data.c (tui_clear_win_detail): Clear source_info.gdbarch. * tui/tui-disasm.c (tui_disassemble): Add GDBARCH parameter. Pass to gdb_print_insn. (tui_find_disassembly_address): Add GDBARCH parameter. Pass to tui_disassemble. (tui_set_disassem_content): Add GDBARCH parameter. Install into source_info.gdbarch. Pass to tui_disassemble. (tui_show_disassem): Add GDBARCH parameter. Pass to tui_update_source_window. (tui_show_disassem_and_update_source): Add GDBARCH parameter. Pass to tui_show_disassem and tui_update_source_window. (tui_get_begin_asm_address): Return locator architecture in addition to locator PC value. (tui_get_low_disassembly_address): Add GDBARCH parameter. Pass to tui_get_low_disassembly_address. (tui_vertical_disassem_scroll): Pass architecture to subroutines. * tui/tui-disasm.h (tui_set_disassem_content): Add GDBARCH parameter. (tui_show_disassem): Likewise. (tui_show_disassem_and_update_source): Likewise. (tui_get_begin_asm_address): Return architecture and PC value. * tui/tui.h (tui_get_low_disassembly_address): Add GDBARCH parameter. (tui_show_assembly): Add GDBARCH parameter. * tui/tui-layout.c (extract_display_start_addr): Return current window architecture in addition to current PC value. (tui_set_layout): Update calls to tui_get_low_disassembly_address and extract_display_start_addr. Pass architecture to tui_update_source_windows_with_addr. * tui/tui-source.c: Include "objfiles.h". (tui_set_source_content): Initialize window architecture. (tui_show_symtab_source): Add GDBARCH parameter. Pass to tui_update_source_window_as_is * tui/tui-source.h (tui_show_symtab_source): Add GDBARCH parameter. * tui/tui-stack.c (tui_set_locator_info): Add GDBARCH parameter. Install locator architecture. (tui_set_locator_filename): Update call. (tui_show_frame_info): Pass architecture to tui_set_locator_info and subroutines. * tui/tui-win.c (make_visible_with_new_height): Pass architecture to tui_update_source_window. * tui/tui-winsource.c: Include "objfiles.h". (tui_display_main): Update call to tui_get_begin_asm_address. Pass architecture to tui_update_source_windows_with_addr. (tui_update_source_window): Add GDBARCH parameter. Pass to tui_update_source_window_as_is. (tui_update_source_window_as_is): Add GDBARCH parameter. Pass to tui_set_disassem_content. (tui_update_source_windows_with_addr): Add GDBARCH parameter. Pass to subroutines. (tui_update_source_windows_with_line): Pass objfile architecture to subroutines. (tui_horizontal_source_scroll): Pass architecture to tui_update_source_window_as_is. * tui/tui-winsource.h (tui_update_source_window): Add GDBARCH parameter. (tui_update_source_window_as_is): Likewise. (tui_update_source_windows_with_addr): Likewise.
2009-07-02 19:17:42 +02:00
low = tui_get_low_disassembly_address (gdbarch, low, pc);
#endif
* disasm.h (gdb_disassembly): Add GDBARCH parameter. (gdb_print_insn): Likewise. * disasm.c (dump_insns): Add GDBARCH parameter. Use it instead of current_gdbarch. (do_mixed_source_and_assembly): Add GDBARCH parameter. Pass to dump_insns. (do_assembly_only): Likewise. (gdb_disassembly): Add GDBARCH parameter. Use it instead of current_gdbarch. Pass to subroutines. (gdb_print_insn): Add GDBARCH parameter. Use it instead of current_gdbarch. * stack.c (struct gdb_disassembly_stub_args): Add GDBARCH member. (gdb_disassembly_stub): Pass architecture to gdb_disassembly. (do_gdb_disassembly): Add GDBARCH argument. Store into args. (print_frame_info): Pass architecture to do_gdb_disassembly. * printcmd.c (print_formatted): Pass architecture to gdb_print_insn. * mi/mi-cmd-disas.c: Include "arch-utils.h" (mi_cmd_disassemble): Pass architecture to gdb_disassembly. * cli/cli-cmds.c: Include "arch-utils.h". (print_disassembly): Add GDBARCH parameter. Pass to gdb_disassembly and tui_show_assembly. (disassemble_current_function): Pass architecture to tui_get_low_disassembly_address and print_disassembly. (disassemble_command): Pass architecture to tui_get_low_disassembly_address and print_disassembly. * tui/tui.c (tui_show_assembly): Add GDBARCH parameter. Pass to tui_update_source_windows_with_addr. * tui/tui-data.h (struct tui_locator_element): Add GDBARCH member. (struct tui_source_info): Likewise. * tui/tui-data.c (tui_clear_win_detail): Clear source_info.gdbarch. * tui/tui-disasm.c (tui_disassemble): Add GDBARCH parameter. Pass to gdb_print_insn. (tui_find_disassembly_address): Add GDBARCH parameter. Pass to tui_disassemble. (tui_set_disassem_content): Add GDBARCH parameter. Install into source_info.gdbarch. Pass to tui_disassemble. (tui_show_disassem): Add GDBARCH parameter. Pass to tui_update_source_window. (tui_show_disassem_and_update_source): Add GDBARCH parameter. Pass to tui_show_disassem and tui_update_source_window. (tui_get_begin_asm_address): Return locator architecture in addition to locator PC value. (tui_get_low_disassembly_address): Add GDBARCH parameter. Pass to tui_get_low_disassembly_address. (tui_vertical_disassem_scroll): Pass architecture to subroutines. * tui/tui-disasm.h (tui_set_disassem_content): Add GDBARCH parameter. (tui_show_disassem): Likewise. (tui_show_disassem_and_update_source): Likewise. (tui_get_begin_asm_address): Return architecture and PC value. * tui/tui.h (tui_get_low_disassembly_address): Add GDBARCH parameter. (tui_show_assembly): Add GDBARCH parameter. * tui/tui-layout.c (extract_display_start_addr): Return current window architecture in addition to current PC value. (tui_set_layout): Update calls to tui_get_low_disassembly_address and extract_display_start_addr. Pass architecture to tui_update_source_windows_with_addr. * tui/tui-source.c: Include "objfiles.h". (tui_set_source_content): Initialize window architecture. (tui_show_symtab_source): Add GDBARCH parameter. Pass to tui_update_source_window_as_is * tui/tui-source.h (tui_show_symtab_source): Add GDBARCH parameter. * tui/tui-stack.c (tui_set_locator_info): Add GDBARCH parameter. Install locator architecture. (tui_set_locator_filename): Update call. (tui_show_frame_info): Pass architecture to tui_set_locator_info and subroutines. * tui/tui-win.c (make_visible_with_new_height): Pass architecture to tui_update_source_window. * tui/tui-winsource.c: Include "objfiles.h". (tui_display_main): Update call to tui_get_begin_asm_address. Pass architecture to tui_update_source_windows_with_addr. (tui_update_source_window): Add GDBARCH parameter. Pass to tui_update_source_window_as_is. (tui_update_source_window_as_is): Add GDBARCH parameter. Pass to tui_set_disassem_content. (tui_update_source_windows_with_addr): Add GDBARCH parameter. Pass to subroutines. (tui_update_source_windows_with_line): Pass objfile architecture to subroutines. (tui_horizontal_source_scroll): Pass architecture to tui_update_source_window_as_is. * tui/tui-winsource.h (tui_update_source_window): Add GDBARCH parameter. (tui_update_source_window_as_is): Likewise. (tui_update_source_windows_with_addr): Likewise.
2009-07-02 19:17:42 +02:00
low += gdbarch_deprecated_function_start_offset (gdbarch);
flags |= DISASSEMBLY_OMIT_FNAME;
}
else
{
/* Two arguments. */
int incl_flag = 0;
low = pc;
Rename _const functions to use overloading instead This renames a few functions -- skip_spaces_const, skip_to_space_const, get_number_const, extract_arg_const -- to drop the "_const" suffix and instead rely on overloading. This makes future const fixes simpler by reducing the number of lines that must be changed. I think it is also not any less clear, as all these functions have the same interface as their non-const versions by design. Furthermore there's an example of using an overload in-tree already, namely check_for_argument. This patch was largely created using some perl one-liners; then a few fixes were applied by hand. ChangeLog 2017-09-11 Tom Tromey <tom@tromey.com> * common/common-utils.h (skip_to_space): Remove macro, redeclare as function. (skip_to_space): Rename from skip_to_space_const. * common/common-utils.c (skip_to_space): New function. (skip_to_space): Rename from skip_to_space_const. * cli/cli-utils.h (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. * cli/cli-utils.c (get_number): Rename from get_number_const. (extract_arg): Rename from extract_arg_const. (number_or_range_parser::get_number): Use ::get_number. * aarch64-linux-tdep.c, ada-lang.c, arm-linux-tdep.c, ax-gdb.c, break-catch-throw.c, breakpoint.c, cli/cli-cmds.c, cli/cli-dump.c, cli/cli-script.c, cli/cli-setshow.c, compile/compile.c, completer.c, demangle.c, disasm.c, findcmd.c, linespec.c, linux-tdep.c, linux-thread-db.c, location.c, mi/mi-parse.c, minsyms.c, nat/linux-procfs.c, printcmd.c, probe.c, python/py-breakpoint.c, record.c, rust-exp.y, serial.c, stack.c, stap-probe.c, tid-parse.c, tracepoint.c: Update all callers.
2017-09-10 22:19:19 +02:00
p = skip_spaces (p);
* ada-lang.c (ada_read_renaming_var_value): Pass const pointer to expression string to parse_exp_1. (create_excep_cond_exprs): Likewise. * ax-gdb.c (agent_eval_command_one): Likewise. (maint_agent_printf_command): Likewise. Constify much of the string handling/parsing. * breakpoint.c (set_breakpoint_condition): Pass const pointer to expression string to parse_exp_1. (update_watchpoint): Likewise. (parse_cmd_to_aexpr): Constify string handling. Pass const pointer to parse_exp_1. (init_breakpoint_sal): Pass const pointer to parse_exp_1. (find_condition_and_thread): Likewise. Make TOK const. (watch_command_1): Make "arg" const. Constify string handling. Copy the expression string instead of changing the input string. (update_breakpoint_location): Pass const pointer to parse_exp_1. * eval.c (parse_and_eval_address): Make "exp" const. (parse_to_comma_and_eval): Make "expp" const. (parse_and_eval): Make "exp" const. * expression.h (parse_expression): Make argument const. (parse_exp_1): Make first argument const. * findcmd.c (parse_find_args): Treat "args" as const. * linespec.c (parse_linespec): Pass const pointer to linespec_expression_to_pc. (linespec_expression_to_pc): Make "exp_ptr" const. * parse.c (parse_exp_1): Make "stringptr" const. Make a copy of the expression to pass to parse_exp_in_context until this whole interface can be constified. (parse_expression): Make "string" const. * printcmd.c (ui_printf): Treat "arg" as const. Handle const strings. * tracepoint.c (validate_actionline): Pass const pointer to all calls to parse_exp_1. (encode_actions_1): Likewise. * value.h (parse_to_comma_and_eval): Make argument const. (parse_and_eval_address): Likewise. (parse_and_eval): Likewise. * varobj.c (varobj_create): Pass const pointer to parse_exp_1. (varobj_set_value): Likewise. * cli/cli-cmds.c (disassemble_command): Treat "arg" as const and constify string handling. Pass const pointers to parse_and_eval_address and parse_to_comman_and_eval. * cli/cli-utils.c (skip_to_space): Rename to ... (skip_to_space_const): ... this. Handle const strings. * cli/cli-utils.h (skip_to_space): Turn into macro which invokes skip_to_space_const. (skip_to_space_const): Declare. * common/format.c (parse_format_string): Make "arg" const. Handle const strings. * common/format.h (parse_format_string): Make "arg" const. * gdbserver/ax.c (ax_printf): Make "format" const. * python/python.c (gdbpy_parse_and_eval): Do not make a copy of the expression string.
2013-03-12 18:39:45 +01:00
if (p[0] == '+')
{
* ada-lang.c (ada_read_renaming_var_value): Pass const pointer to expression string to parse_exp_1. (create_excep_cond_exprs): Likewise. * ax-gdb.c (agent_eval_command_one): Likewise. (maint_agent_printf_command): Likewise. Constify much of the string handling/parsing. * breakpoint.c (set_breakpoint_condition): Pass const pointer to expression string to parse_exp_1. (update_watchpoint): Likewise. (parse_cmd_to_aexpr): Constify string handling. Pass const pointer to parse_exp_1. (init_breakpoint_sal): Pass const pointer to parse_exp_1. (find_condition_and_thread): Likewise. Make TOK const. (watch_command_1): Make "arg" const. Constify string handling. Copy the expression string instead of changing the input string. (update_breakpoint_location): Pass const pointer to parse_exp_1. * eval.c (parse_and_eval_address): Make "exp" const. (parse_to_comma_and_eval): Make "expp" const. (parse_and_eval): Make "exp" const. * expression.h (parse_expression): Make argument const. (parse_exp_1): Make first argument const. * findcmd.c (parse_find_args): Treat "args" as const. * linespec.c (parse_linespec): Pass const pointer to linespec_expression_to_pc. (linespec_expression_to_pc): Make "exp_ptr" const. * parse.c (parse_exp_1): Make "stringptr" const. Make a copy of the expression to pass to parse_exp_in_context until this whole interface can be constified. (parse_expression): Make "string" const. * printcmd.c (ui_printf): Treat "arg" as const. Handle const strings. * tracepoint.c (validate_actionline): Pass const pointer to all calls to parse_exp_1. (encode_actions_1): Likewise. * value.h (parse_to_comma_and_eval): Make argument const. (parse_and_eval_address): Likewise. (parse_and_eval): Likewise. * varobj.c (varobj_create): Pass const pointer to parse_exp_1. (varobj_set_value): Likewise. * cli/cli-cmds.c (disassemble_command): Treat "arg" as const and constify string handling. Pass const pointers to parse_and_eval_address and parse_to_comman_and_eval. * cli/cli-utils.c (skip_to_space): Rename to ... (skip_to_space_const): ... this. Handle const strings. * cli/cli-utils.h (skip_to_space): Turn into macro which invokes skip_to_space_const. (skip_to_space_const): Declare. * common/format.c (parse_format_string): Make "arg" const. Handle const strings. * common/format.h (parse_format_string): Make "arg" const. * gdbserver/ax.c (ax_printf): Make "format" const. * python/python.c (gdbpy_parse_and_eval): Do not make a copy of the expression string.
2013-03-12 18:39:45 +01:00
++p;
incl_flag = 1;
}
* ada-lang.c (ada_read_renaming_var_value): Pass const pointer to expression string to parse_exp_1. (create_excep_cond_exprs): Likewise. * ax-gdb.c (agent_eval_command_one): Likewise. (maint_agent_printf_command): Likewise. Constify much of the string handling/parsing. * breakpoint.c (set_breakpoint_condition): Pass const pointer to expression string to parse_exp_1. (update_watchpoint): Likewise. (parse_cmd_to_aexpr): Constify string handling. Pass const pointer to parse_exp_1. (init_breakpoint_sal): Pass const pointer to parse_exp_1. (find_condition_and_thread): Likewise. Make TOK const. (watch_command_1): Make "arg" const. Constify string handling. Copy the expression string instead of changing the input string. (update_breakpoint_location): Pass const pointer to parse_exp_1. * eval.c (parse_and_eval_address): Make "exp" const. (parse_to_comma_and_eval): Make "expp" const. (parse_and_eval): Make "exp" const. * expression.h (parse_expression): Make argument const. (parse_exp_1): Make first argument const. * findcmd.c (parse_find_args): Treat "args" as const. * linespec.c (parse_linespec): Pass const pointer to linespec_expression_to_pc. (linespec_expression_to_pc): Make "exp_ptr" const. * parse.c (parse_exp_1): Make "stringptr" const. Make a copy of the expression to pass to parse_exp_in_context until this whole interface can be constified. (parse_expression): Make "string" const. * printcmd.c (ui_printf): Treat "arg" as const. Handle const strings. * tracepoint.c (validate_actionline): Pass const pointer to all calls to parse_exp_1. (encode_actions_1): Likewise. * value.h (parse_to_comma_and_eval): Make argument const. (parse_and_eval_address): Likewise. (parse_and_eval): Likewise. * varobj.c (varobj_create): Pass const pointer to parse_exp_1. (varobj_set_value): Likewise. * cli/cli-cmds.c (disassemble_command): Treat "arg" as const and constify string handling. Pass const pointers to parse_and_eval_address and parse_to_comman_and_eval. * cli/cli-utils.c (skip_to_space): Rename to ... (skip_to_space_const): ... this. Handle const strings. * cli/cli-utils.h (skip_to_space): Turn into macro which invokes skip_to_space_const. (skip_to_space_const): Declare. * common/format.c (parse_format_string): Make "arg" const. Handle const strings. * common/format.h (parse_format_string): Make "arg" const. * gdbserver/ax.c (ax_printf): Make "format" const. * python/python.c (gdbpy_parse_and_eval): Do not make a copy of the expression string.
2013-03-12 18:39:45 +01:00
high = parse_and_eval_address (p);
if (incl_flag)
high += low;
}
Disassemble blocks with non-contiguous ranges This patch adds support for disassembly of blocks with non-contiguous ranges. These blocks are printed as follows: (gdb) disassemble foo Dump of assembler code for function foo: Address range 0x401136 to 0x401151: 0x0000000000401136 <+0>: push %rbp 0x0000000000401137 <+1>: mov %rsp,%rbp 0x000000000040113a <+4>: callq 0x401134 <bar> 0x000000000040113f <+9>: mov 0x2eef(%rip),%eax # 0x404034 <e> 0x0000000000401145 <+15>: test %eax,%eax 0x0000000000401147 <+17>: je 0x40114e <foo+24> 0x0000000000401149 <+19>: callq 0x401128 <foo+4294967282> 0x000000000040114e <+24>: nop 0x000000000040114f <+25>: pop %rbp 0x0000000000401150 <+26>: retq Address range 0x401128 to 0x401134: 0x0000000000401128 <+-14>: push %rbp 0x0000000000401129 <+-13>: mov %rsp,%rbp 0x000000000040112c <+-10>: callq 0x401126 <baz> 0x0000000000401131 <+-5>: nop 0x0000000000401132 <+-4>: pop %rbp 0x0000000000401133 <+-3>: retq End of assembler dump. This is an actual dump from the test case that I constructed for this work. The ranges are printed in the order encountered in the debug info. For the above example, note that the second range occupies lower addresses than the first range. Functions with contiguous ranges are still printed as follows: (gdb) disassemble main Dump of assembler code for function main: 0x0000000000401151 <+0>: push %rbp 0x0000000000401152 <+1>: mov %rsp,%rbp 0x0000000000401155 <+4>: callq 0x401136 <foo> 0x000000000040115a <+9>: mov $0x0,%eax 0x000000000040115f <+14>: pop %rbp 0x0000000000401160 <+15>: retq End of assembler dump. gdb/ChangeLog: * cli/cli-cmds.c (block.h): Include. (print_disassembly): Handle printing of non-contiguous blocks. (disassemble_current_function): Likewise. (disassemble_command): Likewise.
2018-08-24 01:00:49 +02:00
print_disassembly (gdbarch, name, low, high, block, flags);
}
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
make_command (const char *arg, int from_tty)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
if (arg == 0)
shell_escape ("make", from_tty);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
else
{
std::string cmd = std::string ("make ") + arg;
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
shell_escape (cmd.c_str (), from_tty);
}
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
}
static void
show_user (const char *args, int from_tty)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
struct cmd_list_element *c;
if (args)
{
Constify strings in tracepoint.c, lookup_cmd and the completers. This is sort of a continuation of Keith's parse_exp_1 constification patch. It started out by undoing these bits: @@ -754,9 +754,12 @@ validate_actionline (char **line, struct tmp_p = p; for (loc = t->base.loc; loc; loc = loc->next) { - p = tmp_p; - exp = parse_exp_1 (&p, loc->address, + const char *q; + + q = tmp_p; + exp = parse_exp_1 (&q, loc->address, block_for_pc (loc->address), 1); + p = (char *) q; and progressively making more things const upwards, fixing fallout, rinse repeat, until GDB built again (--enable-targets=all). That ended up constifying lookup_cmd/add_cmd and (lots of) friends, and the completers. I didn't try to constify the command hooks themselves, because I know upfront there are commands that write to the command string argument, and I think I managed to stop at a nice non-hacky split point already. I think the only non-really-super-obvious changes are tracepoint.c:validate_actionline, and tracepoint.c:trace_dump_actions. The rest is just mostly about 'char *' => 'const char *', 'char **'=> 'const char **', and the occasional (e.g., deprecated_cmd_warning) case of 'char **'=> 'const char *', where/when I noticed that nothing actually cares about the pointer to pointer output. Tested on x86_64 Fedora 17, native and gdbserver. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * ada-lang.c (struct add_partial_datum) <text, text0, word>: Make fields const. (ada_make_symbol_completion_list): Make "text0" parameter const. * ax-gdb.c (agent_eval_command_one): Make "exp" parameter const. * breakpoint.c (condition_completer): Make "text" and "word" parameters const. Adjust. (check_tracepoint_command): Adjust to validate_actionline prototype change. (catch_syscall_completer): Make "text" and "word" parameters const. * cli/cli-cmds.c (show_user): Make "comname" local const. (valid_command_p): Make "command" parameter const. (alias_command): Make "alias_prefix" and "command_prefix" locals const. * cli/cli-decode.c (add_cmd): Make "name" parameter const. (add_alias_cmd): Make "name" and "oldname" parameters const. Adjust. No longer make copy of OLDNAME. (add_prefix_cmd, add_abbrev_prefix_cmd, add_set_or_show_cmd) (add_setshow_cmd_full, add_setshow_enum_cmd) (add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd) (add_setshow_filename_cmd, add_setshow_string_cmd) (add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd) (delete_cmd, add_info, add_info_alias, add_com, add_com_alias): Make "name" parameter const. (help_cmd): Rename "command" parameter to "arg". New const local "command". (find_cmd): Make "command" parameter const. (lookup_cmd_1): Make "text" parameter pointer to const. Adjust to deprecated_cmd_warning prototype change. (undef_cmd_error): Make "cmdtype" parameter const. (lookup_cmd): Make "line" parameter const. (deprecated_cmd_warning): Change type of "text" parameter to pointer to const char, from pointer to pointer to char. Adjust. (lookup_cmd_composition): Make "text" parameter const. (complete_on_cmdlist, complete_on_enum): Make "text" and "word" parameters const. * cli/cli-decode.h (struct cmd_list_element) <name>: Make field const. * cli/cli-script.c (validate_comname): Make "tem" local const. (define_command): New const local "tem_c". Use it in calls to lookup_cmd. (document_command): Make "tem" and "comfull" locals const. (show_user_1): Make "prefix" and "name" parameters const. * cli-script.h (show_user_1): Make "prefix" and "name" parameters const. * command.h (add_cmd, add_alias_cmd, add_prefix_cmd) (add_abbrev_prefix_cmd, completer_ftype, lookup_cmd, lookup_cmd_1) (deprecated_cmd_warning, lookup_cmd_composition, add_com) (add_com_alias, add_info, add_info_alias, complete_on_cmdlist) (complete_on_enum, add_setshow_enum_cmd) (add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd) (add_setshow_filename_cmd, add_setshow_string_cmd) (add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd): Change prototypes, constifying strings. * completer.c (noop_completer, filename_completer): Make "text" and "prefix" parameters const. (location_completer, expression_completer) (complete_line_internal): Make "text" and "prefix" parameters const and adjust. (command_completer, signal_completer): Make "text" and "prefix" parameters const. * completer.h (noop_completer, filename_completer) (expression_completer, location_completer, command_completer) (signal_completer): Change prototypes. * corefile.c (complete_set_gnutarget): Make "text" and "word" parameters const. * cp-abi.c (cp_abi_completer): Likewise. * expression.h (parse_expression_for_completion): Change prototype. * f-lang.c (f_make_symbol_completion_list): Make "text" and "word" parameters const. * infcmd.c (_initialize_infcmd): Make "cmd_name" local const. * infrun.c (handle_completer): Make "text" and "word" parameters const. * interps.c (interpreter_completer): Make "text" and "word" parameters const. * language.h (struct language_defn) <la_make_symbol_completion_list>: Make "text" and "word" parameters const. * parse.c (parse_exp_1): Move const hack to parse_exp_in_context. (parse_exp_in_context): Rename to ... (parse_exp_in_context_1): ... this. (parse_exp_in_context): Reimplement, with const hack from parse_exp_1. (parse_expression_for_completion): Make "string" parameter const. * printcmd.c (decode_format): Make "string_ptr" parameter pointer to pointer to const char. Adjust. (print_command_1): Make "exp" parameter const. (output_command): Rename to ... (output_command_const): ... this. Make "exp" parameter const. (output_command): Reimplement. (x_command): Adjust. (display_command): Rename "exp" parameter to "arg". New "exp" local, const version of "arg". * python/py-auto-load.c (gdbpy_initialize_auto_load): Make "cmd_name" local const. * python/py-cmd.c (cmdpy_destroyer): Cast const away in xfree call. (cmdpy_completer): Make "text" and "word" parameters const. (gdbpy_parse_command_name): Make "prefix_text2" local const. * python/py-param.c (add_setshow_generic): Make "tmp_name" local const. * remote.c (_initialize_remote): Make "cmd_name" local const. * symtab.c (language_search_unquoted_string): Make "text" and "p" parameters const. Adjust. (completion_list_add_fields): Make "sym_text", "text" and "word" parameters const. (struct add_name_data) <sym_text, text, word>: Make fields const. (default_make_symbol_completion_list_break_on): Make "text" and "word" parameters const. Adjust locals. (default_make_symbol_completion_list) (make_symbol_completion_list, make_symbol_completion_type) (make_symbol_completion_list_fn): Make "text" and "word" parameters const. (make_file_symbol_completion_list): Make "text", "word" and "srcfile" parameters const. Adjust locals. (add_filename_to_list): Make "text" and "word" parameters const. (struct add_partial_filename_data) <text, word>: Make fields const. (make_source_files_completion_list): Make "text" and "word" parameters const. * symtab.h (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_type enum type_code) (make_symbol_completion_list_fn make_file_symbol_completion_list) (make_source_files_completion_list): Change prototype. * top.c (execute_command): Adjust to pass pointer to pointer to const char to lookup_cmd, and to deprecated_cmd_warning prototype change. (set_verbose): Make "cmdname" local const. * tracepoint.c (decode_agent_options): Make "exp" parameter const, and adjust. (validate_actionline): Make "line" parameter a pointer to const char, and adjust. (encode_actions_1): Make "action_exp" local const, and adjust. (encode_actions): Adjust. (replace_comma): Delete. (trace_dump_actions): Make "action_exp" and "next_comma" locals const, and adjust. Don't frob the action string while splitting it at commas. Instead, make a copy of each split substring in turn. (trace_dump_command): Adjust to validate_actionline prototype change. * tracepoint.h (decode_agent_options, decode_agent_options) (encode_actions, validate_actionline): Change prototypes. * valprint.h (output_command): Delete declaration. (output_command_const): Declare. * value.c (function_destroyer): Cast const away in xfree call.
2013-03-13 19:34:55 +01:00
const char *comname = args;
c = lookup_cmd (&comname, cmdlist, "", 0, 1);
if (!cli_user_command_p (c))
2005-02-10 Andrew Cagney <cagney@gnu.org> Mark up all error and warning messages. * ada-lang.c, amd64-tdep.c, arch-utils.c, breakpoint.c: Update. * bsd-kvm.c, bsd-uthread.c, coff-solib.h, coffread.c: Update. * core-aout.c, core-regset.c, corefile.c, corelow.c: Update. * cp-abi.c, cp-support.c, cp-valprint.c, cris-tdep.c: Update. * dbxread.c, demangle.c, doublest.c, dsrec.c: Update. * dve3900-rom.c, dwarf2expr.c, dwarf2loc.c: Update. * dwarf2read.c, dwarfread.c, elfread.c, eval.c: Update. * event-top.c, exec.c, expprint.c, f-lang.c: Update. * f-typeprint.c, f-valprint.c, fbsd-nat.c, findvar.c: Update. * frame.c, frv-linux-tdep.c, gcore.c, gdbtypes.c: Update. * gnu-nat.c, gnu-v2-abi.c, gnu-v3-abi.c, go32-nat.c: Update. * hpacc-abi.c, hppa-hpux-nat.c, hppa-hpux-tdep.c: Update. * hppa-linux-nat.c, hppa-linux-tdep.c, hppa-tdep.c: Update. * hpread.c, hpux-thread.c, i386-linux-nat.c: Update. * i386-linux-tdep.c, i386-tdep.c, i386bsd-nat.c: Update. * i386gnu-nat.c, i387-tdep.c, ia64-linux-nat.c: Update. * ia64-tdep.c, inf-child.c, inf-ptrace.c, inf-ttrace.c: Update. * infcall.c, infcmd.c, inflow.c, infptrace.c, infrun.c: Update. * inftarg.c, interps.c, irix5-nat.c, jv-lang.c: Update. * kod-cisco.c, kod.c, language.c, libunwind-frame.c: Update. * linespec.c, linux-nat.c, linux-thread-db.c, m2-lang.c: Update. * m32r-rom.c, m68hc11-tdep.c, m68k-tdep.c: Update. * m68klinux-nat.c, macrocmd.c, macroexp.c, main.c: Update. * maint.c, mdebugread.c, mem-break.c, memattr.c: Update. * mips-linux-tdep.c, mips-tdep.c, mipsread.c, monitor.c: Update. * nlmread.c, nto-procfs.c, objc-lang.c, objfiles.c: Update. * observer.c, ocd.c, p-lang.c, p-typeprint.c: Update. * p-valprint.c, pa64solib.c, parse.c, ppc-linux-tdep.c: Update. * ppcnbsd-tdep.c, printcmd.c, procfs.c, remote-e7000.c: Update. * remote-fileio.c, remote-m32r-sdi.c, remote-rdi.c: Update. * remote-rdp.c, remote-sim.c, remote-st.c: Update. * remote-utils.c, remote-utils.h, remote.c: Update. * rom68k-rom.c, rs6000-nat.c, s390-tdep.c, scm-lang.c: Update. * ser-e7kpc.c, ser-tcp.c, ser-unix.c, sh-tdep.c: Update. * sh3-rom.c, shnbsd-tdep.c, sol-thread.c, solib-aix5.c: Update. * solib-frv.c, solib-irix.c, solib-osf.c, solib-pa64.c: Update. * solib-som.c, solib-sunos.c, solib-svr4.c, solib.c: Update. * somread.c, somsolib.c, source.c, stabsread.c: Update. * stack.c, std-regs.c, symfile-mem.c, symfile.c: Update. * symmisc.c, symtab.c, target.c, thread.c, top.c: Update. * tracepoint.c, trad-frame.c, typeprint.c, utils.c: Update. * uw-thread.c, valarith.c, valops.c, valprint.c: Update. * value.c, varobj.c, version.in, win32-nat.c, wince.c: Update. * xcoffread.c, xcoffsolib.c, cli/cli-cmds.c: Update. * cli/cli-decode.c, cli/cli-dump.c, cli/cli-logging.c: Update. * cli/cli-script.c, cli/cli-setshow.c, mi/mi-cmd-break.c: Update. * mi/mi-cmd-disas.c, mi/mi-cmd-env.c, mi/mi-cmd-file.c: Update. * mi/mi-cmd-stack.c, mi/mi-cmd-var.c, mi/mi-getopt.c: Update. * mi/mi-symbol-cmds.c, tui/tui-layout.c, tui/tui-stack.c: Update. * tui/tui-win.c: Update.
2005-02-11 05:06:14 +01:00
error (_("Not a user command."));
show_user_1 (c, "", args, gdb_stdout);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
}
else
{
for (c = cmdlist; c; c = c->next)
{
if (cli_user_command_p (c) || c->prefixlist != NULL)
show_user_1 (c, "", c->name, gdb_stdout);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
}
}
}
/* Search through names of commands and documentations for a certain
regular expression. */
static void
apropos_command (const char *arg, int from_tty)
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
bool verbose = arg && check_for_argument (&arg, "-v", 2);
if (arg == NULL || *arg == '\0')
error (_("REGEXP string is empty"));
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
compiled_regex pattern (arg, REG_ICASE,
Introduce compiled_regex, eliminate make_regfree_cleanup This patch replaces compile_rx_or_error and make_regfree_cleanup with a class that wraps a regex_t. gdb/ChangeLog: 2017-06-07 Pedro Alves <palves@redhat.com> * Makefile.in (SFILES): Add gdb_regex.c. (COMMON_OBS): Add gdb_regex.o. * ada-lang.c (ada_add_standard_exceptions) (ada_add_exceptions_from_frame, name_matches_regex) (ada_add_global_exceptions, ada_exceptions_list_1): Change regex parameter type to compiled_regex. Adjust. (ada_exceptions_list): Use compiled_regex. * break-catch-throw.c (exception_catchpoint::pattern): Now a std::unique_ptr<compiled_regex>. (exception_catchpoint::~exception_catchpoint): Remove regfree call. (check_status_exception_catchpoint): Adjust to use compiled_regex. (handle_gnu_v3_exceptions): Adjust to use compiled_regex. * breakpoint.c (solib_catchpoint::compiled): Now a std::unique_ptr<compiled_regex>. (solib_catchpoint::~solib_catchpoint): Remove regfree call. (check_status_catch_solib): Adjust to use compiled_regex. (add_solib_catchpoint): Adjust to use compiled_regex. * cli/cli-cmds.c (apropos_command): Use compiled_regex. * cli/cli-decode.c (apropos_cmd): Change regex parameter to compiled_regex reference. Adjust to use it. * cli/cli-decode.h: Remove struct re_pattern_buffer forward declaration. Include "gdb_regex.h". (apropos_cmd): Change regex parameter to compiled_regex reference. * gdb_regex.c: New file. * gdb_regex.h (make_regfree_cleanup, get_regcomp_error): Delete declarations. (class compiled_regex): New. * linux-tdep.c: Include "common/gdb_optional.h". (struct mapping_regexes): New, factored out from mapping_is_anonymous_p, and adjusted to use compiled_regex. (mapping_is_anonymous_p): Use mapping_regexes wrapped in a gdb::optional and remove cleanups. Adjust to compiled_regex. * probe.c: Include "common/gdb_optional.h". (collect_probes): Use compiled_regex and gdb::optional and remove cleanups. * skip.c: Include "common/gdb_optional.h". (skiplist_entry::compiled_function_regexp): Now a gdb::optional<compiled_regex>. (skiplist_entry::compiled_function_regexp_is_valid): Delete field. (free_skiplist_entry): Remove regfree call. (compile_skip_regexp, skip_rfunction_p): Adjust to use compiled_regex and gdb::optional. * symtab.c: Include "common/gdb_optional.h". (search_symbols): Use compiled_regex and gdb::optional. * utils.c (do_regfree_cleanup, make_regfree_cleanup) (get_regcomp_error, compile_rx_or_error): Delete. Some bits moved to gdb_regex.c.
2017-06-07 15:21:40 +02:00
_("Error in regular expression"));
apropos_cmd (gdb_stdout, cmdlist, verbose, pattern, "");
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
}
/* Subroutine of alias_command to simplify it.
Return the first N elements of ARGV flattened back to a string
with a space separating each element.
ARGV may not be NULL.
This does not take care of quoting elements in case they contain spaces
on purpose. */
static std::string
argv_to_string (char **argv, int n)
{
int i;
std::string result;
gdb_assert (argv != NULL);
gdb_assert (n >= 0 && n <= countargv (argv));
for (i = 0; i < n; ++i)
{
if (i > 0)
result += " ";
result += argv[i];
}
return result;
}
/* Subroutine of alias_command to simplify it.
Return true if COMMAND exists, unambiguously. Otherwise false. */
static bool
Constify strings in tracepoint.c, lookup_cmd and the completers. This is sort of a continuation of Keith's parse_exp_1 constification patch. It started out by undoing these bits: @@ -754,9 +754,12 @@ validate_actionline (char **line, struct tmp_p = p; for (loc = t->base.loc; loc; loc = loc->next) { - p = tmp_p; - exp = parse_exp_1 (&p, loc->address, + const char *q; + + q = tmp_p; + exp = parse_exp_1 (&q, loc->address, block_for_pc (loc->address), 1); + p = (char *) q; and progressively making more things const upwards, fixing fallout, rinse repeat, until GDB built again (--enable-targets=all). That ended up constifying lookup_cmd/add_cmd and (lots of) friends, and the completers. I didn't try to constify the command hooks themselves, because I know upfront there are commands that write to the command string argument, and I think I managed to stop at a nice non-hacky split point already. I think the only non-really-super-obvious changes are tracepoint.c:validate_actionline, and tracepoint.c:trace_dump_actions. The rest is just mostly about 'char *' => 'const char *', 'char **'=> 'const char **', and the occasional (e.g., deprecated_cmd_warning) case of 'char **'=> 'const char *', where/when I noticed that nothing actually cares about the pointer to pointer output. Tested on x86_64 Fedora 17, native and gdbserver. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * ada-lang.c (struct add_partial_datum) <text, text0, word>: Make fields const. (ada_make_symbol_completion_list): Make "text0" parameter const. * ax-gdb.c (agent_eval_command_one): Make "exp" parameter const. * breakpoint.c (condition_completer): Make "text" and "word" parameters const. Adjust. (check_tracepoint_command): Adjust to validate_actionline prototype change. (catch_syscall_completer): Make "text" and "word" parameters const. * cli/cli-cmds.c (show_user): Make "comname" local const. (valid_command_p): Make "command" parameter const. (alias_command): Make "alias_prefix" and "command_prefix" locals const. * cli/cli-decode.c (add_cmd): Make "name" parameter const. (add_alias_cmd): Make "name" and "oldname" parameters const. Adjust. No longer make copy of OLDNAME. (add_prefix_cmd, add_abbrev_prefix_cmd, add_set_or_show_cmd) (add_setshow_cmd_full, add_setshow_enum_cmd) (add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd) (add_setshow_filename_cmd, add_setshow_string_cmd) (add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd) (delete_cmd, add_info, add_info_alias, add_com, add_com_alias): Make "name" parameter const. (help_cmd): Rename "command" parameter to "arg". New const local "command". (find_cmd): Make "command" parameter const. (lookup_cmd_1): Make "text" parameter pointer to const. Adjust to deprecated_cmd_warning prototype change. (undef_cmd_error): Make "cmdtype" parameter const. (lookup_cmd): Make "line" parameter const. (deprecated_cmd_warning): Change type of "text" parameter to pointer to const char, from pointer to pointer to char. Adjust. (lookup_cmd_composition): Make "text" parameter const. (complete_on_cmdlist, complete_on_enum): Make "text" and "word" parameters const. * cli/cli-decode.h (struct cmd_list_element) <name>: Make field const. * cli/cli-script.c (validate_comname): Make "tem" local const. (define_command): New const local "tem_c". Use it in calls to lookup_cmd. (document_command): Make "tem" and "comfull" locals const. (show_user_1): Make "prefix" and "name" parameters const. * cli-script.h (show_user_1): Make "prefix" and "name" parameters const. * command.h (add_cmd, add_alias_cmd, add_prefix_cmd) (add_abbrev_prefix_cmd, completer_ftype, lookup_cmd, lookup_cmd_1) (deprecated_cmd_warning, lookup_cmd_composition, add_com) (add_com_alias, add_info, add_info_alias, complete_on_cmdlist) (complete_on_enum, add_setshow_enum_cmd) (add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd) (add_setshow_filename_cmd, add_setshow_string_cmd) (add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd): Change prototypes, constifying strings. * completer.c (noop_completer, filename_completer): Make "text" and "prefix" parameters const. (location_completer, expression_completer) (complete_line_internal): Make "text" and "prefix" parameters const and adjust. (command_completer, signal_completer): Make "text" and "prefix" parameters const. * completer.h (noop_completer, filename_completer) (expression_completer, location_completer, command_completer) (signal_completer): Change prototypes. * corefile.c (complete_set_gnutarget): Make "text" and "word" parameters const. * cp-abi.c (cp_abi_completer): Likewise. * expression.h (parse_expression_for_completion): Change prototype. * f-lang.c (f_make_symbol_completion_list): Make "text" and "word" parameters const. * infcmd.c (_initialize_infcmd): Make "cmd_name" local const. * infrun.c (handle_completer): Make "text" and "word" parameters const. * interps.c (interpreter_completer): Make "text" and "word" parameters const. * language.h (struct language_defn) <la_make_symbol_completion_list>: Make "text" and "word" parameters const. * parse.c (parse_exp_1): Move const hack to parse_exp_in_context. (parse_exp_in_context): Rename to ... (parse_exp_in_context_1): ... this. (parse_exp_in_context): Reimplement, with const hack from parse_exp_1. (parse_expression_for_completion): Make "string" parameter const. * printcmd.c (decode_format): Make "string_ptr" parameter pointer to pointer to const char. Adjust. (print_command_1): Make "exp" parameter const. (output_command): Rename to ... (output_command_const): ... this. Make "exp" parameter const. (output_command): Reimplement. (x_command): Adjust. (display_command): Rename "exp" parameter to "arg". New "exp" local, const version of "arg". * python/py-auto-load.c (gdbpy_initialize_auto_load): Make "cmd_name" local const. * python/py-cmd.c (cmdpy_destroyer): Cast const away in xfree call. (cmdpy_completer): Make "text" and "word" parameters const. (gdbpy_parse_command_name): Make "prefix_text2" local const. * python/py-param.c (add_setshow_generic): Make "tmp_name" local const. * remote.c (_initialize_remote): Make "cmd_name" local const. * symtab.c (language_search_unquoted_string): Make "text" and "p" parameters const. Adjust. (completion_list_add_fields): Make "sym_text", "text" and "word" parameters const. (struct add_name_data) <sym_text, text, word>: Make fields const. (default_make_symbol_completion_list_break_on): Make "text" and "word" parameters const. Adjust locals. (default_make_symbol_completion_list) (make_symbol_completion_list, make_symbol_completion_type) (make_symbol_completion_list_fn): Make "text" and "word" parameters const. (make_file_symbol_completion_list): Make "text", "word" and "srcfile" parameters const. Adjust locals. (add_filename_to_list): Make "text" and "word" parameters const. (struct add_partial_filename_data) <text, word>: Make fields const. (make_source_files_completion_list): Make "text" and "word" parameters const. * symtab.h (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_type enum type_code) (make_symbol_completion_list_fn make_file_symbol_completion_list) (make_source_files_completion_list): Change prototype. * top.c (execute_command): Adjust to pass pointer to pointer to const char to lookup_cmd, and to deprecated_cmd_warning prototype change. (set_verbose): Make "cmdname" local const. * tracepoint.c (decode_agent_options): Make "exp" parameter const, and adjust. (validate_actionline): Make "line" parameter a pointer to const char, and adjust. (encode_actions_1): Make "action_exp" local const, and adjust. (encode_actions): Adjust. (replace_comma): Delete. (trace_dump_actions): Make "action_exp" and "next_comma" locals const, and adjust. Don't frob the action string while splitting it at commas. Instead, make a copy of each split substring in turn. (trace_dump_command): Adjust to validate_actionline prototype change. * tracepoint.h (decode_agent_options, decode_agent_options) (encode_actions, validate_actionline): Change prototypes. * valprint.h (output_command): Delete declaration. (output_command_const): Declare. * value.c (function_destroyer): Cast const away in xfree call.
2013-03-13 19:34:55 +01:00
valid_command_p (const char *command)
{
struct cmd_list_element *c;
c = lookup_cmd_1 (& command, cmdlist, NULL, 1);
if (c == NULL || c == (struct cmd_list_element *) -1)
return false;
/* This is the slightly tricky part.
lookup_cmd_1 will return a pointer to the last part of COMMAND
to match, leaving COMMAND pointing at the remainder. */
while (*command == ' ' || *command == '\t')
++command;
return *command == '\0';
}
/* Called when "alias" was incorrectly used. */
static void
alias_usage_error (void)
{
error (_("Usage: alias [-a] [--] ALIAS = COMMAND"));
}
/* Make an alias of an existing command. */
static void
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
alias_command (const char *args, int from_tty)
{
int i, alias_argc, command_argc;
int abbrev_flag = 0;
Constify add_com This changes add_com to take a cmd_const_cfunc_ftype, and then fixes up all the command implementations. In most cases this is trivial. In a couple of places I had to again introduce a temporary non-const overload. These overloads will be removed when add_info is constified. gdb/ChangeLog 2017-11-07 Tom Tromey <tom@tromey.com> * solib.h (no_shared_libraries): Constify. * frame.h (return_command): Constify. * cli/cli-cmds.h (quit_command): Constify. * top.h (quit_command, execute_command): Constify. * target.h (flash_erase_command): Constify. * inferior.h (set_inferior_args, attach_command): Constify. * tracepoint.h (start_tracing, stop_tracing): Constify. * breakpoint.h (break_command, tbreak_command) (hbreak_command_wrapper, thbreak_command_wrapper) (rbreak_command_wrapper, watch_command_wrapper) (awatch_command_wrapper, rwatch_command_wrapper) (get_tracepoint_by_number): Constify. * symtab.c (info_variables_command, rbreak_command) (symtab_symbol_info): Constify. (info_variables_command): Add non-const overload. * top.c (dont_repeat_command): Constify. * breakpoint.c (ignore_command, commands_command) (condition_command, tbreak_command, hbreak_command) (thbreak_command, clear_command, break_command) (info_breakpoints_command, watch_command, rwatch_command) (awatch_command, trace_command, ftrace_command, strace_command) (trace_pass_command, break_range_command, dprintf_command) (agent_printf_command, get_tracepoint_by_number) (watch_maybe_just_location, trace_pass_command): Constify. (info_breakpoints_command): Add non-const overload. * tracefile.c (tsave_command): Constify. * infcmd.c (attach_command, disconnect_command, signal_command) (queue_signal_command, stepi_command, nexti_command) (finish_command, next_command, step_command, until_command) (advance_command, jump_command, continue_command, run_command) (start_command, starti_command, interrupt_command) (run_command_1, set_inferior_args, step_1): Constify. * inferior.c (add_inferior_command, remove_inferior_command) (clone_inferior_command): Constify. * linux-fork.c (checkpoint_command, restart_command): Constify. * windows-nat.c (signal_event_command): Constify. * guile/guile.c (guile_repl_command, guile_command): Constify. * printcmd.c (x_command, display_command, printf_command) (output_command, set_command, call_command, print_command) (eval_command): Constify. (non_const_set_command): Remove. (_initialize_printcmd): Update. * source.c (forward_search_command, reverse_search_command): Constify. * jit.c (jit_reader_load_command, jit_reader_unload_command): Constify. * infrun.c (handle_command): Constify. * memattr.c (mem_command): Constify. * stack.c (return_command, up_command, up_silently_command) (down_command, down_silently_command, frame_command) (backtrace_command, func_command, backtrace_command_1): Constify. (backtrace_command): Add non-const overload. * remote-sim.c (simulator_command): Constify. * exec.c (set_section_command): Constify. * tracepoint.c (tdump_command, trace_variable_command) (tstatus_command, tstop_command, tstart_command) (end_actions_pseudocommand, while_stepping_pseudocommand) (collect_pseudocommand, teval_pseudocommand, actions_command) (start_tracing, stop_tracing): Constify. * value.c (init_if_undefined_command): Constify. * tui/tui-stack.c (tui_update_command): Constify. * tui/tui-win.c (tui_refresh_all_command) (tui_set_tab_width_command, tui_set_win_height_command) (tui_set_focus_command, tui_scroll_forward_command) (tui_scroll_backward_command, tui_scroll_left_command) (tui_scroll_right_command, parse_scrolling_args, tui_set_focus) (tui_set_win_height): Constify. * tui/tui-layout.c (tui_layout_command): Constify. * procfs.c (proc_trace_syscalls, proc_trace_sysentry_cmd) (proc_trace_sysexit_cmd, proc_untrace_sysentry_cmd) (proc_untrace_sysexit_cmd): Constify. * remote.c (threadlist_test_cmd, threadinfo_test_cmd) (threadset_test_cmd, threadlist_update_test_cmd) (threadalive_test): Constify. * objc-lang.c (print_object_command): Constify. * command.h (add_com): Constify. * cli/cli-dump.c (restore_command): Constify. * cli/cli-cmds.c (pwd_command, echo_command, quit_command) (help_command, complete_command, shell_command, edit_command) (list_command, disassemble_command, make_command) (apropos_command, alias_command): Constify. * cli/cli-script.c (document_command, define_command) (while_command, if_command, validate_comname): Constify. * cli/cli-decode.c (struct cmd_list_element): Change type of "fun". * target.c (do_monitor_command, flash_erase_command): Constify. * regcache.c (reg_flush_command): Constify. * reverse.c (reverse_step, reverse_next, reverse_stepi) (reverse_nexti, reverse_continue, reverse_finish) (save_bookmark_command, goto_bookmark_command) (exec_reverse_once): Constify. * python/python.c (python_interactive_command, python_command): Constify. * typeprint.c (ptype_command, whatis_command, whatis_exp): Constify. * solib.c (sharedlibrary_command, no_shared_libraries): Constify. * gcore.c (gcore_command): Constify.
2017-10-11 23:43:01 +02:00
const char *equals;
const char *alias, *command;
if (args == NULL || strchr (args, '=') == NULL)
alias_usage_error ();
Introduce gdb_argv, a class wrapper for buildargv This introduces gdb_argv, a class wrapping an "argv" pointer; that is, a pointer to a NULL-terminated array of char*, where both the array and each non-NULL element in the array are xmalloc'd. This patch then changes most users of gdb_buildargv to use gdb_argv instead. ChangeLog 2017-08-03 Tom Tromey <tom@tromey.com> * utils.h (struct gdb_argv_deleter): New. (gdb_argv): New class. * utils.c (gdb_argv::reset): New method. * tracepoint.c (delete_trace_variable_command): Use gdb_argv. * tracefile.c (tsave_command): Use gdb_argv. * top.c (new_ui_command): Use gdb_argv. * symmisc.c (maintenance_print_symbols) (maintenance_print_msymbols, maintenance_expand_symtabs): Use gdb_argv. * symfile.c (symbol_file_command, generic_load) (remove_symbol_file_command): Use gdb_argv. * stack.c (backtrace_command): Use gdb_argv. * source.c (add_path, show_substitute_path_command) (unset_substitute_path_command, set_substitute_path_command): Use gdb_argv. * skip.c (skip_command): Use gdb_argv. Use gdb_buildargv. * ser-mingw.c (pipe_windows_open): Use gdb_argv. * remote.c (extended_remote_run, remote_put_command) (remote_get_command, remote_delete_command): Use gdb_argv. * remote-sim.c (gdbsim_load, gdbsim_create_inferior) (gdbsim_open): Use gdb_argv. * python/py-cmd.c (gdbpy_string_to_argv): Use gdb_argv. * psymtab.c (maintenance_print_psymbols): Use gdb_argv. * procfs.c (procfs_info_proc): Use gdb_argv. * interps.c (interpreter_exec_cmd): Use gdb_argv. * infrun.c (handle_command): Use gdb_argv. * inferior.c (add_inferior_command, clone_inferior_command): Use gdb_argv. * guile/scm-string.c (gdbscm_string_to_argv): Use gdb_argv. * exec.c (exec_file_command): Use gdb_argv. * cli/cli-cmds.c (alias_command): Use gdb_argv. * compile/compile.c (build_argc_argv): Use gdb_argv.
2017-05-01 07:02:30 +02:00
equals = strchr (args, '=');
std::string args2 (args, equals - args);
gdb_argv built_alias_argv (args2.c_str ());
gdb_argv command_argv (equals + 1);
Introduce gdb_argv, a class wrapper for buildargv This introduces gdb_argv, a class wrapping an "argv" pointer; that is, a pointer to a NULL-terminated array of char*, where both the array and each non-NULL element in the array are xmalloc'd. This patch then changes most users of gdb_buildargv to use gdb_argv instead. ChangeLog 2017-08-03 Tom Tromey <tom@tromey.com> * utils.h (struct gdb_argv_deleter): New. (gdb_argv): New class. * utils.c (gdb_argv::reset): New method. * tracepoint.c (delete_trace_variable_command): Use gdb_argv. * tracefile.c (tsave_command): Use gdb_argv. * top.c (new_ui_command): Use gdb_argv. * symmisc.c (maintenance_print_symbols) (maintenance_print_msymbols, maintenance_expand_symtabs): Use gdb_argv. * symfile.c (symbol_file_command, generic_load) (remove_symbol_file_command): Use gdb_argv. * stack.c (backtrace_command): Use gdb_argv. * source.c (add_path, show_substitute_path_command) (unset_substitute_path_command, set_substitute_path_command): Use gdb_argv. * skip.c (skip_command): Use gdb_argv. Use gdb_buildargv. * ser-mingw.c (pipe_windows_open): Use gdb_argv. * remote.c (extended_remote_run, remote_put_command) (remote_get_command, remote_delete_command): Use gdb_argv. * remote-sim.c (gdbsim_load, gdbsim_create_inferior) (gdbsim_open): Use gdb_argv. * python/py-cmd.c (gdbpy_string_to_argv): Use gdb_argv. * psymtab.c (maintenance_print_psymbols): Use gdb_argv. * procfs.c (procfs_info_proc): Use gdb_argv. * interps.c (interpreter_exec_cmd): Use gdb_argv. * infrun.c (handle_command): Use gdb_argv. * inferior.c (add_inferior_command, clone_inferior_command): Use gdb_argv. * guile/scm-string.c (gdbscm_string_to_argv): Use gdb_argv. * exec.c (exec_file_command): Use gdb_argv. * cli/cli-cmds.c (alias_command): Use gdb_argv. * compile/compile.c (build_argc_argv): Use gdb_argv.
2017-05-01 07:02:30 +02:00
char **alias_argv = built_alias_argv.get ();
while (alias_argv[0] != NULL)
{
Introduce gdb_argv, a class wrapper for buildargv This introduces gdb_argv, a class wrapping an "argv" pointer; that is, a pointer to a NULL-terminated array of char*, where both the array and each non-NULL element in the array are xmalloc'd. This patch then changes most users of gdb_buildargv to use gdb_argv instead. ChangeLog 2017-08-03 Tom Tromey <tom@tromey.com> * utils.h (struct gdb_argv_deleter): New. (gdb_argv): New class. * utils.c (gdb_argv::reset): New method. * tracepoint.c (delete_trace_variable_command): Use gdb_argv. * tracefile.c (tsave_command): Use gdb_argv. * top.c (new_ui_command): Use gdb_argv. * symmisc.c (maintenance_print_symbols) (maintenance_print_msymbols, maintenance_expand_symtabs): Use gdb_argv. * symfile.c (symbol_file_command, generic_load) (remove_symbol_file_command): Use gdb_argv. * stack.c (backtrace_command): Use gdb_argv. * source.c (add_path, show_substitute_path_command) (unset_substitute_path_command, set_substitute_path_command): Use gdb_argv. * skip.c (skip_command): Use gdb_argv. Use gdb_buildargv. * ser-mingw.c (pipe_windows_open): Use gdb_argv. * remote.c (extended_remote_run, remote_put_command) (remote_get_command, remote_delete_command): Use gdb_argv. * remote-sim.c (gdbsim_load, gdbsim_create_inferior) (gdbsim_open): Use gdb_argv. * python/py-cmd.c (gdbpy_string_to_argv): Use gdb_argv. * psymtab.c (maintenance_print_psymbols): Use gdb_argv. * procfs.c (procfs_info_proc): Use gdb_argv. * interps.c (interpreter_exec_cmd): Use gdb_argv. * infrun.c (handle_command): Use gdb_argv. * inferior.c (add_inferior_command, clone_inferior_command): Use gdb_argv. * guile/scm-string.c (gdbscm_string_to_argv): Use gdb_argv. * exec.c (exec_file_command): Use gdb_argv. * cli/cli-cmds.c (alias_command): Use gdb_argv. * compile/compile.c (build_argc_argv): Use gdb_argv.
2017-05-01 07:02:30 +02:00
if (strcmp (alias_argv[0], "-a") == 0)
{
++alias_argv;
abbrev_flag = 1;
}
Introduce gdb_argv, a class wrapper for buildargv This introduces gdb_argv, a class wrapping an "argv" pointer; that is, a pointer to a NULL-terminated array of char*, where both the array and each non-NULL element in the array are xmalloc'd. This patch then changes most users of gdb_buildargv to use gdb_argv instead. ChangeLog 2017-08-03 Tom Tromey <tom@tromey.com> * utils.h (struct gdb_argv_deleter): New. (gdb_argv): New class. * utils.c (gdb_argv::reset): New method. * tracepoint.c (delete_trace_variable_command): Use gdb_argv. * tracefile.c (tsave_command): Use gdb_argv. * top.c (new_ui_command): Use gdb_argv. * symmisc.c (maintenance_print_symbols) (maintenance_print_msymbols, maintenance_expand_symtabs): Use gdb_argv. * symfile.c (symbol_file_command, generic_load) (remove_symbol_file_command): Use gdb_argv. * stack.c (backtrace_command): Use gdb_argv. * source.c (add_path, show_substitute_path_command) (unset_substitute_path_command, set_substitute_path_command): Use gdb_argv. * skip.c (skip_command): Use gdb_argv. Use gdb_buildargv. * ser-mingw.c (pipe_windows_open): Use gdb_argv. * remote.c (extended_remote_run, remote_put_command) (remote_get_command, remote_delete_command): Use gdb_argv. * remote-sim.c (gdbsim_load, gdbsim_create_inferior) (gdbsim_open): Use gdb_argv. * python/py-cmd.c (gdbpy_string_to_argv): Use gdb_argv. * psymtab.c (maintenance_print_psymbols): Use gdb_argv. * procfs.c (procfs_info_proc): Use gdb_argv. * interps.c (interpreter_exec_cmd): Use gdb_argv. * infrun.c (handle_command): Use gdb_argv. * inferior.c (add_inferior_command, clone_inferior_command): Use gdb_argv. * guile/scm-string.c (gdbscm_string_to_argv): Use gdb_argv. * exec.c (exec_file_command): Use gdb_argv. * cli/cli-cmds.c (alias_command): Use gdb_argv. * compile/compile.c (build_argc_argv): Use gdb_argv.
2017-05-01 07:02:30 +02:00
else if (strcmp (alias_argv[0], "--") == 0)
{
++alias_argv;
break;
}
else
break;
}
if (alias_argv[0] == NULL || command_argv[0] == NULL
|| *alias_argv[0] == '\0' || *command_argv[0] == '\0')
alias_usage_error ();
for (i = 0; alias_argv[i] != NULL; ++i)
{
if (! valid_user_defined_cmd_name_p (alias_argv[i]))
{
if (i == 0)
error (_("Invalid command name: %s"), alias_argv[i]);
else
error (_("Invalid command element name: %s"), alias_argv[i]);
}
}
alias_argc = countargv (alias_argv);
Introduce gdb_argv, a class wrapper for buildargv This introduces gdb_argv, a class wrapping an "argv" pointer; that is, a pointer to a NULL-terminated array of char*, where both the array and each non-NULL element in the array are xmalloc'd. This patch then changes most users of gdb_buildargv to use gdb_argv instead. ChangeLog 2017-08-03 Tom Tromey <tom@tromey.com> * utils.h (struct gdb_argv_deleter): New. (gdb_argv): New class. * utils.c (gdb_argv::reset): New method. * tracepoint.c (delete_trace_variable_command): Use gdb_argv. * tracefile.c (tsave_command): Use gdb_argv. * top.c (new_ui_command): Use gdb_argv. * symmisc.c (maintenance_print_symbols) (maintenance_print_msymbols, maintenance_expand_symtabs): Use gdb_argv. * symfile.c (symbol_file_command, generic_load) (remove_symbol_file_command): Use gdb_argv. * stack.c (backtrace_command): Use gdb_argv. * source.c (add_path, show_substitute_path_command) (unset_substitute_path_command, set_substitute_path_command): Use gdb_argv. * skip.c (skip_command): Use gdb_argv. Use gdb_buildargv. * ser-mingw.c (pipe_windows_open): Use gdb_argv. * remote.c (extended_remote_run, remote_put_command) (remote_get_command, remote_delete_command): Use gdb_argv. * remote-sim.c (gdbsim_load, gdbsim_create_inferior) (gdbsim_open): Use gdb_argv. * python/py-cmd.c (gdbpy_string_to_argv): Use gdb_argv. * psymtab.c (maintenance_print_psymbols): Use gdb_argv. * procfs.c (procfs_info_proc): Use gdb_argv. * interps.c (interpreter_exec_cmd): Use gdb_argv. * infrun.c (handle_command): Use gdb_argv. * inferior.c (add_inferior_command, clone_inferior_command): Use gdb_argv. * guile/scm-string.c (gdbscm_string_to_argv): Use gdb_argv. * exec.c (exec_file_command): Use gdb_argv. * cli/cli-cmds.c (alias_command): Use gdb_argv. * compile/compile.c (build_argc_argv): Use gdb_argv.
2017-05-01 07:02:30 +02:00
command_argc = command_argv.count ();
/* COMMAND must exist.
Reconstruct the command to remove any extraneous spaces,
for better error messages. */
Introduce gdb_argv, a class wrapper for buildargv This introduces gdb_argv, a class wrapping an "argv" pointer; that is, a pointer to a NULL-terminated array of char*, where both the array and each non-NULL element in the array are xmalloc'd. This patch then changes most users of gdb_buildargv to use gdb_argv instead. ChangeLog 2017-08-03 Tom Tromey <tom@tromey.com> * utils.h (struct gdb_argv_deleter): New. (gdb_argv): New class. * utils.c (gdb_argv::reset): New method. * tracepoint.c (delete_trace_variable_command): Use gdb_argv. * tracefile.c (tsave_command): Use gdb_argv. * top.c (new_ui_command): Use gdb_argv. * symmisc.c (maintenance_print_symbols) (maintenance_print_msymbols, maintenance_expand_symtabs): Use gdb_argv. * symfile.c (symbol_file_command, generic_load) (remove_symbol_file_command): Use gdb_argv. * stack.c (backtrace_command): Use gdb_argv. * source.c (add_path, show_substitute_path_command) (unset_substitute_path_command, set_substitute_path_command): Use gdb_argv. * skip.c (skip_command): Use gdb_argv. Use gdb_buildargv. * ser-mingw.c (pipe_windows_open): Use gdb_argv. * remote.c (extended_remote_run, remote_put_command) (remote_get_command, remote_delete_command): Use gdb_argv. * remote-sim.c (gdbsim_load, gdbsim_create_inferior) (gdbsim_open): Use gdb_argv. * python/py-cmd.c (gdbpy_string_to_argv): Use gdb_argv. * psymtab.c (maintenance_print_psymbols): Use gdb_argv. * procfs.c (procfs_info_proc): Use gdb_argv. * interps.c (interpreter_exec_cmd): Use gdb_argv. * infrun.c (handle_command): Use gdb_argv. * inferior.c (add_inferior_command, clone_inferior_command): Use gdb_argv. * guile/scm-string.c (gdbscm_string_to_argv): Use gdb_argv. * exec.c (exec_file_command): Use gdb_argv. * cli/cli-cmds.c (alias_command): Use gdb_argv. * compile/compile.c (build_argc_argv): Use gdb_argv.
2017-05-01 07:02:30 +02:00
std::string command_string (argv_to_string (command_argv.get (),
command_argc));
command = command_string.c_str ();
if (! valid_command_p (command))
error (_("Invalid command to alias to: %s"), command);
/* ALIAS must not exist. */
std::string alias_string (argv_to_string (alias_argv, alias_argc));
alias = alias_string.c_str ();
if (valid_command_p (alias))
error (_("Alias already exists: %s"), alias);
/* If ALIAS is one word, it is an alias for the entire COMMAND.
Example: alias spe = set print elements
Otherwise ALIAS and COMMAND must have the same number of words,
and every word except the last must identify the same prefix command;
and the last word of ALIAS is made an alias of the last word of COMMAND.
Example: alias set print elms = set pr elem
Note that unambiguous abbreviations are allowed. */
if (alias_argc == 1)
{
/* add_cmd requires *we* allocate space for name, hence the xstrdup. */
add_com_alias (xstrdup (alias_argv[0]), command, class_alias,
abbrev_flag);
}
else
{
Constify strings in tracepoint.c, lookup_cmd and the completers. This is sort of a continuation of Keith's parse_exp_1 constification patch. It started out by undoing these bits: @@ -754,9 +754,12 @@ validate_actionline (char **line, struct tmp_p = p; for (loc = t->base.loc; loc; loc = loc->next) { - p = tmp_p; - exp = parse_exp_1 (&p, loc->address, + const char *q; + + q = tmp_p; + exp = parse_exp_1 (&q, loc->address, block_for_pc (loc->address), 1); + p = (char *) q; and progressively making more things const upwards, fixing fallout, rinse repeat, until GDB built again (--enable-targets=all). That ended up constifying lookup_cmd/add_cmd and (lots of) friends, and the completers. I didn't try to constify the command hooks themselves, because I know upfront there are commands that write to the command string argument, and I think I managed to stop at a nice non-hacky split point already. I think the only non-really-super-obvious changes are tracepoint.c:validate_actionline, and tracepoint.c:trace_dump_actions. The rest is just mostly about 'char *' => 'const char *', 'char **'=> 'const char **', and the occasional (e.g., deprecated_cmd_warning) case of 'char **'=> 'const char *', where/when I noticed that nothing actually cares about the pointer to pointer output. Tested on x86_64 Fedora 17, native and gdbserver. gdb/ 2013-03-13 Pedro Alves <palves@redhat.com> * ada-lang.c (struct add_partial_datum) <text, text0, word>: Make fields const. (ada_make_symbol_completion_list): Make "text0" parameter const. * ax-gdb.c (agent_eval_command_one): Make "exp" parameter const. * breakpoint.c (condition_completer): Make "text" and "word" parameters const. Adjust. (check_tracepoint_command): Adjust to validate_actionline prototype change. (catch_syscall_completer): Make "text" and "word" parameters const. * cli/cli-cmds.c (show_user): Make "comname" local const. (valid_command_p): Make "command" parameter const. (alias_command): Make "alias_prefix" and "command_prefix" locals const. * cli/cli-decode.c (add_cmd): Make "name" parameter const. (add_alias_cmd): Make "name" and "oldname" parameters const. Adjust. No longer make copy of OLDNAME. (add_prefix_cmd, add_abbrev_prefix_cmd, add_set_or_show_cmd) (add_setshow_cmd_full, add_setshow_enum_cmd) (add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd) (add_setshow_filename_cmd, add_setshow_string_cmd) (add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_unlimited_cmd, add_setshow_zuinteger_cmd) (delete_cmd, add_info, add_info_alias, add_com, add_com_alias): Make "name" parameter const. (help_cmd): Rename "command" parameter to "arg". New const local "command". (find_cmd): Make "command" parameter const. (lookup_cmd_1): Make "text" parameter pointer to const. Adjust to deprecated_cmd_warning prototype change. (undef_cmd_error): Make "cmdtype" parameter const. (lookup_cmd): Make "line" parameter const. (deprecated_cmd_warning): Change type of "text" parameter to pointer to const char, from pointer to pointer to char. Adjust. (lookup_cmd_composition): Make "text" parameter const. (complete_on_cmdlist, complete_on_enum): Make "text" and "word" parameters const. * cli/cli-decode.h (struct cmd_list_element) <name>: Make field const. * cli/cli-script.c (validate_comname): Make "tem" local const. (define_command): New const local "tem_c". Use it in calls to lookup_cmd. (document_command): Make "tem" and "comfull" locals const. (show_user_1): Make "prefix" and "name" parameters const. * cli-script.h (show_user_1): Make "prefix" and "name" parameters const. * command.h (add_cmd, add_alias_cmd, add_prefix_cmd) (add_abbrev_prefix_cmd, completer_ftype, lookup_cmd, lookup_cmd_1) (deprecated_cmd_warning, lookup_cmd_composition, add_com) (add_com_alias, add_info, add_info_alias, complete_on_cmdlist) (complete_on_enum, add_setshow_enum_cmd) (add_setshow_auto_boolean_cmd, add_setshow_boolean_cmd) (add_setshow_filename_cmd, add_setshow_string_cmd) (add_setshow_string_noescape_cmd) (add_setshow_optional_filename_cmd, add_setshow_integer_cmd) (add_setshow_uinteger_cmd, add_setshow_zinteger_cmd) (add_setshow_zuinteger_cmd, add_setshow_zuinteger_unlimited_cmd): Change prototypes, constifying strings. * completer.c (noop_completer, filename_completer): Make "text" and "prefix" parameters const. (location_completer, expression_completer) (complete_line_internal): Make "text" and "prefix" parameters const and adjust. (command_completer, signal_completer): Make "text" and "prefix" parameters const. * completer.h (noop_completer, filename_completer) (expression_completer, location_completer, command_completer) (signal_completer): Change prototypes. * corefile.c (complete_set_gnutarget): Make "text" and "word" parameters const. * cp-abi.c (cp_abi_completer): Likewise. * expression.h (parse_expression_for_completion): Change prototype. * f-lang.c (f_make_symbol_completion_list): Make "text" and "word" parameters const. * infcmd.c (_initialize_infcmd): Make "cmd_name" local const. * infrun.c (handle_completer): Make "text" and "word" parameters const. * interps.c (interpreter_completer): Make "text" and "word" parameters const. * language.h (struct language_defn) <la_make_symbol_completion_list>: Make "text" and "word" parameters const. * parse.c (parse_exp_1): Move const hack to parse_exp_in_context. (parse_exp_in_context): Rename to ... (parse_exp_in_context_1): ... this. (parse_exp_in_context): Reimplement, with const hack from parse_exp_1. (parse_expression_for_completion): Make "string" parameter const. * printcmd.c (decode_format): Make "string_ptr" parameter pointer to pointer to const char. Adjust. (print_command_1): Make "exp" parameter const. (output_command): Rename to ... (output_command_const): ... this. Make "exp" parameter const. (output_command): Reimplement. (x_command): Adjust. (display_command): Rename "exp" parameter to "arg". New "exp" local, const version of "arg". * python/py-auto-load.c (gdbpy_initialize_auto_load): Make "cmd_name" local const. * python/py-cmd.c (cmdpy_destroyer): Cast const away in xfree call. (cmdpy_completer): Make "text" and "word" parameters const. (gdbpy_parse_command_name): Make "prefix_text2" local const. * python/py-param.c (add_setshow_generic): Make "tmp_name" local const. * remote.c (_initialize_remote): Make "cmd_name" local const. * symtab.c (language_search_unquoted_string): Make "text" and "p" parameters const. Adjust. (completion_list_add_fields): Make "sym_text", "text" and "word" parameters const. (struct add_name_data) <sym_text, text, word>: Make fields const. (default_make_symbol_completion_list_break_on): Make "text" and "word" parameters const. Adjust locals. (default_make_symbol_completion_list) (make_symbol_completion_list, make_symbol_completion_type) (make_symbol_completion_list_fn): Make "text" and "word" parameters const. (make_file_symbol_completion_list): Make "text", "word" and "srcfile" parameters const. Adjust locals. (add_filename_to_list): Make "text" and "word" parameters const. (struct add_partial_filename_data) <text, word>: Make fields const. (make_source_files_completion_list): Make "text" and "word" parameters const. * symtab.h (default_make_symbol_completion_list_break_on) (default_make_symbol_completion_list, make_symbol_completion_list) (make_symbol_completion_type enum type_code) (make_symbol_completion_list_fn make_file_symbol_completion_list) (make_source_files_completion_list): Change prototype. * top.c (execute_command): Adjust to pass pointer to pointer to const char to lookup_cmd, and to deprecated_cmd_warning prototype change. (set_verbose): Make "cmdname" local const. * tracepoint.c (decode_agent_options): Make "exp" parameter const, and adjust. (validate_actionline): Make "line" parameter a pointer to const char, and adjust. (encode_actions_1): Make "action_exp" local const, and adjust. (encode_actions): Adjust. (replace_comma): Delete. (trace_dump_actions): Make "action_exp" and "next_comma" locals const, and adjust. Don't frob the action string while splitting it at commas. Instead, make a copy of each split substring in turn. (trace_dump_command): Adjust to validate_actionline prototype change. * tracepoint.h (decode_agent_options, decode_agent_options) (encode_actions, validate_actionline): Change prototypes. * valprint.h (output_command): Delete declaration. (output_command_const): Declare. * value.c (function_destroyer): Cast const away in xfree call.
2013-03-13 19:34:55 +01:00
const char *alias_prefix, *command_prefix;
struct cmd_list_element *c_alias, *c_command;
if (alias_argc != command_argc)
error (_("Mismatched command length between ALIAS and COMMAND."));
/* Create copies of ALIAS and COMMAND without the last word,
and use that to verify the leading elements give the same
prefix command. */
std::string alias_prefix_string (argv_to_string (alias_argv,
alias_argc - 1));
std::string command_prefix_string (argv_to_string (command_argv.get (),
command_argc - 1));
alias_prefix = alias_prefix_string.c_str ();
command_prefix = command_prefix_string.c_str ();
c_command = lookup_cmd_1 (& command_prefix, cmdlist, NULL, 1);
/* We've already tried to look up COMMAND. */
gdb_assert (c_command != NULL
&& c_command != (struct cmd_list_element *) -1);
gdb_assert (c_command->prefixlist != NULL);
c_alias = lookup_cmd_1 (& alias_prefix, cmdlist, NULL, 1);
if (c_alias != c_command)
error (_("ALIAS and COMMAND prefixes do not match."));
/* add_cmd requires *we* allocate space for name, hence the xstrdup. */
add_alias_cmd (xstrdup (alias_argv[alias_argc - 1]),
command_argv[command_argc - 1],
class_alias, abbrev_flag, c_command->prefixlist);
}
}
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
Make "list ambiguous" show symbol names too Currently, with an ambiguous "list first,last", we get: (gdb) list bar,main Specified first line 'bar' is ambiguous: file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97 file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98 This commit makes gdb's output above a bit clearer by printing the symbol name as well: (gdb) list bar,main Specified first line 'bar' is ambiguous: file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)" file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)" And while at it, makes gdb print the symbol name when actually listing multiple locations too. I.e., before (with "set listsize 2"): (gdb) list bar file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97 96 97 int bar (A) { return 11; } file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98 97 int bar (A) { return 11; } 98 int bar (B) { return 22; } After: (gdb) list bar file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)" 96 97 int bar (A) { return 11; } file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)" 97 int bar (A) { return 11; } 98 int bar (B) { return 22; } Currently, the result of decoding a linespec loses information about the original symbol that was found. All we end up with is an address. This makes it difficult to find the original symbol again to get at its print name. Fix that by storing a pointer to the symbol in the sal. We already store the symtab and obj_section, so it feels like a natural progression to me. This avoids having to do any extra symbol lookup too. gdb/ChangeLog: 2017-09-20 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (list_command): Use print_sal_location. (print_sal_location): New function. (ambiguous_line_spec): Use print_sal_location. * linespec.c (symbol_to_sal): Record the symbol in the sal. * symtab.c (find_function_start_sal): Likewise. * symtab.h (symtab_and_line::symbol): New field. gdb/testsuite/ChangeLog: 2017-09-20 Pedro Alves <palves@redhat.com> * gdb.base/list-ambiguous.exp (test_list_ambiguous_symbol): Expect symbol names in gdb's output. * gdb.cp/overload.exp ("list all overloads"): Likewise.
2017-09-20 17:12:54 +02:00
/* Print the file / line number / symbol name of the location
specified by SAL. */
static void
print_sal_location (const symtab_and_line &sal)
{
scoped_restore_current_program_space restore_pspace;
set_current_program_space (sal.pspace);
const char *sym_name = NULL;
if (sal.symbol != NULL)
Replace SYMBOL_*_NAME accessors with member functions Similar to the MSYMBOL version of this patch, improves readability and will eventually allow making name private. gdb/ChangeLog: 2019-11-22 Christian Biesinger <cbiesinger@google.com> * ada-exp.y: Update. * ada-lang.c (sort_choices): Update. (ada_print_symbol_signature): Update. (resolve_subexp): Update. (ada_parse_renaming): Update. (ada_read_renaming_var_value): Update. (lesseq_defined_than): Update. (remove_extra_symbols): Update. (remove_irrelevant_renamings): Update. (ada_add_block_symbols): Update. (ada_collect_symbol_completion_matches): Update. (ada_is_renaming_symbol): Update. (aggregate_assign_from_choices): Update. (ada_evaluate_subexp): Update. (ada_has_this_exception_support): Update. (ada_is_non_standard_exception_sym): Update. (ada_add_exceptions_from_frame): Update. (ada_add_global_exceptions): Update. (ada_print_subexp): Update. * ax-gdb.c (gen_var_ref): Update. (gen_maybe_namespace_elt): Update. (gen_expr_for_cast): Update. (gen_expr): Update. * block.h: Update. * blockframe.c (find_pc_partial_function): Update. * breakpoint.c (print_breakpoint_location): Update. (update_static_tracepoint): Update. * btrace.c (ftrace_print_function_name): Update. (ftrace_function_switched): Update. * buildsym.c (find_symbol_in_list): Update. * c-exp.y: Update. * c-typeprint.c (c_print_typedef): Update. (c_type_print_template_args): Update. * cli/cli-cmds.c (edit_command): Update. (list_command): Update. (print_sal_location): Update. * coffread.c (patch_opaque_types): Update. (process_coff_symbol): Update. (coff_read_enum_type): Update. * compile/compile-c-symbols.c (c_symbol_substitution_name): Update. (convert_one_symbol): Update. (hash_symname): Update. (eq_symname): Update. * compile/compile-cplus-symbols.c (convert_one_symbol): Update. * compile/compile-cplus-types.c (debug_print_scope): Update. * compile/compile-loc2c.c (do_compile_dwarf_expr_to_c): Update. * compile/compile-object-load.c (get_out_value_type): Update. * cp-namespace.c (cp_scan_for_anonymous_namespaces): Update. (search_symbol_list): Update. (cp_lookup_symbol_imports_or_template): Update. * cp-support.c (overload_list_add_symbol): Update. * ctfread.c (psymtab_to_symtab): Update. * dbxread.c (cp_set_block_scope): Update. * dictionary.c (iter_match_first_hashed): Update. (iter_match_next_hashed): Update. (insert_symbol_hashed): Update. (iter_match_next_linear): Update. * dictionary.h: Update. * dwarf2loc.c (func_get_frame_base_dwarf_block): Update. (locexpr_describe_location_piece): Update. (locexpr_describe_location_1): Update. (locexpr_generate_c_location): Update. (loclist_describe_location): Update. (loclist_generate_c_location): Update. * dwarf2read.c (dw2_debug_names_lookup_symbol): Update. (read_func_scope): Update. (process_enumeration_scope): Update. (new_symbol): Update. (dwarf2_const_value): Update. (dwarf2_symbol_mark_computed): Update. * eval.c (evaluate_funcall): Update. (evaluate_subexp_standard): Update. * expprint.c (print_subexp_standard): Update. (dump_subexp_body_standard): Update. * f-valprint.c (info_common_command_for_block): Update. * findvar.c (get_hosting_frame): Update. (default_read_var_value): Update. * go-lang.c (go_symbol_package_name): Update. * guile/scm-block.c (bkscm_print_block_smob): Update. * guile/scm-symbol.c (syscm_print_symbol_smob): Update. (gdbscm_symbol_name): Update. (gdbscm_symbol_linkage_name): Update. (gdbscm_symbol_print_name): Update. * infcall.c (get_function_name): Update. * infcmd.c (jump_command): Update. (finish_command): Update. * infrun.c (insert_exception_resume_breakpoint): Update. * linespec.c (canonicalize_linespec): Update. (create_sals_line_offset): Update. (convert_linespec_to_sals): Update. (complete_label): Update. (find_label_symbols_in_block): Update. * m2-typeprint.c (m2_print_typedef): Update. * mdebugread.c (mdebug_reg_to_regnum): Update. (parse_symbol): Update. (mylookup_symbol): Update. * mi/mi-cmd-stack.c (list_arg_or_local): Update. (list_args_or_locals): Update. * objc-lang.c (compare_selectors): Update. (info_selectors_command): Update. (compare_classes): Update. (info_classes_command): Update. (find_imps): Update. * p-typeprint.c (pascal_print_typedef): Update. * printcmd.c (build_address_symbolic): Update. (info_address_command): Update. (print_variable_and_value): Update. * python/py-framefilter.c (extract_sym): Update. (py_print_single_arg): Update. * python/py-symbol.c (sympy_str): Update. (sympy_get_name): Update. (sympy_get_linkage_name): Update. * python/python.c (gdbpy_rbreak): Update. * record-btrace.c (btrace_get_bfun_name): Update. (btrace_call_history): Update. * rust-lang.c (rust_print_typedef): Update. * solib-frv.c (frv_fdpic_find_canonical_descriptor): Update. * stabsread.c (stab_reg_to_regnum): Update. (define_symbol): Update. (read_enum_type): Update. (common_block_end): Update. (cleanup_undefined_types_1): Update. (scan_file_globals): Update. * stack.c (print_frame_arg): Update. (print_frame_args): Update. (find_frame_funname): Update. (info_frame_command_core): Update. (iterate_over_block_locals): Update. (print_block_frame_labels): Update. (do_print_variable_and_value): Update. (iterate_over_block_arg_vars): Update. (return_command): Update. * symmisc.c (dump_symtab_1): Update. (print_symbol): Update. * symtab.c (eq_symbol_entry): Update. (symbol_cache_dump): Update. (lookup_language_this): Update. (find_pc_sect_line): Update. (skip_prologue_sal): Update. (symbol_search::compare_search_syms): Update. (treg_matches_sym_type_name): Update. (search_symbols): Update. (print_symbol_info): Update. (rbreak_command): Update. (completion_list_add_symbol): Update. (find_gnu_ifunc): Update. (get_symbol_address): Update. (search_module_symbols): Update. (info_module_subcommand): Update. * symtab.h (SYMBOL_NATURAL_NAME): Remove. (SYMBOL_LINKAGE_NAME): Remove. (SYMBOL_DEMANGLED_NAME): Remove. (SYMBOL_PRINT_NAME): Remove. (SYMBOL_SEARCH_NAME): Remove. * tracepoint.c (set_traceframe_context): Update. (validate_actionline): Update. (collection_list::collect_symbol): Update. (encode_actions_1): Update. (info_scope_command): Update. (print_one_static_tracepoint_marker): Update. * typeprint.c (typedef_hash_table::add_template_parameters): Update. * valops.c (address_of_variable): Update. (find_overload_match): Update. (find_oload_champ): Update. Change-Id: I76bdc8b44eea6876bf03af9d351f8e90cc0154b2
2019-11-22 19:05:14 +01:00
sym_name = sal.symbol->print_name ();
Make "list ambiguous" show symbol names too Currently, with an ambiguous "list first,last", we get: (gdb) list bar,main Specified first line 'bar' is ambiguous: file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97 file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98 This commit makes gdb's output above a bit clearer by printing the symbol name as well: (gdb) list bar,main Specified first line 'bar' is ambiguous: file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)" file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)" And while at it, makes gdb print the symbol name when actually listing multiple locations too. I.e., before (with "set listsize 2"): (gdb) list bar file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97 96 97 int bar (A) { return 11; } file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98 97 int bar (A) { return 11; } 98 int bar (B) { return 22; } After: (gdb) list bar file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)" 96 97 int bar (A) { return 11; } file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)" 97 int bar (A) { return 11; } 98 int bar (B) { return 22; } Currently, the result of decoding a linespec loses information about the original symbol that was found. All we end up with is an address. This makes it difficult to find the original symbol again to get at its print name. Fix that by storing a pointer to the symbol in the sal. We already store the symtab and obj_section, so it feels like a natural progression to me. This avoids having to do any extra symbol lookup too. gdb/ChangeLog: 2017-09-20 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (list_command): Use print_sal_location. (print_sal_location): New function. (ambiguous_line_spec): Use print_sal_location. * linespec.c (symbol_to_sal): Record the symbol in the sal. * symtab.c (find_function_start_sal): Likewise. * symtab.h (symtab_and_line::symbol): New field. gdb/testsuite/ChangeLog: 2017-09-20 Pedro Alves <palves@redhat.com> * gdb.base/list-ambiguous.exp (test_list_ambiguous_symbol): Expect symbol names in gdb's output. * gdb.cp/overload.exp ("list all overloads"): Likewise.
2017-09-20 17:12:54 +02:00
printf_filtered (_("file: \"%s\", line number: %d, symbol: \"%s\"\n"),
symtab_to_filename_for_display (sal.symtab),
sal.line, sym_name != NULL ? sym_name : "???");
}
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
/* Print a list of files and line numbers which a user may choose from
in order to list a function which was specified ambiguously (as
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
with `list classname::overloadedfuncname', for example). The SALS
array provides the filenames and line numbers. FORMAT is a
printf-style format string used to tell the user what was
Clarify "list" output when specified lines are ambiguous Currently, with "list LINESPEC1,LINESPEC2", if one of the linespecs is ambiguous, i.e., if it expands to multiple locations, you get this seemingly odd output: (gdb) list foo,bar file: "file0.c", line number: 26 file: "file1.c", line number: 29 Since "foo" above expands to multiple locations, the specified range is indeterminate, and GDB is trying to be helpful by showing you what was ambiguous. It looks confusing to me, though. I think it'd be much more user friendly if GDB actually told you that, like this: (gdb) list foo,bar Specified first line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 (gdb) list bar,foo Specified last line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 Note, I'm using "first" and "last" in the output because that's what the manual uses: ~~~ list first,last Print lines from first to last. [...] ~~~ Tested on x86-64 GNU/Linux. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (edit_command): Pass message to ambiguous_line_spec. (list_command): Pass message to ambiguous_line_spec. Say "first"/"last" instead of "start" and "end" to be consistent with the manual. (ambiguous_line_spec): Add 'format' and vararg parameters. Use them to print formatted message. gdb/testsuite/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * gdb.base/list-ambiguous.exp: New file. * gdb.base/list-ambiguous0.c: New file. * gdb.base/list-ambiguous1.c: New file. * gdb.base/list.exp (test_list_range): Adjust expected output.
2017-09-04 17:49:29 +02:00
ambiguous. */
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
static void
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
ambiguous_line_spec (gdb::array_view<const symtab_and_line> sals,
const char *format, ...)
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
{
Clarify "list" output when specified lines are ambiguous Currently, with "list LINESPEC1,LINESPEC2", if one of the linespecs is ambiguous, i.e., if it expands to multiple locations, you get this seemingly odd output: (gdb) list foo,bar file: "file0.c", line number: 26 file: "file1.c", line number: 29 Since "foo" above expands to multiple locations, the specified range is indeterminate, and GDB is trying to be helpful by showing you what was ambiguous. It looks confusing to me, though. I think it'd be much more user friendly if GDB actually told you that, like this: (gdb) list foo,bar Specified first line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 (gdb) list bar,foo Specified last line 'foo' is ambiguous: file: "file0.c", line number: 26 file: "file1.c", line number: 29 Note, I'm using "first" and "last" in the output because that's what the manual uses: ~~~ list first,last Print lines from first to last. [...] ~~~ Tested on x86-64 GNU/Linux. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (edit_command): Pass message to ambiguous_line_spec. (list_command): Pass message to ambiguous_line_spec. Say "first"/"last" instead of "start" and "end" to be consistent with the manual. (ambiguous_line_spec): Add 'format' and vararg parameters. Use them to print formatted message. gdb/testsuite/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * gdb.base/list-ambiguous.exp: New file. * gdb.base/list-ambiguous0.c: New file. * gdb.base/list-ambiguous1.c: New file. * gdb.base/list.exp (test_list_range): Adjust expected output.
2017-09-04 17:49:29 +02:00
va_list ap;
va_start (ap, format);
vprintf_filtered (format, ap);
va_end (ap);
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
for (const auto &sal : sals)
Make "list ambiguous" show symbol names too Currently, with an ambiguous "list first,last", we get: (gdb) list bar,main Specified first line 'bar' is ambiguous: file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97 file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98 This commit makes gdb's output above a bit clearer by printing the symbol name as well: (gdb) list bar,main Specified first line 'bar' is ambiguous: file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)" file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)" And while at it, makes gdb print the symbol name when actually listing multiple locations too. I.e., before (with "set listsize 2"): (gdb) list bar file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97 96 97 int bar (A) { return 11; } file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98 97 int bar (A) { return 11; } 98 int bar (B) { return 22; } After: (gdb) list bar file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 97, symbol: "bar(A)" 96 97 int bar (A) { return 11; } file: "src/gdb/testsuite/gdb.cp/overload.cc", line number: 98, symbol: "bar(B)" 97 int bar (A) { return 11; } 98 int bar (B) { return 22; } Currently, the result of decoding a linespec loses information about the original symbol that was found. All we end up with is an address. This makes it difficult to find the original symbol again to get at its print name. Fix that by storing a pointer to the symbol in the sal. We already store the symtab and obj_section, so it feels like a natural progression to me. This avoids having to do any extra symbol lookup too. gdb/ChangeLog: 2017-09-20 Pedro Alves <palves@redhat.com> * cli/cli-cmds.c (list_command): Use print_sal_location. (print_sal_location): New function. (ambiguous_line_spec): Use print_sal_location. * linespec.c (symbol_to_sal): Record the symbol in the sal. * symtab.c (find_function_start_sal): Likewise. * symtab.h (symtab_and_line::symbol): New field. gdb/testsuite/ChangeLog: 2017-09-20 Pedro Alves <palves@redhat.com> * gdb.base/list-ambiguous.exp (test_list_ambiguous_symbol): Expect symbol names in gdb's output. * gdb.cp/overload.exp ("list all overloads"): Likewise.
2017-09-20 17:12:54 +02:00
print_sal_location (sal);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
}
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
/* Comparison function for filter_sals. Returns a qsort-style
result. */
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
static int
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
cmp_symtabs (const symtab_and_line &sala, const symtab_and_line &salb)
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
{
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
const char *dira = SYMTAB_DIRNAME (sala.symtab);
const char *dirb = SYMTAB_DIRNAME (salb.symtab);
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
int r;
if (dira == NULL)
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
{
if (dirb != NULL)
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
return -1;
}
else if (dirb == NULL)
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
{
if (dira != NULL)
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
return 1;
}
else
{
r = filename_cmp (dira, dirb);
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
if (r)
return r;
}
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
r = filename_cmp (sala.symtab->filename, salb.symtab->filename);
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
if (r)
return r;
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
if (sala.line < salb.line)
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
return -1;
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
return sala.line == salb.line ? 0 : 1;
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
}
/* Remove any SALs that do not match the current program space, or
which appear to be "file:line" duplicates. */
static void
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
filter_sals (std::vector<symtab_and_line> &sals)
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
{
struct symtabs_and_lines -> std::vector<symtab_and_line> This replaces "struct symtabs_and_lines" with std::vector<symtab_and_line> in most cases. This removes a number of cleanups. In some cases, the sals objects do not own the sals they point at. Instead they point at some sal that lives on the stack. Typically something like this: struct symtab_and_line sal; struct symtabs_and_lines sals; // fill in sal sals.nelts = 1; sals.sals = &sal; // use sals Instead of switching those cases to std::vector too, such usages are replaced by gdb::array_view<symtab_and_line> instead. This avoids introducing heap allocations. gdb/ChangeLog: 2017-09-04 Pedro Alves <palves@redhat.com> * ax-gdb.c (agent_command_1): Use range-for. * break-catch-throw.c (re_set_exception_catchpoint): Update. * breakpoint.c: Include "common/array-view.h". (init_breakpoint_sal, create_breakpoint_sal): Change sals parameter from struct symtabs_and_lines to array_view<symtab_and_line>. Adjust. Use range-for. Update. (breakpoint_sals_to_pc): Change sals parameter from struct symtabs_and_lines to std::vector reference. (check_fast_tracepoint_sals): Change sals parameter from struct symtabs_and_lines to std::array_view. Use range-for. (decode_static_tracepoint_spec): Return a std::vector instead of symtabs_and_lines. Update. (create_breakpoint): Update. (break_range_command, until_break_command, clear_command): Update. (base_breakpoint_decode_location, bkpt_decode_location) (bkpt_probe_create_sals_from_location) (bkpt_probe_decode_location, tracepoint_decode_location) (tracepoint_probe_decode_location) (strace_marker_create_sals_from_location): Return a std::vector instead of symtabs_and_lines. (strace_marker_create_breakpoints_sal): Update. (strace_marker_decode_location): Return a std::vector instead of symtabs_and_lines. Update. (update_breakpoint_locations): Change struct symtabs_and_lines parameters to gdb::array_view. Adjust. (location_to_sals): Return a std::vector instead of symtabs_and_lines. Update. (breakpoint_re_set_default): Use std::vector instead of struct symtabs_and_lines. (decode_location_default): Return a std::vector instead of symtabs_and_lines. Update. * breakpoint.h: Include "common/array-view.h". (struct breakpoint_ops) <decode_location>: Now returns a std::vector instead of returning a symtabs_and_lines via output parameter. (update_breakpoint_locations): Change sals parameters to use gdb::array_view. * cli/cli-cmds.c (edit_command, list_command): Update to use std::vector and gdb::array_view. (ambiguous_line_spec): Adjust to use gdb::array_view and range-for. (compare_symtabs): Rename to ... (cmp_symtabs): ... this. Change parameters to symtab_and_line const reference and adjust. (filter_sals): Rewrite using std::vector and standard algorithms. * elfread.c (elf_gnu_ifunc_resolver_return_stop): Simplify. (jump_command): Update to use std::vector. * linespec.c (struct linespec_state) <canonical_names>: Update comment. (add_sal_to_sals_basic): Delete. (add_sal_to_sals, filter_results, convert_results_to_lsals) (decode_line_2, create_sals_line_offset) (convert_address_location_to_sals, convert_linespec_to_sals) (convert_explicit_location_to_sals, parse_linespec) (event_location_to_sals, decode_line_full, decode_line_1) (decode_line_with_current_source) (decode_line_with_last_displayed, decode_objc) (decode_digits_list_mode, decode_digits_ordinary, minsym_found) (linespec_result::~linespec_result): Adjust to use std::vector instead of symtabs_and_lines. * linespec.h (linespec_sals::sals): Now a std::vector. (struct linespec_result): Use std::vector, bool, and in-class initialization. (decode_line_1, decode_line_with_current_source) (decode_line_with_last_displayed): Return std::vector. * macrocmd.c (info_macros_command): Use std::vector. * mi/mi-main.c (mi_cmd_trace_find): Use std::vector. * probe.c (parse_probes_in_pspace, parse_probes): Adjust to use std::vector. * probe.h (parse_probes): Return a std::vector. * python/python.c (gdbpy_decode_line): Use std::vector and gdb::array_view. * source.c (select_source_symtab, line_info): Use std::vector. * stack.c (func_command): Use std::vector. * symtab.h (struct symtabs_and_lines): Delete. * tracepoint.c (tfind_line_command, scope_info): Use std::vector.
2017-09-04 18:10:13 +02:00
/* Remove SALs that do not match. */
auto from = std::remove_if (sals.begin (), sals.end (),
[&] (const symtab_and_line &sal)
{ return (sal.pspace != current_program_space || sal.symtab == NULL); });
/* Remove dups. */
std::sort (sals.begin (), from,
[] (const symtab_and_line &sala, const symtab_and_line &salb)
{ return cmp_symtabs (sala, salb) < 0; });
from = std::unique (sals.begin (), from,
[&] (const symtab_and_line &sala,
const symtab_and_line &salb)
{ return cmp_symtabs (sala, salb) == 0; });
sals.erase (from, sals.end ());
the "ambiguous linespec" series gdb 2011-12-06 Joel Brobecker <brobecker@acacore.com> * language.h (struct language_defn): Add new component la_symbol_name_compare. * symfile.h (struct quick_symbol_functions): Update the profile of parameter "name_matcher" for the expand_symtabs_matching method. Update the documentation accordingly. * ada-lang.h (ada_name_for_lookup): Add declaration. * ada-lang.c (ada_name_for_lookup): New function, extracted out from ada_iterate_over_symbols. (ada_iterate_over_symbols): Do not encode symbol name anymore. (ada_expand_partial_symbol_name): Adjust profile. (ada_language_defn): Add value for la_symbol_name_compare field. * linespec.c: #include "ada-lang.h". (iterate_name_matcher): Add language parameter. Replace call to strcmp_iw by call to language->la_symbol_name_compare. (decode_variable): Encode COPY if current language is Ada. * dwarf2read.c (dw2_expand_symtabs_matching): Adjust profile of name_matcher parameter. Adjust call to name_matcher. * psymtab.c (expand_symtabs_matching_via_partial): Likewise. (expand_partial_symbol_names): Update profile of parameter "fun". * psymtab.h (expand_partial_symbol_names): Update profile of parameter "fun". * symtab.c (demangle_for_lookup): Update function documentation. (search_symbols_name_matches): Add language parameter. (expand_partial_symbol_name): Likewise. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Add value for la_symbol_name_compare field. * d-lang.c (d_language_defn): Likewise. * f-lang.c (f_language_defn): Ditto. * jv-lang.c (java_language_defn): Ditto. * m2-lang.c (m2_language_defn): Ditto. * objc-lang.c (objc_language_defn): Ditto. * opencl-lang.c (opencl_language_defn): Ditto. * p-lang.c (pascal_language_defn): Ditto. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Ditto. 2011-12-06 Tom Tromey <tromey@redhat.com> * linespec.c (iterate_over_all_matching_symtabs): Use LA_ITERATE_OVER_SYMBOLS. (lookup_prefix_sym, add_matching_symbols_to_info): Likewise. (find_function_symbols, decode_variable): Remove Ada special case. * language.h (struct language_defn) <la_iterate_over_symbols>: New field. (LA_ITERATE_OVER_SYMBOLS): New macro. * language.c (unknown_language_defn, auto_language_defn) (local_language_defn): Update. * c-lang.c (c_language_defn, cplus_language_defn) (asm_language_defn, minimal_language_defn): Update. * d-lang.c (d_language_defn): Update. * f-lang.c (f_language_defn): Update. * jv-lang.c (java_language_defn): Update. * m2-lang.c (m2_language_defn): Update. * objc-lang.c (objc_language_defn): Update. * opencl-lang.c (opencl_language_defn): Update. * p-lang.c (pascal_language_defn): Update. * ada-lang.c (ada_iterate_over_symbols): New function. (ada_language_defn): Update. 2011-12-06 Tom Tromey <tromey@redhat.com> Joel Brobecker <brobecker@acacore.com> PR breakpoints/13105, PR objc/8341, PR objc/8343, PR objc/8366, PR objc/8535, PR breakpoints/11657, PR breakpoints/11970, PR breakpoints/12023, PR breakpoints/12334, PR breakpoints/12856, PR shlibs/8929, PR shlibs/7393: * python/py-type.c (compare_maybe_null_strings): Rename from compare_strings. (check_types_equal): Update. * utils.c (compare_strings): New function. * tui/tui-winsource.c (tui_update_breakpoint_info): Update for location changes. * tracepoint.c (scope_info): Update. (trace_find_line_command): Use DECODE_LINE_FUNFIRSTLINE. * symtab.h (iterate_over_minimal_symbols) (iterate_over_some_symtabs, iterate_over_symtabs) (find_pcs_for_symtab_line, iterate_over_symbols) (demangle_for_lookup): Declare. (expand_line_sal): Remove. * symtab.c (iterate_over_some_symtabs, iterate_over_symtabs) (lookup_symtab_callback): New functions. (lookup_symtab): Rewrite. (demangle_for_lookup): New function, extract from lookup_symbol_in_language. (lookup_symbol_in_language): Use it. (iterate_over_symbols): New function. (find_line_symtab): Update. (find_pcs_for_symtab_line): New functions. (find_line_common): Add 'start' argument. (decode_line_spec): Update. Change argument to 'flags', change interpretation. (append_expanded_sal): Remove. (append_exact_match_to_sals): Remove. (expand_line_sal): Remove. * symfile.h (struct quick_symbol_functions) <lookup_symtab>: Remove. <map_symtabs_matching_filename>: New field. * stack.c (func_command): Only look in the current program space. Use DECODE_LINE_FUNFIRSTLINE. * source.c (line_info): Set pspace on sal. Check program space in the loop. Use DECODE_LINE_LIST_MODE. (select_source_symtab): Use DECODE_LINE_FUNFIRSTLINE. * solib-target.c: Remove DEF_VEC_I(CORE_ADDR). * python/python.c (gdbpy_decode_line): Update. * psymtab.c (partial_map_expand_apply): New function. (partial_map_symtabs_matching_filename): Rename from lookup_partial_symbol. Update arguments. (lookup_symtab_via_partial_symtab): Remove. (psym_functions): Update. * objc-lang.h (parse_selector, parse_method): Don't declare. (find_imps): Update. * objc-lang.c (parse_selector, parse_method): Now static. (find_methods): Change arguments. Fill in a vector of symbol names. (uniquify_strings): New function. (find_imps): Change arguments. * minsyms.c (iterate_over_minimal_symbols): New function. * linespec.h (enum decode_line_flags): New. (struct linespec_sals): New. (struct linespec_result) <canonical>: Remove. <pre_expanded, addr_string, sals>: New fields. (destroy_linespec_result, make_cleanup_destroy_linespec_result) (decode_line_full): Declare. (decode_line_1): Update. * linespec.c (struct address_entry, struct linespec_state, struct collect_info): New types. (add_sal_to_sals_basic, add_sal_to_sals, hash_address_entry) (eq_address_entry, maybe_add_address): New functions. (total_number_of_methods): Remove. (iterate_name_matcher, iterate_over_all_matching_symtabs): New functions. (find_methods): Change arguments. Don't canonicalize input. Simplify logic. (add_matching_methods, add_constructors) (build_canonical_line_spec): Remove. (filter_results, convert_results_to_lsals): New functions. (decode_line_2): Change arguments. Rewrite for new data structures. (decode_line_internal): Rename from decode_line_1. Change arguments. Add cleanups. Update for new data structures. (linespec_state_constructor, linespec_state_destructor) (decode_line_full, decode_line_1): New functions. (decode_indirect): Change arguments. Update. (locate_first_half): Use skip_spaces. (decode_objc): Change arguments. Update for new data structures. Simplify logic. (decode_compound): Change arguments. Add cleanups. Remove fallback code, replace with error. (struct decode_compound_collector): New type. (collect_one_symbol): New function. (lookup_prefix_sym): Change arguments. Update. (compare_symbol_name, add_all_symbol_names_from_pspace) (find_superclass_methods ): New functions. (find_method): Rewrite. (struct symtab_collector): New type. (add_symtabs_to_list, collect_symtabs_from_filename): New functions. (symtabs_from_filename): Change API. Rename from symtab_from_filename. (collect_function_symbols): New function. (find_function_symbols): Change API. Rename from find_function_symbol. Rewrite. (decode_all_digits): Change arguments. Rewrite. (decode_dollar): Change arguments. Use decode_variable. (decode_label): Change arguments. Rewrite. (collect_symbols): New function. (minsym_found): Change arguments. Rewrite. (check_minsym, search_minsyms_for_name) (add_matching_symbols_to_info): New function. (decode_variable): Change arguments. Iterate over all symbols. (symbol_found): Remove. (symbol_to_sal): New function. (init_linespec_result, destroy_linespec_result) (cleanup_linespec_result, make_cleanup_destroy_linespec_result): New functions. (decode_digits_list_mode, decode_digits_ordinary): New functions. * dwarf2read.c (dw2_map_expand_apply): New function. (dw2_map_symtabs_matching_filename): Rename from dw2_lookup_symtab. Change arguments. (dwarf2_gdb_index_functions): Update. * dwarf2loc.c: Remove DEF_VEC_I(CORE_ADDR). * defs.h (compare_strings): Declare. * cli/cli-cmds.c (compare_strings): Move to utils.c. (edit_command, list_command): Use DECODE_LINE_LIST_MODE. Call filter_sals. (compare_symtabs, filter_sals): New functions. * breakpoint.h (struct bp_location) <line_number, source_file>: New fields. (struct breakpoint) <line_number, source_file>: Remove. <filter>: New field. * breakpoint.c (print_breakpoint_location, init_raw_breakpoint) (momentary_breakpoint_from_master, add_location_to_breakpoint): Update for changes to locations. (init_breakpoint_sal): Add 'filter' argument. Set 'filter' on breakpoint. (create_breakpoint_sal): Add 'filter' argument. (remove_sal, expand_line_sal_maybe): Remove. (create_breakpoints_sal): Remove 'sals' argument. Handle pre-expanded sals and the filter. (parse_breakpoint_sals): Use decode_line_full. (check_fast_tracepoint_sals): Use get_sal_arch. (create_breakpoint): Create a linespec_sals. Update. (break_range_command): Use decode_line_full. Update. (until_break_command): Update. (clear_command): Update match conditions for linespec.c changes. Use DECODE_LINE_LIST_MODE. (say_where): Update for changes to locations. (bp_location_dtor): Free 'source_file'. (base_breakpoint_dtor): Free 'filter'. Don't free 'source_file'. (update_static_tracepoint): Update for changes to locations. (update_breakpoint_locations): Disable ranged breakpoint if too many locations match. Update. (addr_string_to_sals): Use decode_line_full. Resolve all sal PCs. (breakpoint_re_set_default): Don't call expand_line_sal_maybe. (decode_line_spec_1): Update. Change argument name to 'flags', change interpretation. * block.h (block_containing_function): Declare. * block.c (block_containing_function): New function. * skip.c (skip_function_command): Update. (skip_re_set): Update. * infcmd.c (jump_command): Use DECODE_LINE_FUNFIRSTLINE. * mi/mi-main.c (mi_cmd_trace_find): Use DECODE_LINE_FUNFIRSTLINE. * NEWS: Add entry. 2011-12-06 Tom Tromey <tromey@redhat.com> * elfread.c (elf_gnu_ifunc_resolver_return_stop): Allow breakpoint's pspace to be NULL. * breakpoint.h (struct breakpoint) <pspace>: Update comment. * breakpoint.c (init_raw_breakpoint): Conditionally set breakpoint's pspace. (init_breakpoint_sal): Don't set breakpoint's pspace. (prepare_re_set_context): Conditionally switch program space. (addr_string_to_sals): Check executing_startup on location's program space. 2011-12-06 Tom Tromey <tromey@redhat.com> * breakpoint.h (enum enable_state) <bp_startup_disabled>: Remove. * breakpoint.c (should_be_inserted): Explicitly check if program space is executing startup. (describe_other_breakpoints): Update. (disable_breakpoints_before_startup): Change executing_startup earlier. Remove loop. (enable_breakpoints_after_startup): Likewise. (init_breakpoint_sal): Don't use bp_startup_disabled. (create_breakpoint): Don't use bp_startup_disabled. (update_global_location_list): Use should_be_inserted. (bkpt_re_set): Update. gdb/testsuite 2011-12-06 Joel Brobecker <brobecker@acacore.com> * gdb.ada/fullname_bp.exp: Add tests for other valid linespecs involving a fully qualified function name. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.ada/homonym.exp: Add three breakpoint tests. 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.base/solib-weak.exp (do_test): Remove kfail. * gdb.trace/tracecmd.exp: Disable pending breakpoints earlier. * gdb.objc/objcdecode.exp: Update for output changes. * gdb.linespec/linespec.exp: New file. * gdb.linespec/lspec.cc: New file. * gdb.linespec/lspec.h: New file. * gdb.linespec/body.h: New file. * gdb.linespec/base/two/thefile.cc: New file. * gdb.linespec/base/one/thefile.cc: New file. * gdb.linespec/Makefile.in: New file. * gdb.cp/templates.exp (test_template_breakpoints): Update for output changes. * gdb.cp/re-set-overloaded.exp: Remove kfail. * gdb.cp/ovldbreak.exp: Update for output changes. "all" test now makes one breakpoint. * gdb.cp/method2.exp (test_break): Update for output changes. * gdb.cp/mb-templates.exp: Update for output changes. * gdb.cp/mb-inline.exp: Update for output changes. * gdb.cp/mb-ctor.exp: Update for output changes. * gdb.cp/ovsrch.exp: Use fully-qualified names. * gdb.base/solib-symbol.exp: Run to main later. Breakpoint now has multiple matches. * gdb.base/sepdebug.exp: Disable pending breakpoints. Update for error message change. * gdb.base/list.exp (test_list_filename_and_number): Update for error message change. * gdb.base/break.exp: Disable pending breakpoints. Update for output changes. * configure.ac: Add gdb.linespec. * configure: Rebuild. * Makefile.in (ALL_SUBDIRS): Add gdb.linespec. gdb/doc 2011-12-06 Tom Tromey <tromey@redhat.com> * gdb.texinfo (Set Breaks): Update for new behavior.
2011-12-06 19:54:43 +01:00
}
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
void
init_cmd_lists (void)
{
max_user_call_depth = 1024;
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
}
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
static void
show_info_verbose (struct ui_file *file, int from_tty,
struct cmd_list_element *c,
const char *value)
{
if (info_verbose)
fprintf_filtered (file,
_("Verbose printing of informational messages is %s.\n"),
value);
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
else
fprintf_filtered (file, _("Verbosity is %s.\n"), value);
}
static void
show_history_expansion_p (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("History expansion on command input is %s.\n"),
value);
}
static void
show_remote_debug (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file, _("Debugging of remote protocol is %s.\n"),
value);
}
static void
show_remote_timeout (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file,
_("Timeout limit to wait for target to respond is %s.\n"),
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
value);
}
static void
show_max_user_call_depth (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
{
fprintf_filtered (file,
_("The max call depth for user-defined commands is %s.\n"),
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
value);
}
Implement convenience functions to examine GDB settings. The new convenience functions $_gdb_setting and $_gdb_setting_str provide access to the GDB settings in user-defined commands. Similarly, $_gdb_maint_setting and $_gdb_maint_setting_str provide access to the GDB maintenance settings. The patch was developed following a comment of Eli about the 'set may-call-functions'. Eli said that user-defined functions should have a way to change their behavior according to this setting. Rather than have a specialized $_may_call_functions, this patch implements a general way to access any GDB setting. Compared to doing such access via Python 'gdb.parameter' and/or 'gdb.execute("set somesetting tosomevalue"): * The 'with' command is much better than the above python usage: if the user types C-c or an error happens between the set pagination off and the python "set pagination on", the above python does not restore the original setting. * Effectively, with the "gdb.parameter" python one liner, it is possible to do simple 'if' conditions, such as set and restore pagination. But mixing the "python if" within canned sequence of commands is cumbersome for non trivial combinations. E.g. if several commands have to be done for a certain condition accessed from python, I guess something like will be needed: python if __some_setting: gdb.execute("some command") python if __some_setting: gdb.execute("some other command") python if __some_setting: gdb.execute("some different command") (without speaking about nested "if-s"). With the convenience function: if $_gdb_setting("some_setting") some command some other command some different command end Integer settings (for example print elements) will also be more difficult to use. For example, a user defined function that scans and prints a linked list might want to use the value of "set print elements" to stop printing the linked list. Doing that by mixing python expression/if is likely doable, but seems not easy with the above one liners. So, in summary, the $_gdb_setting and $_gdb_setting_str avoids to have the heterogeneous mix of python and GDB commands in one single script (and of course, it works even if python is not configured, but that must be an unusual setup I guess). gdb/ChangeLog 2019-10-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (setting_cmd, value_from_setting) (gdb_setting_internal_fn, gdb_maint_setting_internal_fn) (str_value_from_setting, gdb_setting_str_internal_fn) (gdb_maint_setting_str_internal_fn): New functions. (_initialize_cli_cmds): Define the new convenience functions. * gdb/cli/cli-setshow.h (get_setshow_command_value_string): Constify. * gdb/cli/cli-setshow.c (get_setshow_command_value_string): Constify.
2019-04-28 14:38:18 +02:00
/* Returns the cmd_list_element in SHOWLIST corresponding to the first
argument of ARGV, which must contain one single value.
Throws an error if no value provided, or value not correct.
FNNAME is used in the error message. */
static cmd_list_element *
setting_cmd (const char *fnname, struct cmd_list_element *showlist,
int argc, struct value **argv)
{
if (argc == 0)
error (_("You must provide an argument to %s"), fnname);
if (argc != 1)
error (_("You can only provide one argument to %s"), fnname);
struct type *type0 = check_typedef (value_type (argv[0]));
if (TYPE_CODE (type0) != TYPE_CODE_ARRAY
&& TYPE_CODE (type0) != TYPE_CODE_STRING)
error (_("First argument of %s must be a string."), fnname);
const char *a0 = (const char *) value_contents (argv[0]);
cmd_list_element *cmd = lookup_cmd (&a0, showlist, "", -1, 0);
if (cmd == nullptr || cmd_type (cmd) != show_cmd)
error (_("First argument of %s must be a "
"valid setting of the 'show' command."), fnname);
return cmd;
}
/* Builds a value from the show CMD. */
static struct value *
value_from_setting (const cmd_list_element *cmd, struct gdbarch *gdbarch)
{
switch (cmd->var_type)
{
case var_integer:
if (*(int *) cmd->var == INT_MAX)
return value_from_longest (builtin_type (gdbarch)->builtin_int,
0);
else
return value_from_longest (builtin_type (gdbarch)->builtin_int,
*(int *) cmd->var);
case var_zinteger:
return value_from_longest (builtin_type (gdbarch)->builtin_int,
*(int *) cmd->var);
case var_boolean:
return value_from_longest (builtin_type (gdbarch)->builtin_int,
*(bool *) cmd->var ? 1 : 0);
case var_zuinteger_unlimited:
return value_from_longest (builtin_type (gdbarch)->builtin_int,
*(int *) cmd->var);
case var_auto_boolean:
{
int val;
switch (*(enum auto_boolean*) cmd->var)
{
case AUTO_BOOLEAN_TRUE:
val = 1;
break;
case AUTO_BOOLEAN_FALSE:
val = 0;
break;
case AUTO_BOOLEAN_AUTO:
val = -1;
break;
default:
gdb_assert_not_reached ("invalid var_auto_boolean");
}
return value_from_longest (builtin_type (gdbarch)->builtin_int,
val);
}
case var_uinteger:
if (*(unsigned int *) cmd->var == UINT_MAX)
return value_from_ulongest
(builtin_type (gdbarch)->builtin_unsigned_int, 0);
else
return value_from_ulongest
(builtin_type (gdbarch)->builtin_unsigned_int,
*(unsigned int *) cmd->var);
case var_zuinteger:
return value_from_ulongest (builtin_type (gdbarch)->builtin_unsigned_int,
*(unsigned int *) cmd->var);
case var_string:
case var_string_noescape:
case var_optional_filename:
case var_filename:
case var_enum:
if (*(char **) cmd->var)
return value_cstring (*(char **) cmd->var, strlen (*(char **) cmd->var),
builtin_type (gdbarch)->builtin_char);
else
return value_cstring ("", 1,
builtin_type (gdbarch)->builtin_char);
default:
gdb_assert_not_reached ("bad var_type");
}
}
/* Implementation of the convenience function $_gdb_setting. */
static struct value *
gdb_setting_internal_fn (struct gdbarch *gdbarch,
const struct language_defn *language,
void *cookie, int argc, struct value **argv)
{
return value_from_setting (setting_cmd ("$_gdb_setting", showlist,
argc, argv),
gdbarch);
}
/* Implementation of the convenience function $_gdb_maint_setting. */
static struct value *
gdb_maint_setting_internal_fn (struct gdbarch *gdbarch,
const struct language_defn *language,
void *cookie, int argc, struct value **argv)
{
return value_from_setting (setting_cmd ("$_gdb_maint_setting",
maintenance_show_cmdlist,
argc, argv),
gdbarch);
}
/* Builds a string value from the show CMD. */
static struct value *
str_value_from_setting (const cmd_list_element *cmd, struct gdbarch *gdbarch)
{
switch (cmd->var_type)
{
case var_integer:
case var_zinteger:
case var_boolean:
case var_zuinteger_unlimited:
case var_auto_boolean:
case var_uinteger:
case var_zuinteger:
{
std::string cmd_val = get_setshow_command_value_string (cmd);
return value_cstring (cmd_val.c_str (), cmd_val.size (),
builtin_type (gdbarch)->builtin_char);
}
case var_string:
case var_string_noescape:
case var_optional_filename:
case var_filename:
case var_enum:
/* For these cases, we do not use get_setshow_command_value_string,
as this function handle some characters specially, e.g. by
escaping quotes. So, we directly use the cmd->var string value,
similarly to the value_from_setting code for these cases. */
if (*(char **) cmd->var)
return value_cstring (*(char **) cmd->var, strlen (*(char **) cmd->var),
builtin_type (gdbarch)->builtin_char);
else
return value_cstring ("", 1,
builtin_type (gdbarch)->builtin_char);
default:
gdb_assert_not_reached ("bad var_type");
}
}
/* Implementation of the convenience function $_gdb_setting_str. */
static struct value *
gdb_setting_str_internal_fn (struct gdbarch *gdbarch,
const struct language_defn *language,
void *cookie, int argc, struct value **argv)
{
return str_value_from_setting (setting_cmd ("$_gdb_setting_str",
showlist, argc, argv),
gdbarch);
}
/* Implementation of the convenience function $_gdb_maint_setting_str. */
static struct value *
gdb_maint_setting_str_internal_fn (struct gdbarch *gdbarch,
const struct language_defn *language,
void *cookie, int argc, struct value **argv)
{
return str_value_from_setting (setting_cmd ("$_gdb_maint_setting_str",
maintenance_show_cmdlist,
argc, argv),
gdbarch);
}
gdb: add back declarations for _initialize functions I'd like to enable the -Wmissing-declarations warning. However, it warns for every _initialize function, for example: CXX dcache.o /home/smarchi/src/binutils-gdb/gdb/dcache.c: In function ‘void _initialize_dcache()’: /home/smarchi/src/binutils-gdb/gdb/dcache.c:688:1: error: no previous declaration for ‘void _initialize_dcache()’ [-Werror=missing-declarations] _initialize_dcache (void) ^~~~~~~~~~~~~~~~~~ The only practical way forward I found is to add back the declarations, which were removed by this commit: commit 481695ed5f6e0a8a9c9c50bfac1cdd2b3151e6c9 Author: John Baldwin <jhb@FreeBSD.org> Date: Sat Sep 9 11:02:37 2017 -0700 Remove unnecessary function prototypes. I don't think it's a big problem to have the declarations for these functions, but if anybody has a better solution for this, I'll be happy to use it. gdb/ChangeLog: * aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Add declaration. * aarch64-fbsd-tdep.c (_initialize_aarch64_fbsd_tdep): Add declaration. * aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Add declaration. * aarch64-linux-tdep.c (_initialize_aarch64_linux_tdep): Add declaration. * aarch64-newlib-tdep.c (_initialize_aarch64_newlib_tdep): Add declaration. * aarch64-tdep.c (_initialize_aarch64_tdep): Add declaration. * ada-exp.y (_initialize_ada_exp): Add declaration. * ada-lang.c (_initialize_ada_language): Add declaration. * ada-tasks.c (_initialize_tasks): Add declaration. * agent.c (_initialize_agent): Add declaration. * aix-thread.c (_initialize_aix_thread): Add declaration. * alpha-bsd-nat.c (_initialize_alphabsd_nat): Add declaration. * alpha-linux-nat.c (_initialize_alpha_linux_nat): Add declaration. * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Add declaration. * alpha-nbsd-tdep.c (_initialize_alphanbsd_tdep): Add declaration. * alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Add declaration. * alpha-tdep.c (_initialize_alpha_tdep): Add declaration. * amd64-darwin-tdep.c (_initialize_amd64_darwin_tdep): Add declaration. * amd64-dicos-tdep.c (_initialize_amd64_dicos_tdep): Add declaration. * amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Add declaration. * amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Add declaration. * amd64-linux-nat.c (_initialize_amd64_linux_nat): Add declaration. * amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Add declaration. * amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Add declaration. * amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Add declaration. * amd64-obsd-nat.c (_initialize_amd64obsd_nat): Add declaration. * amd64-obsd-tdep.c (_initialize_amd64obsd_tdep): Add declaration. * amd64-sol2-tdep.c (_initialize_amd64_sol2_tdep): Add declaration. * amd64-tdep.c (_initialize_amd64_tdep): Add declaration. * amd64-windows-nat.c (_initialize_amd64_windows_nat): Add declaration. * amd64-windows-tdep.c (_initialize_amd64_windows_tdep): Add declaration. * annotate.c (_initialize_annotate): Add declaration. * arc-newlib-tdep.c (_initialize_arc_newlib_tdep): Add declaration. * arc-tdep.c (_initialize_arc_tdep): Add declaration. * arch-utils.c (_initialize_gdbarch_utils): Add declaration. * arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Add declaration. * arm-fbsd-tdep.c (_initialize_arm_fbsd_tdep): Add declaration. * arm-linux-nat.c (_initialize_arm_linux_nat): Add declaration. * arm-linux-tdep.c (_initialize_arm_linux_tdep): Add declaration. * arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Add declaration. * arm-nbsd-tdep.c (_initialize_arm_netbsd_tdep): Add declaration. * arm-obsd-tdep.c (_initialize_armobsd_tdep): Add declaration. * arm-pikeos-tdep.c (_initialize_arm_pikeos_tdep): Add declaration. * arm-symbian-tdep.c (_initialize_arm_symbian_tdep): Add declaration. * arm-tdep.c (_initialize_arm_tdep): Add declaration. * arm-wince-tdep.c (_initialize_arm_wince_tdep): Add declaration. * auto-load.c (_initialize_auto_load): Add declaration. * auxv.c (_initialize_auxv): Add declaration. * avr-tdep.c (_initialize_avr_tdep): Add declaration. * ax-gdb.c (_initialize_ax_gdb): Add declaration. * bfin-linux-tdep.c (_initialize_bfin_linux_tdep): Add declaration. * bfin-tdep.c (_initialize_bfin_tdep): Add declaration. * break-catch-sig.c (_initialize_break_catch_sig): Add declaration. * break-catch-syscall.c (_initialize_break_catch_syscall): Add declaration. * break-catch-throw.c (_initialize_break_catch_throw): Add declaration. * breakpoint.c (_initialize_breakpoint): Add declaration. * bsd-uthread.c (_initialize_bsd_uthread): Add declaration. * btrace.c (_initialize_btrace): Add declaration. * charset.c (_initialize_charset): Add declaration. * cli/cli-cmds.c (_initialize_cli_cmds): Add declaration. * cli/cli-dump.c (_initialize_cli_dump): Add declaration. * cli/cli-interp.c (_initialize_cli_interp): Add declaration. * cli/cli-logging.c (_initialize_cli_logging): Add declaration. * cli/cli-script.c (_initialize_cli_script): Add declaration. * cli/cli-style.c (_initialize_cli_style): Add declaration. * coff-pe-read.c (_initialize_coff_pe_read): Add declaration. * coffread.c (_initialize_coffread): Add declaration. * compile/compile-cplus-types.c (_initialize_compile_cplus_types): Add declaration. * compile/compile.c (_initialize_compile): Add declaration. * complaints.c (_initialize_complaints): Add declaration. * completer.c (_initialize_completer): Add declaration. * copying.c (_initialize_copying): Add declaration. * corefile.c (_initialize_core): Add declaration. * corelow.c (_initialize_corelow): Add declaration. * cp-abi.c (_initialize_cp_abi): Add declaration. * cp-namespace.c (_initialize_cp_namespace): Add declaration. * cp-support.c (_initialize_cp_support): Add declaration. * cp-valprint.c (_initialize_cp_valprint): Add declaration. * cris-linux-tdep.c (_initialize_cris_linux_tdep): Add declaration. * cris-tdep.c (_initialize_cris_tdep): Add declaration. * csky-linux-tdep.c (_initialize_csky_linux_tdep): Add declaration. * csky-tdep.c (_initialize_csky_tdep): Add declaration. * ctfread.c (_initialize_ctfread): Add declaration. * d-lang.c (_initialize_d_language): Add declaration. * darwin-nat-info.c (_initialize_darwin_info_commands): Add declaration. * darwin-nat.c (_initialize_darwin_nat): Add declaration. * dbxread.c (_initialize_dbxread): Add declaration. * dcache.c (_initialize_dcache): Add declaration. * disasm-selftests.c (_initialize_disasm_selftests): Add declaration. * disasm.c (_initialize_disasm): Add declaration. * dtrace-probe.c (_initialize_dtrace_probe): Add declaration. * dummy-frame.c (_initialize_dummy_frame): Add declaration. * dwarf-index-cache.c (_initialize_index_cache): Add declaration. * dwarf-index-write.c (_initialize_dwarf_index_write): Add declaration. * dwarf2-frame-tailcall.c (_initialize_tailcall_frame): Add declaration. * dwarf2-frame.c (_initialize_dwarf2_frame): Add declaration. * dwarf2expr.c (_initialize_dwarf2expr): Add declaration. * dwarf2loc.c (_initialize_dwarf2loc): Add declaration. * dwarf2read.c (_initialize_dwarf2_read): Add declaration. * elfread.c (_initialize_elfread): Add declaration. * exec.c (_initialize_exec): Add declaration. * extension.c (_initialize_extension): Add declaration. * f-lang.c (_initialize_f_language): Add declaration. * f-valprint.c (_initialize_f_valprint): Add declaration. * fbsd-nat.c (_initialize_fbsd_nat): Add declaration. * fbsd-tdep.c (_initialize_fbsd_tdep): Add declaration. * filesystem.c (_initialize_filesystem): Add declaration. * findcmd.c (_initialize_mem_search): Add declaration. * findvar.c (_initialize_findvar): Add declaration. * fork-child.c (_initialize_fork_child): Add declaration. * frame-base.c (_initialize_frame_base): Add declaration. * frame-unwind.c (_initialize_frame_unwind): Add declaration. * frame.c (_initialize_frame): Add declaration. * frv-linux-tdep.c (_initialize_frv_linux_tdep): Add declaration. * frv-tdep.c (_initialize_frv_tdep): Add declaration. * ft32-tdep.c (_initialize_ft32_tdep): Add declaration. * gcore.c (_initialize_gcore): Add declaration. * gdb-demangle.c (_initialize_gdb_demangle): Add declaration. * gdb_bfd.c (_initialize_gdb_bfd): Add declaration. * gdbarch-selftests.c (_initialize_gdbarch_selftests): Add declaration. * gdbarch.c (_initialize_gdbarch): Add declaration. * gdbtypes.c (_initialize_gdbtypes): Add declaration. * gnu-nat.c (_initialize_gnu_nat): Add declaration. * gnu-v2-abi.c (_initialize_gnu_v2_abi): Add declaration. * gnu-v3-abi.c (_initialize_gnu_v3_abi): Add declaration. * go-lang.c (_initialize_go_language): Add declaration. * go32-nat.c (_initialize_go32_nat): Add declaration. * guile/guile.c (_initialize_guile): Add declaration. * h8300-tdep.c (_initialize_h8300_tdep): Add declaration. * hppa-linux-nat.c (_initialize_hppa_linux_nat): Add declaration. * hppa-linux-tdep.c (_initialize_hppa_linux_tdep): Add declaration. * hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Add declaration. * hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Add declaration. * hppa-obsd-nat.c (_initialize_hppaobsd_nat): Add declaration. * hppa-obsd-tdep.c (_initialize_hppabsd_tdep): Add declaration. * hppa-tdep.c (_initialize_hppa_tdep): Add declaration. * i386-bsd-nat.c (_initialize_i386bsd_nat): Add declaration. * i386-cygwin-tdep.c (_initialize_i386_cygwin_tdep): Add declaration. * i386-darwin-nat.c (_initialize_i386_darwin_nat): Add declaration. * i386-darwin-tdep.c (_initialize_i386_darwin_tdep): Add declaration. * i386-dicos-tdep.c (_initialize_i386_dicos_tdep): Add declaration. * i386-fbsd-nat.c (_initialize_i386fbsd_nat): Add declaration. * i386-fbsd-tdep.c (_initialize_i386fbsd_tdep): Add declaration. * i386-gnu-nat.c (_initialize_i386gnu_nat): Add declaration. * i386-gnu-tdep.c (_initialize_i386gnu_tdep): Add declaration. * i386-go32-tdep.c (_initialize_i386_go32_tdep): Add declaration. * i386-linux-nat.c (_initialize_i386_linux_nat): Add declaration. * i386-linux-tdep.c (_initialize_i386_linux_tdep): Add declaration. * i386-nbsd-nat.c (_initialize_i386nbsd_nat): Add declaration. * i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Add declaration. * i386-nto-tdep.c (_initialize_i386nto_tdep): Add declaration. * i386-obsd-nat.c (_initialize_i386obsd_nat): Add declaration. * i386-obsd-tdep.c (_initialize_i386obsd_tdep): Add declaration. * i386-sol2-nat.c (_initialize_amd64_sol2_nat): Add declaration. * i386-sol2-tdep.c (_initialize_i386_sol2_tdep): Add declaration. * i386-tdep.c (_initialize_i386_tdep): Add declaration. * i386-windows-nat.c (_initialize_i386_windows_nat): Add declaration. * ia64-libunwind-tdep.c (_initialize_libunwind_frame): Add declaration. * ia64-linux-nat.c (_initialize_ia64_linux_nat): Add declaration. * ia64-linux-tdep.c (_initialize_ia64_linux_tdep): Add declaration. * ia64-tdep.c (_initialize_ia64_tdep): Add declaration. * ia64-vms-tdep.c (_initialize_ia64_vms_tdep): Add declaration. * infcall.c (_initialize_infcall): Add declaration. * infcmd.c (_initialize_infcmd): Add declaration. * inflow.c (_initialize_inflow): Add declaration. * infrun.c (_initialize_infrun): Add declaration. * interps.c (_initialize_interpreter): Add declaration. * iq2000-tdep.c (_initialize_iq2000_tdep): Add declaration. * jit.c (_initialize_jit): Add declaration. * language.c (_initialize_language): Add declaration. * linux-fork.c (_initialize_linux_fork): Add declaration. * linux-nat.c (_initialize_linux_nat): Add declaration. * linux-tdep.c (_initialize_linux_tdep): Add declaration. * linux-thread-db.c (_initialize_thread_db): Add declaration. * lm32-tdep.c (_initialize_lm32_tdep): Add declaration. * m2-lang.c (_initialize_m2_language): Add declaration. * m32c-tdep.c (_initialize_m32c_tdep): Add declaration. * m32r-linux-nat.c (_initialize_m32r_linux_nat): Add declaration. * m32r-linux-tdep.c (_initialize_m32r_linux_tdep): Add declaration. * m32r-tdep.c (_initialize_m32r_tdep): Add declaration. * m68hc11-tdep.c (_initialize_m68hc11_tdep): Add declaration. * m68k-bsd-nat.c (_initialize_m68kbsd_nat): Add declaration. * m68k-bsd-tdep.c (_initialize_m68kbsd_tdep): Add declaration. * m68k-linux-nat.c (_initialize_m68k_linux_nat): Add declaration. * m68k-linux-tdep.c (_initialize_m68k_linux_tdep): Add declaration. * m68k-tdep.c (_initialize_m68k_tdep): Add declaration. * machoread.c (_initialize_machoread): Add declaration. * macrocmd.c (_initialize_macrocmd): Add declaration. * macroscope.c (_initialize_macroscope): Add declaration. * maint-test-options.c (_initialize_maint_test_options): Add declaration. * maint-test-settings.c (_initialize_maint_test_settings): Add declaration. * maint.c (_initialize_maint_cmds): Add declaration. * mdebugread.c (_initialize_mdebugread): Add declaration. * memattr.c (_initialize_mem): Add declaration. * mep-tdep.c (_initialize_mep_tdep): Add declaration. * mi/mi-cmd-env.c (_initialize_mi_cmd_env): Add declaration. * mi/mi-cmds.c (_initialize_mi_cmds): Add declaration. * mi/mi-interp.c (_initialize_mi_interp): Add declaration. * mi/mi-main.c (_initialize_mi_main): Add declaration. * microblaze-linux-tdep.c (_initialize_microblaze_linux_tdep): Add declaration. * microblaze-tdep.c (_initialize_microblaze_tdep): Add declaration. * mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Add declaration. * mips-fbsd-tdep.c (_initialize_mips_fbsd_tdep): Add declaration. * mips-linux-nat.c (_initialize_mips_linux_nat): Add declaration. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Add declaration. * mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Add declaration. * mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Add declaration. * mips-sde-tdep.c (_initialize_mips_sde_tdep): Add declaration. * mips-tdep.c (_initialize_mips_tdep): Add declaration. * mips64-obsd-nat.c (_initialize_mips64obsd_nat): Add declaration. * mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Add declaration. * mipsread.c (_initialize_mipsread): Add declaration. * mn10300-linux-tdep.c (_initialize_mn10300_linux_tdep): Add declaration. * mn10300-tdep.c (_initialize_mn10300_tdep): Add declaration. * moxie-tdep.c (_initialize_moxie_tdep): Add declaration. * msp430-tdep.c (_initialize_msp430_tdep): Add declaration. * nds32-tdep.c (_initialize_nds32_tdep): Add declaration. * nios2-linux-tdep.c (_initialize_nios2_linux_tdep): Add declaration. * nios2-tdep.c (_initialize_nios2_tdep): Add declaration. * nto-procfs.c (_initialize_procfs): Add declaration. * objc-lang.c (_initialize_objc_language): Add declaration. * observable.c (_initialize_observer): Add declaration. * opencl-lang.c (_initialize_opencl_language): Add declaration. * or1k-linux-tdep.c (_initialize_or1k_linux_tdep): Add declaration. * or1k-tdep.c (_initialize_or1k_tdep): Add declaration. * osabi.c (_initialize_gdb_osabi): Add declaration. * osdata.c (_initialize_osdata): Add declaration. * p-valprint.c (_initialize_pascal_valprint): Add declaration. * parse.c (_initialize_parse): Add declaration. * ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Add declaration. * ppc-fbsd-tdep.c (_initialize_ppcfbsd_tdep): Add declaration. * ppc-linux-nat.c (_initialize_ppc_linux_nat): Add declaration. * ppc-linux-tdep.c (_initialize_ppc_linux_tdep): Add declaration. * ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Add declaration. * ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Add declaration. * ppc-obsd-nat.c (_initialize_ppcobsd_nat): Add declaration. * ppc-obsd-tdep.c (_initialize_ppcobsd_tdep): Add declaration. * printcmd.c (_initialize_printcmd): Add declaration. * probe.c (_initialize_probe): Add declaration. * proc-api.c (_initialize_proc_api): Add declaration. * proc-events.c (_initialize_proc_events): Add declaration. * proc-service.c (_initialize_proc_service): Add declaration. * procfs.c (_initialize_procfs): Add declaration. * producer.c (_initialize_producer): Add declaration. * psymtab.c (_initialize_psymtab): Add declaration. * python/python.c (_initialize_python): Add declaration. * ravenscar-thread.c (_initialize_ravenscar): Add declaration. * record-btrace.c (_initialize_record_btrace): Add declaration. * record-full.c (_initialize_record_full): Add declaration. * record.c (_initialize_record): Add declaration. * regcache-dump.c (_initialize_regcache_dump): Add declaration. * regcache.c (_initialize_regcache): Add declaration. * reggroups.c (_initialize_reggroup): Add declaration. * remote-notif.c (_initialize_notif): Add declaration. * remote-sim.c (_initialize_remote_sim): Add declaration. * remote.c (_initialize_remote): Add declaration. * reverse.c (_initialize_reverse): Add declaration. * riscv-fbsd-nat.c (_initialize_riscv_fbsd_nat): Add declaration. * riscv-fbsd-tdep.c (_initialize_riscv_fbsd_tdep): Add declaration. * riscv-linux-nat.c (_initialize_riscv_linux_nat): Add declaration. * riscv-linux-tdep.c (_initialize_riscv_linux_tdep): Add declaration. * riscv-tdep.c (_initialize_riscv_tdep): Add declaration. * rl78-tdep.c (_initialize_rl78_tdep): Add declaration. * rs6000-aix-tdep.c (_initialize_rs6000_aix_tdep): Add declaration. * rs6000-lynx178-tdep.c (_initialize_rs6000_lynx178_tdep): Add declaration. * rs6000-nat.c (_initialize_rs6000_nat): Add declaration. * rs6000-tdep.c (_initialize_rs6000_tdep): Add declaration. * run-on-main-thread.c (_initialize_run_on_main_thread): Add declaration. * rust-exp.y (_initialize_rust_exp): Add declaration. * rx-tdep.c (_initialize_rx_tdep): Add declaration. * s12z-tdep.c (_initialize_s12z_tdep): Add declaration. * s390-linux-nat.c (_initialize_s390_nat): Add declaration. * s390-linux-tdep.c (_initialize_s390_linux_tdep): Add declaration. * s390-tdep.c (_initialize_s390_tdep): Add declaration. * score-tdep.c (_initialize_score_tdep): Add declaration. * ser-go32.c (_initialize_ser_dos): Add declaration. * ser-mingw.c (_initialize_ser_windows): Add declaration. * ser-pipe.c (_initialize_ser_pipe): Add declaration. * ser-tcp.c (_initialize_ser_tcp): Add declaration. * ser-uds.c (_initialize_ser_socket): Add declaration. * ser-unix.c (_initialize_ser_hardwire): Add declaration. * serial.c (_initialize_serial): Add declaration. * sh-linux-tdep.c (_initialize_sh_linux_tdep): Add declaration. * sh-nbsd-nat.c (_initialize_shnbsd_nat): Add declaration. * sh-nbsd-tdep.c (_initialize_shnbsd_tdep): Add declaration. * sh-tdep.c (_initialize_sh_tdep): Add declaration. * skip.c (_initialize_step_skip): Add declaration. * sol-thread.c (_initialize_sol_thread): Add declaration. * solib-aix.c (_initialize_solib_aix): Add declaration. * solib-darwin.c (_initialize_darwin_solib): Add declaration. * solib-dsbt.c (_initialize_dsbt_solib): Add declaration. * solib-frv.c (_initialize_frv_solib): Add declaration. * solib-svr4.c (_initialize_svr4_solib): Add declaration. * solib-target.c (_initialize_solib_target): Add declaration. * solib.c (_initialize_solib): Add declaration. * source-cache.c (_initialize_source_cache): Add declaration. * source.c (_initialize_source): Add declaration. * sparc-linux-nat.c (_initialize_sparc_linux_nat): Add declaration. * sparc-linux-tdep.c (_initialize_sparc_linux_tdep): Add declaration. * sparc-nat.c (_initialize_sparc_nat): Add declaration. * sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Add declaration. * sparc-nbsd-tdep.c (_initialize_sparcnbsd_tdep): Add declaration. * sparc-obsd-tdep.c (_initialize_sparc32obsd_tdep): Add declaration. * sparc-sol2-tdep.c (_initialize_sparc_sol2_tdep): Add declaration. * sparc-tdep.c (_initialize_sparc_tdep): Add declaration. * sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Add declaration. * sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Add declaration. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Add declaration. * sparc64-linux-tdep.c (_initialize_sparc64_linux_tdep): Add declaration. * sparc64-nat.c (_initialize_sparc64_nat): Add declaration. * sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Add declaration. * sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Add declaration. * sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Add declaration. * sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Add declaration. * sparc64-sol2-tdep.c (_initialize_sparc64_sol2_tdep): Add declaration. * sparc64-tdep.c (_initialize_sparc64_adi_tdep): Add declaration. * stabsread.c (_initialize_stabsread): Add declaration. * stack.c (_initialize_stack): Add declaration. * stap-probe.c (_initialize_stap_probe): Add declaration. * std-regs.c (_initialize_frame_reg): Add declaration. * symfile-debug.c (_initialize_symfile_debug): Add declaration. * symfile-mem.c (_initialize_symfile_mem): Add declaration. * symfile.c (_initialize_symfile): Add declaration. * symmisc.c (_initialize_symmisc): Add declaration. * symtab.c (_initialize_symtab): Add declaration. * target.c (_initialize_target): Add declaration. * target-connection.c (_initialize_target_connection): Add declaration. * target-dcache.c (_initialize_target_dcache): Add declaration. * target-descriptions.c (_initialize_target_descriptions): Add declaration. * thread.c (_initialize_thread): Add declaration. * tic6x-linux-tdep.c (_initialize_tic6x_linux_tdep): Add declaration. * tic6x-tdep.c (_initialize_tic6x_tdep): Add declaration. * tilegx-linux-nat.c (_initialize_tile_linux_nat): Add declaration. * tilegx-linux-tdep.c (_initialize_tilegx_linux_tdep): Add declaration. * tilegx-tdep.c (_initialize_tilegx_tdep): Add declaration. * tracectf.c (_initialize_ctf): Add declaration. * tracefile-tfile.c (_initialize_tracefile_tfile): Add declaration. * tracefile.c (_initialize_tracefile): Add declaration. * tracepoint.c (_initialize_tracepoint): Add declaration. * tui/tui-hooks.c (_initialize_tui_hooks): Add declaration. * tui/tui-interp.c (_initialize_tui_interp): Add declaration. * tui/tui-layout.c (_initialize_tui_layout): Add declaration. * tui/tui-regs.c (_initialize_tui_regs): Add declaration. * tui/tui-stack.c (_initialize_tui_stack): Add declaration. * tui/tui-win.c (_initialize_tui_win): Add declaration. * tui/tui.c (_initialize_tui): Add declaration. * typeprint.c (_initialize_typeprint): Add declaration. * ui-style.c (_initialize_ui_style): Add declaration. * unittests/array-view-selftests.c (_initialize_array_view_selftests): Add declaration. * unittests/child-path-selftests.c (_initialize_child_path_selftests): Add declaration. * unittests/cli-utils-selftests.c (_initialize_cli_utils_selftests): Add declaration. * unittests/common-utils-selftests.c (_initialize_common_utils_selftests): Add declaration. * unittests/copy_bitwise-selftests.c (_initialize_copy_bitwise_utils_selftests): Add declaration. * unittests/environ-selftests.c (_initialize_environ_selftests): Add declaration. * unittests/filtered_iterator-selftests.c (_initialize_filtered_iterator_selftests): Add declaration. * unittests/format_pieces-selftests.c (_initialize_format_pieces_selftests): Add declaration. * unittests/function-view-selftests.c (_initialize_function_view_selftests): Add declaration. * unittests/help-doc-selftests.c (_initialize_help_doc_selftests): Add declaration. * unittests/lookup_name_info-selftests.c (_initialize_lookup_name_info_selftests): Add declaration. * unittests/main-thread-selftests.c (_initialize_main_thread_selftests): Add declaration. * unittests/memory-map-selftests.c (_initialize_memory_map_selftests): Add declaration. * unittests/memrange-selftests.c (_initialize_memrange_selftests): Add declaration. * unittests/mkdir-recursive-selftests.c (_initialize_mkdir_recursive_selftests): Add declaration. * unittests/observable-selftests.c (_initialize_observer_selftest): Add declaration. * unittests/offset-type-selftests.c (_initialize_offset_type_selftests): Add declaration. * unittests/optional-selftests.c (_initialize_optional_selftests): Add declaration. * unittests/parse-connection-spec-selftests.c (_initialize_parse_connection_spec_selftests): Add declaration. * unittests/rsp-low-selftests.c (_initialize_rsp_low_selftests): Add declaration. * unittests/scoped_fd-selftests.c (_initialize_scoped_fd_selftests): Add declaration. * unittests/scoped_mmap-selftests.c (_initialize_scoped_mmap_selftests): Add declaration. * unittests/scoped_restore-selftests.c (_initialize_scoped_restore_selftests): Add declaration. * unittests/string_view-selftests.c (_initialize_string_view_selftests): Add declaration. * unittests/style-selftests.c (_initialize_style_selftest): Add declaration. * unittests/tracepoint-selftests.c (_initialize_tracepoint_selftests): Add declaration. * unittests/tui-selftests.c (_initialize_tui_selftest): Add declaration. * unittests/unpack-selftests.c (_initialize_unpack_selftests): Add declaration. * unittests/utils-selftests.c (_initialize_utils_selftests): Add declaration. * unittests/vec-utils-selftests.c (_initialize_vec_utils_selftests): Add declaration. * unittests/xml-utils-selftests.c (_initialize_xml_utils): Add declaration. * user-regs.c (_initialize_user_regs): Add declaration. * utils.c (_initialize_utils): Add declaration. * v850-tdep.c (_initialize_v850_tdep): Add declaration. * valops.c (_initialize_valops): Add declaration. * valprint.c (_initialize_valprint): Add declaration. * value.c (_initialize_values): Add declaration. * varobj.c (_initialize_varobj): Add declaration. * vax-bsd-nat.c (_initialize_vaxbsd_nat): Add declaration. * vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Add declaration. * vax-tdep.c (_initialize_vax_tdep): Add declaration. * windows-nat.c (_initialize_windows_nat): Add declaration. (_initialize_check_for_gdb_ini): Add declaration. (_initialize_loadable): Add declaration. * windows-tdep.c (_initialize_windows_tdep): Add declaration. * x86-bsd-nat.c (_initialize_x86_bsd_nat): Add declaration. * x86-linux-nat.c (_initialize_x86_linux_nat): Add declaration. * xcoffread.c (_initialize_xcoffread): Add declaration. * xml-support.c (_initialize_xml_support): Add declaration. * xstormy16-tdep.c (_initialize_xstormy16_tdep): Add declaration. * xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Add declaration. * xtensa-linux-tdep.c (_initialize_xtensa_linux_tdep): Add declaration. * xtensa-tdep.c (_initialize_xtensa_tdep): Add declaration. Change-Id: I13eec7e0ed2b3c427377a7bdb055cf46da64def9
2020-01-13 20:01:38 +01:00
void _initialize_cli_cmds ();
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
void
gdb: add back declarations for _initialize functions I'd like to enable the -Wmissing-declarations warning. However, it warns for every _initialize function, for example: CXX dcache.o /home/smarchi/src/binutils-gdb/gdb/dcache.c: In function ‘void _initialize_dcache()’: /home/smarchi/src/binutils-gdb/gdb/dcache.c:688:1: error: no previous declaration for ‘void _initialize_dcache()’ [-Werror=missing-declarations] _initialize_dcache (void) ^~~~~~~~~~~~~~~~~~ The only practical way forward I found is to add back the declarations, which were removed by this commit: commit 481695ed5f6e0a8a9c9c50bfac1cdd2b3151e6c9 Author: John Baldwin <jhb@FreeBSD.org> Date: Sat Sep 9 11:02:37 2017 -0700 Remove unnecessary function prototypes. I don't think it's a big problem to have the declarations for these functions, but if anybody has a better solution for this, I'll be happy to use it. gdb/ChangeLog: * aarch64-fbsd-nat.c (_initialize_aarch64_fbsd_nat): Add declaration. * aarch64-fbsd-tdep.c (_initialize_aarch64_fbsd_tdep): Add declaration. * aarch64-linux-nat.c (_initialize_aarch64_linux_nat): Add declaration. * aarch64-linux-tdep.c (_initialize_aarch64_linux_tdep): Add declaration. * aarch64-newlib-tdep.c (_initialize_aarch64_newlib_tdep): Add declaration. * aarch64-tdep.c (_initialize_aarch64_tdep): Add declaration. * ada-exp.y (_initialize_ada_exp): Add declaration. * ada-lang.c (_initialize_ada_language): Add declaration. * ada-tasks.c (_initialize_tasks): Add declaration. * agent.c (_initialize_agent): Add declaration. * aix-thread.c (_initialize_aix_thread): Add declaration. * alpha-bsd-nat.c (_initialize_alphabsd_nat): Add declaration. * alpha-linux-nat.c (_initialize_alpha_linux_nat): Add declaration. * alpha-linux-tdep.c (_initialize_alpha_linux_tdep): Add declaration. * alpha-nbsd-tdep.c (_initialize_alphanbsd_tdep): Add declaration. * alpha-obsd-tdep.c (_initialize_alphaobsd_tdep): Add declaration. * alpha-tdep.c (_initialize_alpha_tdep): Add declaration. * amd64-darwin-tdep.c (_initialize_amd64_darwin_tdep): Add declaration. * amd64-dicos-tdep.c (_initialize_amd64_dicos_tdep): Add declaration. * amd64-fbsd-nat.c (_initialize_amd64fbsd_nat): Add declaration. * amd64-fbsd-tdep.c (_initialize_amd64fbsd_tdep): Add declaration. * amd64-linux-nat.c (_initialize_amd64_linux_nat): Add declaration. * amd64-linux-tdep.c (_initialize_amd64_linux_tdep): Add declaration. * amd64-nbsd-nat.c (_initialize_amd64nbsd_nat): Add declaration. * amd64-nbsd-tdep.c (_initialize_amd64nbsd_tdep): Add declaration. * amd64-obsd-nat.c (_initialize_amd64obsd_nat): Add declaration. * amd64-obsd-tdep.c (_initialize_amd64obsd_tdep): Add declaration. * amd64-sol2-tdep.c (_initialize_amd64_sol2_tdep): Add declaration. * amd64-tdep.c (_initialize_amd64_tdep): Add declaration. * amd64-windows-nat.c (_initialize_amd64_windows_nat): Add declaration. * amd64-windows-tdep.c (_initialize_amd64_windows_tdep): Add declaration. * annotate.c (_initialize_annotate): Add declaration. * arc-newlib-tdep.c (_initialize_arc_newlib_tdep): Add declaration. * arc-tdep.c (_initialize_arc_tdep): Add declaration. * arch-utils.c (_initialize_gdbarch_utils): Add declaration. * arm-fbsd-nat.c (_initialize_arm_fbsd_nat): Add declaration. * arm-fbsd-tdep.c (_initialize_arm_fbsd_tdep): Add declaration. * arm-linux-nat.c (_initialize_arm_linux_nat): Add declaration. * arm-linux-tdep.c (_initialize_arm_linux_tdep): Add declaration. * arm-nbsd-nat.c (_initialize_arm_netbsd_nat): Add declaration. * arm-nbsd-tdep.c (_initialize_arm_netbsd_tdep): Add declaration. * arm-obsd-tdep.c (_initialize_armobsd_tdep): Add declaration. * arm-pikeos-tdep.c (_initialize_arm_pikeos_tdep): Add declaration. * arm-symbian-tdep.c (_initialize_arm_symbian_tdep): Add declaration. * arm-tdep.c (_initialize_arm_tdep): Add declaration. * arm-wince-tdep.c (_initialize_arm_wince_tdep): Add declaration. * auto-load.c (_initialize_auto_load): Add declaration. * auxv.c (_initialize_auxv): Add declaration. * avr-tdep.c (_initialize_avr_tdep): Add declaration. * ax-gdb.c (_initialize_ax_gdb): Add declaration. * bfin-linux-tdep.c (_initialize_bfin_linux_tdep): Add declaration. * bfin-tdep.c (_initialize_bfin_tdep): Add declaration. * break-catch-sig.c (_initialize_break_catch_sig): Add declaration. * break-catch-syscall.c (_initialize_break_catch_syscall): Add declaration. * break-catch-throw.c (_initialize_break_catch_throw): Add declaration. * breakpoint.c (_initialize_breakpoint): Add declaration. * bsd-uthread.c (_initialize_bsd_uthread): Add declaration. * btrace.c (_initialize_btrace): Add declaration. * charset.c (_initialize_charset): Add declaration. * cli/cli-cmds.c (_initialize_cli_cmds): Add declaration. * cli/cli-dump.c (_initialize_cli_dump): Add declaration. * cli/cli-interp.c (_initialize_cli_interp): Add declaration. * cli/cli-logging.c (_initialize_cli_logging): Add declaration. * cli/cli-script.c (_initialize_cli_script): Add declaration. * cli/cli-style.c (_initialize_cli_style): Add declaration. * coff-pe-read.c (_initialize_coff_pe_read): Add declaration. * coffread.c (_initialize_coffread): Add declaration. * compile/compile-cplus-types.c (_initialize_compile_cplus_types): Add declaration. * compile/compile.c (_initialize_compile): Add declaration. * complaints.c (_initialize_complaints): Add declaration. * completer.c (_initialize_completer): Add declaration. * copying.c (_initialize_copying): Add declaration. * corefile.c (_initialize_core): Add declaration. * corelow.c (_initialize_corelow): Add declaration. * cp-abi.c (_initialize_cp_abi): Add declaration. * cp-namespace.c (_initialize_cp_namespace): Add declaration. * cp-support.c (_initialize_cp_support): Add declaration. * cp-valprint.c (_initialize_cp_valprint): Add declaration. * cris-linux-tdep.c (_initialize_cris_linux_tdep): Add declaration. * cris-tdep.c (_initialize_cris_tdep): Add declaration. * csky-linux-tdep.c (_initialize_csky_linux_tdep): Add declaration. * csky-tdep.c (_initialize_csky_tdep): Add declaration. * ctfread.c (_initialize_ctfread): Add declaration. * d-lang.c (_initialize_d_language): Add declaration. * darwin-nat-info.c (_initialize_darwin_info_commands): Add declaration. * darwin-nat.c (_initialize_darwin_nat): Add declaration. * dbxread.c (_initialize_dbxread): Add declaration. * dcache.c (_initialize_dcache): Add declaration. * disasm-selftests.c (_initialize_disasm_selftests): Add declaration. * disasm.c (_initialize_disasm): Add declaration. * dtrace-probe.c (_initialize_dtrace_probe): Add declaration. * dummy-frame.c (_initialize_dummy_frame): Add declaration. * dwarf-index-cache.c (_initialize_index_cache): Add declaration. * dwarf-index-write.c (_initialize_dwarf_index_write): Add declaration. * dwarf2-frame-tailcall.c (_initialize_tailcall_frame): Add declaration. * dwarf2-frame.c (_initialize_dwarf2_frame): Add declaration. * dwarf2expr.c (_initialize_dwarf2expr): Add declaration. * dwarf2loc.c (_initialize_dwarf2loc): Add declaration. * dwarf2read.c (_initialize_dwarf2_read): Add declaration. * elfread.c (_initialize_elfread): Add declaration. * exec.c (_initialize_exec): Add declaration. * extension.c (_initialize_extension): Add declaration. * f-lang.c (_initialize_f_language): Add declaration. * f-valprint.c (_initialize_f_valprint): Add declaration. * fbsd-nat.c (_initialize_fbsd_nat): Add declaration. * fbsd-tdep.c (_initialize_fbsd_tdep): Add declaration. * filesystem.c (_initialize_filesystem): Add declaration. * findcmd.c (_initialize_mem_search): Add declaration. * findvar.c (_initialize_findvar): Add declaration. * fork-child.c (_initialize_fork_child): Add declaration. * frame-base.c (_initialize_frame_base): Add declaration. * frame-unwind.c (_initialize_frame_unwind): Add declaration. * frame.c (_initialize_frame): Add declaration. * frv-linux-tdep.c (_initialize_frv_linux_tdep): Add declaration. * frv-tdep.c (_initialize_frv_tdep): Add declaration. * ft32-tdep.c (_initialize_ft32_tdep): Add declaration. * gcore.c (_initialize_gcore): Add declaration. * gdb-demangle.c (_initialize_gdb_demangle): Add declaration. * gdb_bfd.c (_initialize_gdb_bfd): Add declaration. * gdbarch-selftests.c (_initialize_gdbarch_selftests): Add declaration. * gdbarch.c (_initialize_gdbarch): Add declaration. * gdbtypes.c (_initialize_gdbtypes): Add declaration. * gnu-nat.c (_initialize_gnu_nat): Add declaration. * gnu-v2-abi.c (_initialize_gnu_v2_abi): Add declaration. * gnu-v3-abi.c (_initialize_gnu_v3_abi): Add declaration. * go-lang.c (_initialize_go_language): Add declaration. * go32-nat.c (_initialize_go32_nat): Add declaration. * guile/guile.c (_initialize_guile): Add declaration. * h8300-tdep.c (_initialize_h8300_tdep): Add declaration. * hppa-linux-nat.c (_initialize_hppa_linux_nat): Add declaration. * hppa-linux-tdep.c (_initialize_hppa_linux_tdep): Add declaration. * hppa-nbsd-nat.c (_initialize_hppanbsd_nat): Add declaration. * hppa-nbsd-tdep.c (_initialize_hppanbsd_tdep): Add declaration. * hppa-obsd-nat.c (_initialize_hppaobsd_nat): Add declaration. * hppa-obsd-tdep.c (_initialize_hppabsd_tdep): Add declaration. * hppa-tdep.c (_initialize_hppa_tdep): Add declaration. * i386-bsd-nat.c (_initialize_i386bsd_nat): Add declaration. * i386-cygwin-tdep.c (_initialize_i386_cygwin_tdep): Add declaration. * i386-darwin-nat.c (_initialize_i386_darwin_nat): Add declaration. * i386-darwin-tdep.c (_initialize_i386_darwin_tdep): Add declaration. * i386-dicos-tdep.c (_initialize_i386_dicos_tdep): Add declaration. * i386-fbsd-nat.c (_initialize_i386fbsd_nat): Add declaration. * i386-fbsd-tdep.c (_initialize_i386fbsd_tdep): Add declaration. * i386-gnu-nat.c (_initialize_i386gnu_nat): Add declaration. * i386-gnu-tdep.c (_initialize_i386gnu_tdep): Add declaration. * i386-go32-tdep.c (_initialize_i386_go32_tdep): Add declaration. * i386-linux-nat.c (_initialize_i386_linux_nat): Add declaration. * i386-linux-tdep.c (_initialize_i386_linux_tdep): Add declaration. * i386-nbsd-nat.c (_initialize_i386nbsd_nat): Add declaration. * i386-nbsd-tdep.c (_initialize_i386nbsd_tdep): Add declaration. * i386-nto-tdep.c (_initialize_i386nto_tdep): Add declaration. * i386-obsd-nat.c (_initialize_i386obsd_nat): Add declaration. * i386-obsd-tdep.c (_initialize_i386obsd_tdep): Add declaration. * i386-sol2-nat.c (_initialize_amd64_sol2_nat): Add declaration. * i386-sol2-tdep.c (_initialize_i386_sol2_tdep): Add declaration. * i386-tdep.c (_initialize_i386_tdep): Add declaration. * i386-windows-nat.c (_initialize_i386_windows_nat): Add declaration. * ia64-libunwind-tdep.c (_initialize_libunwind_frame): Add declaration. * ia64-linux-nat.c (_initialize_ia64_linux_nat): Add declaration. * ia64-linux-tdep.c (_initialize_ia64_linux_tdep): Add declaration. * ia64-tdep.c (_initialize_ia64_tdep): Add declaration. * ia64-vms-tdep.c (_initialize_ia64_vms_tdep): Add declaration. * infcall.c (_initialize_infcall): Add declaration. * infcmd.c (_initialize_infcmd): Add declaration. * inflow.c (_initialize_inflow): Add declaration. * infrun.c (_initialize_infrun): Add declaration. * interps.c (_initialize_interpreter): Add declaration. * iq2000-tdep.c (_initialize_iq2000_tdep): Add declaration. * jit.c (_initialize_jit): Add declaration. * language.c (_initialize_language): Add declaration. * linux-fork.c (_initialize_linux_fork): Add declaration. * linux-nat.c (_initialize_linux_nat): Add declaration. * linux-tdep.c (_initialize_linux_tdep): Add declaration. * linux-thread-db.c (_initialize_thread_db): Add declaration. * lm32-tdep.c (_initialize_lm32_tdep): Add declaration. * m2-lang.c (_initialize_m2_language): Add declaration. * m32c-tdep.c (_initialize_m32c_tdep): Add declaration. * m32r-linux-nat.c (_initialize_m32r_linux_nat): Add declaration. * m32r-linux-tdep.c (_initialize_m32r_linux_tdep): Add declaration. * m32r-tdep.c (_initialize_m32r_tdep): Add declaration. * m68hc11-tdep.c (_initialize_m68hc11_tdep): Add declaration. * m68k-bsd-nat.c (_initialize_m68kbsd_nat): Add declaration. * m68k-bsd-tdep.c (_initialize_m68kbsd_tdep): Add declaration. * m68k-linux-nat.c (_initialize_m68k_linux_nat): Add declaration. * m68k-linux-tdep.c (_initialize_m68k_linux_tdep): Add declaration. * m68k-tdep.c (_initialize_m68k_tdep): Add declaration. * machoread.c (_initialize_machoread): Add declaration. * macrocmd.c (_initialize_macrocmd): Add declaration. * macroscope.c (_initialize_macroscope): Add declaration. * maint-test-options.c (_initialize_maint_test_options): Add declaration. * maint-test-settings.c (_initialize_maint_test_settings): Add declaration. * maint.c (_initialize_maint_cmds): Add declaration. * mdebugread.c (_initialize_mdebugread): Add declaration. * memattr.c (_initialize_mem): Add declaration. * mep-tdep.c (_initialize_mep_tdep): Add declaration. * mi/mi-cmd-env.c (_initialize_mi_cmd_env): Add declaration. * mi/mi-cmds.c (_initialize_mi_cmds): Add declaration. * mi/mi-interp.c (_initialize_mi_interp): Add declaration. * mi/mi-main.c (_initialize_mi_main): Add declaration. * microblaze-linux-tdep.c (_initialize_microblaze_linux_tdep): Add declaration. * microblaze-tdep.c (_initialize_microblaze_tdep): Add declaration. * mips-fbsd-nat.c (_initialize_mips_fbsd_nat): Add declaration. * mips-fbsd-tdep.c (_initialize_mips_fbsd_tdep): Add declaration. * mips-linux-nat.c (_initialize_mips_linux_nat): Add declaration. * mips-linux-tdep.c (_initialize_mips_linux_tdep): Add declaration. * mips-nbsd-nat.c (_initialize_mipsnbsd_nat): Add declaration. * mips-nbsd-tdep.c (_initialize_mipsnbsd_tdep): Add declaration. * mips-sde-tdep.c (_initialize_mips_sde_tdep): Add declaration. * mips-tdep.c (_initialize_mips_tdep): Add declaration. * mips64-obsd-nat.c (_initialize_mips64obsd_nat): Add declaration. * mips64-obsd-tdep.c (_initialize_mips64obsd_tdep): Add declaration. * mipsread.c (_initialize_mipsread): Add declaration. * mn10300-linux-tdep.c (_initialize_mn10300_linux_tdep): Add declaration. * mn10300-tdep.c (_initialize_mn10300_tdep): Add declaration. * moxie-tdep.c (_initialize_moxie_tdep): Add declaration. * msp430-tdep.c (_initialize_msp430_tdep): Add declaration. * nds32-tdep.c (_initialize_nds32_tdep): Add declaration. * nios2-linux-tdep.c (_initialize_nios2_linux_tdep): Add declaration. * nios2-tdep.c (_initialize_nios2_tdep): Add declaration. * nto-procfs.c (_initialize_procfs): Add declaration. * objc-lang.c (_initialize_objc_language): Add declaration. * observable.c (_initialize_observer): Add declaration. * opencl-lang.c (_initialize_opencl_language): Add declaration. * or1k-linux-tdep.c (_initialize_or1k_linux_tdep): Add declaration. * or1k-tdep.c (_initialize_or1k_tdep): Add declaration. * osabi.c (_initialize_gdb_osabi): Add declaration. * osdata.c (_initialize_osdata): Add declaration. * p-valprint.c (_initialize_pascal_valprint): Add declaration. * parse.c (_initialize_parse): Add declaration. * ppc-fbsd-nat.c (_initialize_ppcfbsd_nat): Add declaration. * ppc-fbsd-tdep.c (_initialize_ppcfbsd_tdep): Add declaration. * ppc-linux-nat.c (_initialize_ppc_linux_nat): Add declaration. * ppc-linux-tdep.c (_initialize_ppc_linux_tdep): Add declaration. * ppc-nbsd-nat.c (_initialize_ppcnbsd_nat): Add declaration. * ppc-nbsd-tdep.c (_initialize_ppcnbsd_tdep): Add declaration. * ppc-obsd-nat.c (_initialize_ppcobsd_nat): Add declaration. * ppc-obsd-tdep.c (_initialize_ppcobsd_tdep): Add declaration. * printcmd.c (_initialize_printcmd): Add declaration. * probe.c (_initialize_probe): Add declaration. * proc-api.c (_initialize_proc_api): Add declaration. * proc-events.c (_initialize_proc_events): Add declaration. * proc-service.c (_initialize_proc_service): Add declaration. * procfs.c (_initialize_procfs): Add declaration. * producer.c (_initialize_producer): Add declaration. * psymtab.c (_initialize_psymtab): Add declaration. * python/python.c (_initialize_python): Add declaration. * ravenscar-thread.c (_initialize_ravenscar): Add declaration. * record-btrace.c (_initialize_record_btrace): Add declaration. * record-full.c (_initialize_record_full): Add declaration. * record.c (_initialize_record): Add declaration. * regcache-dump.c (_initialize_regcache_dump): Add declaration. * regcache.c (_initialize_regcache): Add declaration. * reggroups.c (_initialize_reggroup): Add declaration. * remote-notif.c (_initialize_notif): Add declaration. * remote-sim.c (_initialize_remote_sim): Add declaration. * remote.c (_initialize_remote): Add declaration. * reverse.c (_initialize_reverse): Add declaration. * riscv-fbsd-nat.c (_initialize_riscv_fbsd_nat): Add declaration. * riscv-fbsd-tdep.c (_initialize_riscv_fbsd_tdep): Add declaration. * riscv-linux-nat.c (_initialize_riscv_linux_nat): Add declaration. * riscv-linux-tdep.c (_initialize_riscv_linux_tdep): Add declaration. * riscv-tdep.c (_initialize_riscv_tdep): Add declaration. * rl78-tdep.c (_initialize_rl78_tdep): Add declaration. * rs6000-aix-tdep.c (_initialize_rs6000_aix_tdep): Add declaration. * rs6000-lynx178-tdep.c (_initialize_rs6000_lynx178_tdep): Add declaration. * rs6000-nat.c (_initialize_rs6000_nat): Add declaration. * rs6000-tdep.c (_initialize_rs6000_tdep): Add declaration. * run-on-main-thread.c (_initialize_run_on_main_thread): Add declaration. * rust-exp.y (_initialize_rust_exp): Add declaration. * rx-tdep.c (_initialize_rx_tdep): Add declaration. * s12z-tdep.c (_initialize_s12z_tdep): Add declaration. * s390-linux-nat.c (_initialize_s390_nat): Add declaration. * s390-linux-tdep.c (_initialize_s390_linux_tdep): Add declaration. * s390-tdep.c (_initialize_s390_tdep): Add declaration. * score-tdep.c (_initialize_score_tdep): Add declaration. * ser-go32.c (_initialize_ser_dos): Add declaration. * ser-mingw.c (_initialize_ser_windows): Add declaration. * ser-pipe.c (_initialize_ser_pipe): Add declaration. * ser-tcp.c (_initialize_ser_tcp): Add declaration. * ser-uds.c (_initialize_ser_socket): Add declaration. * ser-unix.c (_initialize_ser_hardwire): Add declaration. * serial.c (_initialize_serial): Add declaration. * sh-linux-tdep.c (_initialize_sh_linux_tdep): Add declaration. * sh-nbsd-nat.c (_initialize_shnbsd_nat): Add declaration. * sh-nbsd-tdep.c (_initialize_shnbsd_tdep): Add declaration. * sh-tdep.c (_initialize_sh_tdep): Add declaration. * skip.c (_initialize_step_skip): Add declaration. * sol-thread.c (_initialize_sol_thread): Add declaration. * solib-aix.c (_initialize_solib_aix): Add declaration. * solib-darwin.c (_initialize_darwin_solib): Add declaration. * solib-dsbt.c (_initialize_dsbt_solib): Add declaration. * solib-frv.c (_initialize_frv_solib): Add declaration. * solib-svr4.c (_initialize_svr4_solib): Add declaration. * solib-target.c (_initialize_solib_target): Add declaration. * solib.c (_initialize_solib): Add declaration. * source-cache.c (_initialize_source_cache): Add declaration. * source.c (_initialize_source): Add declaration. * sparc-linux-nat.c (_initialize_sparc_linux_nat): Add declaration. * sparc-linux-tdep.c (_initialize_sparc_linux_tdep): Add declaration. * sparc-nat.c (_initialize_sparc_nat): Add declaration. * sparc-nbsd-nat.c (_initialize_sparcnbsd_nat): Add declaration. * sparc-nbsd-tdep.c (_initialize_sparcnbsd_tdep): Add declaration. * sparc-obsd-tdep.c (_initialize_sparc32obsd_tdep): Add declaration. * sparc-sol2-tdep.c (_initialize_sparc_sol2_tdep): Add declaration. * sparc-tdep.c (_initialize_sparc_tdep): Add declaration. * sparc64-fbsd-nat.c (_initialize_sparc64fbsd_nat): Add declaration. * sparc64-fbsd-tdep.c (_initialize_sparc64fbsd_tdep): Add declaration. * sparc64-linux-nat.c (_initialize_sparc64_linux_nat): Add declaration. * sparc64-linux-tdep.c (_initialize_sparc64_linux_tdep): Add declaration. * sparc64-nat.c (_initialize_sparc64_nat): Add declaration. * sparc64-nbsd-nat.c (_initialize_sparc64nbsd_nat): Add declaration. * sparc64-nbsd-tdep.c (_initialize_sparc64nbsd_tdep): Add declaration. * sparc64-obsd-nat.c (_initialize_sparc64obsd_nat): Add declaration. * sparc64-obsd-tdep.c (_initialize_sparc64obsd_tdep): Add declaration. * sparc64-sol2-tdep.c (_initialize_sparc64_sol2_tdep): Add declaration. * sparc64-tdep.c (_initialize_sparc64_adi_tdep): Add declaration. * stabsread.c (_initialize_stabsread): Add declaration. * stack.c (_initialize_stack): Add declaration. * stap-probe.c (_initialize_stap_probe): Add declaration. * std-regs.c (_initialize_frame_reg): Add declaration. * symfile-debug.c (_initialize_symfile_debug): Add declaration. * symfile-mem.c (_initialize_symfile_mem): Add declaration. * symfile.c (_initialize_symfile): Add declaration. * symmisc.c (_initialize_symmisc): Add declaration. * symtab.c (_initialize_symtab): Add declaration. * target.c (_initialize_target): Add declaration. * target-connection.c (_initialize_target_connection): Add declaration. * target-dcache.c (_initialize_target_dcache): Add declaration. * target-descriptions.c (_initialize_target_descriptions): Add declaration. * thread.c (_initialize_thread): Add declaration. * tic6x-linux-tdep.c (_initialize_tic6x_linux_tdep): Add declaration. * tic6x-tdep.c (_initialize_tic6x_tdep): Add declaration. * tilegx-linux-nat.c (_initialize_tile_linux_nat): Add declaration. * tilegx-linux-tdep.c (_initialize_tilegx_linux_tdep): Add declaration. * tilegx-tdep.c (_initialize_tilegx_tdep): Add declaration. * tracectf.c (_initialize_ctf): Add declaration. * tracefile-tfile.c (_initialize_tracefile_tfile): Add declaration. * tracefile.c (_initialize_tracefile): Add declaration. * tracepoint.c (_initialize_tracepoint): Add declaration. * tui/tui-hooks.c (_initialize_tui_hooks): Add declaration. * tui/tui-interp.c (_initialize_tui_interp): Add declaration. * tui/tui-layout.c (_initialize_tui_layout): Add declaration. * tui/tui-regs.c (_initialize_tui_regs): Add declaration. * tui/tui-stack.c (_initialize_tui_stack): Add declaration. * tui/tui-win.c (_initialize_tui_win): Add declaration. * tui/tui.c (_initialize_tui): Add declaration. * typeprint.c (_initialize_typeprint): Add declaration. * ui-style.c (_initialize_ui_style): Add declaration. * unittests/array-view-selftests.c (_initialize_array_view_selftests): Add declaration. * unittests/child-path-selftests.c (_initialize_child_path_selftests): Add declaration. * unittests/cli-utils-selftests.c (_initialize_cli_utils_selftests): Add declaration. * unittests/common-utils-selftests.c (_initialize_common_utils_selftests): Add declaration. * unittests/copy_bitwise-selftests.c (_initialize_copy_bitwise_utils_selftests): Add declaration. * unittests/environ-selftests.c (_initialize_environ_selftests): Add declaration. * unittests/filtered_iterator-selftests.c (_initialize_filtered_iterator_selftests): Add declaration. * unittests/format_pieces-selftests.c (_initialize_format_pieces_selftests): Add declaration. * unittests/function-view-selftests.c (_initialize_function_view_selftests): Add declaration. * unittests/help-doc-selftests.c (_initialize_help_doc_selftests): Add declaration. * unittests/lookup_name_info-selftests.c (_initialize_lookup_name_info_selftests): Add declaration. * unittests/main-thread-selftests.c (_initialize_main_thread_selftests): Add declaration. * unittests/memory-map-selftests.c (_initialize_memory_map_selftests): Add declaration. * unittests/memrange-selftests.c (_initialize_memrange_selftests): Add declaration. * unittests/mkdir-recursive-selftests.c (_initialize_mkdir_recursive_selftests): Add declaration. * unittests/observable-selftests.c (_initialize_observer_selftest): Add declaration. * unittests/offset-type-selftests.c (_initialize_offset_type_selftests): Add declaration. * unittests/optional-selftests.c (_initialize_optional_selftests): Add declaration. * unittests/parse-connection-spec-selftests.c (_initialize_parse_connection_spec_selftests): Add declaration. * unittests/rsp-low-selftests.c (_initialize_rsp_low_selftests): Add declaration. * unittests/scoped_fd-selftests.c (_initialize_scoped_fd_selftests): Add declaration. * unittests/scoped_mmap-selftests.c (_initialize_scoped_mmap_selftests): Add declaration. * unittests/scoped_restore-selftests.c (_initialize_scoped_restore_selftests): Add declaration. * unittests/string_view-selftests.c (_initialize_string_view_selftests): Add declaration. * unittests/style-selftests.c (_initialize_style_selftest): Add declaration. * unittests/tracepoint-selftests.c (_initialize_tracepoint_selftests): Add declaration. * unittests/tui-selftests.c (_initialize_tui_selftest): Add declaration. * unittests/unpack-selftests.c (_initialize_unpack_selftests): Add declaration. * unittests/utils-selftests.c (_initialize_utils_selftests): Add declaration. * unittests/vec-utils-selftests.c (_initialize_vec_utils_selftests): Add declaration. * unittests/xml-utils-selftests.c (_initialize_xml_utils): Add declaration. * user-regs.c (_initialize_user_regs): Add declaration. * utils.c (_initialize_utils): Add declaration. * v850-tdep.c (_initialize_v850_tdep): Add declaration. * valops.c (_initialize_valops): Add declaration. * valprint.c (_initialize_valprint): Add declaration. * value.c (_initialize_values): Add declaration. * varobj.c (_initialize_varobj): Add declaration. * vax-bsd-nat.c (_initialize_vaxbsd_nat): Add declaration. * vax-nbsd-tdep.c (_initialize_vaxnbsd_tdep): Add declaration. * vax-tdep.c (_initialize_vax_tdep): Add declaration. * windows-nat.c (_initialize_windows_nat): Add declaration. (_initialize_check_for_gdb_ini): Add declaration. (_initialize_loadable): Add declaration. * windows-tdep.c (_initialize_windows_tdep): Add declaration. * x86-bsd-nat.c (_initialize_x86_bsd_nat): Add declaration. * x86-linux-nat.c (_initialize_x86_linux_nat): Add declaration. * xcoffread.c (_initialize_xcoffread): Add declaration. * xml-support.c (_initialize_xml_support): Add declaration. * xstormy16-tdep.c (_initialize_xstormy16_tdep): Add declaration. * xtensa-linux-nat.c (_initialize_xtensa_linux_nat): Add declaration. * xtensa-linux-tdep.c (_initialize_xtensa_linux_tdep): Add declaration. * xtensa-tdep.c (_initialize_xtensa_tdep): Add declaration. Change-Id: I13eec7e0ed2b3c427377a7bdb055cf46da64def9
2020-01-13 20:01:38 +01:00
_initialize_cli_cmds ()
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
{
struct cmd_list_element *c;
/* Define the classes of commands.
2011-10-06 Justin Lebar <justin.lebar@gmail.com> * Makefile.in: (SFILES): Add skip.c. (HFILES_NO_SRCDIR): Add skip.h. (COMMON_OBS): Add skip.o. * skip.h, skip.c: New. * breakpoint.h (set_default_breakpoint): Remove. (get_sal_arch): Declare. * breakpoint.c: Remove default_breakpoint_valid, default_breakpoint_address, default_breakpoint_symtab, default_breakpoint_line, default_breakpoint_pspace variables. (get_sal_arch): Make public. (set_default_breakpoint): Remove. (parse_breakpoint_sals, create_breakpoint, clear_command, decode_line_spec_1): Remove uses of default_breakpoint variables; replaced with function calls into stack.c. * cli/cli-cmds.h: Add cmd_list_element *skiplist. * cli/cli-cmds.c: Add skiplist. (init_cmd_lists): Initialize skiplist. (init_cli_cmds): Fix comment (classes of commands appear in alphabetical order). * infrun.c (handle_inferior_event): Add check that we don't step into a function whose pc is marked for skip. * stack.c: Declare last_displayed_sal_valid, last_displayed_pspace, last_displayed_addr, last_displayed_symtab, last_displayed_line variables. (set_last_displayed_sal): New static function. (print_frame_info): Switch call to set_default_breakpoint to call to set_last_displayed_sal. (clear_last_displayed_sal, last_displayed_sal_is_valid, get_last_displayed_pspace, get_last_displayed_addr, get_last_displayed_symtab, get_last_displayed_line, get_last_displayed_sal): New public functions. * stack.h (clear_last_displayed_sal, last_displayed_sal_is_valid, get_last_displayed_pspace, get_last_displayed_addr, get_last_displayed_symtab, get_last_displayed_line, get_last_displayed_sal): Declare. 2011-10-06 Justin Lebar <justin.lebar@gmail.com> Add tests for skip command. * testsuite/gdb.base/skip-solib-lib.c: New * testsuite/gdb.base/skip-solib-main.c: New * testsuite/gdb.base/skip-solib.exp: New * testsuite/gdb.base/skip.c: New * testsuite/gdb.base/skip.exp: New * testsuite/gdb.base/skip1.c: New * testsuite/gdb.base/Makefile.in: Adding new files.
2011-11-01 15:51:25 +01:00
They will appear in the help list in alphabetical order. */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
add_cmd ("internals", class_maintenance, _("\
Maintenance commands.\n\
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
Some gdb commands are provided just for use by gdb maintainers.\n\
These commands are subject to frequent change, and may not be as\n\
well documented as user commands."),
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
&cmdlist);
add_cmd ("obscure", class_obscure, _("Obscure features."), &cmdlist);
add_cmd ("aliases", class_alias,
_("Aliases of other commands."), &cmdlist);
add_cmd ("user-defined", class_user, _("\
User-defined commands.\n\
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
The commands in this class are those defined by the user.\n\
Use the \"define\" command to define a command."), &cmdlist);
add_cmd ("support", class_support, _("Support facilities."), &cmdlist);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
if (!dbx_commands)
add_cmd ("status", class_info, _("Status inquiries."), &cmdlist);
add_cmd ("files", class_files, _("Specifying and examining files."),
&cmdlist);
add_cmd ("breakpoints", class_breakpoint,
_("Making program stop at certain points."), &cmdlist);
add_cmd ("data", class_vars, _("Examining data."), &cmdlist);
add_cmd ("stack", class_stack, _("\
Examining the stack.\n\
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
The stack is made up of stack frames. Gdb assigns numbers to stack frames\n\
counting from zero for the innermost (currently executing) frame.\n\n\
At any time gdb identifies one frame as the \"selected\" frame.\n\
Variable lookups are done with respect to the selected frame.\n\
When the program being debugged stops, gdb selects the innermost frame.\n\
The commands below can be used to select other frames by number or address."),
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
&cmdlist);
add_cmd ("running", class_run, _("Running the program."), &cmdlist);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
/* Define general commands. */
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
2009-03-25 22:42:35 +01:00
add_com ("pwd", class_files, pwd_command, _("\
Make first and last lines of 'command help documentation' consistent. With this patch, the help docs now respect 2 invariants: * The first line of a command help is terminated by a '.' character. * The last character of a command help is not a newline character. Note that the changes for the last invariant were done by Tom, as part of : [PATCH] Remove trailing newlines from help text https://sourceware.org/ml/gdb-patches/2019-06/msg00050.html but some occurrences have been re-introduced since then. Some help docs had to be rephrased/restructured to respect the above invariants. Before this patch, print_doc_line was printing the first line of a command help documentation, but stopping at the first '.' or ',' character. This was giving inconsistent results : * The first line of command helps was sometimes '.' terminated, sometimes not. * The first line of command helps was not always designed to be readable/understandable/unambiguous when stopping at the first '.' or ',' character. This e.g. created the following inconsistencies/problems: < catch exception -- Catch Ada exceptions < catch handlers -- Catch Ada exceptions < catch syscall -- Catch system calls by their names < down-silently -- Same as the `down' command while the new help is: > catch exception -- Catch Ada exceptions, when raised. > catch handlers -- Catch Ada exceptions, when handled. > catch syscall -- Catch system calls by their names, groups and/or numbers. > down-silently -- Same as the `down' command, but does not print anything. Also, the command help doc should not be terminated by a newline character, but this was not respected by all commands. The cli-option -OPT framework re-introduced some occurences. So, the -OPT build help framework was changed to not output newlines at the end of %OPTIONS% replacement. This patch changes the help documentations to ensure the 2 invariants given above. It implied to slightly rephrase or restructure some help docs. Based on the above invariants, print_doc_line (called by 'apropos' and 'help' commands to print the first line of a command help) now outputs the full first line of a command help. This all results in a lot of small changes in the produced help docs. There are less code changes than changes in the help docs, as a lot of docs are produced by some code (e.g. the remote packet usage settings). gdb/ChangeLog 2019-08-07 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-decode.h (print_doc_line): Add for_value_prefix argument. * cli/cli-decode.c (print_doc_line): Likewise. It now prints the full first line, except when FOR_VALUE_PREFIX. In this case, the trailing '.' is not output, and the first character is uppercased. (print_help_for_command): Update call to print_doc_line. (print_doc_of_command): Likewise. * cli/cli-setshow.c (deprecated_show_value_hack): Likewise. * cli/cli-option.c (append_indented_doc): Do not append newline. (build_help_option): Append newline after first appended_indented_doc only if a second call is done. (build_help): Append 2 new lines before each option, except the first one. * compile/compile.c (_initialize_compile): Add new lines after %OPTIONS%, when not at the end of the help. Change help doc or code producing the help doc to respect the invariants. * maint-test-options.c (_initialize_maint_test_options): Likewise. Also removed the new line after 'Options:', as all other commands do not put an empty line between 'Options:' and the first option. * printcmd.c (_initialize_printcmd): Likewise. * stack.c (_initialize_stack): Likewise. * interps.c (interpreter_exec_cmd): Fix "Usage:" line that was incorrectly telling COMMAND is optional. * ada-lang.c (_initialize_ada_language): Change help doc or code producing the help doc to respect the invariants. * ada-tasks.c (_initialize_ada_tasks): Likewise. * breakpoint.c (_initialize_breakpoint): Likewise. * cli/cli-cmds.c (_initialize_cli_cmds): Likewise. * cli/cli-logging.c (_initialize_cli_logging): Likewise. * cli/cli-setshow.c (_initialize_cli_setshow): Likewise. * cli/cli-style.c (cli_style_option::add_setshow_commands, _initialize_cli_style): Likewise. * corelow.c (core_target_info): Likewise. * dwarf-index-cache.c (_initialize_index_cache): Likewise. * dwarf2read.c (_initialize_dwarf2_read): Likewise. * filesystem.c (_initialize_filesystem): Likewise. * frame.c (_initialize_frame): Likewise. * gnu-nat.c (add_task_commands): Likewise. * infcall.c (_initialize_infcall): Likewise. * infcmd.c (_initialize_infcmd): Likewise. * interps.c (_initialize_interpreter): Likewise. * language.c (_initialize_language): Likewise. * linux-fork.c (_initialize_linux_fork): Likewise. * maint-test-settings.c (_initialize_maint_test_settings): Likewise. * maint.c (_initialize_maint_cmds): Likewise. * memattr.c (_initialize_mem): Likewise. * printcmd.c (_initialize_printcmd): Likewise. * python/lib/gdb/function/strfns.py (_MemEq, _StrLen, _StrEq, _RegEx): Likewise. * ravenscar-thread.c (_initialize_ravenscar): Likewise. * record-btrace.c (_initialize_record_btrace): Likewise. * record-full.c (_initialize_record_full): Likewise. * record.c (_initialize_record): Likewise. * regcache-dump.c (_initialize_regcache_dump): Likewise. * regcache.c (_initialize_regcache): Likewise. * remote.c (add_packet_config_cmd, init_remote_threadtests, _initialize_remote): Likewise. * ser-tcp.c (_initialize_ser_tcp): Likewise. * serial.c (_initialize_serial): Likewise. * skip.c (_initialize_step_skip): Likewise. * source.c (_initialize_source): Likewise. * stack.c (_initialize_stack): Likewise. * symfile.c (_initialize_symfile): Likewise. * symtab.c (_initialize_symtab): Likewise. * target-descriptions.c (_initialize_target_descriptions): Likewise. * top.c (init_main): Likewise. * tracefile-tfile.c (tfile_target_info): Likewise. * tracepoint.c (_initialize_tracepoint): Likewise. * tui/tui-win.c (_initialize_tui_win): Likewise. * utils.c (add_internal_problem_command): Likewise. * valprint.c (value_print_option_defs): Likewise. gdb/testsuite/ChangeLog 2019-08-07 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/style.exp: Update tests for help doc new invariants. * gdb.base/help.exp: Likewise.
2019-06-09 11:16:20 +02:00
Print working directory.\n\
This is used for your program as well."));
Exited threads. * thread.c (enum thread_state): New. (thread_state main_thread_running): Delete, in favor of... (thread_state main_thread_state): ... this. Update throughout. (clear_thread_inferior_resources): New, split from free_thread. (free_thread): Call clear_thread_inferior_resources. (init_thread_list): Set main thread to stopped state. (add_thread_silent): Take care of PTID reuses. (delete_thread): If deleting inferior_ptid or a thread with refcount > 0, mark it as exited, but still keep it in the list. Only notify of thread exits, if we haven't done so yet. (iterate_over_threads): Make it safe to delete threads while iterating over them. (do_captured_list_thread_ids): Don't account for exited threads. (thread_alive): Check for the THREAD_EXITED state, and don't set ptid to -1 on exited threads. (set_running): Update to account for extra possible states. (is_thread_state): New. (is_stopped, is_exited): New. (is_running): Implement in terms of is_thread_state. (any_running): Update. (print_thread_info): Update. Account for exited threads. Don't warn about missed frame restoring here, its done in the cleanup. (switch_to_thread): Don't read from a thread that has gone. (restore_current_thread): In non-stop mode, do a full context switch. (restore_selected_frame): Add a frame_level argument. Rewrite. (struct current_thread_cleanup): Add selected_frame_level and was_stopped members. (do_restore_current_thread_cleanup): Check if thread was stopped and still is, and if the target has registers, stack and memory before restoring the selected frame. Don't delete the cleanup argument here. (restore_current_thread_cleanup_dtor): New. (make_cleanup_restore_current_thread): Remove all arguments. Rewrite. (thread_apply_all_command): Update. Prune threads. (thread_apply_command): Update. (thread_command): Account for currently selected exited thread. (do_captured_thread_select): Check for a running thread. Prune threads. (_initialize_thread): Make "info threads", "thread", "thread apply", and "thread apply all" appliable without a selected thread. * gdbthread.h (struct thread_info): Replace running_ by state_. Add refcount. (is_exited, is_stopped): Declare. (make_cleanup_restore_current_thread): Remove all arguments. * infrun.c: Include "event-top.h". (fetch_inferior_event): In non-stop mode, restore selected thread and frame after handling the event and running breakpoint commands. Display GDB prompt if needed. (normal_stop): In non-stop mode, don't print thread switching notice. * cli/cli-decode.c (set_cmd_no_selected_thread_ok) (get_cmd_no_selected_thread_ok): New. * cli/cli-decode.h (CMD_NO_SELECTED_THREAD_OK): New. (set_cmd_no_selected_thread_ok, get_cmd_no_selected_thread_ok): Declare. * cli/cli-cmds.c: Set "pwd", "help", "info", "show" as no-selected-thread ok. * top.c (execute_command): Check for non no-selected-thread-ok commands. * linux-nat.c (struct saved_ptids, threads_to_delete) (record_dead_thread, prune_lwps): Delete. (exit_lwp): Unconditionally delete thread. (linux_nat_resume): Remove prune_lwps call. * infcmd.c (proceed_thread_callback): Check if !is_stopped instead of is_running. Adjust to make_cleanup_restore_current_thread interface change. * mi/mi-main.c (mi_cmd_execute): Only allow a few commands if the selected thread has exited. * inf-loop.c (inferior_event_handler): Don't display the prompt here. * varobj.c (c_value_of_root): Update. * defs.h (make_cleanup_dtor): Declare. * utils.c (make_cleanup_dtor): New. * Makefile.in (infrun.o): Depend on $(event_top_h).
2008-07-11 13:07:39 +02:00
c = add_cmd ("cd", class_files, cd_command, _("\
Implement "set cwd" command on GDB This commit adds new "set/show cwd" commands, which are used to set/show the current working directory of the inferior that will be started. The idea here is that "set cwd" will become the de facto way of setting the inferior's cwd. Currently, the user can use "cd" for that, but there are side effects: with "cd", GDB also switches to another directory, and that can impact the loading of scripts and other files. With "set cwd", we separate the logic into a new command. To maintain backward compatibility, if the user issues a "cd" command but doesn't use "set cwd", then the inferior's cwd will still be changed according to what the user specified. However, "set cwd" has precedence over "cd", so it can always be used to override it. "set cwd" works in the following way: - If the user sets the inferior's cwd by using "set cwd", then this directory is saved into current_inferior ()->cwd and is used when the inferior is started (see below). - If the user doesn't set the inferior's cwd by using "set cwd", but rather use the "cd" command as before, then this directory is inherited by the inferior because GDB will have chdir'd into it. On Unix-like hosts, the way the directory is changed before the inferior execution is by expanding the user set directory before the fork, and then "chdir" after the call to fork/vfork on "fork_inferior", but before the actual execution. On Windows, the inferior cwd set by the user is passed directly to the CreateProcess call, which takes care of the actual chdir for us. This way, we'll make sure that GDB's cwd is not affected by the user set cwd. gdb/ChangeLog: 2017-10-04 Sergio Durigan Junior <sergiodj@redhat.com> * NEWS (New commands): Mention "set/show cwd". * cli/cli-cmds.c (_initialize_cli_cmds): Mention "set cwd" on "cd" command's help text. * common/common-inferior.h (get_inferior_cwd): New prototype. * infcmd.c (inferior_cwd_scratch): New global variable. (set_inferior_cwd): New function. (get_inferior_cwd): Likewise. (set_cwd_command): Likewise. (show_cwd_command): Likewise. (_initialize_infcmd): Add "set/show cwd" commands. * inferior.h (class inferior) <cwd>: New field. * nat/fork-inferior.c: Include "gdb_tilde_expand.h". (fork_inferior): Change inferior's cwd before its execution. * windows-nat.c (windows_create_inferior): Pass inferior's cwd to CreateProcess. gdb/gdbserver/ChangeLog: 2017-10-04 Sergio Durigan Junior <sergiodj@redhat.com> * inferiors.c (current_inferior_cwd): New global variable. (get_inferior_cwd): New function. * inferiors.h (struct process_info) <cwd>: New field. gdb/doc/ChangeLog: 2017-10-04 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.texinfo (Starting your Program) <The working directory.>: Mention new "set cwd" command. (Working Directory) <Your Program's Working Directory>: Rephrase to explain that "set cwd" exists and is the default way to change the inferior's cwd. gdb/testsuite/ChangeLog: 2017-10-04 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.base/set-cwd.c: New file. * gdb.base/set-cwd.exp: Likewise.
2017-09-11 07:13:50 +02:00
Set working directory to DIR for debugger.\n\
The debugger's current working directory specifies where scripts and other\n\
files that can be loaded by GDB are located.\n\
In order to change the inferior's current working directory, the recommended\n\
way is to use the \"set cwd\" command."), &cmdlist);
set_cmd_completer (c, filename_completer);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
add_com ("echo", class_support, echo_command, _("\
Print a constant string. Give string as argument.\n\
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
C escape sequences may be used in the argument.\n\
No newline is added at the end of the argument;\n\
use \"\\n\" if you want a newline to be printed.\n\
Since leading and trailing whitespace are ignored in command arguments,\n\
if you want to print some you must use \"\\\" before leading whitespace\n\
to be printed or after trailing whitespace."));
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
add_setshow_enum_cmd ("script-extension", class_support,
script_ext_enums, &script_ext_mode, _("\
Set mode for script filename extension recognition."), _("\
Show mode for script filename extension recognition."), _("\
off == no filename extension recognition (all sourced files are GDB scripts)\n\
soft == evaluate script according to filename extension, fallback to GDB script"
"\n\
strict == evaluate script according to filename extension, error if not supported"
),
NULL,
show_script_ext_mode,
&setlist, &showlist);
add_com ("quit", class_support, quit_command, _("\
Exit gdb.\n\
Usage: quit [EXPR]\n\
The optional expression EXPR, if present, is evaluated and the result\n\
used as GDB's exit code. The default is zero."));
c = add_com ("help", class_support, help_command,
_("Print list of commands."));
set_cmd_completer (c, command_completer);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
add_com_alias ("q", "quit", class_support, 1);
add_com_alias ("h", "help", class_support, 1);
add_setshow_boolean_cmd ("verbose", class_support, &info_verbose, _("\
Set verbosity."), _("\
Show verbosity."), NULL,
set_verbose,
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
show_info_verbose,
&setlist, &showlist);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
Replace most calls to help_list and cmd_show_list Currently there are many prefix commands that do nothing but call either help_list or cmd_show_list. I happened to notice that one such call, for "set print type", used the wrong command list parameter, causing incorrect output. Rather than fix this bug in isolation, I decided to eliminate this possibility by adding two new ways to add prefix commands, which simply route the call to help_list or cmd_show_list, as appropriate. This makes it impossible for a mismatch to occur. In some cases, a bit of output was removed; however, I don't think this output in general was very useful. It seemed redundant with what's already printed by help_list. A representative example is this hunk, removed from ada-lang.c: - printf_unfiltered (_(\ -"\"set ada\" must be followed by the name of a setting.\n")); This simplified the CLI style set/show commands quite a bit, and allowed the deletion of a macro. This also cleans up some unusual code in windows-tdep.c. Tested on x86-64 Fedora 30. Note that I have no way to build the go32-nat.c change. gdb/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * auto-load.c (show_auto_load_cmd): Remove. (auto_load_show_cmdlist_get): Use add_show_prefix_cmd. * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd. (maintenance_print_arc_command): Remove. * tui/tui-win.c (tui_command): Remove. (tui_get_cmd_list): Use add_basic_prefix_cmd. * tui/tui-layout.c (tui_layout_command): Remove. (_initialize_tui_layout): Use add_basic_prefix_cmd. * python/python.c (user_set_python, user_show_python): Remove. (_initialize_python): Use add_basic_prefix_cmd, add_show_prefix_cmd. * guile/guile.c (set_guile_command, show_guile_command): Remove. (install_gdb_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_guile_command): Remove. * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove. (_initialize_dwarf2_read): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Remove do_set and do_show parameters. * cli/cli-style.c (set_style, show_style): Remove. (_initialize_cli_style): Use add_basic_prefix_cmd, add_show_prefix_cmd. (cli_style_option::add_setshow_commands): Remove do_set and do_show parameters. (cli_style_option::add_setshow_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (STYLE_ADD_SETSHOW_COMMANDS): Remove macro. (set_style_name): Remove. * cli/cli-dump.c (dump_command, append_command): Remove. (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Remove. (_initialize_cli_dump): Use add_basic_prefix_cmd. * windows-tdep.c (w32_prefix_command_valid): Remove global. (init_w32_command_list): Remove; move into ... (_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Remove. (_initialize_valprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * typeprint.c (set_print_type, show_print_type): Remove. (_initialize_typeprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record.c (set_record_command, show_record_command): Remove. (_initialize_record): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_command, show_command, set_debug, show_debug): Remove. * top.h (set_history, show_history): Don't declare. * top.c (set_history, show_history): Remove. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Remove. (_initialize_target_descriptions): Use add_basic_prefix_cmd, add_show_prefix_cmd. * symtab.c (info_module_command): Remove. (_initialize_symtab): Use add_basic_prefix_cmd. * symfile.c (overlay_command): Remove. (_initialize_symfile): Use add_basic_prefix_cmd. * sparc64-tdep.c (info_adi_command): Remove. (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd. * sh-tdep.c (show_sh_command, set_sh_command): Remove. (_initialize_sh_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * serial.c (serial_set_cmd, serial_show_cmd): Remove. (_initialize_serial): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove. (_initialize_ser_tcp): Use add_basic_prefix_cmd, add_show_prefix_cmd. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command) (_initialize_rs6000_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * riscv-tdep.c (show_riscv_command, set_riscv_command) (show_debug_riscv_command, set_debug_riscv_command): Remove. (_initialize_riscv_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * remote.c (remote_command, set_remote_cmd): Remove. (_initialize_remote): Use add_basic_prefix_cmd. * record-full.c (set_record_full_command) (show_record_full_command): Remove. (_initialize_record_full): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record-btrace.c (cmd_set_record_btrace) (cmd_show_record_btrace, cmd_set_record_btrace_bts) (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt) (cmd_show_record_btrace_pt): Remove. (_initialize_record_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Remove. (_initialize_ravenscar): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (show_mips_command, set_mips_command) (_initialize_mips_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint.c (maintenance_command, maintenance_info_command) (maintenance_check_command, maintenance_print_command) (maintenance_set_cmd, maintenance_show_cmd): Remove. (_initialize_maint_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_per_command_cmd): Remove. * maint-test-settings.c (maintenance_set_test_settings_cmd): Remove. (maintenance_show_test_settings_cmd): Remove. (_initialize_maint_test_settings): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint-test-options.c (maintenance_test_options_command): Remove. (_initialize_maint_test_options): Use add_basic_prefix_cmd. * macrocmd.c (macro_command): Remove (_initialize_macrocmd): Use add_basic_prefix_cmd. * language.c (set_check, show_check): Remove. (_initialize_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * infcmd.c (unset_command): Remove. (_initialize_infcmd): Use add_basic_prefix_cmd. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove. (_initialize_i386_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * go32-nat.c (go32_info_dos_command): Remove. (_initialize_go32_nat): Use add_basic_prefix_cmd. * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd) (do_show_prefix_cmd, add_show_prefix_cmd): New functions. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove. (_initialize_frame): Use add_basic_prefix_cmd, add_show_prefix_cmd. * dcache.c (set_dcache_command, show_dcache_command): Remove. (_initialize_dcache): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cp-support.c (maint_cplus_command): Remove. (_initialize_cp_support): Use add_basic_prefix_cmd. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd, _initialize_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * breakpoint.c (save_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd. * arm-tdep.c (set_arm_command, show_arm_command): Remove. (_initialize_arm_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd) (set_ada_command, show_ada_command): Remove. (_initialize_ada_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare. gdb/testsuite/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * gdb.cp/maint.exp (test_help): Simplify multiple_help_body. Update tests. * gdb.btrace/cpu.exp: Update tests. * gdb.base/maint.exp: Update tests. * gdb.base/default.exp: Update tests. * gdb.base/completion.exp: Update tests.
2020-04-17 15:27:14 +02:00
add_basic_prefix_cmd ("history", class_support, _("\
Generic command for setting command history parameters."),
&sethistlist, "set history ", 0, &setlist);
add_show_prefix_cmd ("history", class_support, _("\
Generic command for showing command history parameters."),
&showhistlist, "show history ", 0, &showlist);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
add_setshow_boolean_cmd ("expansion", no_class, &history_expansion_p, _("\
Set history expansion on command input."), _("\
Show history expansion on command input."), _("\
Without an argument, history expansion is enabled."),
NULL,
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
show_history_expansion_p,
&sethistlist, &showhistlist);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
Replace most calls to help_list and cmd_show_list Currently there are many prefix commands that do nothing but call either help_list or cmd_show_list. I happened to notice that one such call, for "set print type", used the wrong command list parameter, causing incorrect output. Rather than fix this bug in isolation, I decided to eliminate this possibility by adding two new ways to add prefix commands, which simply route the call to help_list or cmd_show_list, as appropriate. This makes it impossible for a mismatch to occur. In some cases, a bit of output was removed; however, I don't think this output in general was very useful. It seemed redundant with what's already printed by help_list. A representative example is this hunk, removed from ada-lang.c: - printf_unfiltered (_(\ -"\"set ada\" must be followed by the name of a setting.\n")); This simplified the CLI style set/show commands quite a bit, and allowed the deletion of a macro. This also cleans up some unusual code in windows-tdep.c. Tested on x86-64 Fedora 30. Note that I have no way to build the go32-nat.c change. gdb/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * auto-load.c (show_auto_load_cmd): Remove. (auto_load_show_cmdlist_get): Use add_show_prefix_cmd. * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd. (maintenance_print_arc_command): Remove. * tui/tui-win.c (tui_command): Remove. (tui_get_cmd_list): Use add_basic_prefix_cmd. * tui/tui-layout.c (tui_layout_command): Remove. (_initialize_tui_layout): Use add_basic_prefix_cmd. * python/python.c (user_set_python, user_show_python): Remove. (_initialize_python): Use add_basic_prefix_cmd, add_show_prefix_cmd. * guile/guile.c (set_guile_command, show_guile_command): Remove. (install_gdb_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_guile_command): Remove. * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove. (_initialize_dwarf2_read): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Remove do_set and do_show parameters. * cli/cli-style.c (set_style, show_style): Remove. (_initialize_cli_style): Use add_basic_prefix_cmd, add_show_prefix_cmd. (cli_style_option::add_setshow_commands): Remove do_set and do_show parameters. (cli_style_option::add_setshow_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (STYLE_ADD_SETSHOW_COMMANDS): Remove macro. (set_style_name): Remove. * cli/cli-dump.c (dump_command, append_command): Remove. (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Remove. (_initialize_cli_dump): Use add_basic_prefix_cmd. * windows-tdep.c (w32_prefix_command_valid): Remove global. (init_w32_command_list): Remove; move into ... (_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Remove. (_initialize_valprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * typeprint.c (set_print_type, show_print_type): Remove. (_initialize_typeprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record.c (set_record_command, show_record_command): Remove. (_initialize_record): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_command, show_command, set_debug, show_debug): Remove. * top.h (set_history, show_history): Don't declare. * top.c (set_history, show_history): Remove. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Remove. (_initialize_target_descriptions): Use add_basic_prefix_cmd, add_show_prefix_cmd. * symtab.c (info_module_command): Remove. (_initialize_symtab): Use add_basic_prefix_cmd. * symfile.c (overlay_command): Remove. (_initialize_symfile): Use add_basic_prefix_cmd. * sparc64-tdep.c (info_adi_command): Remove. (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd. * sh-tdep.c (show_sh_command, set_sh_command): Remove. (_initialize_sh_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * serial.c (serial_set_cmd, serial_show_cmd): Remove. (_initialize_serial): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove. (_initialize_ser_tcp): Use add_basic_prefix_cmd, add_show_prefix_cmd. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command) (_initialize_rs6000_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * riscv-tdep.c (show_riscv_command, set_riscv_command) (show_debug_riscv_command, set_debug_riscv_command): Remove. (_initialize_riscv_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * remote.c (remote_command, set_remote_cmd): Remove. (_initialize_remote): Use add_basic_prefix_cmd. * record-full.c (set_record_full_command) (show_record_full_command): Remove. (_initialize_record_full): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record-btrace.c (cmd_set_record_btrace) (cmd_show_record_btrace, cmd_set_record_btrace_bts) (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt) (cmd_show_record_btrace_pt): Remove. (_initialize_record_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Remove. (_initialize_ravenscar): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (show_mips_command, set_mips_command) (_initialize_mips_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint.c (maintenance_command, maintenance_info_command) (maintenance_check_command, maintenance_print_command) (maintenance_set_cmd, maintenance_show_cmd): Remove. (_initialize_maint_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_per_command_cmd): Remove. * maint-test-settings.c (maintenance_set_test_settings_cmd): Remove. (maintenance_show_test_settings_cmd): Remove. (_initialize_maint_test_settings): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint-test-options.c (maintenance_test_options_command): Remove. (_initialize_maint_test_options): Use add_basic_prefix_cmd. * macrocmd.c (macro_command): Remove (_initialize_macrocmd): Use add_basic_prefix_cmd. * language.c (set_check, show_check): Remove. (_initialize_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * infcmd.c (unset_command): Remove. (_initialize_infcmd): Use add_basic_prefix_cmd. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove. (_initialize_i386_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * go32-nat.c (go32_info_dos_command): Remove. (_initialize_go32_nat): Use add_basic_prefix_cmd. * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd) (do_show_prefix_cmd, add_show_prefix_cmd): New functions. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove. (_initialize_frame): Use add_basic_prefix_cmd, add_show_prefix_cmd. * dcache.c (set_dcache_command, show_dcache_command): Remove. (_initialize_dcache): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cp-support.c (maint_cplus_command): Remove. (_initialize_cp_support): Use add_basic_prefix_cmd. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd, _initialize_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * breakpoint.c (save_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd. * arm-tdep.c (set_arm_command, show_arm_command): Remove. (_initialize_arm_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd) (set_ada_command, show_ada_command): Remove. (_initialize_ada_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare. gdb/testsuite/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * gdb.cp/maint.exp (test_help): Simplify multiple_help_body. Update tests. * gdb.btrace/cpu.exp: Update tests. * gdb.base/maint.exp: Update tests. * gdb.base/default.exp: Update tests. * gdb.base/completion.exp: Update tests.
2020-04-17 15:27:14 +02:00
add_basic_prefix_cmd ("info", class_info, _("\
Generic command for showing things about the program being debugged."),
Replace most calls to help_list and cmd_show_list Currently there are many prefix commands that do nothing but call either help_list or cmd_show_list. I happened to notice that one such call, for "set print type", used the wrong command list parameter, causing incorrect output. Rather than fix this bug in isolation, I decided to eliminate this possibility by adding two new ways to add prefix commands, which simply route the call to help_list or cmd_show_list, as appropriate. This makes it impossible for a mismatch to occur. In some cases, a bit of output was removed; however, I don't think this output in general was very useful. It seemed redundant with what's already printed by help_list. A representative example is this hunk, removed from ada-lang.c: - printf_unfiltered (_(\ -"\"set ada\" must be followed by the name of a setting.\n")); This simplified the CLI style set/show commands quite a bit, and allowed the deletion of a macro. This also cleans up some unusual code in windows-tdep.c. Tested on x86-64 Fedora 30. Note that I have no way to build the go32-nat.c change. gdb/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * auto-load.c (show_auto_load_cmd): Remove. (auto_load_show_cmdlist_get): Use add_show_prefix_cmd. * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd. (maintenance_print_arc_command): Remove. * tui/tui-win.c (tui_command): Remove. (tui_get_cmd_list): Use add_basic_prefix_cmd. * tui/tui-layout.c (tui_layout_command): Remove. (_initialize_tui_layout): Use add_basic_prefix_cmd. * python/python.c (user_set_python, user_show_python): Remove. (_initialize_python): Use add_basic_prefix_cmd, add_show_prefix_cmd. * guile/guile.c (set_guile_command, show_guile_command): Remove. (install_gdb_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_guile_command): Remove. * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove. (_initialize_dwarf2_read): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Remove do_set and do_show parameters. * cli/cli-style.c (set_style, show_style): Remove. (_initialize_cli_style): Use add_basic_prefix_cmd, add_show_prefix_cmd. (cli_style_option::add_setshow_commands): Remove do_set and do_show parameters. (cli_style_option::add_setshow_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (STYLE_ADD_SETSHOW_COMMANDS): Remove macro. (set_style_name): Remove. * cli/cli-dump.c (dump_command, append_command): Remove. (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Remove. (_initialize_cli_dump): Use add_basic_prefix_cmd. * windows-tdep.c (w32_prefix_command_valid): Remove global. (init_w32_command_list): Remove; move into ... (_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Remove. (_initialize_valprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * typeprint.c (set_print_type, show_print_type): Remove. (_initialize_typeprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record.c (set_record_command, show_record_command): Remove. (_initialize_record): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_command, show_command, set_debug, show_debug): Remove. * top.h (set_history, show_history): Don't declare. * top.c (set_history, show_history): Remove. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Remove. (_initialize_target_descriptions): Use add_basic_prefix_cmd, add_show_prefix_cmd. * symtab.c (info_module_command): Remove. (_initialize_symtab): Use add_basic_prefix_cmd. * symfile.c (overlay_command): Remove. (_initialize_symfile): Use add_basic_prefix_cmd. * sparc64-tdep.c (info_adi_command): Remove. (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd. * sh-tdep.c (show_sh_command, set_sh_command): Remove. (_initialize_sh_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * serial.c (serial_set_cmd, serial_show_cmd): Remove. (_initialize_serial): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove. (_initialize_ser_tcp): Use add_basic_prefix_cmd, add_show_prefix_cmd. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command) (_initialize_rs6000_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * riscv-tdep.c (show_riscv_command, set_riscv_command) (show_debug_riscv_command, set_debug_riscv_command): Remove. (_initialize_riscv_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * remote.c (remote_command, set_remote_cmd): Remove. (_initialize_remote): Use add_basic_prefix_cmd. * record-full.c (set_record_full_command) (show_record_full_command): Remove. (_initialize_record_full): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record-btrace.c (cmd_set_record_btrace) (cmd_show_record_btrace, cmd_set_record_btrace_bts) (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt) (cmd_show_record_btrace_pt): Remove. (_initialize_record_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Remove. (_initialize_ravenscar): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (show_mips_command, set_mips_command) (_initialize_mips_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint.c (maintenance_command, maintenance_info_command) (maintenance_check_command, maintenance_print_command) (maintenance_set_cmd, maintenance_show_cmd): Remove. (_initialize_maint_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_per_command_cmd): Remove. * maint-test-settings.c (maintenance_set_test_settings_cmd): Remove. (maintenance_show_test_settings_cmd): Remove. (_initialize_maint_test_settings): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint-test-options.c (maintenance_test_options_command): Remove. (_initialize_maint_test_options): Use add_basic_prefix_cmd. * macrocmd.c (macro_command): Remove (_initialize_macrocmd): Use add_basic_prefix_cmd. * language.c (set_check, show_check): Remove. (_initialize_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * infcmd.c (unset_command): Remove. (_initialize_infcmd): Use add_basic_prefix_cmd. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove. (_initialize_i386_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * go32-nat.c (go32_info_dos_command): Remove. (_initialize_go32_nat): Use add_basic_prefix_cmd. * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd) (do_show_prefix_cmd, add_show_prefix_cmd): New functions. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove. (_initialize_frame): Use add_basic_prefix_cmd, add_show_prefix_cmd. * dcache.c (set_dcache_command, show_dcache_command): Remove. (_initialize_dcache): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cp-support.c (maint_cplus_command): Remove. (_initialize_cp_support): Use add_basic_prefix_cmd. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd, _initialize_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * breakpoint.c (save_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd. * arm-tdep.c (set_arm_command, show_arm_command): Remove. (_initialize_arm_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd) (set_ada_command, show_ada_command): Remove. (_initialize_ada_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare. gdb/testsuite/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * gdb.cp/maint.exp (test_help): Simplify multiple_help_body. Update tests. * gdb.btrace/cpu.exp: Update tests. * gdb.base/maint.exp: Update tests. * gdb.base/default.exp: Update tests. * gdb.base/completion.exp: Update tests.
2020-04-17 15:27:14 +02:00
&infolist, "info ", 0, &cmdlist);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
add_com_alias ("i", "info", class_info, 1);
add_com_alias ("inf", "info", class_info, 1);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
add_com ("complete", class_obscure, complete_command,
_("List the completions for the rest of the line as a command."));
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
Replace most calls to help_list and cmd_show_list Currently there are many prefix commands that do nothing but call either help_list or cmd_show_list. I happened to notice that one such call, for "set print type", used the wrong command list parameter, causing incorrect output. Rather than fix this bug in isolation, I decided to eliminate this possibility by adding two new ways to add prefix commands, which simply route the call to help_list or cmd_show_list, as appropriate. This makes it impossible for a mismatch to occur. In some cases, a bit of output was removed; however, I don't think this output in general was very useful. It seemed redundant with what's already printed by help_list. A representative example is this hunk, removed from ada-lang.c: - printf_unfiltered (_(\ -"\"set ada\" must be followed by the name of a setting.\n")); This simplified the CLI style set/show commands quite a bit, and allowed the deletion of a macro. This also cleans up some unusual code in windows-tdep.c. Tested on x86-64 Fedora 30. Note that I have no way to build the go32-nat.c change. gdb/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * auto-load.c (show_auto_load_cmd): Remove. (auto_load_show_cmdlist_get): Use add_show_prefix_cmd. * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd. (maintenance_print_arc_command): Remove. * tui/tui-win.c (tui_command): Remove. (tui_get_cmd_list): Use add_basic_prefix_cmd. * tui/tui-layout.c (tui_layout_command): Remove. (_initialize_tui_layout): Use add_basic_prefix_cmd. * python/python.c (user_set_python, user_show_python): Remove. (_initialize_python): Use add_basic_prefix_cmd, add_show_prefix_cmd. * guile/guile.c (set_guile_command, show_guile_command): Remove. (install_gdb_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_guile_command): Remove. * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove. (_initialize_dwarf2_read): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Remove do_set and do_show parameters. * cli/cli-style.c (set_style, show_style): Remove. (_initialize_cli_style): Use add_basic_prefix_cmd, add_show_prefix_cmd. (cli_style_option::add_setshow_commands): Remove do_set and do_show parameters. (cli_style_option::add_setshow_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (STYLE_ADD_SETSHOW_COMMANDS): Remove macro. (set_style_name): Remove. * cli/cli-dump.c (dump_command, append_command): Remove. (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Remove. (_initialize_cli_dump): Use add_basic_prefix_cmd. * windows-tdep.c (w32_prefix_command_valid): Remove global. (init_w32_command_list): Remove; move into ... (_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Remove. (_initialize_valprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * typeprint.c (set_print_type, show_print_type): Remove. (_initialize_typeprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record.c (set_record_command, show_record_command): Remove. (_initialize_record): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_command, show_command, set_debug, show_debug): Remove. * top.h (set_history, show_history): Don't declare. * top.c (set_history, show_history): Remove. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Remove. (_initialize_target_descriptions): Use add_basic_prefix_cmd, add_show_prefix_cmd. * symtab.c (info_module_command): Remove. (_initialize_symtab): Use add_basic_prefix_cmd. * symfile.c (overlay_command): Remove. (_initialize_symfile): Use add_basic_prefix_cmd. * sparc64-tdep.c (info_adi_command): Remove. (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd. * sh-tdep.c (show_sh_command, set_sh_command): Remove. (_initialize_sh_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * serial.c (serial_set_cmd, serial_show_cmd): Remove. (_initialize_serial): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove. (_initialize_ser_tcp): Use add_basic_prefix_cmd, add_show_prefix_cmd. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command) (_initialize_rs6000_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * riscv-tdep.c (show_riscv_command, set_riscv_command) (show_debug_riscv_command, set_debug_riscv_command): Remove. (_initialize_riscv_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * remote.c (remote_command, set_remote_cmd): Remove. (_initialize_remote): Use add_basic_prefix_cmd. * record-full.c (set_record_full_command) (show_record_full_command): Remove. (_initialize_record_full): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record-btrace.c (cmd_set_record_btrace) (cmd_show_record_btrace, cmd_set_record_btrace_bts) (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt) (cmd_show_record_btrace_pt): Remove. (_initialize_record_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Remove. (_initialize_ravenscar): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (show_mips_command, set_mips_command) (_initialize_mips_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint.c (maintenance_command, maintenance_info_command) (maintenance_check_command, maintenance_print_command) (maintenance_set_cmd, maintenance_show_cmd): Remove. (_initialize_maint_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_per_command_cmd): Remove. * maint-test-settings.c (maintenance_set_test_settings_cmd): Remove. (maintenance_show_test_settings_cmd): Remove. (_initialize_maint_test_settings): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint-test-options.c (maintenance_test_options_command): Remove. (_initialize_maint_test_options): Use add_basic_prefix_cmd. * macrocmd.c (macro_command): Remove (_initialize_macrocmd): Use add_basic_prefix_cmd. * language.c (set_check, show_check): Remove. (_initialize_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * infcmd.c (unset_command): Remove. (_initialize_infcmd): Use add_basic_prefix_cmd. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove. (_initialize_i386_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * go32-nat.c (go32_info_dos_command): Remove. (_initialize_go32_nat): Use add_basic_prefix_cmd. * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd) (do_show_prefix_cmd, add_show_prefix_cmd): New functions. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove. (_initialize_frame): Use add_basic_prefix_cmd, add_show_prefix_cmd. * dcache.c (set_dcache_command, show_dcache_command): Remove. (_initialize_dcache): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cp-support.c (maint_cplus_command): Remove. (_initialize_cp_support): Use add_basic_prefix_cmd. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd, _initialize_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * breakpoint.c (save_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd. * arm-tdep.c (set_arm_command, show_arm_command): Remove. (_initialize_arm_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd) (set_ada_command, show_ada_command): Remove. (_initialize_ada_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare. gdb/testsuite/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * gdb.cp/maint.exp (test_help): Simplify multiple_help_body. Update tests. * gdb.btrace/cpu.exp: Update tests. * gdb.base/maint.exp: Update tests. * gdb.base/default.exp: Update tests. * gdb.base/completion.exp: Update tests.
2020-04-17 15:27:14 +02:00
add_show_prefix_cmd ("show", class_info, _("\
Generic command for showing things about the debugger."),
Replace most calls to help_list and cmd_show_list Currently there are many prefix commands that do nothing but call either help_list or cmd_show_list. I happened to notice that one such call, for "set print type", used the wrong command list parameter, causing incorrect output. Rather than fix this bug in isolation, I decided to eliminate this possibility by adding two new ways to add prefix commands, which simply route the call to help_list or cmd_show_list, as appropriate. This makes it impossible for a mismatch to occur. In some cases, a bit of output was removed; however, I don't think this output in general was very useful. It seemed redundant with what's already printed by help_list. A representative example is this hunk, removed from ada-lang.c: - printf_unfiltered (_(\ -"\"set ada\" must be followed by the name of a setting.\n")); This simplified the CLI style set/show commands quite a bit, and allowed the deletion of a macro. This also cleans up some unusual code in windows-tdep.c. Tested on x86-64 Fedora 30. Note that I have no way to build the go32-nat.c change. gdb/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * auto-load.c (show_auto_load_cmd): Remove. (auto_load_show_cmdlist_get): Use add_show_prefix_cmd. * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd. (maintenance_print_arc_command): Remove. * tui/tui-win.c (tui_command): Remove. (tui_get_cmd_list): Use add_basic_prefix_cmd. * tui/tui-layout.c (tui_layout_command): Remove. (_initialize_tui_layout): Use add_basic_prefix_cmd. * python/python.c (user_set_python, user_show_python): Remove. (_initialize_python): Use add_basic_prefix_cmd, add_show_prefix_cmd. * guile/guile.c (set_guile_command, show_guile_command): Remove. (install_gdb_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_guile_command): Remove. * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove. (_initialize_dwarf2_read): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Remove do_set and do_show parameters. * cli/cli-style.c (set_style, show_style): Remove. (_initialize_cli_style): Use add_basic_prefix_cmd, add_show_prefix_cmd. (cli_style_option::add_setshow_commands): Remove do_set and do_show parameters. (cli_style_option::add_setshow_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (STYLE_ADD_SETSHOW_COMMANDS): Remove macro. (set_style_name): Remove. * cli/cli-dump.c (dump_command, append_command): Remove. (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Remove. (_initialize_cli_dump): Use add_basic_prefix_cmd. * windows-tdep.c (w32_prefix_command_valid): Remove global. (init_w32_command_list): Remove; move into ... (_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Remove. (_initialize_valprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * typeprint.c (set_print_type, show_print_type): Remove. (_initialize_typeprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record.c (set_record_command, show_record_command): Remove. (_initialize_record): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_command, show_command, set_debug, show_debug): Remove. * top.h (set_history, show_history): Don't declare. * top.c (set_history, show_history): Remove. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Remove. (_initialize_target_descriptions): Use add_basic_prefix_cmd, add_show_prefix_cmd. * symtab.c (info_module_command): Remove. (_initialize_symtab): Use add_basic_prefix_cmd. * symfile.c (overlay_command): Remove. (_initialize_symfile): Use add_basic_prefix_cmd. * sparc64-tdep.c (info_adi_command): Remove. (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd. * sh-tdep.c (show_sh_command, set_sh_command): Remove. (_initialize_sh_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * serial.c (serial_set_cmd, serial_show_cmd): Remove. (_initialize_serial): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove. (_initialize_ser_tcp): Use add_basic_prefix_cmd, add_show_prefix_cmd. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command) (_initialize_rs6000_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * riscv-tdep.c (show_riscv_command, set_riscv_command) (show_debug_riscv_command, set_debug_riscv_command): Remove. (_initialize_riscv_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * remote.c (remote_command, set_remote_cmd): Remove. (_initialize_remote): Use add_basic_prefix_cmd. * record-full.c (set_record_full_command) (show_record_full_command): Remove. (_initialize_record_full): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record-btrace.c (cmd_set_record_btrace) (cmd_show_record_btrace, cmd_set_record_btrace_bts) (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt) (cmd_show_record_btrace_pt): Remove. (_initialize_record_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Remove. (_initialize_ravenscar): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (show_mips_command, set_mips_command) (_initialize_mips_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint.c (maintenance_command, maintenance_info_command) (maintenance_check_command, maintenance_print_command) (maintenance_set_cmd, maintenance_show_cmd): Remove. (_initialize_maint_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_per_command_cmd): Remove. * maint-test-settings.c (maintenance_set_test_settings_cmd): Remove. (maintenance_show_test_settings_cmd): Remove. (_initialize_maint_test_settings): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint-test-options.c (maintenance_test_options_command): Remove. (_initialize_maint_test_options): Use add_basic_prefix_cmd. * macrocmd.c (macro_command): Remove (_initialize_macrocmd): Use add_basic_prefix_cmd. * language.c (set_check, show_check): Remove. (_initialize_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * infcmd.c (unset_command): Remove. (_initialize_infcmd): Use add_basic_prefix_cmd. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove. (_initialize_i386_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * go32-nat.c (go32_info_dos_command): Remove. (_initialize_go32_nat): Use add_basic_prefix_cmd. * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd) (do_show_prefix_cmd, add_show_prefix_cmd): New functions. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove. (_initialize_frame): Use add_basic_prefix_cmd, add_show_prefix_cmd. * dcache.c (set_dcache_command, show_dcache_command): Remove. (_initialize_dcache): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cp-support.c (maint_cplus_command): Remove. (_initialize_cp_support): Use add_basic_prefix_cmd. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd, _initialize_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * breakpoint.c (save_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd. * arm-tdep.c (set_arm_command, show_arm_command): Remove. (_initialize_arm_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd) (set_ada_command, show_ada_command): Remove. (_initialize_ada_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare. gdb/testsuite/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * gdb.cp/maint.exp (test_help): Simplify multiple_help_body. Update tests. * gdb.btrace/cpu.exp: Update tests. * gdb.base/maint.exp: Update tests. * gdb.base/default.exp: Update tests. * gdb.base/completion.exp: Update tests.
2020-04-17 15:27:14 +02:00
&showlist, "show ", 0, &cmdlist);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
/* Another way to get at the same thing. */
Replace most calls to help_list and cmd_show_list Currently there are many prefix commands that do nothing but call either help_list or cmd_show_list. I happened to notice that one such call, for "set print type", used the wrong command list parameter, causing incorrect output. Rather than fix this bug in isolation, I decided to eliminate this possibility by adding two new ways to add prefix commands, which simply route the call to help_list or cmd_show_list, as appropriate. This makes it impossible for a mismatch to occur. In some cases, a bit of output was removed; however, I don't think this output in general was very useful. It seemed redundant with what's already printed by help_list. A representative example is this hunk, removed from ada-lang.c: - printf_unfiltered (_(\ -"\"set ada\" must be followed by the name of a setting.\n")); This simplified the CLI style set/show commands quite a bit, and allowed the deletion of a macro. This also cleans up some unusual code in windows-tdep.c. Tested on x86-64 Fedora 30. Note that I have no way to build the go32-nat.c change. gdb/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * auto-load.c (show_auto_load_cmd): Remove. (auto_load_show_cmdlist_get): Use add_show_prefix_cmd. * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd. (maintenance_print_arc_command): Remove. * tui/tui-win.c (tui_command): Remove. (tui_get_cmd_list): Use add_basic_prefix_cmd. * tui/tui-layout.c (tui_layout_command): Remove. (_initialize_tui_layout): Use add_basic_prefix_cmd. * python/python.c (user_set_python, user_show_python): Remove. (_initialize_python): Use add_basic_prefix_cmd, add_show_prefix_cmd. * guile/guile.c (set_guile_command, show_guile_command): Remove. (install_gdb_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_guile_command): Remove. * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove. (_initialize_dwarf2_read): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Remove do_set and do_show parameters. * cli/cli-style.c (set_style, show_style): Remove. (_initialize_cli_style): Use add_basic_prefix_cmd, add_show_prefix_cmd. (cli_style_option::add_setshow_commands): Remove do_set and do_show parameters. (cli_style_option::add_setshow_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (STYLE_ADD_SETSHOW_COMMANDS): Remove macro. (set_style_name): Remove. * cli/cli-dump.c (dump_command, append_command): Remove. (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Remove. (_initialize_cli_dump): Use add_basic_prefix_cmd. * windows-tdep.c (w32_prefix_command_valid): Remove global. (init_w32_command_list): Remove; move into ... (_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Remove. (_initialize_valprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * typeprint.c (set_print_type, show_print_type): Remove. (_initialize_typeprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record.c (set_record_command, show_record_command): Remove. (_initialize_record): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_command, show_command, set_debug, show_debug): Remove. * top.h (set_history, show_history): Don't declare. * top.c (set_history, show_history): Remove. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Remove. (_initialize_target_descriptions): Use add_basic_prefix_cmd, add_show_prefix_cmd. * symtab.c (info_module_command): Remove. (_initialize_symtab): Use add_basic_prefix_cmd. * symfile.c (overlay_command): Remove. (_initialize_symfile): Use add_basic_prefix_cmd. * sparc64-tdep.c (info_adi_command): Remove. (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd. * sh-tdep.c (show_sh_command, set_sh_command): Remove. (_initialize_sh_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * serial.c (serial_set_cmd, serial_show_cmd): Remove. (_initialize_serial): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove. (_initialize_ser_tcp): Use add_basic_prefix_cmd, add_show_prefix_cmd. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command) (_initialize_rs6000_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * riscv-tdep.c (show_riscv_command, set_riscv_command) (show_debug_riscv_command, set_debug_riscv_command): Remove. (_initialize_riscv_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * remote.c (remote_command, set_remote_cmd): Remove. (_initialize_remote): Use add_basic_prefix_cmd. * record-full.c (set_record_full_command) (show_record_full_command): Remove. (_initialize_record_full): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record-btrace.c (cmd_set_record_btrace) (cmd_show_record_btrace, cmd_set_record_btrace_bts) (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt) (cmd_show_record_btrace_pt): Remove. (_initialize_record_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Remove. (_initialize_ravenscar): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (show_mips_command, set_mips_command) (_initialize_mips_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint.c (maintenance_command, maintenance_info_command) (maintenance_check_command, maintenance_print_command) (maintenance_set_cmd, maintenance_show_cmd): Remove. (_initialize_maint_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_per_command_cmd): Remove. * maint-test-settings.c (maintenance_set_test_settings_cmd): Remove. (maintenance_show_test_settings_cmd): Remove. (_initialize_maint_test_settings): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint-test-options.c (maintenance_test_options_command): Remove. (_initialize_maint_test_options): Use add_basic_prefix_cmd. * macrocmd.c (macro_command): Remove (_initialize_macrocmd): Use add_basic_prefix_cmd. * language.c (set_check, show_check): Remove. (_initialize_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * infcmd.c (unset_command): Remove. (_initialize_infcmd): Use add_basic_prefix_cmd. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove. (_initialize_i386_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * go32-nat.c (go32_info_dos_command): Remove. (_initialize_go32_nat): Use add_basic_prefix_cmd. * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd) (do_show_prefix_cmd, add_show_prefix_cmd): New functions. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove. (_initialize_frame): Use add_basic_prefix_cmd, add_show_prefix_cmd. * dcache.c (set_dcache_command, show_dcache_command): Remove. (_initialize_dcache): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cp-support.c (maint_cplus_command): Remove. (_initialize_cp_support): Use add_basic_prefix_cmd. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd, _initialize_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * breakpoint.c (save_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd. * arm-tdep.c (set_arm_command, show_arm_command): Remove. (_initialize_arm_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd) (set_ada_command, show_ada_command): Remove. (_initialize_ada_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare. gdb/testsuite/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * gdb.cp/maint.exp (test_help): Simplify multiple_help_body. Update tests. * gdb.btrace/cpu.exp: Update tests. * gdb.base/maint.exp: Update tests. * gdb.base/default.exp: Update tests. * gdb.base/completion.exp: Update tests.
2020-04-17 15:27:14 +02:00
add_show_prefix_cmd ("set", class_info, _("Show all GDB settings."),
&showlist, "info set ", 0, &infolist);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
Introduce the "with" command ( See original discussion and prototype here: https://sourceware.org/ml/gdb-patches/2019-05/msg00570.html ) (gdb) help with Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING. Usage: with SETTING [VALUE] [-- COMMAND] Usage: w SETTING [VALUE] [-- COMMAND] With no COMMAND, repeats the last executed command. SETTING is any setting you can change with the "set" subcommands. E.g.: with language pascal -- print obj with print elements unlimited -- print obj As can be seen above, the "with" command is just like "set", but instead of setting the setting permanently, it sets the setting, runs a command and then restores the setting. (gdb) p g_s $1 = {a = 1, b = 2, c = 3} (gdb) with language ada -- print g_s $2 = (a => 1, b => 2, c => 3) Warning: the current language does not match this frame. (gdb) show language The current source language is "auto; currently c". (gdb) with print elements 100 -- with print object on -- print 1 $3 = 1 You can shorten things a bit though, as long as unambiguous. So this: (gdb) with print elements 100 -- with print object off -- print 1 is the same as: (gdb) w p el 100 -- w p o 0 -- p 1 Note that the patch adds a "w" alias for "with", as "w" is not currently taken: (gdb) w Ambiguous command "w": watch, wh, whatis, where, while, while-stepping, winheight, ws. Let me know if you'd prefer to reserve "w" for one of the other commands above. IMHO, this command will end up being used frequently enough that it deserves the "w" shorthand. A nice feature is that this is fully integrated with TAB-completion: (gdb) with p[TAB] pagination print prompt python (gdb) with print [TAB] address max-depth static-members array max-symbolic-offset symbol array-indexes null-stop symbol-filename asm-demangle object symbol-loading demangle pascal_static-members thread-events elements pretty type entry-values raw union frame-arguments repeats vtbl inferior-events sevenbit-strings (gdb) with print [TAB] (gdb) with print elements unlimited -- thread apply all -[TAB] -ascending -c -q -s (gdb) with print elements unlimited -- print -[TAB] -address -max-depth -repeats -vtbl -array -null-stop -static-members -array-indexes -object -symbol -elements -pretty -union The main advantage of this new command compared to command options, like the new "print -OPT", is that this command works with any setting, and, it works nicely when you want to override a setting while running a user-defined command, like: (gdb) with print pretty -- usercmd The disadvantage is that it isn't as compact or easy to type. I think of command options and this command as complementary. I think that even with this new command, it makes sense to continue developing the command options in the direction of exposing most-oft-used settings as command options. Inspired by Philippe's "/" command proposal, if no command is specified, then the last command is re-invoked, under the overridden setting: (gdb) p g_s $1 = {a = 1, b = 2, c = 3} (gdb) with language ada $2 = (a => 1, b => 2, c => 3) Warning: the current language does not match this frame. Note: "with" requires "--" to separate the setting from the command. It might be possible to do without that, but, I haven't tried it yet, and I think that this can go in without it. We can always downgrade to making "--" optional if we manage to make it work. On to the patch itself, the implementation of the command is simpler than one might expect. A few details: - I factored out a bit from pipe_command into repeat_previous directly, because otherwise I'd need to copy&paste the same code and same error message in the with command. - The parse_cli_var_uinteger / parse_cli_var_zuinteger_unlimited / do_set_command changes are necessary since we can now pass an empty string as argument. - do_show_command was split in two, as a FIXME comment suggests, but for a different reason: we need to get a string version of a "set" command's value, and we already had code for that in do_show_command. That code is now factored out to the new get_setshow_command_value_string function. - There's a new "maint with" command added too: (gdb) help maint with Like "with", but works with "maintenance set" variables. Usage: maintenance with SETTING [VALUE] [-- COMMAND] With no COMMAND, repeats the last executed command. SETTING is any setting you can change with the "maintenance set" subcommands. "with" and "maint with" share 99% of the implementation. This might be useful on its own, but it's also useful for testing, since with this, we can use the "maint set/show test-settings" settings for exercising the "with" machinery with all the command type variants (all enum var_types). This is done in the new gdb/base/with.exp testcase. The documentation bits are originally based on Philippe's docs for the "/" command, hence the attribution in the ChangeLog. gdb/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> * NEWS (New commands): Mention "with" and "maint with". * cli/cli-cmds.c (with_command_1, with_command_completer_1) (with_command, with_command_completer): New. (pipe_command): Adjust to new repeat_previous interface. (_initialize_cli_cmds): Install the "with" command and its "w" alias. * cli/cli-cmds.h (with_command_1, with_command_completer_1): New declarations. * cli/cli-setshow.c (parse_cli_var_uinteger) (parse_cli_var_zuinteger_unlimited, do_set_command): Handle empty argument strings for all var_types. (get_setshow_command_value_string): New, factored out from ... (do_show_command): ... this. * cli/cli-setshow.h: Include <string>. (get_setshow_command_value_string): Declare. * command.h (repeat_previous): Now returns const char *. Adjust comment. * maint.c: Include "cli/cli-cmds.h". (maintenance_with_cmd, maintenance_with_cmd_completer): New. (_initialize_maint_cmds): Register the "maintenance with" command. * top.c (repeat_previous): Move bits from pipe_command here: Return the saved command line, if any; error out if there's no command to relaunch. gdb/doc/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.texinfo (Command Settings): New node documenting the general concept of settings, how to change them, and the new "with" command. (Maintenance Commands): Document "maint with". gdb/testsuite/ChangeLog: 2019-07-03 Pedro Alves <palves@redhat.com> * gdb.base/with.c: New file. * gdb.base/with.exp: New file.
2019-07-03 14:34:20 +02:00
c = add_com ("with", class_vars, with_command, _("\
Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING.\n\
Usage: with SETTING [VALUE] [-- COMMAND]\n\
Usage: w SETTING [VALUE] [-- COMMAND]\n\
With no COMMAND, repeats the last executed command.\n\
\n\
SETTING is any setting you can change with the \"set\" subcommands.\n\
E.g.:\n\
with language pascal -- print obj\n\
with print elements unlimited -- print obj\n\
\n\
You can change multiple settings using nested with, and use\n\
abbreviations for commands and/or values. E.g.:\n\
w la p -- w p el u -- p obj"));
set_cmd_completer_handle_brkchars (c, with_command_completer);
add_com_alias ("w", "with", class_vars, 1);
Implement convenience functions to examine GDB settings. The new convenience functions $_gdb_setting and $_gdb_setting_str provide access to the GDB settings in user-defined commands. Similarly, $_gdb_maint_setting and $_gdb_maint_setting_str provide access to the GDB maintenance settings. The patch was developed following a comment of Eli about the 'set may-call-functions'. Eli said that user-defined functions should have a way to change their behavior according to this setting. Rather than have a specialized $_may_call_functions, this patch implements a general way to access any GDB setting. Compared to doing such access via Python 'gdb.parameter' and/or 'gdb.execute("set somesetting tosomevalue"): * The 'with' command is much better than the above python usage: if the user types C-c or an error happens between the set pagination off and the python "set pagination on", the above python does not restore the original setting. * Effectively, with the "gdb.parameter" python one liner, it is possible to do simple 'if' conditions, such as set and restore pagination. But mixing the "python if" within canned sequence of commands is cumbersome for non trivial combinations. E.g. if several commands have to be done for a certain condition accessed from python, I guess something like will be needed: python if __some_setting: gdb.execute("some command") python if __some_setting: gdb.execute("some other command") python if __some_setting: gdb.execute("some different command") (without speaking about nested "if-s"). With the convenience function: if $_gdb_setting("some_setting") some command some other command some different command end Integer settings (for example print elements) will also be more difficult to use. For example, a user defined function that scans and prints a linked list might want to use the value of "set print elements" to stop printing the linked list. Doing that by mixing python expression/if is likely doable, but seems not easy with the above one liners. So, in summary, the $_gdb_setting and $_gdb_setting_str avoids to have the heterogeneous mix of python and GDB commands in one single script (and of course, it works even if python is not configured, but that must be an unusual setup I guess). gdb/ChangeLog 2019-10-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (setting_cmd, value_from_setting) (gdb_setting_internal_fn, gdb_maint_setting_internal_fn) (str_value_from_setting, gdb_setting_str_internal_fn) (gdb_maint_setting_str_internal_fn): New functions. (_initialize_cli_cmds): Define the new convenience functions. * gdb/cli/cli-setshow.h (get_setshow_command_value_string): Constify. * gdb/cli/cli-setshow.c (get_setshow_command_value_string): Constify.
2019-04-28 14:38:18 +02:00
add_internal_function ("_gdb_setting_str", _("\
$_gdb_setting_str - returns the value of a GDB setting as a string.\n\
Usage: $_gdb_setting_str (setting)\n\
\n\
auto-boolean values are \"off\", \"on\", \"auto\".\n\
boolean values are \"off\", \"on\".\n\
Some integer settings accept an unlimited value, returned\n\
as \"unlimited\"."),
gdb_setting_str_internal_fn, NULL);
add_internal_function ("_gdb_setting", _("\
$_gdb_setting - returns the value of a GDB setting.\n\
Usage: $_gdb_setting (setting)\n\
auto-boolean values are \"off\", \"on\", \"auto\".\n\
boolean values are \"off\", \"on\".\n\
Some integer settings accept an unlimited value, returned\n\
as 0 or -1 depending on the setting."),
gdb_setting_internal_fn, NULL);
add_internal_function ("_gdb_maint_setting_str", _("\
$_gdb_maint_setting_str - returns the value of a GDB maintenance setting as a string.\n\
Usage: $_gdb_maint_setting_str (setting)\n\
\n\
auto-boolean values are \"off\", \"on\", \"auto\".\n\
boolean values are \"off\", \"on\".\n\
Some integer settings accept an unlimited value, returned\n\
as \"unlimited\"."),
gdb_maint_setting_str_internal_fn, NULL);
add_internal_function ("_gdb_maint_setting", _("\
$_gdb_maint_setting - returns the value of a GDB maintenance setting.\n\
Usage: $_gdb_maint_setting (setting)\n\
auto-boolean values are \"off\", \"on\", \"auto\".\n\
boolean values are \"off\", \"on\".\n\
Some integer settings accept an unlimited value, returned\n\
as 0 or -1 depending on the setting."),
gdb_maint_setting_internal_fn, NULL);
add_cmd ("commands", no_set_class, show_commands, _("\
Show the history of commands you typed.\n\
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
You can supply a command number to start with, or a `+' to start after\n\
the previous command number shown."),
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
&showlist);
add_cmd ("version", no_set_class, show_version,
_("Show what version of GDB this is."), &showlist);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
add_cmd ("configuration", no_set_class, show_configuration,
_("Show how GDB was configured at build time."), &showlist);
add_setshow_zinteger_cmd ("remote", no_class, &remote_debug, _("\
Set debugging of remote protocol."), _("\
Show debugging of remote protocol."), _("\
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
When enabled, each packet sent or received with the remote target\n\
is displayed."),
NULL,
2005-02-24 Andrew Cagney <cagney@gnu.org> Add show_VARIABLE functions, update add_setshow call. * varobj.c (_initialize_varobj, show_varobjdebug): Add and update. * valprint.c (_initialize_valprint, show_print_max) (show_stop_print_at_null, show_repeat_count_threshold) (show_prettyprint_structs, show_unionprint) (show_prettyprint_arrays, show_addressprint, show_input_radix) (show_output_radix): Ditto. * valops.c (_initialize_valops, show_overload_resolution): Ditto. * utils.c (initialize_utils, show_chars_per_line) (show_lines_per_page, show_demangle, show_pagination_enabled) (show_sevenbit_strings, show_asm_demangle): Ditto * tui/tui-win.c (_initialize_tui_win, show_tui_border_kind) (show_tui_border_mode, show_tui_active_border_mode): Ditto. * top.c (init_main, show_new_async_prompt) (show_async_command_editing_p, show_write_history_p) (show_history_size, show_history_filename, show_caution) (show_annotation_level, init_main): Ditto. * target.c (initialize_targets, show_targetdebug) (show_trust_readonly): Ditto. * symfile.c (_initialize_symfile, show_symbol_reloading) (show_ext_args, show_download_write_size) (show_debug_file_directory): Ditto. * source.c (_initialize_source, show_lines_to_list): Ditto. * solib.c (_initialize_solib, show_auto_solib_add) (show_solib_search_path): Ditto. * p-valprint.c (_initialize_pascal_valprint) (show_pascal_static_field_print): Ditto. * printcmd.c (_initialize_printcmd, show_max_symbolic_offset) (show_print_symbol_filename): Add and update. * parse.c (_initialize_parse, show_expressiondebug): Dito. * observer.c (_initialize_observer, show_observer_debug): Dito. * maint.c (_initialize_maint_cmds, show_watchdog) (show_maintenance_profile_p): Dito. * linux-nat.c (_initialize_linux_nat, show_debug_linux_nat): Dito. * infrun.c (_initialize_infrun, show_debug_infrun) (show_stop_on_solib_events, show_follow_fork_mode_string) (show_scheduler_mode, show_step_stop_if_no_debug): Ditto. * infcall.c (_initialize_infcall, show_coerce_float_to_double_p) (show_unwind_on_signal_p): Ditto. * gdbtypes.c (build_gdbtypes, show_opaque_type_resolution) (_initialize_gdbtypes, show_overload_debug): Ditto. * gdb-events.c, gdb-events.sh (_initialize_gdb_events) (show_gdb_events_debug): Ditto. * gdbarch.c, gdbarch.sh (show_gdbarch_debug) (_initialize_gdbarch): Ditto. * frame.c (_initialize_frame, show_backtrace_past_main) (show_backtrace_past_entry, show_backtrace_limit) (show_frame_debug): Ditto. * exec.c (_initialize_exec, show_write_files): Ditto. * dwarf2read.c (_initialize_dwarf2_read) (show_dwarf2_max_cache_age): Ditto. * demangle.c (_initialize_demangler) (show_demangling_style_names): Ditto. * dcache.c (_initialize_dcache, show_dcache_enabled_p): Ditto. * cp-valprint.c (show_static_field_print) (_initialize_cp_valprint, show_vtblprint, show_objectprint): Ditto. * corefile.c (_initialize_core, show_gnutarget_string): Ditto. * cli/cli-logging.c (_initialize_cli_logging) (show_logging_overwrite, show_logging_redirect) (show_logging_filename): Ditto. * cli/cli-cmds.c (show_info_verbose, show_history_expansion_p) (init_cli_cmds, show_baud_rate, show_remote_debug) (show_remote_timeout, show_max_user_call_depth): Ditto. * charset.c (show_host_charset_name, show_target_charset_name) (initialize_charset): Ditto. * breakpoint.c (show_can_use_hw_watchpoints) (show_pending_break_support, _initialize_breakpoint): Ditto.
2005-02-24 14:51:36 +01:00
show_remote_debug,
&setdebuglist, &showdebuglist);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
add_setshow_zuinteger_unlimited_cmd ("remotetimeout", no_class,
&remote_timeout, _("\
Set timeout limit to wait for target to respond."), _("\
Show timeout limit to wait for target to respond."), _("\
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
This value is used to set the time limit for gdb to wait for a response\n\
from the target."),
NULL,
show_remote_timeout,
&setlist, &showlist);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
Replace most calls to help_list and cmd_show_list Currently there are many prefix commands that do nothing but call either help_list or cmd_show_list. I happened to notice that one such call, for "set print type", used the wrong command list parameter, causing incorrect output. Rather than fix this bug in isolation, I decided to eliminate this possibility by adding two new ways to add prefix commands, which simply route the call to help_list or cmd_show_list, as appropriate. This makes it impossible for a mismatch to occur. In some cases, a bit of output was removed; however, I don't think this output in general was very useful. It seemed redundant with what's already printed by help_list. A representative example is this hunk, removed from ada-lang.c: - printf_unfiltered (_(\ -"\"set ada\" must be followed by the name of a setting.\n")); This simplified the CLI style set/show commands quite a bit, and allowed the deletion of a macro. This also cleans up some unusual code in windows-tdep.c. Tested on x86-64 Fedora 30. Note that I have no way to build the go32-nat.c change. gdb/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * auto-load.c (show_auto_load_cmd): Remove. (auto_load_show_cmdlist_get): Use add_show_prefix_cmd. * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd. (maintenance_print_arc_command): Remove. * tui/tui-win.c (tui_command): Remove. (tui_get_cmd_list): Use add_basic_prefix_cmd. * tui/tui-layout.c (tui_layout_command): Remove. (_initialize_tui_layout): Use add_basic_prefix_cmd. * python/python.c (user_set_python, user_show_python): Remove. (_initialize_python): Use add_basic_prefix_cmd, add_show_prefix_cmd. * guile/guile.c (set_guile_command, show_guile_command): Remove. (install_gdb_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_guile_command): Remove. * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove. (_initialize_dwarf2_read): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Remove do_set and do_show parameters. * cli/cli-style.c (set_style, show_style): Remove. (_initialize_cli_style): Use add_basic_prefix_cmd, add_show_prefix_cmd. (cli_style_option::add_setshow_commands): Remove do_set and do_show parameters. (cli_style_option::add_setshow_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (STYLE_ADD_SETSHOW_COMMANDS): Remove macro. (set_style_name): Remove. * cli/cli-dump.c (dump_command, append_command): Remove. (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Remove. (_initialize_cli_dump): Use add_basic_prefix_cmd. * windows-tdep.c (w32_prefix_command_valid): Remove global. (init_w32_command_list): Remove; move into ... (_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Remove. (_initialize_valprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * typeprint.c (set_print_type, show_print_type): Remove. (_initialize_typeprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record.c (set_record_command, show_record_command): Remove. (_initialize_record): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_command, show_command, set_debug, show_debug): Remove. * top.h (set_history, show_history): Don't declare. * top.c (set_history, show_history): Remove. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Remove. (_initialize_target_descriptions): Use add_basic_prefix_cmd, add_show_prefix_cmd. * symtab.c (info_module_command): Remove. (_initialize_symtab): Use add_basic_prefix_cmd. * symfile.c (overlay_command): Remove. (_initialize_symfile): Use add_basic_prefix_cmd. * sparc64-tdep.c (info_adi_command): Remove. (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd. * sh-tdep.c (show_sh_command, set_sh_command): Remove. (_initialize_sh_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * serial.c (serial_set_cmd, serial_show_cmd): Remove. (_initialize_serial): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove. (_initialize_ser_tcp): Use add_basic_prefix_cmd, add_show_prefix_cmd. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command) (_initialize_rs6000_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * riscv-tdep.c (show_riscv_command, set_riscv_command) (show_debug_riscv_command, set_debug_riscv_command): Remove. (_initialize_riscv_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * remote.c (remote_command, set_remote_cmd): Remove. (_initialize_remote): Use add_basic_prefix_cmd. * record-full.c (set_record_full_command) (show_record_full_command): Remove. (_initialize_record_full): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record-btrace.c (cmd_set_record_btrace) (cmd_show_record_btrace, cmd_set_record_btrace_bts) (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt) (cmd_show_record_btrace_pt): Remove. (_initialize_record_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Remove. (_initialize_ravenscar): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (show_mips_command, set_mips_command) (_initialize_mips_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint.c (maintenance_command, maintenance_info_command) (maintenance_check_command, maintenance_print_command) (maintenance_set_cmd, maintenance_show_cmd): Remove. (_initialize_maint_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_per_command_cmd): Remove. * maint-test-settings.c (maintenance_set_test_settings_cmd): Remove. (maintenance_show_test_settings_cmd): Remove. (_initialize_maint_test_settings): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint-test-options.c (maintenance_test_options_command): Remove. (_initialize_maint_test_options): Use add_basic_prefix_cmd. * macrocmd.c (macro_command): Remove (_initialize_macrocmd): Use add_basic_prefix_cmd. * language.c (set_check, show_check): Remove. (_initialize_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * infcmd.c (unset_command): Remove. (_initialize_infcmd): Use add_basic_prefix_cmd. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove. (_initialize_i386_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * go32-nat.c (go32_info_dos_command): Remove. (_initialize_go32_nat): Use add_basic_prefix_cmd. * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd) (do_show_prefix_cmd, add_show_prefix_cmd): New functions. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove. (_initialize_frame): Use add_basic_prefix_cmd, add_show_prefix_cmd. * dcache.c (set_dcache_command, show_dcache_command): Remove. (_initialize_dcache): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cp-support.c (maint_cplus_command): Remove. (_initialize_cp_support): Use add_basic_prefix_cmd. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd, _initialize_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * breakpoint.c (save_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd. * arm-tdep.c (set_arm_command, show_arm_command): Remove. (_initialize_arm_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd) (set_ada_command, show_ada_command): Remove. (_initialize_ada_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare. gdb/testsuite/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * gdb.cp/maint.exp (test_help): Simplify multiple_help_body. Update tests. * gdb.btrace/cpu.exp: Update tests. * gdb.base/maint.exp: Update tests. * gdb.base/default.exp: Update tests. * gdb.base/completion.exp: Update tests.
2020-04-17 15:27:14 +02:00
add_basic_prefix_cmd ("debug", no_class,
_("Generic command for setting gdb debugging flags."),
&setdebuglist, "set debug ", 0, &setlist);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
Replace most calls to help_list and cmd_show_list Currently there are many prefix commands that do nothing but call either help_list or cmd_show_list. I happened to notice that one such call, for "set print type", used the wrong command list parameter, causing incorrect output. Rather than fix this bug in isolation, I decided to eliminate this possibility by adding two new ways to add prefix commands, which simply route the call to help_list or cmd_show_list, as appropriate. This makes it impossible for a mismatch to occur. In some cases, a bit of output was removed; however, I don't think this output in general was very useful. It seemed redundant with what's already printed by help_list. A representative example is this hunk, removed from ada-lang.c: - printf_unfiltered (_(\ -"\"set ada\" must be followed by the name of a setting.\n")); This simplified the CLI style set/show commands quite a bit, and allowed the deletion of a macro. This also cleans up some unusual code in windows-tdep.c. Tested on x86-64 Fedora 30. Note that I have no way to build the go32-nat.c change. gdb/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * auto-load.c (show_auto_load_cmd): Remove. (auto_load_show_cmdlist_get): Use add_show_prefix_cmd. * arc-tdep.c (_initialize_arc_tdep): Use add_show_prefix_cmd. (maintenance_print_arc_command): Remove. * tui/tui-win.c (tui_command): Remove. (tui_get_cmd_list): Use add_basic_prefix_cmd. * tui/tui-layout.c (tui_layout_command): Remove. (_initialize_tui_layout): Use add_basic_prefix_cmd. * python/python.c (user_set_python, user_show_python): Remove. (_initialize_python): Use add_basic_prefix_cmd, add_show_prefix_cmd. * guile/guile.c (set_guile_command, show_guile_command): Remove. (install_gdb_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_guile_command): Remove. * dwarf2/read.c (set_dwarf_cmd, show_dwarf_cmd): Remove. (_initialize_dwarf2_read): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Remove do_set and do_show parameters. * cli/cli-style.c (set_style, show_style): Remove. (_initialize_cli_style): Use add_basic_prefix_cmd, add_show_prefix_cmd. (cli_style_option::add_setshow_commands): Remove do_set and do_show parameters. (cli_style_option::add_setshow_commands): Use add_basic_prefix_cmd, add_show_prefix_cmd. (STYLE_ADD_SETSHOW_COMMANDS): Remove macro. (set_style_name): Remove. * cli/cli-dump.c (dump_command, append_command): Remove. (srec_dump_command, ihex_dump_command, verilog_dump_command) (tekhex_dump_command, binary_dump_command) (binary_append_command): Remove. (_initialize_cli_dump): Use add_basic_prefix_cmd. * windows-tdep.c (w32_prefix_command_valid): Remove global. (init_w32_command_list): Remove; move into ... (_initialize_windows_tdep): ... here. Use add_basic_prefix_cmd. * valprint.c (set_print, show_print, set_print_raw) (show_print_raw): Remove. (_initialize_valprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * typeprint.c (set_print_type, show_print_type): Remove. (_initialize_typeprint): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record.c (set_record_command, show_record_command): Remove. (_initialize_record): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cli/cli-cmds.c (_initialize_cli_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (info_command, show_command, set_debug, show_debug): Remove. * top.h (set_history, show_history): Don't declare. * top.c (set_history, show_history): Remove. * target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd) (unset_tdesc_cmd): Remove. (_initialize_target_descriptions): Use add_basic_prefix_cmd, add_show_prefix_cmd. * symtab.c (info_module_command): Remove. (_initialize_symtab): Use add_basic_prefix_cmd. * symfile.c (overlay_command): Remove. (_initialize_symfile): Use add_basic_prefix_cmd. * sparc64-tdep.c (info_adi_command): Remove. (_initialize_sparc64_adi_tdep): Use add_basic_prefix_cmd. * sh-tdep.c (show_sh_command, set_sh_command): Remove. (_initialize_sh_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * serial.c (serial_set_cmd, serial_show_cmd): Remove. (_initialize_serial): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Remove. (_initialize_ser_tcp): Use add_basic_prefix_cmd, add_show_prefix_cmd. * rs6000-tdep.c (set_powerpc_command, show_powerpc_command) (_initialize_rs6000_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * riscv-tdep.c (show_riscv_command, set_riscv_command) (show_debug_riscv_command, set_debug_riscv_command): Remove. (_initialize_riscv_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * remote.c (remote_command, set_remote_cmd): Remove. (_initialize_remote): Use add_basic_prefix_cmd. * record-full.c (set_record_full_command) (show_record_full_command): Remove. (_initialize_record_full): Use add_basic_prefix_cmd, add_show_prefix_cmd. * record-btrace.c (cmd_set_record_btrace) (cmd_show_record_btrace, cmd_set_record_btrace_bts) (cmd_show_record_btrace_bts, cmd_set_record_btrace_pt) (cmd_show_record_btrace_pt): Remove. (_initialize_record_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ravenscar-thread.c (set_ravenscar_command) (show_ravenscar_command): Remove. (_initialize_ravenscar): Use add_basic_prefix_cmd, add_show_prefix_cmd. * mips-tdep.c (show_mips_command, set_mips_command) (_initialize_mips_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint.c (maintenance_command, maintenance_info_command) (maintenance_check_command, maintenance_print_command) (maintenance_set_cmd, maintenance_show_cmd): Remove. (_initialize_maint_cmds): Use add_basic_prefix_cmd, add_show_prefix_cmd. (show_per_command_cmd): Remove. * maint-test-settings.c (maintenance_set_test_settings_cmd): Remove. (maintenance_show_test_settings_cmd): Remove. (_initialize_maint_test_settings): Use add_basic_prefix_cmd, add_show_prefix_cmd. * maint-test-options.c (maintenance_test_options_command): Remove. (_initialize_maint_test_options): Use add_basic_prefix_cmd. * macrocmd.c (macro_command): Remove (_initialize_macrocmd): Use add_basic_prefix_cmd. * language.c (set_check, show_check): Remove. (_initialize_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * infcmd.c (unset_command): Remove. (_initialize_infcmd): Use add_basic_prefix_cmd. * i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Remove. (_initialize_i386_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * go32-nat.c (go32_info_dos_command): Remove. (_initialize_go32_nat): Use add_basic_prefix_cmd. * cli/cli-decode.c (do_prefix_cmd, add_basic_prefix_cmd) (do_show_prefix_cmd, add_show_prefix_cmd): New functions. * frame.c (set_backtrace_cmd, show_backtrace_cmd): Remove. (_initialize_frame): Use add_basic_prefix_cmd, add_show_prefix_cmd. * dcache.c (set_dcache_command, show_dcache_command): Remove. (_initialize_dcache): Use add_basic_prefix_cmd, add_show_prefix_cmd. * cp-support.c (maint_cplus_command): Remove. (_initialize_cp_support): Use add_basic_prefix_cmd. * btrace.c (maint_btrace_cmd, maint_btrace_set_cmd) (maint_btrace_show_cmd, maint_btrace_pt_set_cmd) (maint_btrace_pt_show_cmd, _initialize_btrace): Use add_basic_prefix_cmd, add_show_prefix_cmd. * breakpoint.c (save_command): Remove. (_initialize_breakpoint): Use add_basic_prefix_cmd. * arm-tdep.c (set_arm_command, show_arm_command): Remove. (_initialize_arm_tdep): Use add_basic_prefix_cmd, add_show_prefix_cmd. * ada-lang.c (maint_set_ada_cmd, maint_show_ada_cmd) (set_ada_command, show_ada_command): Remove. (_initialize_ada_language): Use add_basic_prefix_cmd, add_show_prefix_cmd. * command.h (add_basic_prefix_cmd, add_show_prefix_cmd): Declare. gdb/testsuite/ChangeLog 2020-04-17 Tom Tromey <tromey@adacore.com> * gdb.cp/maint.exp (test_help): Simplify multiple_help_body. Update tests. * gdb.btrace/cpu.exp: Update tests. * gdb.base/maint.exp: Update tests. * gdb.base/default.exp: Update tests. * gdb.base/completion.exp: Update tests.
2020-04-17 15:27:14 +02:00
add_show_prefix_cmd ("debug", no_class,
_("Generic command for showing gdb debugging flags."),
&showdebuglist, "show debug ", 0, &showlist);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
c = add_com ("shell", class_support, shell_command, _("\
Execute the rest of the line as a shell command.\n\
With no arguments, run an inferior shell."));
set_cmd_completer (c, filename_completer);
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
add_com_alias ("!", "shell", class_support, 0);
c = add_com ("edit", class_files, edit_command, _("\
Edit specified file or function.\n\
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
With no argument, edits file containing most recent line listed.\n\
Editing targets can be specified in these ways:\n\
FILE:LINENUM, to edit at that line in that file,\n\
FUNCTION, to edit at the beginning of that function,\n\
FILE:FUNCTION, to distinguish among like-named static functions.\n\
*ADDRESS, to edit at the line containing that address.\n\
Uses EDITOR environment variable contents as editor (or ex as default)."));
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
c->completer = location_completer;
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
c = add_com ("pipe", class_support, pipe_command, _("\
Send the output of a gdb command to a shell command.\n\
Usage: | [COMMAND] | SHELL_COMMAND\n\
Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND\n\
Usage: pipe [COMMAND] | SHELL_COMMAND\n\
Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND\n\
\n\
Executes COMMAND and sends its output to SHELL_COMMAND.\n\
\n\
The -d option indicates to use the string DELIM to separate COMMAND\n\
from SHELL_COMMAND, in alternative to |. This is useful in\n\
case COMMAND contains a | character.\n\
\n\
With no COMMAND, repeat the last executed command\n\
and send its output to SHELL_COMMAND."));
set_cmd_completer_handle_brkchars (c, pipe_command_completer);
Implement | (pipe) command. The pipe command allows to run a GDB command, and pipe its output to a shell command: (gdb) help pipe Send the output of a gdb command to a shell command. Usage: | [COMMAND] | SHELL_COMMAND Usage: | -d DELIM COMMAND DELIM SHELL_COMMAND Usage: pipe [COMMAND] | SHELL_COMMAND Usage: pipe -d DELIM COMMAND DELIM SHELL_COMMAND Executes COMMAND and sends its output to SHELL_COMMAND. The -d option indicates to use the string DELIM to separate COMMAND from SHELL_COMMAND, in alternative to |. This is useful in case COMMAND contains a | character. With no COMMAND, repeat the last executed command and send its output to SHELL_COMMAND. (gdb) For example: (gdb) pipe print some_data_structure | grep -B3 -A3 something The pipe character is defined as an alias for pipe command, so that the above can be typed as: (gdb) | print some_data_structure | grep -B3 -A3 something If no GDB COMMAND is given, then the previous command is relaunched, and its output is sent to the given SHELL_COMMAND. This also defines convenience vars $_shell_exitcode and $_shell_exitsignal to record the exit code and exit signal of the last shell command launched by GDB e.g. by "shell", "pipe", ... gdb/ChangeLog 2019-05-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-cmds.c (pipe_command): New function. (_initialize_cli_cmds): Call add_com for pipe_command. Define | as an alias for pipe. (exit_status_set_internal_vars): New function. (shell_escape): Call exit_status_set_internal_vars. cli/cli-decode.c (find_command_name_length): Recognize | as a single character command.
2019-04-20 14:14:23 +02:00
add_com_alias ("|", "pipe", class_support, 0);
add_com ("list", class_files, list_command, _("\
List specified function or line.\n\
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
With no argument, lists ten more lines after or around previous listing.\n\
\"list -\" lists the ten lines before a previous ten-line listing.\n\
One argument specifies a line, and ten lines are listed around that line.\n\
Two arguments with comma between specify starting and ending lines to list.\n\
Lines can be specified in these ways:\n\
LINENUM, to list around that line in current file,\n\
FILE:LINENUM, to list around that line in that file,\n\
FUNCTION, to list around beginning of that function,\n\
FILE:FUNCTION, to distinguish among like-named static functions.\n\
*ADDRESS, to list around the line containing that address.\n\
With two args, if one is empty, it stands for ten lines away from\n\
the other arg.\n\
\n\
By default, when a single location is given, display ten lines.\n\
This can be changed using \"set listsize\", and the current value\n\
can be shown using \"show listsize\"."));
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
Remove --xdb Pedro Alves: The commands that enables aren't even documented in the manual. Judging from that, I assume that only wdb users would ever really be using the --xdb switch. I think it's time to drop "support" for the --xdb switch too. I looked through the commands that that exposes, the only that looked potentially interesting was "go", but then it's just an alias for "tbreak+jump", which can easily be done with "define go...end". I'd rather free up the "go" name for something potentially more interesting (either run control, or maybe even unrelated, e.g., for golang). gdb/ChangeLog 2015-04-11 Jan Kratochvil <jan.kratochvil@redhat.com> * NEWS (Changes since GDB 7.9): Add removed -xdb. * breakpoint.c (command_line_is_silent): Remove xdb_commands conditional. (_initialize_breakpoint): Remove xdb_commands for bc, ab, sb, db, ba and lb. * cli/cli-cmds.c (_initialize_cli_cmds): Remove xdb_commands for v and va. * cli/cli-decode.c (find_command_name_length): Remove xdb_commands conditional. * defs.h (xdb_commands): Remove declaration. * f-valprint.c (_initialize_f_valprint): Remove xdb_commands for lc. * guile/scm-cmd.c (command_classes): Remove xdb from comment. * infcmd.c (run_no_args_command, go_command): Remove. (_initialize_infcmd): Remove xdb_commands for S, go, g, R and lr. * infrun.c (xdb_handle_command): Remove. (_initialize_infrun): Remove xdb_commands for lz and z. * main.c (xdb_commands): Remove variable. (captured_main): Remove "xdb" from long_options. (print_gdb_help): Remove --xdb from help. * python/py-cmd.c (gdbpy_initialize_commands): Remove xdb from comment. * source.c (_initialize_source): Remove xdb_commands for D, ld, / and ?. * stack.c (backtrace_full_command, args_plus_locals_info) (current_frame_command): Remove. (_initialize_stack): Remove xdb_commands for t, T and l. * symtab.c (_initialize_symtab): Remove xdb_commands for lf and lg. * thread.c (_initialize_thread): Remove xdb_commands condition. * tui/tui-layout.c (tui_toggle_layout_command) (tui_toggle_split_layout_command, tui_handle_xdb_layout): Remove. (_initialize_tui_layout): Remove xdb_commands for td and ts. * tui/tui-regs.c (tui_scroll_regs_forward_command) (tui_scroll_regs_backward_command): Remove. (_initialize_tui_regs): Remove xdb_commands for fr, gr, sr, +r and -r. * tui/tui-win.c (tui_xdb_set_win_height_command): Remove. (_initialize_tui_win): Remove xdb_commands for U and w. * utils.c (pagination_on_command, pagination_off_command): Remove. (initialize_utils): Remove xdb_commands for am and sm. gdb/doc/ChangeLog 2015-04-11 Jan Kratochvil <jan.kratochvil@redhat.com> * gdb.texinfo (Mode Options): Remove -xdb.
2015-04-11 19:49:03 +02:00
add_com_alias ("l", "list", class_files, 1);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
if (dbx_commands)
add_com_alias ("file", "list", class_files, 1);
c = add_com ("disassemble", class_vars, disassemble_command, _("\
Disassemble a specified section of memory.\n\
Default is the function surrounding the pc of the selected frame.\n\
New /s modifier for the disassemble command. The "source centric" /m option to the disassemble command is often unhelpful, e.g., in the presence of optimized code. This patch adds a /s modifier that is better. For one, /m only prints instructions from the originating source file, leaving out instructions from e.g., inlined functions from other files. gdb/ChangeLog: PR gdb/11833 * NEWS: Document new /s modifier for the disassemble command. * cli/cli-cmds.c (disassemble_command): Add support for /s. (_initialize_cli_cmds): Update online docs of disassemble command. * disasm.c: #include "source.h". (struct deprecated_dis_line_entry): Renamed from dis_line_entry. All uses updated. (dis_line_entry): New struct. (hash_dis_line_entry, eq_dis_line_entry): New functions. (allocate_dis_line_table): New functions. (maybe_add_dis_line_entry, line_has_code_p): New functions. (dump_insns): New arg end_pc. All callers updated. (do_mixed_source_and_assembly_deprecated): Renamed from do_mixed_source_and_assembly. All callers updated. (do_mixed_source_and_assembly): New function. (gdb_disassembly): Handle /s (DISASSEMBLY_SOURCE). * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED): Renamed from DISASSEMBLY_SOURCE. All uses updated. (DISASSEMBLY_SOURCE): New macro. * mi/mi-cmd-disas.c (mi_cmd_disassemble): New modes 4,5. gdb/doc/ChangeLog: * gdb.texinfo (Machine Code): Update docs for mixed source/assembly disassembly. (GDB/MI Data Manipulation): Update docs for new disassembly modes. gdb/testsuite/ChangeLog: * gdb.mi/mi-disassemble.exp: Update. * gdb.base/disasm-optim.S: New file. * gdb.base/disasm-optim.c: New file. * gdb.base/disasm-optim.h: New file. * gdb.base/disasm-optim.exp: New file.
2015-08-15 06:45:54 +02:00
\n\
With a /m modifier, source lines are included (if available).\n\
New /s modifier for the disassemble command. The "source centric" /m option to the disassemble command is often unhelpful, e.g., in the presence of optimized code. This patch adds a /s modifier that is better. For one, /m only prints instructions from the originating source file, leaving out instructions from e.g., inlined functions from other files. gdb/ChangeLog: PR gdb/11833 * NEWS: Document new /s modifier for the disassemble command. * cli/cli-cmds.c (disassemble_command): Add support for /s. (_initialize_cli_cmds): Update online docs of disassemble command. * disasm.c: #include "source.h". (struct deprecated_dis_line_entry): Renamed from dis_line_entry. All uses updated. (dis_line_entry): New struct. (hash_dis_line_entry, eq_dis_line_entry): New functions. (allocate_dis_line_table): New functions. (maybe_add_dis_line_entry, line_has_code_p): New functions. (dump_insns): New arg end_pc. All callers updated. (do_mixed_source_and_assembly_deprecated): Renamed from do_mixed_source_and_assembly. All callers updated. (do_mixed_source_and_assembly): New function. (gdb_disassembly): Handle /s (DISASSEMBLY_SOURCE). * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED): Renamed from DISASSEMBLY_SOURCE. All uses updated. (DISASSEMBLY_SOURCE): New macro. * mi/mi-cmd-disas.c (mi_cmd_disassemble): New modes 4,5. gdb/doc/ChangeLog: * gdb.texinfo (Machine Code): Update docs for mixed source/assembly disassembly. (GDB/MI Data Manipulation): Update docs for new disassembly modes. gdb/testsuite/ChangeLog: * gdb.mi/mi-disassemble.exp: Update. * gdb.base/disasm-optim.S: New file. * gdb.base/disasm-optim.c: New file. * gdb.base/disasm-optim.h: New file. * gdb.base/disasm-optim.exp: New file.
2015-08-15 06:45:54 +02:00
This view is \"source centric\": the output is in source line order,\n\
regardless of any optimization that is present. Only the main source file\n\
is displayed, not those of, e.g., any inlined functions.\n\
This modifier hasn't proved useful in practice and is deprecated\n\
in favor of /s.\n\
\n\
With a /s modifier, source lines are included (if available).\n\
This differs from /m in two important respects:\n\
- the output is still in pc address order, and\n\
- file names and contents for all relevant source files are displayed.\n\
\n\
With a /r modifier, raw instructions in hex are included.\n\
New /s modifier for the disassemble command. The "source centric" /m option to the disassemble command is often unhelpful, e.g., in the presence of optimized code. This patch adds a /s modifier that is better. For one, /m only prints instructions from the originating source file, leaving out instructions from e.g., inlined functions from other files. gdb/ChangeLog: PR gdb/11833 * NEWS: Document new /s modifier for the disassemble command. * cli/cli-cmds.c (disassemble_command): Add support for /s. (_initialize_cli_cmds): Update online docs of disassemble command. * disasm.c: #include "source.h". (struct deprecated_dis_line_entry): Renamed from dis_line_entry. All uses updated. (dis_line_entry): New struct. (hash_dis_line_entry, eq_dis_line_entry): New functions. (allocate_dis_line_table): New functions. (maybe_add_dis_line_entry, line_has_code_p): New functions. (dump_insns): New arg end_pc. All callers updated. (do_mixed_source_and_assembly_deprecated): Renamed from do_mixed_source_and_assembly. All callers updated. (do_mixed_source_and_assembly): New function. (gdb_disassembly): Handle /s (DISASSEMBLY_SOURCE). * disasm.h (DISASSEMBLY_SOURCE_DEPRECATED): Renamed from DISASSEMBLY_SOURCE. All uses updated. (DISASSEMBLY_SOURCE): New macro. * mi/mi-cmd-disas.c (mi_cmd_disassemble): New modes 4,5. gdb/doc/ChangeLog: * gdb.texinfo (Machine Code): Update docs for mixed source/assembly disassembly. (GDB/MI Data Manipulation): Update docs for new disassembly modes. gdb/testsuite/ChangeLog: * gdb.mi/mi-disassemble.exp: Update. * gdb.base/disasm-optim.S: New file. * gdb.base/disasm-optim.c: New file. * gdb.base/disasm-optim.h: New file. * gdb.base/disasm-optim.exp: New file.
2015-08-15 06:45:54 +02:00
\n\
With a single argument, the function surrounding that address is dumped.\n\
Two arguments (separated by a comma) are taken as a range of memory to dump,\n\
in the form of \"start,end\", or \"start,+length\".\n\
\n\
Note that the address is interpreted as an expression, not as a location\n\
like in the \"break\" command.\n\
So, for example, if you want to disassemble function bar in file foo.c\n\
you must type \"disassemble 'foo.c'::bar\" and not \"disassemble foo.c:bar\"."));
set_cmd_completer (c, location_completer);
* source.c: Make global variables current_source_symtab and current_source_line static. (list_command): Moved to cli/cli-cmds.c. (ambiguous_line_spec): Moved to cli/cli-cmds.c. (get_first_line_listed): New accessor function. (get_lines_to_list): New accessor function. (get_current_source_symtab_and_line): New function. Retrieves the position in the source code that we consider current. (get_current_or_default_source_symtab_and_line): New function. Like the above but attempts to determine a default position if one is not currently defined. (set_current_source_symtab_and_line): New function. Sets the source code position considered current and returns the previously set one. (clear_current_source_symtab_and_line): Reset stored information about a current source line. (_initialize_source): Remove registration for the "list" command and its alias. * source.h: Add declarations for the new functions above. * symtab.h: Remove declarations for the global variables mentioned above. * breakpoint.c (parse_breakpoint_sals): Use accessor functions to obtain current source line. * linespec.c (decode_line_1): Ditto. * macroscope.c (default_macro_scope): Ditto. * scm-lang.c (scm_unpac): Ditto. * stack.c (print_frame_info_base): Ditto. * symfile.c (clear_symtab_users): Ditto. * symtab.c (decode_line_spec): Ditto. * cli/cli-cmds.c (list_command): Moved here from source.c. (ambiguous_line_spec): Moved here from source.c. (_init_cli_cmds): Add definition for "list" and its alias. * Makefile.in: Update dependencies.
2002-09-20 16:58:59 +02:00
c = add_com ("make", class_support, make_command, _("\
Run the ``make'' program using the rest of the line as arguments."));
set_cmd_completer (c, filename_completer);
add_cmd ("user", no_class, show_user, _("\
Add Guile as an extension language. * NEWS: Mention Guile scripting. * Makefile.in (SUBDIR_GUILE_OBS): New variable. (SUBDIR_GUILE_SRCS, SUBDIR_GUILE_DEPS): New variables (SUBDIR_GUILE_LDFLAGS, SUBDIR_GUILE_CFLAGS): New variables. (INTERNAL_CPPFLAGS): Add GUILE_CPPFLAGS. (CLIBS): Add GUILE_LIBS. (install-guile): New rule. (guile.o): New rule. (scm-arch.o, scm-auto-load.o, scm-block.o): New rules. (scm-breakpoint.o, scm-disasm.o, scm-exception.o): New rules. (scm-frame.o, scm-iterator.o, scm-lazy-string.o): New rules. (scm-math.o, scm-objfile.o, scm-ports.o): New rules. (scm-pretty-print.o, scm-safe-call.o, scm-gsmob.o): New rules. (scm-string.o, scm-symbol.o, scm-symtab.o): New rules. (scm-type.o, scm-utils.o, scm-value.o): New rules. * configure.ac: New option --with-guile. * configure: Regenerate. * config.in: Regenerate. * auto-load.c: Remove #include "python/python.h". Add #include "gdb/section-scripts.h". (source_section_scripts): Handle Guile scripts. (_initialize_auto_load): Add name of Guile objfile script to scripts-directory help text. * breakpoint.c (condition_command): Tweak comment to include Scheme. * breakpoint.h (gdbscm_breakpoint_object): Add forward decl. (struct breakpoint): New member scm_bp_object. * defs.h (enum command_control_type): New value guile_control. * cli/cli-cmds.c: Remove #include "python/python.h". Add #include "extension.h". (show_user): Update comment. (_initialize_cli_cmds): Update help text for "show user". Update help text for max-user-call-depth. * cli/cli-script.c: Remove #include "python/python.h". Add #include "extension.h". (multi_line_command_p): Add guile_control. (print_command_lines): Handle guile_control. (execute_control_command, recurse_read_control_structure): Ditto. (process_next_line): Recognize "guile" commands. * disasm.c (gdb_disassemble_info): Make non-static. * disasm.h: #include "dis-asm.h". (struct gdbarch): Add forward decl. (gdb_disassemble_info): Declare. * extension.c: #include "guile/guile.h". (extension_languages): Add guile. (get_ext_lang_defn): Handle EXT_LANG_GDB. * extension.h (enum extension_language): New value EXT_LANG_GUILE. * gdbtypes.c (get_unsigned_type_max): New function. (get_signed_type_minmax): New function. * gdbtypes.h (get_unsigned_type_max): Declare. (get_signed_type_minmax): Declare. * guile/README: New file. * guile/guile-internal.h: New file. * guile/guile.c: New file. * guile/guile.h: New file. * guile/scm-arch.c: New file. * guile/scm-auto-load.c: New file. * guile/scm-block.c: New file. * guile/scm-breakpoint.c: New file. * guile/scm-disasm.c: New file. * guile/scm-exception.c: New file. * guile/scm-frame.c: New file. * guile/scm-gsmob.c: New file. * guile/scm-iterator.c: New file. * guile/scm-lazy-string.c: New file. * guile/scm-math.c: New file. * guile/scm-objfile.c: New file. * guile/scm-ports.c: New file. * guile/scm-pretty-print.c: New file. * guile/scm-safe-call.c: New file. * guile/scm-string.c: New file. * guile/scm-symbol.c: New file. * guile/scm-symtab.c: New file. * guile/scm-type.c: New file. * guile/scm-utils.c: New file. * guile/scm-value.c: New file. * guile/lib/gdb.scm: New file. * guile/lib/gdb/boot.scm: New file. * guile/lib/gdb/experimental.scm: New file. * guile/lib/gdb/init.scm: New file. * guile/lib/gdb/iterator.scm: New file. * guile/lib/gdb/printing.scm: New file. * guile/lib/gdb/types.scm: New file. * data-directory/Makefile.in (GUILE_SRCDIR): New variable. (VPATH): Add $(GUILE_SRCDIR). (GUILE_DIR): New variable. (GUILE_INSTALL_DIR, GUILE_FILES): New variables. (all): Add stamp-guile dependency. (stamp-guile): New rule. (clean-guile, install-guile, uninstall-guile): New rules. (install-only): Add install-guile dependency. (uninstall): Add uninstall-guile dependency. (clean): Add clean-guile dependency. doc/ * Makefile.in (GDB_DOC_FILES): Add guile.texi. * gdb.texinfo (Auto-loading): Add set/show auto-load guile-scripts. (Extending GDB): New menu entries Guile, Multiple Extension Languages. (Guile docs): Include guile.texi. (objfile-gdbdotext file): Add objfile-gdb.scm. (dotdebug_gdb_scripts section): Mention Guile scripts. (Multiple Extension Languages): New node. * guile.texi: New file. testsuite/ * configure.ac (AC_OUTPUT): Add gdb.guile. * configure: Regenerate. * lib/gdb-guile.exp: New file. * lib/gdb.exp (get_target_charset): New function. * gdb.base/help.exp: Update expected output from "apropos apropos". * gdb.guile/Makefile.in: New file. * gdb.guile/guile.exp: New file. * gdb.guile/scm-arch.c: New file. * gdb.guile/scm-arch.exp: New file. * gdb.guile/scm-block.c: New file. * gdb.guile/scm-block.exp: New file. * gdb.guile/scm-breakpoint.c: New file. * gdb.guile/scm-breakpoint.exp: New file. * gdb.guile/scm-disasm.c: New file. * gdb.guile/scm-disasm.exp: New file. * gdb.guile/scm-equal.c: New file. * gdb.guile/scm-equal.exp: New file. * gdb.guile/scm-error.exp: New file. * gdb.guile/scm-error.scm: New file. * gdb.guile/scm-frame-args.c: New file. * gdb.guile/scm-frame-args.exp: New file. * gdb.guile/scm-frame-args.scm: New file. * gdb.guile/scm-frame-inline.c: New file. * gdb.guile/scm-frame-inline.exp: New file. * gdb.guile/scm-frame.c: New file. * gdb.guile/scm-frame.exp: New file. * gdb.guile/scm-generics.exp: New file. * gdb.guile/scm-gsmob.exp: New file. * gdb.guile/scm-iterator.c: New file. * gdb.guile/scm-iterator.exp: New file. * gdb.guile/scm-math.c: New file. * gdb.guile/scm-math.exp: New file. * gdb.guile/scm-objfile-script-gdb.in: New file. * gdb.guile/scm-objfile-script.c: New file. * gdb.guile/scm-objfile-script.exp: New file. * gdb.guile/scm-objfile.c: New file. * gdb.guile/scm-objfile.exp: New file. * gdb.guile/scm-ports.exp: New file. * gdb.guile/scm-pretty-print.c: New file. * gdb.guile/scm-pretty-print.exp: New file. * gdb.guile/scm-pretty-print.scm: New file. * gdb.guile/scm-section-script.c: New file. * gdb.guile/scm-section-script.exp: New file. * gdb.guile/scm-section-script.scm: New file. * gdb.guile/scm-symbol.c: New file. * gdb.guile/scm-symbol.exp: New file. * gdb.guile/scm-symtab-2.c: New file. * gdb.guile/scm-symtab.c: New file. * gdb.guile/scm-symtab.exp: New file. * gdb.guile/scm-type.c: New file. * gdb.guile/scm-type.exp: New file. * gdb.guile/scm-value-cc.cc: New file. * gdb.guile/scm-value-cc.exp: New file. * gdb.guile/scm-value.c: New file. * gdb.guile/scm-value.exp: New file. * gdb.guile/source2.scm: New file. * gdb.guile/types-module.cc: New file. * gdb.guile/types-module.exp: New file.
2014-02-10 04:40:01 +01:00
Show definitions of non-python/scheme user defined commands.\n\
2000-12-01 Fernando Nasser <fnasser@redhat.com> * cli/cli-decode.c: New file. Handle lists of commands, their decoding and documentation. (add_cmd, deprecate_cmd, add_abbrev_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, not_just_help_class_command, empty_sfunc, add_set_cmd, add_set_enum_cmd, add_set_auto_boolean_cmd, add_show_from_set, delete_cmd, apropos_cmd, help_cmd, help_list, help_all, print_doc_line, help_cmd_list, find_cmd, lookup_cmd_1, undef_cmd_error, lookup_cmd, deprecated_cmd_warning, lookup_cmd_composition, complete_on_cmdlist, complete_on_enum): Moved here from command.c. (add_info, add_info_alias, add_com, add_com_alias): Moved here from top.c. * cli/cli-decode.h: Definitions/declarations for the above. * cli/cli-cmds.c: New file. GDB CLI commands. (error_no_arg, info_command, show_command, help_command, show_version, quit_command, pwd_command, cd_command, echo_command, shell_escape, make_command, show_user, set_debug, show_debug, init_cmd_lists): Moved here from top.c. (apropos_command): Moved here from command.c. (complete_command, source_command): Moved here (part) from top.c. (is_complete_command): New function. Checks if a command is the "complete" command. (init_cli_cmds): New function. Add commands to the CLI (from code previously in top.c. * cli/cli-cmds.h: Definitions/declarations for the above. * cli/cli-script.c: New file. GDB CLI command scripting. (build_command_line, get_command_line, print_command_lines, print_command_line, execute_user_command, execute_control_command, while_command, if_command, arg_cleanup, setup_user_args, locate_arg, insert_args, realloc_body_list, read_next_line, recurse_read_control_structure, read_command_lines, free_command_lines, do_free_command_lines_cleanup, make_cleanup_free_command_lines, validate_comname, user_defined_command, define_command, document_command, source_cleanup_lines, do_fclose_cleanup, show_user_1): Moved here from top.c. (script_from_file): New function. Implements execution of a script contained in a file (part of code for the source_command() that used to exist in top.c). * cli/cli-script.h: Definitions/declarations for the above. * cli/cli-setshow.c: New file. Handle set and show GDB CLI commands. (parse_auto_binary_operation, parse_binary_operation, do_setshow_command, cmd_show_list): Moved here from command.c. * cli/cli-setshow.h: Definitions/declarations for the above. * top.c: Remove all CLI code, except the command loop. (gdb_init): Call init_cli_cmds(). * command.c: Remove obsolete file. * command.h: Mark as DEPRECATED. * gdbcmd.h: Ditto. * call-cmds.h: Ditto. * Makefile.in (SFILES): Remove command.c. (COMMON_OBS): Remove command.o. (command.o): Remove obsolete target. (cli_decode_h, cli_cmds_h, cli_script_h, cli_setshow_h): New macros. Refer to CLI header files. (cli-decode.o, cli-cmds.o, cli-setshow.o, cli-script.o): New targets. (SUBDIR_CLI_OBS, SUBDIR_CLI_SRCS, SUBDIR_CLI_DEPS, SUBDIR_CLI_INITS, SUBDIR_CLI_LDFLAGS, SUBDIR_CLI_CFLAGS, SUBDIR_CLI_ALL, SUBDIR_CLI_CLEAN, SUBDIR_CLI_INSTALL, SUBDIR_CLI_UNINSTALL): New macros for new cli subdirectory. * configure.in (enable_gdbcli): New option. Include the CLI in the executable (cannot be disabled yet). (CONFIG_OBS, CONFIG_DEPS, CONFIG_SRCS, CONFIG_INITS, ENABLE_CFLAGS, CONFIG_ALL, CONFIG_CLEAN, CONFIG_INSTALL, CONFIG_UNINSTALL): Add the corresponding SUBDIR_CLI_* macros if CLI requested. * configure: Regenerate.
2000-12-01 19:01:38 +01:00
Argument is the name of the user defined command.\n\
With no argument, show definitions of all user defined commands."), &showlist);
add_com ("apropos", class_support, apropos_command, _("\
Make first and last lines of 'command help documentation' consistent. With this patch, the help docs now respect 2 invariants: * The first line of a command help is terminated by a '.' character. * The last character of a command help is not a newline character. Note that the changes for the last invariant were done by Tom, as part of : [PATCH] Remove trailing newlines from help text https://sourceware.org/ml/gdb-patches/2019-06/msg00050.html but some occurrences have been re-introduced since then. Some help docs had to be rephrased/restructured to respect the above invariants. Before this patch, print_doc_line was printing the first line of a command help documentation, but stopping at the first '.' or ',' character. This was giving inconsistent results : * The first line of command helps was sometimes '.' terminated, sometimes not. * The first line of command helps was not always designed to be readable/understandable/unambiguous when stopping at the first '.' or ',' character. This e.g. created the following inconsistencies/problems: < catch exception -- Catch Ada exceptions < catch handlers -- Catch Ada exceptions < catch syscall -- Catch system calls by their names < down-silently -- Same as the `down' command while the new help is: > catch exception -- Catch Ada exceptions, when raised. > catch handlers -- Catch Ada exceptions, when handled. > catch syscall -- Catch system calls by their names, groups and/or numbers. > down-silently -- Same as the `down' command, but does not print anything. Also, the command help doc should not be terminated by a newline character, but this was not respected by all commands. The cli-option -OPT framework re-introduced some occurences. So, the -OPT build help framework was changed to not output newlines at the end of %OPTIONS% replacement. This patch changes the help documentations to ensure the 2 invariants given above. It implied to slightly rephrase or restructure some help docs. Based on the above invariants, print_doc_line (called by 'apropos' and 'help' commands to print the first line of a command help) now outputs the full first line of a command help. This all results in a lot of small changes in the produced help docs. There are less code changes than changes in the help docs, as a lot of docs are produced by some code (e.g. the remote packet usage settings). gdb/ChangeLog 2019-08-07 Philippe Waroquiers <philippe.waroquiers@skynet.be> * cli/cli-decode.h (print_doc_line): Add for_value_prefix argument. * cli/cli-decode.c (print_doc_line): Likewise. It now prints the full first line, except when FOR_VALUE_PREFIX. In this case, the trailing '.' is not output, and the first character is uppercased. (print_help_for_command): Update call to print_doc_line. (print_doc_of_command): Likewise. * cli/cli-setshow.c (deprecated_show_value_hack): Likewise. * cli/cli-option.c (append_indented_doc): Do not append newline. (build_help_option): Append newline after first appended_indented_doc only if a second call is done. (build_help): Append 2 new lines before each option, except the first one. * compile/compile.c (_initialize_compile): Add new lines after %OPTIONS%, when not at the end of the help. Change help doc or code producing the help doc to respect the invariants. * maint-test-options.c (_initialize_maint_test_options): Likewise. Also removed the new line after 'Options:', as all other commands do not put an empty line between 'Options:' and the first option. * printcmd.c (_initialize_printcmd): Likewise. * stack.c (_initialize_stack): Likewise. * interps.c (interpreter_exec_cmd): Fix "Usage:" line that was incorrectly telling COMMAND is optional. * ada-lang.c (_initialize_ada_language): Change help doc or code producing the help doc to respect the invariants. * ada-tasks.c (_initialize_ada_tasks): Likewise. * breakpoint.c (_initialize_breakpoint): Likewise. * cli/cli-cmds.c (_initialize_cli_cmds): Likewise. * cli/cli-logging.c (_initialize_cli_logging): Likewise. * cli/cli-setshow.c (_initialize_cli_setshow): Likewise. * cli/cli-style.c (cli_style_option::add_setshow_commands, _initialize_cli_style): Likewise. * corelow.c (core_target_info): Likewise. * dwarf-index-cache.c (_initialize_index_cache): Likewise. * dwarf2read.c (_initialize_dwarf2_read): Likewise. * filesystem.c (_initialize_filesystem): Likewise. * frame.c (_initialize_frame): Likewise. * gnu-nat.c (add_task_commands): Likewise. * infcall.c (_initialize_infcall): Likewise. * infcmd.c (_initialize_infcmd): Likewise. * interps.c (_initialize_interpreter): Likewise. * language.c (_initialize_language): Likewise. * linux-fork.c (_initialize_linux_fork): Likewise. * maint-test-settings.c (_initialize_maint_test_settings): Likewise. * maint.c (_initialize_maint_cmds): Likewise. * memattr.c (_initialize_mem): Likewise. * printcmd.c (_initialize_printcmd): Likewise. * python/lib/gdb/function/strfns.py (_MemEq, _StrLen, _StrEq, _RegEx): Likewise. * ravenscar-thread.c (_initialize_ravenscar): Likewise. * record-btrace.c (_initialize_record_btrace): Likewise. * record-full.c (_initialize_record_full): Likewise. * record.c (_initialize_record): Likewise. * regcache-dump.c (_initialize_regcache_dump): Likewise. * regcache.c (_initialize_regcache): Likewise. * remote.c (add_packet_config_cmd, init_remote_threadtests, _initialize_remote): Likewise. * ser-tcp.c (_initialize_ser_tcp): Likewise. * serial.c (_initialize_serial): Likewise. * skip.c (_initialize_step_skip): Likewise. * source.c (_initialize_source): Likewise. * stack.c (_initialize_stack): Likewise. * symfile.c (_initialize_symfile): Likewise. * symtab.c (_initialize_symtab): Likewise. * target-descriptions.c (_initialize_target_descriptions): Likewise. * top.c (init_main): Likewise. * tracefile-tfile.c (tfile_target_info): Likewise. * tracepoint.c (_initialize_tracepoint): Likewise. * tui/tui-win.c (_initialize_tui_win): Likewise. * utils.c (add_internal_problem_command): Likewise. * valprint.c (value_print_option_defs): Likewise. gdb/testsuite/ChangeLog 2019-08-07 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/style.exp: Update tests for help doc new invariants. * gdb.base/help.exp: Likewise.
2019-06-09 11:16:20 +02:00
Search for commands matching a REGEXP.\n\
Usage: apropos [-v] REGEXP\n\
Flag -v indicates to produce a verbose output, showing full documentation\n\
of the matching commands."));
add_setshow_uinteger_cmd ("max-user-call-depth", no_class,
&max_user_call_depth, _("\
Add Guile as an extension language. * NEWS: Mention Guile scripting. * Makefile.in (SUBDIR_GUILE_OBS): New variable. (SUBDIR_GUILE_SRCS, SUBDIR_GUILE_DEPS): New variables (SUBDIR_GUILE_LDFLAGS, SUBDIR_GUILE_CFLAGS): New variables. (INTERNAL_CPPFLAGS): Add GUILE_CPPFLAGS. (CLIBS): Add GUILE_LIBS. (install-guile): New rule. (guile.o): New rule. (scm-arch.o, scm-auto-load.o, scm-block.o): New rules. (scm-breakpoint.o, scm-disasm.o, scm-exception.o): New rules. (scm-frame.o, scm-iterator.o, scm-lazy-string.o): New rules. (scm-math.o, scm-objfile.o, scm-ports.o): New rules. (scm-pretty-print.o, scm-safe-call.o, scm-gsmob.o): New rules. (scm-string.o, scm-symbol.o, scm-symtab.o): New rules. (scm-type.o, scm-utils.o, scm-value.o): New rules. * configure.ac: New option --with-guile. * configure: Regenerate. * config.in: Regenerate. * auto-load.c: Remove #include "python/python.h". Add #include "gdb/section-scripts.h". (source_section_scripts): Handle Guile scripts. (_initialize_auto_load): Add name of Guile objfile script to scripts-directory help text. * breakpoint.c (condition_command): Tweak comment to include Scheme. * breakpoint.h (gdbscm_breakpoint_object): Add forward decl. (struct breakpoint): New member scm_bp_object. * defs.h (enum command_control_type): New value guile_control. * cli/cli-cmds.c: Remove #include "python/python.h". Add #include "extension.h". (show_user): Update comment. (_initialize_cli_cmds): Update help text for "show user". Update help text for max-user-call-depth. * cli/cli-script.c: Remove #include "python/python.h". Add #include "extension.h". (multi_line_command_p): Add guile_control. (print_command_lines): Handle guile_control. (execute_control_command, recurse_read_control_structure): Ditto. (process_next_line): Recognize "guile" commands. * disasm.c (gdb_disassemble_info): Make non-static. * disasm.h: #include "dis-asm.h". (struct gdbarch): Add forward decl. (gdb_disassemble_info): Declare. * extension.c: #include "guile/guile.h". (extension_languages): Add guile. (get_ext_lang_defn): Handle EXT_LANG_GDB. * extension.h (enum extension_language): New value EXT_LANG_GUILE. * gdbtypes.c (get_unsigned_type_max): New function. (get_signed_type_minmax): New function. * gdbtypes.h (get_unsigned_type_max): Declare. (get_signed_type_minmax): Declare. * guile/README: New file. * guile/guile-internal.h: New file. * guile/guile.c: New file. * guile/guile.h: New file. * guile/scm-arch.c: New file. * guile/scm-auto-load.c: New file. * guile/scm-block.c: New file. * guile/scm-breakpoint.c: New file. * guile/scm-disasm.c: New file. * guile/scm-exception.c: New file. * guile/scm-frame.c: New file. * guile/scm-gsmob.c: New file. * guile/scm-iterator.c: New file. * guile/scm-lazy-string.c: New file. * guile/scm-math.c: New file. * guile/scm-objfile.c: New file. * guile/scm-ports.c: New file. * guile/scm-pretty-print.c: New file. * guile/scm-safe-call.c: New file. * guile/scm-string.c: New file. * guile/scm-symbol.c: New file. * guile/scm-symtab.c: New file. * guile/scm-type.c: New file. * guile/scm-utils.c: New file. * guile/scm-value.c: New file. * guile/lib/gdb.scm: New file. * guile/lib/gdb/boot.scm: New file. * guile/lib/gdb/experimental.scm: New file. * guile/lib/gdb/init.scm: New file. * guile/lib/gdb/iterator.scm: New file. * guile/lib/gdb/printing.scm: New file. * guile/lib/gdb/types.scm: New file. * data-directory/Makefile.in (GUILE_SRCDIR): New variable. (VPATH): Add $(GUILE_SRCDIR). (GUILE_DIR): New variable. (GUILE_INSTALL_DIR, GUILE_FILES): New variables. (all): Add stamp-guile dependency. (stamp-guile): New rule. (clean-guile, install-guile, uninstall-guile): New rules. (install-only): Add install-guile dependency. (uninstall): Add uninstall-guile dependency. (clean): Add clean-guile dependency. doc/ * Makefile.in (GDB_DOC_FILES): Add guile.texi. * gdb.texinfo (Auto-loading): Add set/show auto-load guile-scripts. (Extending GDB): New menu entries Guile, Multiple Extension Languages. (Guile docs): Include guile.texi. (objfile-gdbdotext file): Add objfile-gdb.scm. (dotdebug_gdb_scripts section): Mention Guile scripts. (Multiple Extension Languages): New node. * guile.texi: New file. testsuite/ * configure.ac (AC_OUTPUT): Add gdb.guile. * configure: Regenerate. * lib/gdb-guile.exp: New file. * lib/gdb.exp (get_target_charset): New function. * gdb.base/help.exp: Update expected output from "apropos apropos". * gdb.guile/Makefile.in: New file. * gdb.guile/guile.exp: New file. * gdb.guile/scm-arch.c: New file. * gdb.guile/scm-arch.exp: New file. * gdb.guile/scm-block.c: New file. * gdb.guile/scm-block.exp: New file. * gdb.guile/scm-breakpoint.c: New file. * gdb.guile/scm-breakpoint.exp: New file. * gdb.guile/scm-disasm.c: New file. * gdb.guile/scm-disasm.exp: New file. * gdb.guile/scm-equal.c: New file. * gdb.guile/scm-equal.exp: New file. * gdb.guile/scm-error.exp: New file. * gdb.guile/scm-error.scm: New file. * gdb.guile/scm-frame-args.c: New file. * gdb.guile/scm-frame-args.exp: New file. * gdb.guile/scm-frame-args.scm: New file. * gdb.guile/scm-frame-inline.c: New file. * gdb.guile/scm-frame-inline.exp: New file. * gdb.guile/scm-frame.c: New file. * gdb.guile/scm-frame.exp: New file. * gdb.guile/scm-generics.exp: New file. * gdb.guile/scm-gsmob.exp: New file. * gdb.guile/scm-iterator.c: New file. * gdb.guile/scm-iterator.exp: New file. * gdb.guile/scm-math.c: New file. * gdb.guile/scm-math.exp: New file. * gdb.guile/scm-objfile-script-gdb.in: New file. * gdb.guile/scm-objfile-script.c: New file. * gdb.guile/scm-objfile-script.exp: New file. * gdb.guile/scm-objfile.c: New file. * gdb.guile/scm-objfile.exp: New file. * gdb.guile/scm-ports.exp: New file. * gdb.guile/scm-pretty-print.c: New file. * gdb.guile/scm-pretty-print.exp: New file. * gdb.guile/scm-pretty-print.scm: New file. * gdb.guile/scm-section-script.c: New file. * gdb.guile/scm-section-script.exp: New file. * gdb.guile/scm-section-script.scm: New file. * gdb.guile/scm-symbol.c: New file. * gdb.guile/scm-symbol.exp: New file. * gdb.guile/scm-symtab-2.c: New file. * gdb.guile/scm-symtab.c: New file. * gdb.guile/scm-symtab.exp: New file. * gdb.guile/scm-type.c: New file. * gdb.guile/scm-type.exp: New file. * gdb.guile/scm-value-cc.cc: New file. * gdb.guile/scm-value-cc.exp: New file. * gdb.guile/scm-value.c: New file. * gdb.guile/scm-value.exp: New file. * gdb.guile/source2.scm: New file. * gdb.guile/types-module.cc: New file. * gdb.guile/types-module.exp: New file.
2014-02-10 04:40:01 +01:00
Set the max call depth for non-python/scheme user-defined commands."), _("\
Show the max call depth for non-python/scheme user-defined commands."), NULL,
NULL,
show_max_user_call_depth,
&setlist, &showlist);
2006-07-21 16:46:56 +02:00
add_setshow_boolean_cmd ("trace-commands", no_class, &trace_commands, _("\
Set tracing of GDB CLI commands."), _("\
Show state of GDB CLI command tracing."), _("\
When 'on', each command is displayed as it is executed."),
NULL,
NULL,
&setlist, &showlist);
c = add_com ("alias", class_support, alias_command, _("\
Define a new command that is an alias of an existing command.\n\
Usage: alias [-a] [--] ALIAS = COMMAND\n\
ALIAS is the name of the alias command to create.\n\
COMMAND is the command being aliased to.\n\
If \"-a\" is specified, the command is an abbreviation,\n\
and will not appear in help command list output.\n\
\n\
Examples:\n\
Make \"spe\" an alias of \"set print elements\":\n\
alias spe = set print elements\n\
Make \"elms\" an alias of \"elements\" in the \"set print\" command:\n\
alias -a set print elms = set print elements"));
const char *source_help_text = xstrprintf (_("\
Read commands from a file named FILE.\n\
\n\
Usage: source [-s] [-v] FILE\n\
-s: search for the script in the source search path,\n\
even if FILE contains directories.\n\
-v: each command in FILE is echoed as it is executed.\n\
\n\
Note that the file \"%s\" is read automatically in this way\n\
when GDB is started."), GDBINIT);
c = add_cmd ("source", class_support, source_command,
source_help_text, &cmdlist);
set_cmd_completer (c, filename_completer);
}