Commit Graph

114 Commits

Author SHA1 Message Date
Pedro Alves eb3ff9a551 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 14:45:59 +01:00
Pedro Alves 6e1dbf8cda Clean up "completer_handle_brkchars" callback handling
This patch cleans up "completer_handle_brkchars" callback handling:

- Renames the function typedef to better match its intent:
  completer_ftype_void ->  completer_handle_brkchars_ftype

- Factors out common code in complete_line_internal handling the
  "handle_brkchars" callback to a separate function.

- Centralizes all the "completer method" to "handle_brkchars method"
  mapping in a single function.

gdb/ChangeLog:
2017-07-17  Pedro Alves  <palves@redhat.com>

	* cli/cli-decode.c (set_cmd_completer_handle_brkchars): Adjust to
	renames.
	* cli/cli-decode.h (struct cmd_list_element) <completer>: Move
	comments to completer_ftype's declaration.
	<completer_handle_brkchars>: Change type to
	completer_handle_brkchars_ftype.
	* command.h (completer_ftype): Add describing comment and give
	names to parameters.
	(completer_ftype_void): Rename to ...
	(completer_handle_brkchars_ftype) ... this.  Add describing comment.
	(set_cmd_completer_handle_brkchars): Adjust.
	* completer.c (filename_completer_handle_brkchars): New function.
	(complete_line_internal_normal_command): New function, factored
	out from ...
	(complete_line_internal): ... here.
	(command_completer_handle_brkchars)
	(default_completer_handle_brkchars)
	(completer_handle_brkchars_func_for_completer): New functions.
	* completer.h (set_gdb_completion_word_break_characters): Delete
	declaration.
	(completer_handle_brkchars_func_for_completer): New declaration.
	* python/py-cmd.c (cmdpy_completer_handle_brkchars): Adjust to use
	completer_handle_brkchars_func_for_completer.
2017-07-17 12:05:03 +01:00
Pedro Alves 6e75794e9d gdb/command.h: Include common/scoped_restore.h
command.h depends on scoped_restore:

  extern scoped_restore_tmpl<int> prevent_dont_repeat (void);

But doesn't include the corresponding header
("common/scoped_restore.h").  We haven't noticed a problem because
utils.h includes scoped_restore.h, and defs.h includes utils.h.

However, a patch that makes "symtab.h" include "completer.h", exposed
the issue:
 https://sourceware.org/ml/gdb-patches/2017-06/msg00023.html.

Without this fix that would break building all .o files like this:

 In file included from src/gdb/completer.h:21:0,
                  from src/gdb/symtab.h:28,
                  from src/gdb/language.h:26,
                  from src/gdb/frame.h:72,
                  from src/gdb/gdbarch.h:39,
                  from src/gdb/defs.h:636,
                  from src/gdb/top.c:20:
 src/gdb/command.h:434:8: error: ‘scoped_restore_tmpl’ does not name a type
  extern scoped_restore_tmpl<int> prevent_dont_repeat (void);
         ^
 Makefile:1911: recipe for target 'top.o' failed

because defs.h includes gdbarch.h before it includes utils.h.

gdb/ChangeLog:
2017-06-28  Pedro Alves  <palves@redhat.com>

	* command.h: Include "common/scoped_restore.h".
2017-06-28 15:19:02 +01:00
Yao Qi 21873064e8 Add alias command to cmd_list_element
When we add alias command, we call add_alias_cmd and pass the alias name
and command name.  This implicitly requires the command and its prefix
commands are already added to cmdlist.  This may not be true, for example,

  add_com_alias ("tty", "set inferior-tty", class_alias, 0);

"inferior-tty" command is added to setlist, but setlist may not be added
to cmdlist (It depends on the order of related _initialize_XXX functions
called) so that we can't find "set inferior-tty" from cmdlist.

This patch fixes this problem by passing cmd_list_element of "inferior-tty"
to add_alias_cmd, so that cmd_list_element of "inferior-tty" doesn't have
to be reachable from cmdlist at that moment.

gdb:

2017-05-17  Yao Qi  <yao.qi@linaro.org>

	* cli/cli-decode.c (add_alias_cmd): New function.
	* command.h (add_alias_cmd): Declare.
	* infcmd.c (_initialize_infcmd): Don't call add_com_alias,
	instead call add_alias_cmd.

gdb/testsuite:

2017-05-17  Simon Marchi  <simon.marchi@ericsson.com>

	* gdb.base/set-inferior-tty.exp (test_set_inferior_tty): Add
	argument command.
	(top-level): Invoke test_set_inferior_tty.
2017-05-17 14:22:35 +01:00
Pedro Alves a121b7c1ac -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 19:21:37 +01:00
Tom Tromey 1ac32117f7 Remove cleanups from execute_gdb_command
This replaces a cleanup in execute_gdb_command with an instance of
std::string.

Testing showed that this originally missed a cleanup that was returned
by prevent_dont_repeat.  This version of the patch changes
prevent_dont_repeat to return a scoped_restore rather than a cleanup.

2017-01-10  Tom Tromey  <tom@tromey.com>

	* top.c (prevent_dont_repeat): Change return type.
	* python/python.c (execute_gdb_command): Use std::string.
	Update.
	* guile/guile.c (gdbscm_execute_gdb_command): Update.
	* command.h (prevent_dont_repeat): Change return type.
	* breakpoint.c (bpstat_do_actions_1): Update.
2017-01-10 19:14:14 -07:00
Joel Brobecker 61baf725ec update copyright year range in GDB files
This applies the second part of GDB's End of Year Procedure, which
updates the copyright year range in all of GDB's files.

gdb/ChangeLog:

        Update copyright year range in all GDB files.
2017-01-01 10:52:34 +04:00
Antoine Tremblay 4034d0ff52 Emit inferior, thread and frame selection events to all UIs
With this patch, when an inferior, thread or frame is explicitly
selected by the user, notifications will appear on all CLI and MI UIs.
When a GDB console is integrated in a front-end, this allows the
front-end to follow a selection made by the user ont he CLI, and it
informs the user about selection changes made behind the scenes by the
front-end.

This patch addresses PR gdb/20487.

In order to communicate frame changes to the front-end, this patch adds
a new field to the =thread-selected event for the selected frame.  The
idea is that since inferior/thread/frame can be seen as a composition,
it makes sense to send them together in the same event.  The vision
would be to eventually send the inferior information as well, if we find
that it's needed, although the "=thread-selected" event would be
ill-named for that job.

Front-ends need to handle this new field if they want to follow the
frame selection changes that originate from the console.  The format of
the frame attribute is the same as what is found in the *stopped events.

Here's a detailed example for each command and the events they generate:

thread
------

1. CLI command:

     thread 1.3

   MI event:

     =thread-selected,id="3",frame={...}

2. MI command:

     -thread-select 3

   CLI event:

     [Switching to thread 1.3 ...]

3. MI command (CLI-in-MI):

     thread 1.3

   MI event/reply:

     &"thread 1.3\n"
     ~"#0  child_sub_function () ...
     =thread-selected,id="3",frame={level="0",...}
     ^done

frame
-----

1. CLI command:

     frame 1

   MI event:

     =thread-selected,id="3",frame={level="1",...}

2. MI command:

     -stack-select-frame 1

   CLI event:

     #1  0x00000000004007f0 in child_function...

3. MI command (CLI-in-MI):

     frame 1

   MI event/reply:

     &"frame 1\n"
     ~"#1  0x00000000004007f9 in ..."
     =thread-selected,id="3",frame={level="1"...}
     ^done

inferior
--------

Inferior selection events only go from the console to MI, since there's
no way to select the inferior in pure MI.

1. CLI command:

     inferior 2

   MI event:

     =thread-selected,id="3"

Note that if the user selects an inferior that is not started or exited,
the MI doesn't receive a notification.  Since there is no threads to
select, the =thread-selected event does not apply...

2. MI command (CLI-in-MI):

     inferior 2

   MI event/reply:

     &"inferior 2\n"
     ~"[Switching to inferior 2 ...]"
     =thread-selected,id="4",frame={level="0"...}
     ^done

Internal implementation detail: this patch makes it possible to suppress
notifications caused by a CLI command, like what is done in mi-interp.c.
This means that it's now possible to use the
add_com_suppress_notification function to register a command with some
event suppressed.  It is used to implement the select-frame command in
this patch.

The function command_notifies_uscc_observer was added to extract
the rather complicated logical expression from the if statement.  It is
also now clearer what that logic does: if the command used by the user
already notifies the user_selected_context_changed observer, there is
not need to notify it again.  It therefore protects again emitting the
event twice.

No regressions, tested on ubuntu 14.04 x86 with target boards unix and
native-extended-gdbserver.

gdb/ChangeLog:

YYYY-MM-DD  Antoine Tremblay  <antoine.tremblay@ericsson.com>
YYYY-MM-DD  Simon Marchi  <simon.marchi@ericsson.com>

	PR gdb/20487
	* NEWS: Mention new frame field of =thread-selected event.
	* cli/cli-decode.c (add_cmd): Initialize c->suppress_notification.
	(add_com_suppress_notification): New function definition.
	(cmd_func): Set and restore the suppress_notification flag.
	* cli/cli-deicode.h (struct cmd_list_element)
	<suppress_notification>: New field.
	* cli/cli-interp.c (cli_suppress_notification): New global variable.
	(cli_on_user_selected_context_changed): New function.
	(_initialize_cli_interp): Attach to user_selected_context_changed
	observer.
	* command.h (struct cli_suppress_notification): New structure.
	(cli_suppress_notification): New global variable declaration.
	(add_com_suppress_notification): New function declaration.
	* defs.h (enum user_selected_what_flag): New enum.
	(user_selected_what): New enum flag type.
	* frame.h (print_stack_frame_to_uiout): New function declaration.
	* gdbthread.h (print_selected_thread_frame): New function declaration.
	* inferior.c (print_selected_inferior): New function definition.
	(inferior_command): Remove printing of inferior/thread/frame switch
	notifications, notify user_selected_context_changed observer.
	* inferior.h (print_selected_inferior): New function declaration.
	* mi/mi-cmds.c (struct mi_cmd): Add user_selected_context
	suppression to stack-select-frame and thread-select commands.
	* mi/mi-interp.c (struct mi_suppress_notification)
	<user_selected_context>: Initialize.
	(mi_user_selected_context_changed): New function definition.
	(_initialize_mi_interp): Attach to user_selected_context_changed.
	* mi/mi-main.c (mi_cmd_thread_select): Print thread selection reply.
	(mi_execute_command): Handle notification suppression.  Notify
	user_selected_context_changed observer on thread change instead of printing
	event directly.  Don't send it if command already sends the notification.
	(command_notifies_uscc_observer): New function.
	(mi_cmd_execute): Don't handle notification suppression.
	* mi/mi-main.h (struct mi_suppress_notification)
	<user_selected_context>: New field.
	* stack.c (print_stack_frame_to_uiout): New function definition.
	(select_frame_command): Notify user_selected_context_changed
	observer.
	(frame_command): Call print_selected_thread_frame if there's no frame
	change or notify user_selected_context_changed observer if there is.
	(up_command): Notify user_selected_context_changed observer.
	(down_command): Likewise.
	(_initialize_stack): Suppress user_selected_context notification for
	command select-frame.
	* thread.c (thread_command): Notify
	user_selected_context_changed if the thread has changed, print
	thread info directly if it hasn't.
	(do_captured_thread_select): Do not print thread switch event.
	(print_selected_thread_frame): New function definition.
	* tui/tui-interp.c (tui_on_user_selected_context_changed):
	New function definition.
	(_initialize_tui_interp): Attach to user_selected_context_changed
	observer.

gdb/doc/ChangeLog:

	PR gdb/20487
	* gdb.texinfo (Context management): Update mention of frame
	change notifications.
	(gdb/mi Async Records): Document frame field in
	=thread-select event.
	* observer.texi (GDB Observers): New user_selected_context_changed
	observer.

gdb/testsuite/ChangeLog:

	PR gdb/20487
	* gdb.mi/mi-pthreads.exp (check_mi_thread_command_set): Adapt
	=thread-select-event check.
2016-10-03 16:54:58 -04:00
Joel Brobecker 618f726fcb GDB copyright headers update after running GDB's copyright.py script.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2016-01-01 08:43:22 +04:00
Pedro Alves fe978cb071 C++ keyword cleanliness, mostly auto-generated
This patch renames symbols that happen to have names which are
reserved keywords in C++.

Most of this was generated with Tromey's cxx-conversion.el script.
Some places where later hand massaged a bit, to fix formatting, etc.
And this was rebased several times meanwhile, along with re-running
the script, so re-running the script from scratch probably does not
result in the exact same output.  I don't think that matters anyway.

gdb/
2015-02-27  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	Rename symbols whose names are reserved C++ keywords throughout.

gdb/gdbserver/
2015-02-27  Tom Tromey  <tromey@redhat.com>
	    Pedro Alves  <palves@redhat.com>

	Rename symbols whose names are reserved C++ keywords throughout.
2015-02-27 16:33:07 +00:00
Joel Brobecker 32d0add0a6 Update year range in copyright notice of all files owned by the GDB project.
gdb/ChangeLog:

        Update year range in copyright notice of all files.
2015-01-01 13:32:14 +04:00
Sergio Durigan Junior 7d793aa9f0 PR python/16699: GDB Python command completion with overriden complete vs. completer class
This PR came from a Red Hat bug that was filed recently.  I checked and
it still exists on HEAD, so here's a proposed fix.  Although this is
marked as a Python backend bug, this is really about the completion
mechanism used by GDB.  Since this code reminds me of my first attempt
to make a good noodle, it took me quite some time to fix it in a
non-intrusive way.

The problem is triggered when one registers a completion method inside a
class in a Python script, rather than registering the command using a
completer class directly.  For example, consider the following script:

    class MyFirstCommand(gdb.Command):
          def __init__(self):
              gdb.Command.__init__(self,'myfirstcommand',gdb.COMMAND_USER,gdb.COMPLETE_FILENAME)

              def invoke(self,argument,from_tty):
                  raise gdb.GdbError('not implemented')

    class MySecondCommand(gdb.Command):
          def __init__(self):
              gdb.Command.__init__(self,'mysecondcommand',gdb.COMMAND_USER)

              def invoke(self,argument,from_tty):
                  raise gdb.GdbError('not implemented')

                  def complete(self,text,word):
                      return gdb.COMPLETE_FILENAME

    MyFirstCommand ()
    MySecondCommand ()

When one loads this into GDB and tries to complete filenames for both
myfirstcommand and mysecondcommand, she gets:

    (gdb) myfirstcommand /hom<TAB>
    (gdb) myfirstcommand /home/
                               ^
    ...
    (gdb) mysecondcommand /hom<TAB>
    (gdb) mysecondcommand /home
                                ^

(The "^" marks the final position of the cursor after the TAB).

So we see that myfirstcommand honors the COMPLETE_FILENAME class (as
specified in the command creation), but mysecondcommand does not.  After
some investigation, I found that the problem lies with the set of word
break characters that is used for each case.  The set should be the same
for both commands, but it is not.

During the process of deciding which type of completion should be used,
the code in gdb/completer.c:complete_line_internal analyses the command
that requested the completion and tries to determine the type of
completion wanted by checking which completion function will be called
(e.g., filename_completer for filenames, location_completer for
locations, etc.).

This all works fine for myfirstcommand, because immediately after the
command registration the Python backend already sets its completion
function to filename_completer (which then causes the
complete_line_internal function to choose the right set of word break
chars).  However, for mysecondcommand, this decision is postponed to
when the completer function is evaluated, and the Python backend uses an
internal completer (called cmdpy_completer).  complete_line_internal
doesn't know about this internal completer, and can't choose the right
set of word break chars in time, which then leads to a bad decision when
completing the "/hom" word.

So, after a few attempts, I decided to create another callback in
"struct cmd_list_element" that will be responsible for handling the case
when there is an unknown completer function for complete_line_internal
to work with.  So far, only the Python backend uses this callback, and
only when the user provides a completer method instead of registering
the command directly with a completer class.  I think this is the best
option because it not very intrusive (all the other commands will still
work normally), but especially because the whole completion code is so
messy that it would be hard to fix this without having to redesign
things.

I have regtested this on Fedora 18 x86_64, without regressions.  I also
included a testcase.

gdb/ChangeLog:
2014-09-03  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR python/16699
	* cli/cli-decode.c (set_cmd_completer_handle_brkchars): New
	function.
	(add_cmd): Set "completer_handle_brkchars" to NULL.
	* cli/cli-decode.h (struct cmd_list_element)
	<completer_handle_brkchars>: New field.
	* command.h (completer_ftype_void): New typedef.
	(set_cmd_completer_handle_brkchars): New prototype.
	* completer.c (set_gdb_completion_word_break_characters): New
	function.
	(complete_line_internal): Call "completer_handle_brkchars"
	callback from command.
	* completer.h: Include "command.h".
	(set_gdb_completion_word_break_characters): New prototype.
	* python/py-cmd.c (cmdpy_completer_helper): New function.
	(cmdpy_completer_handle_brkchars): New function.
	(cmdpy_completer): Adjust to use cmdpy_completer_helper.
	(cmdpy_init): Set completer_handle_brkchars to
	cmdpy_completer_handle_brkchars.

gdb/testsuite/ChangeLog:
2014-09-03  Sergio Durigan Junior  <sergiodj@redhat.com>

	PR python/16699
	* gdb.python/py-completion.exp: New file.
	* gdb.python/py-completion.py: Likewise.
2014-09-03 16:30:28 -04:00
Tom Tromey 1947513d92 constify command docs
This makes the command "doc" parameter const.

2014-07-24  Tom Tromey  <tromey@redhat.com>

	* cli/cli-decode.c (add_cmd, add_prefix_cmd)
	(add_abbrev_prefix_cmd, add_set_or_show_cmd, add_info)
	(add_info_alias, add_com): Make "doc" const.
	(print_doc_line): Make "str" const.
	(delete_cmd): Update.
	* cli/cli-decode.h (struct cmd_list_element) <doc>: Now const.
	(print_doc_line): Update.
	* cli/cli-script.c (document_command): Update.
	* command.h (add_cmd, add_prefix_cmd, add_abbrev_prefix_cmd)
	(add_com, add_info, add_info_alias): Update.
	* guile/scm-cmd.c (cmdscm_destroyer): Update.
	* python/py-cmd.c (cmdpy_destroyer): Update.
2014-07-24 11:30:04 -06:00
Tom Tromey 64e61d290e constify command prefix
This constifies the "prefix" argument to the various command-adding
functions.

2014-07-24  Tom Tromey  <tromey@redhat.com>

	* cli/cli-decode.c (print_help_for_command): Make "prefix" const.
	(add_prefix_cmd, add_abbrev_prefix_cmd, apropos_cmd, help_list)
	(help_cmd_list): Constify.
	(lookup_cmd): Update.
	* cli/cli-decode.h (struct cmd_list_element) <prefixname>: Now
	const.
	(help_cmd_list, apropos_cmd): Update.
	* cli/cli-script.c (show_user): Update.
	* cli/cli-setshow.c (cmd_show_list): Make "prefix" const.
	* cli/cli-setshow.h (cmd_show_list): Update.
	* command.h (add_prefix_cmd, add_abbrev_prefix_cmd, help_list)
	(cmd_show_list): Update.
	* guile/scm-cmd.c (cmdscm_destroyer): Update.
	* python/py-cmd.c (cmdpy_destroyer): Update.
2014-07-24 11:30:04 -06:00
Tom Tromey 429e55ea94 constify deprecate_cmd
This constifies deprecate_cmd and the "replacement" field in struct
cmd_list_element.

2014-07-24  Tom Tromey  <tromey@redhat.com>

	* cli/cli-decode.c (deprecate_cmd): Make "replacement" const.
	* cli/cli-decode.h (struct cmd_list_element) <replacement>: Now
	const.
	* command.h (deprecate_cmd): Update.
	* maint.c (maintenance_do_deprecate): Add casts.
2014-07-24 11:30:03 -06:00
Tom Tromey 82ae6c8d79 use cmd_sfunc_ftype and cmd_cfunc_ftype more
This patch changes a few more spots to use either cmd_sfunc_ftype or
cmd_cfunc_ftype, as appropriate.  This is a bit cleaner.

Tested by rebuilding.

2014-07-01  Tom Tromey  <tromey@redhat.com>

	* breakpoint.c (add_catch_command): Use cmd_sfunc_ftype.
	* breakpoint.h (add_catch_command): Use cmd_sfunc_ftype.
	* cli/cli-decode.c (cmd_cfunc_eq, add_cmd, add_prefix_cmd)
	(add_abbrev_prefix_cmd, add_info, add_com): Use cmd_cfunc_ftype.
	* command.h (cmd_cfunc_ftype): Move earlier.
	(add_cmd, add_prefix_cmd, add_abbrev_prefix_cmd, cmd_cfunc_eq)
	(add_com, add_info): Use cmd_cfunc_ftype.
2014-07-01 10:21:10 -06:00
Tom Tromey 5b10184c58 constify error_no_arg
This is a trivial patch to make error_no_arg take a const argument.

2014-06-26  Tom Tromey  <tromey@redhat.com>

	* cli/cli-cmds.c (error_no_arg): Make "why" const.
	* command.h (error_no_arg): Update.
2014-06-26 09:14:18 -06:00
Joel Brobecker ecd75fc8ee Update Copyright year range in all files maintained by GDB. 2014-01-01 07:54:24 +04:00
Pedro Alves 6f937416b9 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 18:34:55 +00:00
Yao Qi b69b1fb10d gdb/
* cli/cli-decode.c (add_setshow_zuinteger_unlimited_cmd): Change
	parameter VAR's type from "unsigned int" to "int".
	* command.h (var_zuinteger_unlimited): Update its comments.
	(add_setshow_zuinteger_unlimited_cmd): Update the declaration.
2013-03-05 14:23:23 +00:00
Tom Tromey 44478ab340 * cli/cli-decode.c (add_setshow_string_noescape_cmd): Return the
set command.
	* command.h (add_setshow_string_noescape_cmd): Update.
	* corefile.c (set_gnutarget_command): Remove trailing whitespace.
	(complete_set_gnutarget): New function.
	(_initialize_core): Set the "set gnutarget" completer.
gdb/testsuite
	* gdb.base/completion.exp: Add "set gnutarget" test.
2013-01-14 21:05:07 +00:00
Joel Brobecker 28e7fd6234 Update years in copyright notice for the GDB files.
Two modifications:
  1. The addition of 2013 to the copyright year range for every file;
  2. The use of a single year range, instead of potentially multiple
     year ranges, as approved by the FSF.
2013-01-01 06:33:28 +00:00
Mike Frysinger ace2195744 gdb: include help aliases in help command completion
There are a bunch of aliases that get used with help, but the current
command completion logic does not include those when doing completions.

Since the framework is already mostly in place, extend complete_on_cmdlist
slightly to pass down the ignore_help_classes flag like is done with the
existing lookup command logic.

Now you can do:
	(gdb) help use<tab>
and get back:
	(gdb) help user-defined

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-11-20 21:02:36 +00:00
Yao Qi 6fc1c7733e gdb/
* cli/cli-decode.c (add_setshow_zuinteger_unlimited_cmd): New.
	Update comment to add_setshow_integer_cmd.
	* cli/cli-setshow.c (do_set_command): Handle case
	'var_zuinteger_unlimited'.
	(do_show_command): Likewise.
	* cli/cli-cmds.c (init_cmds): Call add_setshow_zuinteger_unlimited_cmd
	for command 'remotetimeout'.
	* command.h (enum var_types): New zuinteger_unlimited.  Update comment
	to var_integer.
	* source.c (_initialize_source): Call add_setshow_zuinteger_unlimited_cmd
	for command 'set listsize'.

gdb/doc/
	* gdb.texinfo (List): Describe the meaning of 0 and -1 in
	'set listsize'.

gdb/testsuite/
	* gdb.base/list.exp (set_listsize): Don't set arg to "unlimited"
	when it is less than 0.
2012-09-17 08:42:14 +00:00
Yao Qi a7c3d16228 gdb/
* command.h, remote.c: Fix a typo in comment.
2012-07-19 16:01:13 +00:00
Tom Tromey 49c4e619f8 * ada-lang.c (ada_make_symbol_completion_list): Return a VEC.
* breakpoint.c (catch_syscall_completer): Return a VEC.
	* cli/cli-cmds.c (complete_command): Update.
	* cli/cli-decode.c (complete_on_cmdlist): Return a VEC.
	(complete_on_enum): Likewise.
	* command.h: Include gdb_vecs.h.
	(completer_ftype): Change return type.
	(complete_on_cmdlist, complete_on_enum): Likewise.
	* completer.c (noop_completer, filename_completer)
	(location_completer): Return a VEC.
	(add_struct_fields): Remove 'nextp' argument.  Change 'output'
	to a VEC.
	(expression_completer, complete_line_internal, complete_line)
	(command_completer): Return a VEC.
	(gdb_completion_word_break_characters, line_completion_function):
	Update.
	* completer.h: Include gdb_vecs.h.
	(complete_line, noop_completer, filename_completer)
	(expression_completer, location_completer, command_completer):
	Update.
	* f-lang.c (f_word_break_characters): Return a VEC.
	* interps.c (interpreter_completer): Return a VEC.
	* language.h (struct language_defn)
	<la_make_symbol_completion_list>: Return a VEC.
	* python/py-cmd.c (cmdpy_completer): Return a VEC.
	* symtab.c (free_completion_list): Take a VEC.
	(return_val_size, return_val_index): Remove.
	(return_val): Now a VEC.
	(completion_list_add_name): Update.
	(default_make_symbol_completion_list_break_on)
	(default_make_symbol_completion_list, make_symbol_completion_list)
	(make_symbol_completion_list_fn, make_file_symbol_completion_list):
	Return a VEC.
	(add_filename_to_list): Update.
	(struct add_partial_filename_data) <list_used, list_alloced>: Remove.
	<list>: Now a VEC.
	(maybe_add_partial_symtab_filename): Update.
	(make_source_files_completion_list): Return a VEC.
	* symtab.h (default_make_symbol_completion_list_break_on)
	(default_make_symbol_completion_list, make_symbol_completion_list)
	(make_symbol_completion_list_fn, make_file_symbol_completion_list)
	(make_source_files_completion_list): Update.
2012-06-13 15:47:16 +00:00
Tom Tromey 625e8578d7 * breakpoint.c (add_catch_command): Use completer_ftype.
* breakpoint.h: Include command.h.
	(add_catch_command): Use completer_ftype.
	* cli/cli-decode.c (set_cmd_completer): Use completer_ftype.
	* cli/cli-decode.h (struct cmd_list_element) <completer>:
	Use completer_ftype.
	* command.h (completer_ftype): New typedef.
	(set_cmd_completer): Use it.
	* python/py-cmd.c (struct cmdpy_completer) <completer>: Use
	completer_ftype.
2012-06-13 15:41:24 +00:00
Jan Kratochvil 4047852192 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 18:08:22 +00:00
Pedro Alves 50aeff07f4 2012-01-05 Pedro Alves <alves.ped@gmail.com>
* cli/cli-decode.h: Add comments.
	(CMD_LIST_AMBIGUOUS): Moved to command.h
	(add_cmd, add_alias_cmd, add_prefix_cmd, add_abbrev_prefix_cmd)
	(set_cmd_cfunc, set_cmd_sfunc, set_cmd_completer, cmd_cfunc_eq)
	(set_cmd_context, get_cmd_context, lookup_cmd, lookup_cmd_1)
	(deprecate_cmd, deprecated_cmd_warning, lookup_cmd_composition)
	(add_com, add_com_alias, add_info, add_info_alias)
	(complete_on_cmdlist, complete_on_enum, help_list): Remove
	declarations.
	* command.h: Add and adjust comments.
	(CMD_LIST_AMBIGUOUS): Moved here.
	(help_cmd, help_cmd_list): Delete declarations.
2012-01-05 11:39:31 +00:00
Joel Brobecker 0b30217134 Copyright year update in most files of the GDB Project.
gdb/ChangeLog:

        Copyright year update in most files of the GDB Project.
2012-01-04 08:17:56 +00:00
Doug Evans 5a56e9c5e9 Add new "alias" command.
* NEWS: Mention new command.
	* command.h (valid_user_defined_cmd_name_p): Declare.
	* defs.h (make_cleanup_dyn_string_delete): Declare.
	* utils.c: #include "dyn-string.h".
	(do_dyn_string_delete, make_cleanup_dyn_string_delete): New functions.
	* cli/cli-cmds.c: #include "dyn-string.h".
	(argv_to_dyn_string, valid_command_p, alias_command): New functions.
	(init_cli_cmds): Add new command.
	* cli/cli-decode.c (valid_user_defined_cmd_name_p): New function.

	doc/
	* gdb.texinfo (Extending GDB): Document alias command.

	testsuite/
	* gdb.base/alias.exp: Add tests for alias command.
2011-10-09 22:21:43 +00:00
Michael Snyder db5f229b95 2011-02-14 Michael Snyder <msnyder@vmware.com>
* command.h (enum command_class): New class 'no_set_class', for
	"show" commands without a corresponding "set" command.
	* value.c (_initialize_values): Use 'no_set_class' for "show values".
	* copying.c (_initialize_copying): Ditto for "show copying" and
	"show warranty".
	* cli/cli-cmds.c (init_cli_cmds): Ditto for "show commands" and
	"show version".
	* cli/cli-setshow.c (cmd_show_list): Skip "show" commands for
	which there is no corresponding "set" command (eg. "show copying").
2011-02-14 23:41:33 +00:00
Tom Tromey 47a80e9093 PR python/12216:
* python/python.c (execute_gdb_command): Call
	prevent_dont_repeat.
	* top.c (suppress_dont_repeat): New global.
	(dont_repeat): Use it.
	(prevent_dont_repeat): New function.
	* command.h (prevent_dont_repeat): Declare.
2011-01-31 16:52:35 +00:00
Michael Snyder 3e43a32aaa 2011-01-05 Michael Snyder <msnyder@vmware.com>
* addrmap.c: Shorten lines of >= 80 columns.
	* arch-utils.c: Ditto.
	* arch-utils.h: Ditto.
	* ax-gdb.c: Ditto.
	* ax-general.c: Ditto.
	* bcache.c: Ditto.
	* blockframe.c: Ditto.
	* breakpoint.c: Ditto.
	* buildsym.c: Ditto.
	* c-lang.c: Ditto.
	* c-typeprint.c: Ditto.
	* charset.c: Ditto.
	* coffread.c: Ditto.
	* command.h: Ditto.
	* corelow.c: Ditto.
	* cp-abi.c: Ditto.
	* cp-namespace.c: Ditto.
	* cp-support.c: Ditto.
	* dbug-rom.c: Ditto.
	* dbxread.c: Ditto.
	* defs.h: Ditto.
	* dfp.c: Ditto.
	* dfp.h: Ditto.
	* dictionary.c: Ditto.
	* disasm.c: Ditto.
	* doublest.c: Ditto.
	* dwarf2-frame.c: Ditto.
	* dwarf2expr.c: Ditto.
	* dwarf2loc.c: Ditto.
	* dwarf2read.c: Ditto.
	* elfread.c: Ditto.
	* eval.c: Ditto.
	* event-loop.c: Ditto.
	* event-loop.h: Ditto.
	* exceptions.h: Ditto.
	* exec.c: Ditto.
	* expprint.c: Ditto.
	* expression.h: Ditto.
	* f-lang.c: Ditto.
	* f-valprint.c: Ditto.
	* findcmd.c: Ditto.
	* frame-base.c: Ditto.
	* frame-unwind.c: Ditto.
	* frame-unwind.h: Ditto.
	* frame.c: Ditto.
	* frame.h: Ditto.
	* gcore.c: Ditto.
	* gdb-stabs.h: Ditto.
	* gdb_assert.h: Ditto.
	* gdb_dirent.h: Ditto.
	* gdb_obstack.h: Ditto.
	* gdbcore.h: Ditto.
	* gdbtypes.c: Ditto.
	* gdbtypes.h: Ditto.
	* inf-ttrace.c: Ditto.
	* infcall.c: Ditto.
	* infcmd.c: Ditto.
	* inflow.c: Ditto.
	* infrun.c: Ditto.
	* inline-frame.h: Ditto.
	* language.c: Ditto.
	* language.h: Ditto.
	* libunwind-frame.c: Ditto.
	* libunwind-frame.h: Ditto.
	* linespec.c: Ditto.
	* linux-nat.c: Ditto.
	* linux-nat.h: Ditto.
	* linux-thread-db.c: Ditto.
	* machoread.c: Ditto.
	* macroexp.c: Ditto.
	* macrotab.c: Ditto.
	* main.c: Ditto.
	* maint.c: Ditto.
	* mdebugread.c: Ditto.
	* memattr.c: Ditto.
	* minsyms.c: Ditto.
	* monitor.c: Ditto.
	* monitor.h: Ditto.
	* objfiles.c: Ditto.
	* objfiles.h: Ditto.
	* osabi.c: Ditto.
	* p-typeprint.c: Ditto.
	* p-valprint.c: Ditto.
	* parse.c: Ditto.
	* printcmd.c: Ditto.
	* proc-events.c: Ditto.
	* procfs.c: Ditto.
	* progspace.c: Ditto.
	* progspace.h: Ditto.
	* psympriv.h: Ditto.
	* psymtab.c: Ditto.
	* record.c: Ditto.
	* regcache.c: Ditto.
	* regcache.h: Ditto.
	* remote-fileio.c: Ditto.
	* remote.c: Ditto.
	* ser-mingw.c: Ditto.
	* ser-tcp.c: Ditto.
	* ser-unix.c: Ditto.
	* serial.c: Ditto.
	* serial.h: Ditto.
	* solib-frv.c: Ditto.
	* solib-irix.c: Ditto.
	* solib-osf.c: Ditto.
	* solib-pa64.c: Ditto.
	* solib-som.c: Ditto.
	* solib-sunos.c: Ditto.
	* solib-svr4.c: Ditto.
	* solib-target.c: Ditto.
	* solib.c: Ditto.
	* somread.c: Ditto.
	* source.c: Ditto.
	* stabsread.c: Ditto.
	* stabsread.c: Ditto.
	* stack.c: Ditto.
	* stack.h: Ditto.
	* symfile-mem.c: Ditto.
	* symfile.c: Ditto.
	* symfile.h: Ditto.
	* symmisc.c: Ditto.
	* symtab.c: Ditto.
	* symtab.h: Ditto.
	* target-descriptions.c: Ditto.
	* target-memory.c: Ditto.
	* target.c: Ditto.
	* target.h: Ditto.
	* terminal.h: Ditto.
	* thread.c: Ditto.
	* top.c: Ditto.
	* tracepoint.c: Ditto.
	* tracepoint.h: Ditto.
	* ui-file.c: Ditto.
	* ui-file.h: Ditto.
	* ui-out.h: Ditto.
	* user-regs.c: Ditto.
	* user-regs.h: Ditto.
	* utils.c: Ditto.
	* valarith.c: Ditto.
	* valops.c: Ditto.
	* valprint.c: Ditto.
	* valprint.h: Ditto.
	* value.c: Ditto.
	* varobj.c: Ditto.
	* varobj.h: Ditto.
	* vec.h: Ditto.
	* xcoffread.c: Ditto.
	* xcoffsolib.c: Ditto.
	* xcoffsolib.h: Ditto.
	* xml-syscall.c: Ditto.
	* xml-tdesc.c: Ditto.
2011-01-05 22:22:53 +00:00
Joel Brobecker 7b6bb8daac run copyright.sh for 2011. 2011-01-01 15:34:07 +00:00
Michael Snyder aff410f180 2010-12-31 Michael Snyder <msnyder@vmware.com>
* charset.c: Comment cleanup and long line wrapping.
	* charset.h: Ditto.
	* c-lang.c: Ditto.
	* c-lang.h: Ditto.
	* coff-pe-read.c: Ditto.
	* coff-pe-read.h: Ditto.
	* coffread.c: Ditto.
	* command.h: Ditto.
	* complaints.c: Ditto.
	* complaints.h: Ditto.
	* completer.c: Ditto.
	* completer.h: Ditto.
	* corefile.c: Ditto.
	* corelow.c: Ditto.
	* core-regset.c: Ditto.
	* cp-abi.c: Ditto.
	* cp-abi.h: Ditto.
	* cp-namespace.c: Ditto.
	* cp-support.c: Ditto.
	* cp-support.h: Ditto.
	* cp-valprint.c: Ditto.
	* cp-typeprint.c: Ditto.
	* c-valprint.c: Ditto.
2010-12-31 22:59:52 +00:00
Michael Snyder ebcd3b23ee 2010-12-28 Michael Snyder <msnyder@vmware.com>
* command.h: Comment clean-up.
	* cli/cli-cmds.c: Ditto.
	* cli/cli-cmds.h: Ditto.
	* cli/cli-decode.c: Ditto.
	* cli/cli-decode.h: Ditto.
	* cli/cli-dump.c: Ditto.
	* cli/cli-interp.c: Ditto.
	* cli/cli-logging.c: Ditto.
	* cli/cli-script.c: Ditto.
	* cli/cli-setshow.c: Ditto.
	* cli/cli-setshow.h: Ditto.
2010-12-29 02:11:04 +00:00
Jan Kratochvil c25c4a8b0e gdb/
* cli/cli-cmds.h (error_no_arg): Remove.  Move the comment ...
	* command.h (error_no_arg): ... here.  Remove NORETURN, change
	ATTR_NORETURN to ATTRIBUTE_NORETURN.
	* defs.h (NORETURN, ATTR_NORETURN): Remove.
	(perror_with_name, verror, error, error_stream, vfatal, fatal)
	(internal_verror, internal_error, nomem): Remove NORETURN, change
	ATTR_NORETURN to ATTRIBUTE_NORETURN.
	* exceptions.c (throw_exception, deprecated_throw_reason, throw_verror)
	(throw_vfatal, throw_error): Remove NORETURN.
	(throw_it): Remove NORETURN, change ATTR_NORETURN to ATTRIBUTE_NORETURN.
	* exceptions.h (throw_exception, throw_verror, throw_vfatal)
	(throw_error, deprecated_throw_reason): Remove NORETURN, change
	ATTR_NORETURN to ATTRIBUTE_NORETURN.
	* linespec.c (cplusplus_error): Remove NORETURN, change ATTR_NORETURN
	to ATTRIBUTE_NORETURN for prototype, for the definition only remove
	NORETURN.
	* remote-mips.c (mips_error): Change NORETURN to ATTRIBUTE_NORETURN.
	* remote-sim.c (gdb_os_error): Change ATTR_NORETURN to
	ATTRIBUTE_NORETURN.
	* target.c (tcomplain): Likewise.
	* target.h (noprocess): Remove NORETURN, change ATTR_NORETURN to
	ATTRIBUTE_NORETURN.
	* utils.c (verror, error, vfatal, fatal, error_stream, internal_verror)
	(internal_error, perror_with_name, nomem): Remove NORETURN.
	* xml-support.h (gdb_xml_error): Change ATTR_NORETURN to
	ATTRIBUTE_NORETURN.

gdb/doc/
	* gdbint.texinfo (Host Definition): Remove items NORETURN and
	ATTR_NORETURN.
2010-05-02 23:52:14 +00:00
Joel Brobecker 4c38e0a4fc Update copyright year in most headers.
Automatic update by copyright.sh.
2010-01-01 07:32:07 +00:00
Michael Snyder 6b04bdb74a 2009-10-25 Michael Snyder <msnyder@vmware.com>
* target.h (struct target_ops): New methods to_get_bookmark
        and to_goto_bookmark.
        (target_get_bookmark): New macro.
        (target_goto_bookmark): New macro.
        * target.c (dummy_get_bookmark): New function, default implementation.
        (dummy_goto_bookmark): New function, default implementation.
        (update_current_target): Inherit new methods.
        * record.c (record_get_bookmark): New function.
        (record_goto_bookmark): New function.
        (init_record_ops): Set to_get_bookmark and to_goto_bookmark methods.
        * reverse.c (struct bookmark): New type.
        (save_bookmark_command): New function (command).
        (delete_bookmark_command): New function (command).
        (goto_bookmark_command): New function (command).
        (bookmarks_info): New function (command).
        (_initialize_reverse): Add new bookmark commands.
	* command.h (enum command_class): Add class_bookmark.
	* NEWS: Mention bookmark commands.
2009-11-20 17:23:38 +00:00
Pedro Alves 5efd5804f7 Revert 2009-08-07 changes for PR gdb/8869:
* language.c (set_language_command): Strip whitespace.
	(set_type_command): Likewise.
	(set_range_command): Likewise.

	* language.c (language_completer): New function.
	(range_or_type_completer): New function.
	(case_completer): New function.
	(_initialize_language): Set completers.
	* cli/cli-decode.c (add_setshow_string_cmd): Return the "set"
	command.
	(add_setshow_string_noescape_cmd): Likewise.
	(add_setshow_integer_cmd): Likewise.
	(add_setshow_uinteger_cmd): Likewise.
	(add_setshow_zinteger_cmd): Likewise.
	(add_setshow_zuinteger_cmd): Likewise.
	* command.h (add_setshow_string_cmd,
	add_setshow_string_noescape_cmd, add_setshow_uinteger_cmd,
	add_setshow_zinteger_cmd, add_setshow_zuinteger_cmd): Update.
2009-08-13 14:56:19 +00:00
Tom Tromey 6cc0b2563e PR gdb/8869:
* language.c (language_completer): New function.
	(range_or_type_completer): New function.
	(case_completer): New function.
	(_initialize_language): Set completers.
	* cli/cli-decode.c (add_setshow_string_cmd): Return the "set"
	command.
	(add_setshow_string_noescape_cmd): Likewise.
	(add_setshow_integer_cmd): Likewise.
	(add_setshow_uinteger_cmd): Likewise.
	(add_setshow_zinteger_cmd): Likewise.
	(add_setshow_zuinteger_cmd): Likewise.
	* command.h (add_setshow_string_cmd,
	add_setshow_string_noescape_cmd, add_setshow_uinteger_cmd,
	add_setshow_zinteger_cmd, add_setshow_zuinteger_cmd): Update.
2009-08-07 20:44:15 +00:00
Pedro Alves cbe54154ef gdb/
2009-05-12  Pedro Alves  <pedro@codesourcery.com>

	* cli/cli-decode.c (deprecated_add_set_cmd): Delete.
	* command.h (deprecated_add_set_cmd): Delete declaration.
	* gnu-nat.c (_initialize_gnu_nat): Replace 'maint gnu-debug' with
	'set debug gnu-nat' and 'show debug gnu-nat'.
	* i386-nat.c (_initialize_i386_nat): Replace 'maint
	show-debug-registers' with 'maint set show-debug-registers' and
	'maint show show-debug-registers'.
	* mips-linux-nat.c (_initialize_mips_linux_nat): Replace 'maint
	show-debug-registers' with 'maint set show-debug-registers' and
	'maint show show-debug-registers'.

gdb/doc/
2009-05-12  Pedro Alves  <pedro@codesourcery.com>

	* gdb.texinfo: Document 'set/show debug gnu-nat'.  Replace 'maint
	show-debug-regs' docs by 'maint set show-debug-regs' and 'maint
	show show-debug-regs' docs.
2009-05-12 16:51:13 +00:00
Thiago Jung Bauermann d8906c6f0e gdb/
2009-02-06  Tom Tromey  <tromey@redhat.com>

	* Makefile.in (SUBDIR_PYTHON_OBS): Add python-cmd.o.
	(SUBDIR_PYTHON_SRCS): Add python-cmd.c.
	(python-cmd.o): New target.
	* cli/cli-decode.c (set_cmd_completer): Add self parameter to
	completer prototype.
	(add_cmd): Initialize destroyer member of cmd_list_element. Use
	make_symbol_completion_list_fn as completer.
	(delete_cmd): Call destroyer if one is set.
	* cli/cli-decode.h (cmd_list_element): Add cmd parameter to
	completer member.  Add destroyer member.
	(set_cmd_completer): Add self parameter to
	completer prototype.
	* command.h (set_cmd_completer): Add cmd parameter to
	completer prototype.
	* completer.c (noop_completer, filename_completer,
	location_completer, expression_completer, command_completer): Adapt
	to new completer prototype.
	(complete_line_internal): Pass new parameter to completer function.
	* completer.h (noop_completer, filename_completer,
	location_completer, expression_completer, command_completer): Adapt
	prototypes to new completer prototype.
	* interps.c (interpreter_completer): Adapt to new completer
	prototype.
	* python/python-cmd.c: New file.
	* python/python-internal.h (gdbpy_initialize_commands): Add
	prototype.
	(gdbpy_doc_cst): Add forward declaration.
	* python/python.c (gdbpy_doc_cst): Declare.
	(_initialize_python): Call gdbpy_initialize_commands.  Initialize
	gdbpy_doc_cst.
	* symtab.c (make_symbol_completion_list_fn): New function.
	* symtab.h (make_symbol_completion_list_fn): Add prototype.

gdb/doc/
2009-02-06  Tom Tromey  <tromey@redhat.com>

	* gdb.texinfo (Python API): Add entry for Commands In Python.
	(Commands In Python): New node.

gdb/testsuite/
2009-02-06  Thiago Jung Bauermann  <bauerman@br.ibm.com>

	* gdb.python/python-cmd.exp: New file.
2009-02-06 21:33:59 +00:00
Pedro Alves 1e8fb9762b 2009-01-23 Pedro Alves <pedro@codesourcery.com>
* cli/cli-decode.c (add_setshow_zuinteger_cmd): New.
	* cli/cli-setshow.c (do_setshow_command): Handle it.
	* command.h (enum var_types): Add var_zuinteger.
	(add_setshow_zuinteger_cmd): Declare.

	* valprint.c (_initialize_valprint): Change the set input-radix
	and set output-radix commands to zuinteger type.

2009-01-23  Pedro Alves  <pedro@codesourcery.com>

	* gdb.base/radix.exp: Add tests to ensure that that set
	input-radix 0 and set output-radix 0 are really rejected.
2009-01-23 18:47:46 +00:00
Joel Brobecker 0fb0cc7590 Updated copyright notices for most files. 2009-01-03 05:58:08 +00:00
Tom Tromey b05dcbb7f9 gdb
PR gdb/1815:
	* cli/cli-decode.c (delete_cmd): Forward declare.
	(delete_cmd): Now static.  Change return type.  Remove command
	from alias chain.  Rewrite.
	(add_cmd): Initialize new fields.  Update cmd_pointer on all
	aliases.
	(add_alias_cmd): Put command on alias chain.
	* command.h (delete_cmd): Don't declare.
	* cli/cli-decode.h (delete_cmd): Don't declare.
	(struct cmd_list_element) <aliases, alias_chain>: New fields.
gdb/testsuite
	* gdb.base/commands.exp (redefine_backtrace_test): New proc.
	Call it.
2008-12-10 01:05:16 +00:00
Daniel Jacobowitz 9b254dd1ce Updated copyright notices for most files. 2008-01-01 22:53:26 +00:00
Joel Brobecker a9762ec78a Switch the license of all .c files to GPLv3.
Switch the license of all .h files to GPLv3.
        Switch the license of all .cc files to GPLv3.
2007-08-23 18:08:50 +00:00
Daniel Jacobowitz 6aba47ca06 Copyright updates for 2007. 2007-01-09 17:59:20 +00:00