binutils-gdb/gdb/python
Tom Tromey 981a3fb359 Constify add_prefix_cmd
This changes add_prefix_cmd to accept a const-taking function as an
argument; then fixes up all the callers.

In a couple of spots I had to add a non-const overload of a function,
because the function is passed to two different command-adding
"constructors".  These overloads are temporary; once constification is
complete they can be removed.

This patch also fixes a typo I happened to notice while constifying.

Note that this touches a couple of files (gnu-nat.c and go32-nat.c)
that I can't build.  So, while I made a best-effort there, I am not
certain they will still compile.

Tested by rebuilding.

gdb/ChangeLog
2017-10-11  Tom Tromey  <tom@tromey.com>

	* gdbthread.h (thread_command): Constify.
	* inferior.h (detach_command): Constify.
	* top.h (set_history, show_history): Constify.
	* arm-tdep.c (set_arm_command, show_arm_command): Constify.
	* serial.c (serial_set_cmd, serial_show_cmd): Constify.
	* bsd-kvm.c (bsd_kvm_cmd): Constify.
	* printcmd.c (set_command): Constify.
	(non_const_set_command): New function.
	* dcache.c (set_dcache_command, show_dcache_command): Constify.
	* breakpoint.c (enable_command, disable_command, delete_command)
	(catch_command, tcatch_command, set_breakpoint_cmd)
	(show_breakpoint_cmd): Constify.
	* macrocmd.c (macro_command): Constify.
	* infcmd.c (unset_command, kill_command, detach_command)
	(info_proc_cmd): Constify.
	* i386-tdep.c (set_mpx_cmd, show_mpx_cmd): Constify.
	* auto-load.c (show_auto_load_cmd, set_auto_load_cmd)
	(info_auto_load_cmd): Constify.
	* target-descriptions.c (set_tdesc_cmd, show_tdesc_cmd)
	(unset_tdesc_cmd): Constify.
	* ada-lang.c (set_ada_command, show_ada_command)
	(maint_set_ada_cmd, maint_show_ada_cmd): Constify.
	* guile/guile.c (set_guile_command, show_guile_command)
	(info_guile_command): Constify.
	* tui/tui-win.c (tui_command, set_tui_cmd, show_tui_cmd):
	Constify.
	* skip.c (skip_command): Constify.
	* compile/compile.c (_initialize_compile): Constify.
	* dwarf2read.c (set_dwarf_cmd, show_dwarf_cmd): Constify.
	* btrace.c (maint_btrace_cmd, maint_btrace_set_cmd)
	(maint_btrace_show_cmd, maint_btrace_pt_set_cmd)
	(maint_btrace_pt_show_cmd): Constify.
	* remote.c (set_remote_cmd, show_remote_cmd, remote_command):
	Constify.
	* python/python.c (user_show_python, user_set_python): Constify.
	* mips-tdep.c (set_mips_command, show_mips_command)
	(set_mipsfpu_command): Constify.
	* record-btrace.c (cmd_record_btrace_start)
	(cmd_set_record_btrace, cmd_show_record_btrace)
	(cmd_set_record_btrace_bts, cmd_show_record_btrace_bts)
	(cmd_set_record_btrace_pt, cmd_show_record_btrace_pt): Constify.
	* rs6000-tdep.c (set_powerpc_command, show_powerpc_command):
	Constify.
	* symfile.c (overlay_command): Constify.
	* spu-tdep.c (set_spu_command, show_spu_command): Constify.
	* cli/cli-logging.c (set_logging_command, show_logging_command):
	Constify.
	* cli/cli-dump.c (dump_command, append_command)
	(srec_dump_command, ihex_dump_command, verilog_dump_command)
	(tekhex_dump_command, binary_dump_command)
	(binary_append_command): Constify.
	* cli/cli-decode.c (struct cmd_list_element): Change type of
	"fun".
	* cli/cli-cmds.c (info_command, show_command, set_debug)
	(show_debug): Constify.
	(show_command): Add non-const overload.
	* top.c (set_history, show_history): Constify.
	* sh-tdep.c (set_sh_command, show_sh_command): Constify.
	* command.h (add_prefix_cmd): Accept a cmd_const_cfunc_ftype.
	* target.c (target_command): Constify.
	* sparc64-tdep.c (info_adi_command): Constify.
	* record-full.c (cmd_record_full_start): Constify.
	(set_record_full_command): Constify.  Fix typo.
	(show_record_full_command): Constify.
	* thread.c (thread_command, thread_apply_command): Constify.
	* memattr.c (dummy_cmd): Constify.
	* value.c (function_command): Constify.
	* frame.c (set_backtrace_cmd, show_backtrace_cmd): Constify.
	* probe.c (info_probes_command): Constify.
	* ser-tcp.c (set_tcp_cmd, show_tcp_cmd): Constify.
	* gnu-nat.c (set_task_cmd, show_task_cmd, set_thread_cmd)
	(show_thread_cmd, set_thread_default_cmd)
	(show_thread_default_cmd): Constify.
	(check_empty): Constify.
	* tracepoint.c (tfind_command): Constify.
	* cp-support.c (maint_cplus_command): Constify.
	* windows-tdep.c (info_w32_command): Constify.
	* record.c (cmd_record_start, set_record_command)
	(show_record_command, info_record_command, cmd_record_goto):
	Constify.
	* ravenscar-thread.c (set_ravenscar_command)
	(show_ravenscar_command): Constify.
	* utils.c (set_internal_problem_cmd, show_internal_problem_cmd):
	Constify.
	(add_internal_problem_command): Remove casts.
	* arc-tdep.c (maintenance_print_arc_command): Constify.
	* valprint.c (set_print, show_print, set_print_raw)
	(show_print_raw): Constify.
	* maint.c (maintenance_command, maintenance_info_command)
	(maintenance_print_command, maintenance_set_cmd)
	(maintenance_show_cmd, set_per_command_cmd)
	(show_per_command_cmd, maintenance_check_command): Constify.
	* language.c (set_check, show_check): Constify.
	* typeprint.c (show_print_type, set_print_type): Constify.
	* go32-nat.c (go32_info_dos_command): Constify.
2017-10-11 16:21:02 -06:00
..
lib/gdb Import sys in gdb/python/lib/gdb/printer/bound_registers.py 2017-03-22 11:22:07 +00:00
py-all-events.def Make it simpler to add events to Python 2017-09-11 14:15:22 -06:00
py-arch.c -Wwrite-strings: Add a PyArg_ParseTupleAndKeywords "const char *" overload 2017-04-05 19:21:36 +01:00
py-auto-load.c update copyright year range in GDB files 2017-01-01 10:52:34 +04:00
py-block.c -Wwrite-strings: Wrap PyGetSetDef for construction with string literals 2017-04-05 19:21:36 +01:00
py-bpevent.c Make it simpler to add events to Python 2017-09-11 14:15:22 -06:00
py-breakpoint.c Constify some linespec functions 2017-09-27 08:44:45 -06:00
py-cmd.c Add add_cmd function overloads 2017-09-27 08:44:14 -06:00
py-continueevent.c Make it simpler to add events to Python 2017-09-11 14:15:22 -06:00
py-event-types.def Make it simpler to add events to Python 2017-09-11 14:15:22 -06:00
py-event.c Small event ownership clean up in Python layer 2017-09-11 14:15:21 -06:00
py-event.h Make it simpler to add events to Python 2017-09-11 14:15:22 -06:00
py-events.h Make it simpler to add events to Python 2017-09-11 14:15:22 -06:00
py-evtregistry.c Use gdbpy_ref to simplify some logic 2017-02-10 12:24:32 -07:00
py-evts.c Make it simpler to add events to Python 2017-09-11 14:15:22 -06:00
py-exitedevent.c Make it simpler to add events to Python 2017-09-11 14:15:22 -06:00
py-finishbreakpoint.c Introduce event_location_up 2017-04-12 11:16:17 -06:00
py-frame.c Remove cleanups from find_frame_funname 2017-09-11 16:15:11 -06:00
py-framefilter.c -Wwrite-strings: The Rest 2017-04-05 19:21:37 +01:00
py-function.c Turn gdbpy_ref into a template 2017-02-10 12:24:31 -07:00
py-gdb-readline.c Fix python-interactive with Python 3.6 2017-01-20 20:39:08 -05:00
py-inferior.c Add `thread_from_thread_handle' method to (Python) gdb.Inferior 2017-09-21 11:20:51 -07:00
py-infevents.c Make it simpler to add events to Python 2017-09-11 14:15:22 -06:00
py-infthread.c -Wwrite-strings: Wrap PyGetSetDef for construction with string literals 2017-04-05 19:21:36 +01:00
py-instruction.c Python: Introduce gdb.Instruction class 2017-05-02 11:35:54 +02:00
py-instruction.h Python: Introduce gdb.Instruction class 2017-05-02 11:35:54 +02:00
py-lazy-string.c -Wwrite-strings: Wrap PyGetSetDef for construction with string literals 2017-04-05 19:21:36 +01:00
py-linetable.c Change find_pcs_for_symtab_line to return a std::vector 2017-04-12 11:16:17 -06:00
py-newobjfileevent.c Make it simpler to add events to Python 2017-09-11 14:15:22 -06:00
py-objfile.c -Wwrite-strings: Add a PyArg_ParseTupleAndKeywords "const char *" overload 2017-04-05 19:21:36 +01:00
py-param.c Use gdb_argv in Python 2017-08-03 07:59:09 -06:00
py-prettyprint.c Change one more spot to use gdbpy_ref 2017-02-10 12:24:33 -07:00
py-progspace.c -Wwrite-strings: Wrap PyGetSetDef for construction with string literals 2017-04-05 19:21:36 +01:00
py-record-btrace.c btrace: Store btrace_insn in an std::vector 2017-09-04 10:46:36 +02:00
py-record-btrace.h Python: Move and rename gdb.BtraceFunction 2017-05-02 11:35:54 +02:00
py-record-full.c python: Implement btrace Python bindings for record history. 2017-02-14 10:57:56 +01:00
py-record-full.h python: Implement btrace Python bindings for record history. 2017-02-14 10:57:56 +01:00
py-record.c Python: Introduce gdb.Instruction class 2017-05-02 11:35:54 +02:00
py-record.h Python: Move and rename gdb.BtraceFunction 2017-05-02 11:35:54 +02:00
py-ref.h Turn gdbpy_ref into a template 2017-02-10 12:24:31 -07:00
py-signalevent.c Make it simpler to add events to Python 2017-09-11 14:15:22 -06:00
py-stopevent.c Make it simpler to add events to Python 2017-09-11 14:15:22 -06:00
py-stopevent.h Small event ownership clean up in Python layer 2017-09-11 14:15:21 -06:00
py-symbol.c -Wwrite-strings: Add a PyArg_ParseTupleAndKeywords "const char *" overload 2017-04-05 19:21:36 +01:00
py-symtab.c -Wwrite-strings: Wrap PyGetSetDef for construction with string literals 2017-04-05 19:21:36 +01:00
py-threadevent.c Make it simpler to add events to Python 2017-09-11 14:15:22 -06:00
py-type.c Make cp_comp_to_string return a gdb::unique_xmalloc_ptr<char> 2017-08-09 15:04:32 +01:00
py-unwind.c Fix Python unwinder frames regression 2017-07-06 00:19:24 +01:00
py-utils.c Turn gdbpy_ref into a template 2017-02-10 12:24:31 -07:00
py-value.c Stop assuming no-debug-info functions return int 2017-09-04 20:21:13 +01:00
py-varobj.c Avoid some manual memory management in Python 2017-08-03 07:59:07 -06:00
py-xmethods.c Support rvalue references in the gdb python module (includes doc/) 2017-03-20 13:47:52 -07:00
python-config.py
python-internal.h Add `thread_from_thread_handle' method to (Python) gdb.Inferior 2017-09-21 11:20:51 -07:00
python.c Constify add_prefix_cmd 2017-10-11 16:21:02 -06:00
python.h update copyright year range in GDB files 2017-01-01 10:52:34 +04:00