public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFA 05/67] Constify two functions in valprint.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
@ 2017-09-21  5:11 ` Tom Tromey
  2017-09-21  5:13 ` [RFA 16/67] Constify some functions in memattr.c Tom Tromey
                   ` (66 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:11 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* valprint.c (set_radix, show_radix): Constify.
---
 gdb/ChangeLog  | 4 ++++
 gdb/valprint.c | 8 ++------
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/gdb/valprint.c b/gdb/valprint.c
index d3094ca..ead4131 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -88,10 +88,6 @@ static void show_print (char *, int);
 
 static void set_print (char *, int);
 
-static void set_radix (char *, int);
-
-static void show_radix (char *, int);
-
 static void set_input_radix (char *, int, struct cmd_list_element *);
 
 static void set_input_radix_1 (int, unsigned);
@@ -3093,7 +3089,7 @@ set_output_radix_1 (int from_tty, unsigned radix)
    the 'set input-radix' command.  */
 
 static void
-set_radix (char *arg, int from_tty)
+set_radix (const char *arg, int from_tty)
 {
   unsigned radix;
 
@@ -3111,7 +3107,7 @@ set_radix (char *arg, int from_tty)
 /* Show both the input and output radices.  */
 
 static void
-show_radix (char *arg, int from_tty)
+show_radix (const char *arg, int from_tty)
 {
   if (from_tty)
     {
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 25/67] Constify some commands in symfile.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (9 preceding siblings ...)
  2017-09-21  5:13 ` [RFA 14/67] Constify core_file_command Tom Tromey
@ 2017-09-21  5:13 ` Tom Tromey
  2017-09-21  5:13 ` [RFA 09/67] Constify display_tib Tom Tromey
                   ` (56 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* symfile.c (add_symbol_file_command)
	(remove_symbol_file_command, list_overlays_command)
	(map_overlay_command, unmap_overlay_command)
	(overlay_auto_command, overlay_manual_command)
	(overlay_off_command, overlay_load_command): Constify.
---
 gdb/ChangeLog |  8 ++++++++
 gdb/symfile.c | 28 +++++++++-------------------
 2 files changed, 17 insertions(+), 19 deletions(-)

diff --git a/gdb/symfile.c b/gdb/symfile.c
index 96b7d6f..c6e3b90 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -87,20 +87,10 @@ static void load_command (char *, int);
 static void symbol_file_add_main_1 (const char *args, symfile_add_flags add_flags,
 				    objfile_flags flags);
 
-static void add_symbol_file_command (char *, int);
-
 static const struct sym_fns *find_sym_fns (bfd *);
 
 static void overlay_invalidate_all (void);
 
-static void overlay_auto_command (char *, int);
-
-static void overlay_manual_command (char *, int);
-
-static void overlay_off_command (char *, int);
-
-static void overlay_load_command (char *, int);
-
 static void overlay_command (char *, int);
 
 static void simple_free_overlay_table (void);
@@ -2198,7 +2188,7 @@ print_transfer_performance (struct ui_file *stream,
    value to use.  We are now discontinuing this type of ad hoc syntax.  */
 
 static void
-add_symbol_file_command (char *args, int from_tty)
+add_symbol_file_command (const char *args, int from_tty)
 {
   struct gdbarch *gdbarch = get_current_arch ();
   gdb::unique_xmalloc_ptr<char> filename;
@@ -2333,7 +2323,7 @@ add_symbol_file_command (char *args, int from_tty)
 /* This function removes a symbol file that was added via add-symbol-file.  */
 
 static void
-remove_symbol_file_command (char *args, int from_tty)
+remove_symbol_file_command (const char *args, int from_tty)
 {
   struct objfile *objf = NULL;
   struct program_space *pspace = current_program_space;
@@ -3233,7 +3223,7 @@ find_pc_mapped_section (CORE_ADDR pc)
    Print a list of mapped sections and their PC ranges.  */
 
 static void
-list_overlays_command (char *args, int from_tty)
+list_overlays_command (const char *args, int from_tty)
 {
   int nmapped = 0;
   struct objfile *objfile;
@@ -3275,7 +3265,7 @@ list_overlays_command (char *args, int from_tty)
    Mark the named section as mapped (ie. residing at its VMA address).  */
 
 static void
-map_overlay_command (char *args, int from_tty)
+map_overlay_command (const char *args, int from_tty)
 {
   struct objfile *objfile, *objfile2;
   struct obj_section *sec, *sec2;
@@ -3320,7 +3310,7 @@ map_overlay_command (char *args, int from_tty)
    (ie. resident in its LMA address range, rather than the VMA range).  */
 
 static void
-unmap_overlay_command (char *args, int from_tty)
+unmap_overlay_command (const char *args, int from_tty)
 {
   struct objfile *objfile;
   struct obj_section *sec = NULL;
@@ -3350,7 +3340,7 @@ unmap_overlay_command (char *args, int from_tty)
    Possibly this should be done via a set/show command.  */
 
 static void
-overlay_auto_command (char *args, int from_tty)
+overlay_auto_command (const char *args, int from_tty)
 {
   overlay_debugging = ovly_auto;
   enable_overlay_breakpoints ();
@@ -3363,7 +3353,7 @@ overlay_auto_command (char *args, int from_tty)
    Possibly this should be done via a set/show command.  */
 
 static void
-overlay_manual_command (char *args, int from_tty)
+overlay_manual_command (const char *args, int from_tty)
 {
   overlay_debugging = ovly_on;
   disable_overlay_breakpoints ();
@@ -3376,7 +3366,7 @@ overlay_manual_command (char *args, int from_tty)
    Possibly this should be done via a set/show command.  */
 
 static void
-overlay_off_command (char *args, int from_tty)
+overlay_off_command (const char *args, int from_tty)
 {
   overlay_debugging = ovly_off;
   disable_overlay_breakpoints ();
@@ -3385,7 +3375,7 @@ overlay_off_command (char *args, int from_tty)
 }
 
 static void
-overlay_load_command (char *args, int from_tty)
+overlay_load_command (const char *args, int from_tty)
 {
   struct gdbarch *gdbarch = get_current_arch ();
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 04/67] Constify info_probes_dtrace_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (6 preceding siblings ...)
  2017-09-21  5:13 ` [RFA 12/67] Constify maintenance_cplus_namespace Tom Tromey
@ 2017-09-21  5:13 ` Tom Tromey
  2017-09-21 12:48   ` Sergio Durigan Junior
  2017-09-21  5:13 ` [RFA 03/67] Constify not_just_help_class_command Tom Tromey
                   ` (59 subsequent siblings)
  67 siblings, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* dtrace-probe.c (info_probes_dtrace_command): Constify.
---
 gdb/ChangeLog      | 4 ++++
 gdb/dtrace-probe.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
index 5a4daa3..2bbe03e 100644
--- a/gdb/dtrace-probe.c
+++ b/gdb/dtrace-probe.c
@@ -904,7 +904,7 @@ const struct probe_ops dtrace_probe_ops =
 /* Implementation of the `info probes dtrace' command.  */
 
 static void
-info_probes_dtrace_command (char *arg, int from_tty)
+info_probes_dtrace_command (const char *arg, int from_tty)
 {
   info_probes_for_ops (arg, from_tty, &dtrace_probe_ops);
 }
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 09/67] Constify display_tib
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (10 preceding siblings ...)
  2017-09-21  5:13 ` [RFA 25/67] Constify some commands in symfile.c Tom Tromey
@ 2017-09-21  5:13 ` Tom Tromey
  2017-09-21  5:15 ` [RFA 20/67] Constify some commands in cli-cmds.c Tom Tromey
                   ` (55 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* windows-tdep.c (display_tib): Constify.
---
 gdb/ChangeLog      | 4 ++++
 gdb/windows-tdep.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c
index 197d779..49402d3 100644
--- a/gdb/windows-tdep.c
+++ b/gdb/windows-tdep.c
@@ -361,7 +361,7 @@ display_one_tib (ptid_t ptid)
 /* Display thread information block of the current thread.  */
 
 static void
-display_tib (char * args, int from_tty)
+display_tib (const char * args, int from_tty)
 {
   if (!ptid_equal (inferior_ptid, null_ptid))
     display_one_tib (inferior_ptid);
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 03/67] Constify not_just_help_class_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (7 preceding siblings ...)
  2017-09-21  5:13 ` [RFA 04/67] Constify info_probes_dtrace_command Tom Tromey
@ 2017-09-21  5:13 ` Tom Tromey
  2017-09-21  5:13 ` [RFA 14/67] Constify core_file_command Tom Tromey
                   ` (58 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* command.h (not_just_help_class_command): Update.
	* cli/cli-decode.h (not_just_help_class_command): Update.
	* cli/cli-decode.c (not_just_help_class_command): Constify.
---
 gdb/ChangeLog        | 6 ++++++
 gdb/cli/cli-decode.c | 2 +-
 gdb/cli/cli-decode.h | 2 +-
 gdb/command.h        | 2 +-
 4 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 55d4124..577fea9 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -440,7 +440,7 @@ add_abbrev_prefix_cmd (const char *name, enum command_class theclass,
 
 /* This is an empty "cfunc".  */
 void
-not_just_help_class_command (char *args, int from_tty)
+not_just_help_class_command (const char *args, int from_tty)
 {
 }
 
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index 691bfe3..76f3ca9 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -228,7 +228,7 @@ extern void apropos_cmd (struct ui_file *, struct cmd_list_element *,
    function field NULL, the command is interpreted as a help topic, or
    as a class of commands.  */
 
-extern void not_just_help_class_command (char *arg, int from_tty);
+extern void not_just_help_class_command (const char *arg, int from_tty);
 
 /* Exported to cli/cli-setshow.c */
 
diff --git a/gdb/command.h b/gdb/command.h
index b6c4091..6d9bac8 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -452,7 +452,7 @@ extern scoped_restore_tmpl<int> prevent_dont_repeat (void);
    function field NULL, the command is interpreted as a help topic, or
    as a class of commands.  */
 
-extern void not_just_help_class_command (char *, int);
+extern void not_just_help_class_command (const char *, int);
 
 /* Check function pointer.  */
 extern int cmd_func_p (struct cmd_list_element *cmd);
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 07/67] Constify two functions in cp-abi.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (3 preceding siblings ...)
  2017-09-21  5:13 ` [RFA 10/67] Constify some functions in psymtab.c Tom Tromey
@ 2017-09-21  5:13 ` Tom Tromey
  2017-09-21  5:13 ` [RFA 28/67] Constify some commands in record-btrace.c Tom Tromey
                   ` (62 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* cp-abi.c (set_cp_abi_cmd, show_cp_abi_cmd): Constify.
---
 gdb/ChangeLog | 4 ++++
 gdb/cp-abi.c  | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/cp-abi.c b/gdb/cp-abi.c
index 49fab32..11b8424 100644
--- a/gdb/cp-abi.c
+++ b/gdb/cp-abi.c
@@ -341,7 +341,7 @@ list_cp_abis (int from_tty)
    argument is given.  */
 
 static void
-set_cp_abi_cmd (char *args, int from_tty)
+set_cp_abi_cmd (const char *args, int from_tty)
 {
   if (args == NULL)
     {
@@ -378,7 +378,7 @@ cp_abi_completer (struct cmd_list_element *ignore,
 /* Show the currently selected C++ ABI.  */
 
 static void
-show_cp_abi_cmd (char *args, int from_tty)
+show_cp_abi_cmd (const char *args, int from_tty)
 {
   struct ui_out *uiout = current_uiout;
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 12/67] Constify maintenance_cplus_namespace
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (5 preceding siblings ...)
  2017-09-21  5:13 ` [RFA 28/67] Constify some commands in record-btrace.c Tom Tromey
@ 2017-09-21  5:13 ` Tom Tromey
  2017-09-21  5:13 ` [RFA 04/67] Constify info_probes_dtrace_command Tom Tromey
                   ` (60 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* cp-namespace.c (maintenance_cplus_namespace): Constify.
---
 gdb/ChangeLog      | 4 ++++
 gdb/cp-namespace.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c
index 90ff513..214b7e1 100644
--- a/gdb/cp-namespace.c
+++ b/gdb/cp-namespace.c
@@ -1078,7 +1078,7 @@ cp_lookup_transparent_type_loop (const char *name,
    obsolete.  */
 
 static void
-maintenance_cplus_namespace (char *args, int from_tty)
+maintenance_cplus_namespace (const char *args, int from_tty)
 {
   printf_unfiltered (_("The `maint namespace' command was removed.\n"));
 }
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 28/67] Constify some commands in record-btrace.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (4 preceding siblings ...)
  2017-09-21  5:13 ` [RFA 07/67] Constify two functions in cp-abi.c Tom Tromey
@ 2017-09-21  5:13 ` Tom Tromey
  2017-09-21  7:02   ` Metzger, Markus T
  2017-09-21  5:13 ` [RFA 12/67] Constify maintenance_cplus_namespace Tom Tromey
                   ` (61 subsequent siblings)
  67 siblings, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* record-btrace.c (cmd_record_btrace_bts_start)
	(cmd_record_btrace_pt_start): Constify.
---
 gdb/ChangeLog       | 5 +++++
 gdb/record-btrace.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/record-btrace.c b/gdb/record-btrace.c
index 783e5a1..77844bc 100644
--- a/gdb/record-btrace.c
+++ b/gdb/record-btrace.c
@@ -2883,7 +2883,7 @@ init_record_btrace_ops (void)
 /* Start recording in BTS format.  */
 
 static void
-cmd_record_btrace_bts_start (char *args, int from_tty)
+cmd_record_btrace_bts_start (const char *args, int from_tty)
 {
   if (args != NULL && *args != 0)
     error (_("Invalid argument."));
@@ -2905,7 +2905,7 @@ cmd_record_btrace_bts_start (char *args, int from_tty)
 /* Start recording in Intel Processor Trace format.  */
 
 static void
-cmd_record_btrace_pt_start (char *args, int from_tty)
+cmd_record_btrace_pt_start (const char *args, int from_tty)
 {
   if (args != NULL && *args != 0)
     error (_("Invalid argument."));
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 16/67] Constify some functions in memattr.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
  2017-09-21  5:11 ` [RFA 05/67] Constify two functions in valprint.c Tom Tromey
@ 2017-09-21  5:13 ` Tom Tromey
  2017-09-21  5:13 ` [RFA 18/67] Constify interpreter_exec_cmd Tom Tromey
                   ` (65 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* memattr.c (enable_mem_command, disable_mem_command)
	(delete_mem_command): Constify.
---
 gdb/ChangeLog | 5 +++++
 gdb/memattr.c | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/gdb/memattr.c b/gdb/memattr.c
index c1ac978..5be6397 100644
--- a/gdb/memattr.c
+++ b/gdb/memattr.c
@@ -561,7 +561,7 @@ mem_enable (int num)
 }
 
 static void
-enable_mem_command (char *args, int from_tty)
+enable_mem_command (const char *args, int from_tty)
 {
   int num;
   struct mem_region *m;
@@ -606,7 +606,7 @@ mem_disable (int num)
 }
 
 static void
-disable_mem_command (char *args, int from_tty)
+disable_mem_command (const char *args, int from_tty)
 {
   require_user_regions (from_tty);
 
@@ -659,7 +659,7 @@ mem_delete (int num)
 }
 
 static void
-delete_mem_command (char *args, int from_tty)
+delete_mem_command (const char *args, int from_tty)
 {
   require_user_regions (from_tty);
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 18/67] Constify interpreter_exec_cmd
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
  2017-09-21  5:11 ` [RFA 05/67] Constify two functions in valprint.c Tom Tromey
  2017-09-21  5:13 ` [RFA 16/67] Constify some functions in memattr.c Tom Tromey
@ 2017-09-21  5:13 ` Tom Tromey
  2017-09-21  5:13 ` [RFA 10/67] Constify some functions in psymtab.c Tom Tromey
                   ` (64 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* interps.c (interpreter_exec_cmd): Constify.
---
 gdb/ChangeLog | 4 ++++
 gdb/interps.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/interps.c b/gdb/interps.c
index 63a1230..1e89a99 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -401,7 +401,7 @@ clear_interpreter_hooks (void)
 }
 
 static void
-interpreter_exec_cmd (char *args, int from_tty)
+interpreter_exec_cmd (const char *args, int from_tty)
 {
   struct ui_interp_info *ui_interp = get_current_interp_info ();
   struct interp *old_interp, *interp_to_use;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 14/67] Constify core_file_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (8 preceding siblings ...)
  2017-09-21  5:13 ` [RFA 03/67] Constify not_just_help_class_command Tom Tromey
@ 2017-09-21  5:13 ` Tom Tromey
  2017-09-21  5:13 ` [RFA 25/67] Constify some commands in symfile.c Tom Tromey
                   ` (57 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* gdbcore.h (core_file_command): Update.
	* corefile.c (core_file_command): Constify.
---
 gdb/ChangeLog  | 5 +++++
 gdb/corefile.c | 2 +-
 gdb/gdbcore.h  | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/corefile.c b/gdb/corefile.c
index da3f72f..b9d95c0 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -61,7 +61,7 @@ struct target_ops *core_target;
 /* Backward compatability with old way of specifying core files.  */
 
 void
-core_file_command (char *filename, int from_tty)
+core_file_command (const char *filename, int from_tty)
 {
   dont_repeat ();		/* Either way, seems bogus.  */
 
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index 5d4e36e..7554245 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -141,7 +141,7 @@ extern struct target_ops *core_target;
 
 extern int write_files;
 
-extern void core_file_command (char *filename, int from_tty);
+extern void core_file_command (const char *filename, int from_tty);
 
 extern void exec_file_attach (const char *filename, int from_tty);
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 10/67] Constify some functions in psymtab.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (2 preceding siblings ...)
  2017-09-21  5:13 ` [RFA 18/67] Constify interpreter_exec_cmd Tom Tromey
@ 2017-09-21  5:13 ` Tom Tromey
  2017-09-21  5:13 ` [RFA 07/67] Constify two functions in cp-abi.c Tom Tromey
                   ` (63 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:13 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* psymtab.c (maintenance_print_psymbols)
	(maintenance_info_psymtabs, maintenance_check_psymtabs):
	Constify.
---
 gdb/ChangeLog | 6 ++++++
 gdb/psymtab.c | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index ea300fe..4527d69 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1892,7 +1892,7 @@ dump_psymtab_addrmap (struct objfile *objfile, struct partial_symtab *psymtab,
 }
 
 static void
-maintenance_print_psymbols (char *args, int from_tty)
+maintenance_print_psymbols (const char *args, int from_tty)
 {
   struct ui_file *outfile = gdb_stdout;
   char *address_arg = NULL, *source_arg = NULL, *objfile_arg = NULL;
@@ -2050,7 +2050,7 @@ maintenance_print_psymbols (char *args, int from_tty)
 /* List all the partial symbol tables whose names match REGEXP (optional).  */
 
 static void
-maintenance_info_psymtabs (char *regexp, int from_tty)
+maintenance_info_psymtabs (const char *regexp, int from_tty)
 {
   struct program_space *pspace;
   struct objfile *objfile;
@@ -2156,7 +2156,7 @@ maintenance_info_psymtabs (char *regexp, int from_tty)
 /* Check consistency of currently expanded psymtabs vs symtabs.  */
 
 static void
-maintenance_check_psymtabs (char *ignore, int from_tty)
+maintenance_check_psymtabs (const char *ignore, int from_tty)
 {
   struct symbol *sym;
   struct partial_symbol **psym;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 15/67] Constify show_convenience
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (13 preceding siblings ...)
  2017-09-21  5:15 ` [RFA 21/67] Constify commands in cli-dump.c Tom Tromey
@ 2017-09-21  5:15 ` Tom Tromey
  2017-09-21  5:16 ` [RFA 26/67] Constify new_ui_command Tom Tromey
                   ` (52 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:15 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* value.c (show_convenience): Constify.
---
 gdb/ChangeLog | 4 ++++
 gdb/value.c   | 4 +---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/gdb/value.c b/gdb/value.c
index 1fd9cc9..d0871ef 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -885,8 +885,6 @@ value_contents_eq (const struct value *val1, LONGEST offset1,
 
 static void show_values (char *, int);
 
-static void show_convenience (char *, int);
-
 
 /* The value-history records all the values printed
    by print commands during this session.  Each chunk
@@ -2661,7 +2659,7 @@ preserve_values (struct objfile *objfile)
 }
 
 static void
-show_convenience (char *ignore, int from_tty)
+show_convenience (const char *ignore, int from_tty)
 {
   struct gdbarch *gdbarch = get_current_arch ();
   struct internalvar *var;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 20/67] Constify some commands in  cli-cmds.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (11 preceding siblings ...)
  2017-09-21  5:13 ` [RFA 09/67] Constify display_tib Tom Tromey
@ 2017-09-21  5:15 ` Tom Tromey
  2017-09-21  5:15 ` [RFA 21/67] Constify commands in cli-dump.c Tom Tromey
                   ` (54 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:15 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* cli/cli-cmds.c (show_version, show_configuration)
	(source_command, show_user): Constify.
---
 gdb/ChangeLog      |  5 +++++
 gdb/cli/cli-cmds.c | 14 +++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index f7e7bf7..e6239ca 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -66,8 +66,6 @@ static void echo_command (char *, int);
 
 static void pwd_command (char *, int);
 
-static void show_version (char *, int);
-
 static void help_command (char *, int);
 
 static void show_command (char *, int);
@@ -78,8 +76,6 @@ static void show_debug (char *, int);
 
 static void set_debug (char *, int);
 
-static void show_user (char *, int);
-
 static void make_command (char *, int);
 
 static void shell_escape (const char *, int);
@@ -343,14 +339,14 @@ is_complete_command (struct cmd_list_element *c)
 }
 
 static void
-show_version (char *args, int from_tty)
+show_version (const char *args, int from_tty)
 {
   print_gdb_version (gdb_stdout);
   printf_filtered ("\n");
 }
 
 static void
-show_configuration (char *args, int from_tty)
+show_configuration (const char *args, int from_tty)
 {
   print_gdb_configuration (gdb_stdout);
 }
@@ -638,9 +634,9 @@ source_script (const char *file, int from_tty)
 }
 
 static void
-source_command (char *args, int from_tty)
+source_command (const char *args, int from_tty)
 {
-  char *file = args;
+  const char *file = args;
   int search_path = 0;
 
   scoped_restore save_source_verbose = make_scoped_restore (&source_verbose);
@@ -1303,7 +1299,7 @@ make_command (char *arg, int from_tty)
 }
 
 static void
-show_user (char *args, int from_tty)
+show_user (const char *args, int from_tty)
 {
   struct cmd_list_element *c;
   extern struct cmd_list_element *cmdlist;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 21/67] Constify commands in cli-dump.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (12 preceding siblings ...)
  2017-09-21  5:15 ` [RFA 20/67] Constify some commands in cli-cmds.c Tom Tromey
@ 2017-09-21  5:15 ` Tom Tromey
  2017-09-21  5:15 ` [RFA 15/67] Constify show_convenience Tom Tromey
                   ` (53 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:15 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* cli/cli-dump.c (dump_memory_command, dump_value_command)
	(dump_srec_memory, dump_srec_value, dump_ihex_memory)
	(dump_ihex_value, dump_verilog_memory, dump_verilog_value)
	(dump_tekhex_memory, dump_tekhex_value, dump_binary_memory)
	(dump_binary_value, append_binary_memory, append_binary_value):
	Constify.
	(struct dump_context) <func>: Constify.
	(add_dump_command): Update.
---
 gdb/ChangeLog      | 11 +++++++++++
 gdb/cli/cli-dump.c | 32 ++++++++++++++++----------------
 2 files changed, 27 insertions(+), 16 deletions(-)

diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 550548a..f4ea2d7 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -215,7 +215,7 @@ dump_memory_to_file (const char *cmd, const char *mode, const char *file_format)
 }
 
 static void
-dump_memory_command (char *cmd, const char *mode)
+dump_memory_command (const char *cmd, const char *mode)
 {
   dump_memory_to_file (cmd, mode, "binary");
 }
@@ -260,86 +260,86 @@ dump_value_to_file (const char *cmd, const char *mode, const char *file_format)
 }
 
 static void
-dump_value_command (char *cmd, const char *mode)
+dump_value_command (const char *cmd, const char *mode)
 {
   dump_value_to_file (cmd, mode, "binary");
 }
 
 static void
-dump_srec_memory (char *args, int from_tty)
+dump_srec_memory (const char *args, int from_tty)
 {
   dump_memory_to_file (args, FOPEN_WB, "srec");
 }
 
 static void
-dump_srec_value (char *args, int from_tty)
+dump_srec_value (const char *args, int from_tty)
 {
   dump_value_to_file (args, FOPEN_WB, "srec");
 }
 
 static void
-dump_ihex_memory (char *args, int from_tty)
+dump_ihex_memory (const char *args, int from_tty)
 {
   dump_memory_to_file (args, FOPEN_WB, "ihex");
 }
 
 static void
-dump_ihex_value (char *args, int from_tty)
+dump_ihex_value (const char *args, int from_tty)
 {
   dump_value_to_file (args, FOPEN_WB, "ihex");
 }
 
 static void
-dump_verilog_memory (char *args, int from_tty)
+dump_verilog_memory (const char *args, int from_tty)
 {
   dump_memory_to_file (args, FOPEN_WB, "verilog");
 }
 
 static void
-dump_verilog_value (char *args, int from_tty)
+dump_verilog_value (const char *args, int from_tty)
 {
   dump_value_to_file (args, FOPEN_WB, "verilog");
 }
 
 static void
-dump_tekhex_memory (char *args, int from_tty)
+dump_tekhex_memory (const char *args, int from_tty)
 {
   dump_memory_to_file (args, FOPEN_WB, "tekhex");
 }
 
 static void
-dump_tekhex_value (char *args, int from_tty)
+dump_tekhex_value (const char *args, int from_tty)
 {
   dump_value_to_file (args, FOPEN_WB, "tekhex");
 }
 
 static void
-dump_binary_memory (char *args, int from_tty)
+dump_binary_memory (const char *args, int from_tty)
 {
   dump_memory_to_file (args, FOPEN_WB, "binary");
 }
 
 static void
-dump_binary_value (char *args, int from_tty)
+dump_binary_value (const char *args, int from_tty)
 {
   dump_value_to_file (args, FOPEN_WB, "binary");
 }
 
 static void
-append_binary_memory (char *args, int from_tty)
+append_binary_memory (const char *args, int from_tty)
 {
   dump_memory_to_file (args, FOPEN_AB, "binary");
 }
 
 static void
-append_binary_value (char *args, int from_tty)
+append_binary_value (const char *args, int from_tty)
 {
   dump_value_to_file (args, FOPEN_AB, "binary");
 }
 
 struct dump_context
 {
-  void (*func) (char *cmd, const char *mode);
+  void (*func) (const char *cmd, const char *mode);
   const char *mode;
 };
 
@@ -353,7 +353,7 @@ call_dump_func (struct cmd_list_element *c, char *args, int from_tty)
 
 static void
 add_dump_command (const char *name,
-		  void (*func) (char *args, const char *mode),
+		  void (*func) (const char *args, const char *mode),
 		  const char *descr)
 
 {
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 22/67] Constify user_defined_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (16 preceding siblings ...)
  2017-09-21  5:16 ` [RFA 01/67] Add add_cmd function overloads Tom Tromey
@ 2017-09-21  5:16 ` Tom Tromey
  2017-09-21  5:16 ` [RFA 02/67] Constify add_cmd gdb_bfd.c Tom Tromey
                   ` (49 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:16 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* cli/cli-script.c (user_defined_command): Constify.
---
 gdb/ChangeLog        | 4 ++++
 gdb/cli/cli-script.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/cli/cli-script.c b/gdb/cli/cli-script.c
index 37466fd..0a93e8b 100644
--- a/gdb/cli/cli-script.c
+++ b/gdb/cli/cli-script.c
@@ -1401,7 +1401,7 @@ validate_comname (char **comname)
 
 /* This is just a placeholder in the command data structures.  */
 static void
-user_defined_command (char *ignore, int from_tty)
+user_defined_command (const char *ignore, int from_tty)
 {
 }
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 00/67] Simple add_cmd constification
@ 2017-09-21  5:16 Tom Tromey
  2017-09-21  5:11 ` [RFA 05/67] Constify two functions in valprint.c Tom Tromey
                   ` (67 more replies)
  0 siblings, 68 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:16 UTC (permalink / raw)
  To: gdb-patches

First, left me offer my apologies for the length of this series.  It
was somewhat simpler to break it into many tiny pieces, because
sometimes when const-ifying it is easy to get in over one's head.  On
the plus side, nearly all of the patches are trivial and so review
should not be too difficult -- just boring.

This starts by adding const-correct overloads of add_cmd and a few
related functions.  Then, it converts many functions to use the
const-correct form.  The idea is to gradually convert all commands
(and set/show, etc) to const-correctness, then remove the non-const
overloads.

Regression tested on the buildbot.

Tom

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 26/67] Constify new_ui_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (14 preceding siblings ...)
  2017-09-21  5:15 ` [RFA 15/67] Constify show_convenience Tom Tromey
@ 2017-09-21  5:16 ` Tom Tromey
  2017-09-21  5:16 ` [RFA 01/67] Add add_cmd function overloads Tom Tromey
                   ` (51 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:16 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* top.c (new_ui_command): Constify.
---
 gdb/ChangeLog | 4 ++++
 gdb/top.c     | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/top.c b/gdb/top.c
index 404e096..137ae3b 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -357,7 +357,7 @@ open_terminal_stream (const char *name)
 /* Implementation of the "new-ui" command.  */
 
 static void
-new_ui_command (char *args, int from_tty)
+new_ui_command (const char *args, int from_tty)
 {
   struct ui *ui;
   struct interp *interp;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 01/67] Add add_cmd function overloads
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (15 preceding siblings ...)
  2017-09-21  5:16 ` [RFA 26/67] Constify new_ui_command Tom Tromey
@ 2017-09-21  5:16 ` Tom Tromey
  2017-09-21  7:02   ` Metzger, Markus T
  2017-09-21 10:25   ` Pedro Alves
  2017-09-21  5:16 ` [RFA 22/67] Constify user_defined_command Tom Tromey
                   ` (50 subsequent siblings)
  67 siblings, 2 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:16 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This adds two add_cmd overloads: one whose callback takes a const char *,
and one that doesn't accept a function at all.  The no-function overload
was introduced to avoid ambiguity when NULL was passed as the function.

Long term the goal is for all commands to take const arguments, and
for the non-const variants to be removed entirely.

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* cli/cli-decode.c (add_cmd, set_cmd_cfunc): New function
	overloads.
	(do_add_cmd): Rename from add_cmd.  Don't call set_cmd_cfunc.
	(do_const_cfunc): New function.
	(cmd_cfunc_eq): New overload.
	(cli_user_command_p): Check do_const_cfunc.
	* cli/cli-decode.h (struct cmd_list_element) <function>: New field
	const_cfunc.
	* command.h (add_cmd): Add const overload and no-function
	overload.
	(set_cmd_cfunc): Add const overload.
	(cmd_const_cfunc_ftype): Declare.
	(cmd_cfunc_eq): Add const overload.
	* breakpoint.c, cli-cmds.c, cli-dump.c, guile/scm-cmd.c,
	python/py-cmd.c, target.c, tracepoint.c: Use no-function add_cmd
	overload.
---
 gdb/ChangeLog        | 19 +++++++++++++++
 gdb/breakpoint.c     |  4 ++--
 gdb/cli/cli-cmds.c   | 22 +++++++++---------
 gdb/cli/cli-decode.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++------
 gdb/cli/cli-decode.h |  2 ++
 gdb/cli/cli-dump.c   |  4 ++--
 gdb/command.h        | 14 +++++++++++
 gdb/guile/scm-cmd.c  |  2 +-
 gdb/python/py-cmd.c  |  2 +-
 gdb/target.c         |  4 ++--
 gdb/tracepoint.c     |  2 +-
 11 files changed, 113 insertions(+), 27 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 8585f5e..5549fe7 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15414,13 +15414,13 @@ add_catch_command (const char *name, const char *docstring,
 {
   struct cmd_list_element *command;
 
-  command = add_cmd (name, class_breakpoint, NULL, docstring,
+  command = add_cmd (name, class_breakpoint, docstring,
 		     &catch_cmdlist);
   set_cmd_sfunc (command, sfunc);
   set_cmd_context (command, user_data_catch);
   set_cmd_completer (command, completer);
 
-  command = add_cmd (name, class_breakpoint, NULL, docstring,
+  command = add_cmd (name, class_breakpoint, docstring,
 		     &tcatch_cmdlist);
   set_cmd_sfunc (command, sfunc);
   set_cmd_context (command, user_data_tcatch);
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 260fd3f..f7e7bf7 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1686,28 +1686,28 @@ _initialize_cli_cmds (void)
   /* Define the classes of commands.
      They will appear in the help list in alphabetical order.  */
 
-  add_cmd ("internals", class_maintenance, NULL, _("\
+  add_cmd ("internals", class_maintenance, _("\
 Maintenance commands.\n\
 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."),
 	   &cmdlist);
-  add_cmd ("obscure", class_obscure, NULL, _("Obscure features."), &cmdlist);
-  add_cmd ("aliases", class_alias, NULL,
+  add_cmd ("obscure", class_obscure, _("Obscure features."), &cmdlist);
+  add_cmd ("aliases", class_alias,
 	   _("Aliases of other commands."), &cmdlist);
-  add_cmd ("user-defined", class_user, NULL, _("\
+  add_cmd ("user-defined", class_user, _("\
 User-defined commands.\n\
 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, NULL, _("Support facilities."), &cmdlist);
+  add_cmd ("support", class_support, _("Support facilities."), &cmdlist);
   if (!dbx_commands)
-    add_cmd ("status", class_info, NULL, _("Status inquiries."), &cmdlist);
-  add_cmd ("files", class_files, NULL, _("Specifying and examining files."),
+    add_cmd ("status", class_info, _("Status inquiries."), &cmdlist);
+  add_cmd ("files", class_files, _("Specifying and examining files."),
 	   &cmdlist);
-  add_cmd ("breakpoints", class_breakpoint, NULL,
+  add_cmd ("breakpoints", class_breakpoint,
 	   _("Making program stop at certain points."), &cmdlist);
-  add_cmd ("data", class_vars, NULL, _("Examining data."), &cmdlist);
-  add_cmd ("stack", class_stack, NULL, _("\
+  add_cmd ("data", class_vars, _("Examining data."), &cmdlist);
+  add_cmd ("stack", class_stack, _("\
 Examining the stack.\n\
 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\
@@ -1716,7 +1716,7 @@ 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."),
 	   &cmdlist);
-  add_cmd ("running", class_run, NULL, _("Running the program."), &cmdlist);
+  add_cmd ("running", class_run, _("Running the program."), &cmdlist);
 
   /* Define general commands.  */
 
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 1bbbe46..55d4124 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -117,6 +117,22 @@ set_cmd_cfunc (struct cmd_list_element *cmd, cmd_cfunc_ftype *cfunc)
 }
 
 static void
+do_const_cfunc (struct cmd_list_element *c, char *args, int from_tty)
+{
+  c->function.const_cfunc (args, from_tty); /* Ok.  */
+}
+
+void
+set_cmd_cfunc (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfunc)
+{
+  if (cfunc == NULL)
+    cmd->func = NULL;
+  else
+    cmd->func = do_const_cfunc;
+  cmd->function.const_cfunc = cfunc; /* Ok.  */
+}
+
+static void
 do_sfunc (struct cmd_list_element *c, char *args, int from_tty)
 {
   c->function.sfunc (args, from_tty, c); /* Ok.  */
@@ -138,6 +154,12 @@ cmd_cfunc_eq (struct cmd_list_element *cmd, cmd_cfunc_ftype *cfunc)
   return cmd->func == do_cfunc && cmd->function.cfunc == cfunc;
 }
 
+int
+cmd_cfunc_eq (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfunc)
+{
+  return cmd->func == do_const_cfunc && cmd->function.const_cfunc == cfunc;
+}
+
 void
 set_cmd_context (struct cmd_list_element *cmd, void *context)
 {
@@ -189,9 +211,9 @@ set_cmd_completer_handle_brkchars (struct cmd_list_element *cmd,
    Returns a pointer to the added command (not necessarily the head 
    of *LIST).  */
 
-struct cmd_list_element *
-add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
-	 const char *doc, struct cmd_list_element **list)
+static struct cmd_list_element *
+do_add_cmd (const char *name, enum command_class theclass,
+	    const char *doc, struct cmd_list_element **list)
 {
   struct cmd_list_element *c = XNEW (struct cmd_list_element);
   struct cmd_list_element *p, *iter;
@@ -229,7 +251,6 @@ add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
 
   c->name = name;
   c->theclass = theclass;
-  set_cmd_cfunc (c, fun);
   set_cmd_context (c, NULL);
   c->doc = doc;
   c->cmd_deprecated = 0;
@@ -259,6 +280,35 @@ add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
   return c;
 }
 
+struct cmd_list_element *
+add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
+	 const char *doc, struct cmd_list_element **list)
+{
+  cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
+  set_cmd_cfunc (result, fun);
+  return result;
+}
+
+struct cmd_list_element *
+add_cmd (const char *name, enum command_class theclass,
+	 const char *doc, struct cmd_list_element **list)
+{
+  cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
+  result->func = NULL;
+  result->function.cfunc = NULL; /* Ok.  */
+  return result;
+}
+
+struct cmd_list_element *
+add_cmd (const char *name, enum command_class theclass,
+	 cmd_const_cfunc_ftype *fun,
+	 const char *doc, struct cmd_list_element **list)
+{
+  cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
+  set_cmd_cfunc (result, fun);
+  return result;
+}
+
 /* Deprecates a command CMD.
    REPLACEMENT is the name of the command which should be used in
    place of this command, or NULL if no such command exists.
@@ -301,7 +351,7 @@ add_alias_cmd (const char *name, cmd_list_element *old,
       return 0;
     }
 
-  struct cmd_list_element *c = add_cmd (name, theclass, NULL, old->doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, old->doc, list);
 
   /* If OLD->DOC can be freed, we should make another copy.  */
   if (old->doc_allocated)
@@ -419,7 +469,7 @@ add_set_or_show_cmd (const char *name,
 		     const char *doc,
 		     struct cmd_list_element **list)
 {
-  struct cmd_list_element *c = add_cmd (name, theclass, NULL, doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, doc, list);
 
   gdb_assert (type == set_cmd || type == show_cmd);
   c->type = type;
@@ -1909,5 +1959,6 @@ int
 cli_user_command_p (struct cmd_list_element *cmd)
 {
   return (cmd->theclass == class_user
-	  && (cmd->func == do_cfunc || cmd->func == do_sfunc));
+	  && (cmd->func == do_cfunc || cmd->func == do_sfunc
+	      || cmd->func == do_const_cfunc));
 }
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index 50b858c..691bfe3 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -114,6 +114,8 @@ struct cmd_list_element
       {
 	/* If type is not_set_cmd, call it like this: */
 	cmd_cfunc_ftype *cfunc;
+	/* ... or like this.  */
+	cmd_const_cfunc_ftype *const_cfunc;
 	/* If type is set_cmd or show_cmd, first set the variables,
 	   and then call this: */
 	cmd_sfunc_ftype *sfunc;
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 8d57119..550548a 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -360,7 +360,7 @@ add_dump_command (const char *name,
   struct cmd_list_element *c;
   struct dump_context *d;
 
-  c = add_cmd (name, all_commands, NULL, descr, &dump_cmdlist);
+  c = add_cmd (name, all_commands, descr, &dump_cmdlist);
   c->completer =  filename_completer;
   d = XNEW (struct dump_context);
   d->func = func;
@@ -368,7 +368,7 @@ add_dump_command (const char *name,
   set_cmd_context (c, d);
   c->func = call_dump_func;
 
-  c = add_cmd (name, all_commands, NULL, descr, &append_cmdlist);
+  c = add_cmd (name, all_commands, descr, &append_cmdlist);
   c->completer =  filename_completer;
   d = XNEW (struct dump_context);
   d->func = func;
diff --git a/gdb/command.h b/gdb/command.h
index 3a4a449..b6c4091 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -117,6 +117,7 @@ var_types;
 struct cmd_list_element;
 
 typedef void cmd_cfunc_ftype (char *args, int from_tty);
+typedef void cmd_const_cfunc_ftype (const char *args, int from_tty);
 
 /* This structure specifies notifications to be suppressed by a cli
    command interpreter.  */
@@ -140,6 +141,15 @@ extern struct cmd_list_element *add_cmd (const char *, enum command_class,
 					 const char *,
 					 struct cmd_list_element **);
 
+extern struct cmd_list_element *add_cmd (const char *, enum command_class,
+					 const char *,
+					 struct cmd_list_element **);
+
+extern struct cmd_list_element *add_cmd (const char *, enum command_class,
+					 cmd_const_cfunc_ftype *fun,
+					 const char *,
+					 struct cmd_list_element **);
+
 extern struct cmd_list_element *add_alias_cmd (const char *, const char *,
 					       enum command_class, int,
 					       struct cmd_list_element **);
@@ -170,6 +180,8 @@ extern struct cmd_list_element *add_abbrev_prefix_cmd (const char *,
 
 extern void set_cmd_cfunc (struct cmd_list_element *cmd,
 			   cmd_cfunc_ftype *cfunc);
+extern void set_cmd_cfunc (struct cmd_list_element *cmd,
+			   cmd_const_cfunc_ftype *cfunc);
 
 typedef void cmd_sfunc_ftype (char *args, int from_tty,
 			      struct cmd_list_element *c);
@@ -205,6 +217,8 @@ extern void set_cmd_completer_handle_brkchars (struct cmd_list_element *,
    around in cmd objects to test the value of the commands sfunc().  */
 extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
 			 cmd_cfunc_ftype *cfun);
+extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
+			 cmd_const_cfunc_ftype *cfun);
 
 /* Each command object has a local context attached to it.  */
 extern void set_cmd_context (struct cmd_list_element *cmd,
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 5501d31..0bd5105 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -774,7 +774,7 @@ gdbscm_register_command_x (SCM self)
       else
 	{
 	  cmd = add_cmd (c_smob->cmd_name, c_smob->cmd_class,
-			 NULL, c_smob->doc, cmd_list);
+			 c_smob->doc, cmd_list);
 	}
     }
   CATCH (except, RETURN_MASK_ALL)
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index 2a7c613..d969b12 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -612,7 +612,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
 				pfx_name, allow_unknown, cmd_list);
 	}
       else
-	cmd = add_cmd (cmd_name, (enum command_class) cmdtype, NULL,
+	cmd = add_cmd (cmd_name, (enum command_class) cmdtype,
 		       docstring, cmd_list);
 
       /* There appears to be no API to set this.  */
diff --git a/gdb/target.c b/gdb/target.c
index 55ff99e..87c7af0 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -386,7 +386,7 @@ Remaining arguments are interpreted by the target protocol.  For more\n\
 information on the arguments for a particular protocol, type\n\
 `help target ' followed by the protocol name."),
 		    &targetlist, "target ", 0, &cmdlist);
-  c = add_cmd (t->to_shortname, no_class, NULL, t->to_doc, &targetlist);
+  c = add_cmd (t->to_shortname, no_class, t->to_doc, &targetlist);
   set_cmd_sfunc (c, open_target);
   set_cmd_context (c, t);
   if (completer != NULL)
@@ -411,7 +411,7 @@ add_deprecated_target_alias (struct target_ops *t, const char *alias)
 
   /* If we use add_alias_cmd, here, we do not get the deprecated warning,
      see PR cli/15104.  */
-  c = add_cmd (alias, no_class, NULL, t->to_doc, &targetlist);
+  c = add_cmd (alias, no_class, t->to_doc, &targetlist);
   set_cmd_sfunc (c, open_target);
   set_cmd_context (c, t);
   alt = xstrprintf ("target %s", t->to_shortname);
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 437db59..12cc2fb 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -4203,7 +4203,7 @@ _initialize_tracepoint (void)
   add_info ("scope", info_scope_command,
 	    _("List the variables local to a scope"));
 
-  add_cmd ("tracepoints", class_trace, NULL,
+  add_cmd ("tracepoints", class_trace,
 	   _("Tracing of program execution without stopping the program."),
 	   &cmdlist);
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 11/67] Constify first_component_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (18 preceding siblings ...)
  2017-09-21  5:16 ` [RFA 02/67] Constify add_cmd gdb_bfd.c Tom Tromey
@ 2017-09-21  5:16 ` Tom Tromey
  2017-09-21  5:17 ` [RFA 13/67] Constify maintenance_print_user_registers Tom Tromey
                   ` (47 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:16 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* cp-support.c (first_component_command): Constify.
---
 gdb/ChangeLog    | 4 ++++
 gdb/cp-support.c | 3 +--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/gdb/cp-support.c b/gdb/cp-support.c
index aa0229f..6b5f2a3 100644
--- a/gdb/cp-support.c
+++ b/gdb/cp-support.c
@@ -68,7 +68,6 @@ struct cmd_list_element *maint_cplus_cmd_list = NULL;
 /* The actual commands.  */
 
 static void maint_cplus_command (char *arg, int from_tty);
-static void first_component_command (char *arg, int from_tty);
 
 /* A list of typedefs which should not be substituted by replace_typedefs.  */
 static const char * const ignore_typedefs[] =
@@ -1611,7 +1610,7 @@ maint_cplus_command (char *arg, int from_tty)
    cp_find_first_component.  */
 
 static void
-first_component_command (char *arg, int from_tty)
+first_component_command (const char *arg, int from_tty)
 {
   int len;  
   char *prefix; 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 02/67] Constify add_cmd gdb_bfd.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (17 preceding siblings ...)
  2017-09-21  5:16 ` [RFA 22/67] Constify user_defined_command Tom Tromey
@ 2017-09-21  5:16 ` Tom Tromey
  2017-09-21  5:16 ` [RFA 11/67] Constify first_component_command Tom Tromey
                   ` (48 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:16 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This constifies a command function in gdb_bfd.c.

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* gdb_bfd.c (maintenance_info_bfds): Constify.
---
 gdb/ChangeLog | 4 ++++
 gdb/gdb_bfd.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index d80b3fb..29080b8 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -974,7 +974,7 @@ print_one_bfd (void **slot, void *data)
 /* Implement the 'maint info bfd' command.  */
 
 static void
-maintenance_info_bfds (char *arg, int from_tty)
+maintenance_info_bfds (const char *arg, int from_tty)
 {
   struct ui_out *uiout = current_uiout;
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 06/67] Constify dump_arc_instruction_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (22 preceding siblings ...)
  2017-09-21  5:17 ` [RFA 29/67] Constify some commands in skip.c Tom Tromey
@ 2017-09-21  5:17 ` Tom Tromey
  2017-09-21  5:17 ` [RFA 17/67] Constify cmd_record_full_restore Tom Tromey
                   ` (43 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* arc-tdep.c (dump_arc_instruction_command): Constify.
---
 gdb/ChangeLog  | 4 ++++
 gdb/arc-tdep.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/arc-tdep.c b/gdb/arc-tdep.c
index 31c7b56..1d05c5a 100644
--- a/gdb/arc-tdep.c
+++ b/gdb/arc-tdep.c
@@ -2119,7 +2119,7 @@ maintenance_print_arc_command (char *args, int from_tty)
    disassemble.  */
 
 static void
-dump_arc_instruction_command (char *args, int from_tty)
+dump_arc_instruction_command (const char *args, int from_tty)
 {
   struct value *val;
   if (args != NULL && strlen (args) > 0)
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 29/67] Constify some commands in skip.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (21 preceding siblings ...)
  2017-09-21  5:17 ` [RFA 27/67] Constify some commands in symmisc.c Tom Tromey
@ 2017-09-21  5:17 ` Tom Tromey
  2017-09-21  5:17 ` [RFA 06/67] Constify dump_arc_instruction_command Tom Tromey
                   ` (44 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* skip.c (skip_file_command, skip_function_command)
	(skip_enable_command, skip_disable_command, skip_delete_command):
	Constify.
---
 gdb/ChangeLog |  6 ++++++
 gdb/skip.c    | 10 +++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/gdb/skip.c b/gdb/skip.c
index 8db0cd5..6e82a33 100644
--- a/gdb/skip.c
+++ b/gdb/skip.c
@@ -161,7 +161,7 @@ skiplist_entry::add_entry (bool file_is_glob, std::string &&file,
 }
 
 static void
-skip_file_command (char *arg, int from_tty)
+skip_file_command (const char *arg, int from_tty)
 {
   struct symtab *symtab;
   const char *filename = NULL;
@@ -199,7 +199,7 @@ skip_function (const char *name)
 }
 
 static void
-skip_function_command (char *arg, int from_tty)
+skip_function_command (const char *arg, int from_tty)
 {
   /* Default to the current function if no argument is given.  */
   if (arg == NULL)
@@ -424,7 +424,7 @@ info_skip_command (char *arg, int from_tty)
 }
 
 static void
-skip_enable_command (char *arg, int from_tty)
+skip_enable_command (const char *arg, int from_tty)
 {
   bool found = false;
 
@@ -440,7 +440,7 @@ skip_enable_command (char *arg, int from_tty)
 }
 
 static void
-skip_disable_command (char *arg, int from_tty)
+skip_disable_command (const char *arg, int from_tty)
 {
   bool found = false;
 
@@ -456,7 +456,7 @@ skip_disable_command (char *arg, int from_tty)
 }
 
 static void
-skip_delete_command (char *arg, int from_tty)
+skip_delete_command (const char *arg, int from_tty)
 {
   bool found = false;
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 23/67] Constify some commands in cli-logging.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (24 preceding siblings ...)
  2017-09-21  5:17 ` [RFA 17/67] Constify cmd_record_full_restore Tom Tromey
@ 2017-09-21  5:17 ` Tom Tromey
  2017-09-21  5:17 ` [RFA 08/67] Constify two functions in linux-fork.c Tom Tromey
                   ` (41 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* cli/cli-logging.c (set_logging_on, set_logging_off): Constify.
---
 gdb/ChangeLog         | 4 ++++
 gdb/cli/cli-logging.c | 6 +++---
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/gdb/cli/cli-logging.c b/gdb/cli/cli-logging.c
index 67005a1..14242e0 100644
--- a/gdb/cli/cli-logging.c
+++ b/gdb/cli/cli-logging.c
@@ -146,9 +146,9 @@ handle_redirections (int from_tty)
 }
 
 static void
-set_logging_on (char *args, int from_tty)
+set_logging_on (const char *args, int from_tty)
 {
-  char *rest = args;
+  const char *rest = args;
 
   if (rest && *rest)
     {
@@ -159,7 +159,7 @@ set_logging_on (char *args, int from_tty)
 }
 
 static void 
-set_logging_off (char *args, int from_tty)
+set_logging_off (const char *args, int from_tty)
 {
   if (saved_filename == NULL)
     return;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 13/67] Constify maintenance_print_user_registers
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (19 preceding siblings ...)
  2017-09-21  5:16 ` [RFA 11/67] Constify first_component_command Tom Tromey
@ 2017-09-21  5:17 ` Tom Tromey
  2017-09-21  5:17 ` [RFA 27/67] Constify some commands in symmisc.c Tom Tromey
                   ` (46 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* user-regs.c (maintenance_print_user_registers): Constify.
---
 gdb/ChangeLog   | 4 ++++
 gdb/user-regs.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/user-regs.c b/gdb/user-regs.c
index 121c69f..a5388d1 100644
--- a/gdb/user-regs.c
+++ b/gdb/user-regs.c
@@ -222,7 +222,7 @@ value_of_user_reg (int regnum, struct frame_info *frame)
 }
 
 static void
-maintenance_print_user_registers (char *args, int from_tty)
+maintenance_print_user_registers (const char *args, int from_tty)
 {
   struct gdbarch *gdbarch = get_current_arch ();
   struct gdb_user_regs *regs;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 17/67] Constify cmd_record_full_restore
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (23 preceding siblings ...)
  2017-09-21  5:17 ` [RFA 06/67] Constify dump_arc_instruction_command Tom Tromey
@ 2017-09-21  5:17 ` Tom Tromey
  2017-09-21  7:02   ` Metzger, Markus T
  2017-09-21  5:17 ` [RFA 23/67] Constify some commands in cli-logging.c Tom Tromey
                   ` (42 subsequent siblings)
  67 siblings, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* record-full.c (cmd_record_full_restore): Constify.
---
 gdb/ChangeLog     | 4 ++++
 gdb/record-full.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/record-full.c b/gdb/record-full.c
index 93c43a1..5073be3 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2533,7 +2533,7 @@ bfdcore_write (bfd *obfd, asection *osec, void *buf, int len, int *offset)
    corefile format, with an extra section for our data.  */
 
 static void
-cmd_record_full_restore (char *args, int from_tty)
+cmd_record_full_restore (const char *args, int from_tty)
 {
   core_file_command (args, from_tty);
   record_full_open (args, from_tty);
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 27/67] Constify some commands in symmisc.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (20 preceding siblings ...)
  2017-09-21  5:17 ` [RFA 13/67] Constify maintenance_print_user_registers Tom Tromey
@ 2017-09-21  5:17 ` Tom Tromey
  2017-09-21  5:17 ` [RFA 29/67] Constify some commands in skip.c Tom Tromey
                   ` (45 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* symmisc.c (maintenance_print_symbols)
	(maintenance_print_msymbols, maintenance_print_objfiles)
	(maintenance_info_symtabs, maintenance_check_symtabs)
	(maintenance_expand_symtabs, maintenance_info_line_tables):
	Constify.
---
 gdb/ChangeLog |  8 ++++++++
 gdb/symmisc.c | 14 +++++++-------
 2 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/gdb/symmisc.c b/gdb/symmisc.c
index 6cbb2ce..86422e7 100644
--- a/gdb/symmisc.c
+++ b/gdb/symmisc.c
@@ -403,7 +403,7 @@ dump_symtab (struct symtab *symtab, struct ui_file *outfile)
 }
 
 static void
-maintenance_print_symbols (char *args, int from_tty)
+maintenance_print_symbols (const char *args, int from_tty)
 {
   struct ui_file *outfile = gdb_stdout;
   char *address_arg = NULL, *source_arg = NULL, *objfile_arg = NULL;
@@ -698,7 +698,7 @@ print_symbol (void *args)
 }
 
 static void
-maintenance_print_msymbols (char *args, int from_tty)
+maintenance_print_msymbols (const char *args, int from_tty)
 {
   struct ui_file *outfile = gdb_stdout;
   char *objfile_arg = NULL;
@@ -756,7 +756,7 @@ maintenance_print_msymbols (char *args, int from_tty)
 }
 
 static void
-maintenance_print_objfiles (char *regexp, int from_tty)
+maintenance_print_objfiles (const char *regexp, int from_tty)
 {
   struct program_space *pspace;
   struct objfile *objfile;
@@ -779,7 +779,7 @@ maintenance_print_objfiles (char *regexp, int from_tty)
 /* List all the symbol tables whose names match REGEXP (optional).  */
 
 static void
-maintenance_info_symtabs (char *regexp, int from_tty)
+maintenance_info_symtabs (const char *regexp, int from_tty)
 {
   struct program_space *pspace;
   struct objfile *objfile;
@@ -873,7 +873,7 @@ maintenance_info_symtabs (char *regexp, int from_tty)
    Use "maint check-psymtabs" for that.  */
 
 static void
-maintenance_check_symtabs (char *ignore, int from_tty)
+maintenance_check_symtabs (const char *ignore, int from_tty)
 {
   struct program_space *pspace;
   struct objfile *objfile;
@@ -924,7 +924,7 @@ maintenance_check_symtabs (char *ignore, int from_tty)
 /* Expand all symbol tables whose name matches an optional regexp.  */
 
 static void
-maintenance_expand_symtabs (char *args, int from_tty)
+maintenance_expand_symtabs (const char *args, int from_tty)
 {
   struct program_space *pspace;
   struct objfile *objfile;
@@ -1038,7 +1038,7 @@ maintenance_print_one_line_table (struct symtab *symtab, void *data)
 /* Implement the 'maint info line-table' command.  */
 
 static void
-maintenance_info_line_tables (char *regexp, int from_tty)
+maintenance_info_line_tables (const char *regexp, int from_tty)
 {
   struct program_space *pspace;
   struct objfile *objfile;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 08/67] Constify two functions in linux-fork.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (25 preceding siblings ...)
  2017-09-21  5:17 ` [RFA 23/67] Constify some commands in cli-logging.c Tom Tromey
@ 2017-09-21  5:17 ` Tom Tromey
  2017-09-21  5:31 ` [RFA 24/67] Constify some commands in spu-tdep.c Tom Tromey
                   ` (40 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:17 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* linux-fork.c (delete_checkpoint_command)
	(detach_checkpoint_command): Constify.
---
 gdb/ChangeLog    | 5 +++++
 gdb/linux-fork.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/linux-fork.c b/gdb/linux-fork.c
index 22a11c6..4580aa6 100644
--- a/gdb/linux-fork.c
+++ b/gdb/linux-fork.c
@@ -503,7 +503,7 @@ out:
 /* Fork list <-> user interface.  */
 
 static void
-delete_checkpoint_command (char *args, int from_tty)
+delete_checkpoint_command (const char *args, int from_tty)
 {
   ptid_t ptid, pptid;
   struct fork_info *fi;
@@ -544,7 +544,7 @@ Please switch to another checkpoint before deleting the current one"));
 }
 
 static void
-detach_checkpoint_command (char *args, int from_tty)
+detach_checkpoint_command (const char *args, int from_tty)
 {
   ptid_t ptid;
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 24/67] Constify some commands in spu-tdep.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (26 preceding siblings ...)
  2017-09-21  5:17 ` [RFA 08/67] Constify two functions in linux-fork.c Tom Tromey
@ 2017-09-21  5:31 ` Tom Tromey
  2017-09-21  5:31 ` [RFA 19/67] Constify maintenance_print_target_stack Tom Tromey
                   ` (39 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:31 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* spu-tdep.c (info_spu_event_command, info_spu_signal_command)
	(info_spu_mailbox_command, info_spu_dma_command)
	(info_spu_proxydma_command): Constify.
---
 gdb/ChangeLog  |  6 ++++++
 gdb/spu-tdep.c | 10 +++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/gdb/spu-tdep.c b/gdb/spu-tdep.c
index 4338d5c..ac72491 100644
--- a/gdb/spu-tdep.c
+++ b/gdb/spu-tdep.c
@@ -2059,7 +2059,7 @@ spu_attach_normal_stop (struct bpstats *bs, int print_frame)
 /* "info spu" commands.  */
 
 static void
-info_spu_event_command (char *args, int from_tty)
+info_spu_event_command (const char *args, int from_tty)
 {
   struct frame_info *frame = get_selected_frame (NULL);
   ULONGEST event_status = 0;
@@ -2107,7 +2107,7 @@ info_spu_event_command (char *args, int from_tty)
 }
 
 static void
-info_spu_signal_command (char *args, int from_tty)
+info_spu_signal_command (const char *args, int from_tty)
 {
   struct frame_info *frame = get_selected_frame (NULL);
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -2228,7 +2228,7 @@ info_spu_mailbox_list (gdb_byte *buf, int nr, enum bfd_endian byte_order,
 }
 
 static void
-info_spu_mailbox_command (char *args, int from_tty)
+info_spu_mailbox_command (const char *args, int from_tty)
 {
   struct frame_info *frame = get_selected_frame (NULL);
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -2456,7 +2456,7 @@ info_spu_dma_cmdlist (gdb_byte *buf, int nr, enum bfd_endian byte_order)
 }
 
 static void
-info_spu_dma_command (char *args, int from_tty)
+info_spu_dma_command (const char *args, int from_tty)
 {
   struct frame_info *frame = get_selected_frame (NULL);
   struct gdbarch *gdbarch = get_frame_arch (frame);
@@ -2535,7 +2535,7 @@ info_spu_dma_command (char *args, int from_tty)
 }
 
 static void
-info_spu_proxydma_command (char *args, int from_tty)
+info_spu_proxydma_command (const char *args, int from_tty)
 {
   struct frame_info *frame = get_selected_frame (NULL);
   struct gdbarch *gdbarch = get_frame_arch (frame);
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 19/67] Constify maintenance_print_target_stack
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (27 preceding siblings ...)
  2017-09-21  5:31 ` [RFA 24/67] Constify some commands in spu-tdep.c Tom Tromey
@ 2017-09-21  5:31 ` Tom Tromey
  2017-09-21  5:39 ` [RFA 51/67] Constify info_probes_stap_command Tom Tromey
                   ` (38 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:31 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* target.c (maintenance_print_target_stack): Constify.
---
 gdb/ChangeLog | 4 ++++
 gdb/target.c  | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/target.c b/gdb/target.c
index 87c7af0..7ff52ce 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -3883,7 +3883,7 @@ flash_erase_command (char *cmd, int from_tty)
 /* Print the name of each layers of our target stack.  */
 
 static void
-maintenance_print_target_stack (char *cmd, int from_tty)
+maintenance_print_target_stack (const char *cmd, int from_tty)
 {
   struct target_ops *t;
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 52/67] Constify save_gdb_index_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (32 preceding siblings ...)
  2017-09-21  5:39 ` [RFA 49/67] Constify some commands in btrace.c Tom Tromey
@ 2017-09-21  5:39 ` Tom Tromey
  2017-09-21  5:39 ` [RFA 48/67] Constify delete_bookmark_command Tom Tromey
                   ` (33 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:39 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* dwarf2read.c (save_gdb_index_command): Constify.
---
 gdb/ChangeLog    | 4 ++++
 gdb/dwarf2read.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
index b1914cf..302ac42 100644
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -24025,7 +24025,7 @@ write_psymtabs_to_index (struct objfile *objfile, const char *dir)
    GDB manual.  Any changes here must be documented there.  */
 
 static void
-save_gdb_index_command (char *arg, int from_tty)
+save_gdb_index_command (const char *arg, int from_tty)
 {
   struct objfile *objfile;
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 31/67] Constify some commands in tui.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (35 preceding siblings ...)
  2017-09-21  5:39 ` [RFA 32/67] Constify maintenance_print_dummy_frames Tom Tromey
@ 2017-09-21  5:39 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 35/67] Constify commands maint.c, plus maintenance_print_type Tom Tromey
                   ` (30 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:39 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* tui/tui.c (tui_enable_command, tui_disable_command): Constify.
---
 gdb/ChangeLog | 4 ++++
 gdb/tui/tui.c | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/tui/tui.c b/gdb/tui/tui.c
index 77dc866..a59907f 100644
--- a/gdb/tui/tui.c
+++ b/gdb/tui/tui.c
@@ -545,7 +545,7 @@ tui_disable (void)
 /* Command wrapper for enabling tui mode.  */
 
 static void
-tui_enable_command (char *args, int from_tty)
+tui_enable_command (const char *args, int from_tty)
 {
   tui_enable ();
 }
@@ -553,7 +553,7 @@ tui_enable_command (char *args, int from_tty)
 /* Command wrapper for leaving tui mode.  */
 
 static void
-tui_disable_command (char *args, int from_tty)
+tui_disable_command (const char *args, int from_tty)
 {
   tui_disable ();
 }
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 51/67] Constify info_probes_stap_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (28 preceding siblings ...)
  2017-09-21  5:31 ` [RFA 19/67] Constify maintenance_print_target_stack Tom Tromey
@ 2017-09-21  5:39 ` Tom Tromey
  2017-09-21 12:48   ` Sergio Durigan Junior
  2017-09-21  5:39 ` [RFA 50/67] Constify unset_exec_wrapper_command Tom Tromey
                   ` (37 subsequent siblings)
  67 siblings, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:39 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* stap-probe.c (info_probes_stap_command): Constify.
---
 gdb/ChangeLog    | 4 ++++
 gdb/stap-probe.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
index 61eb8e4..6fa0d20 100644
--- a/gdb/stap-probe.c
+++ b/gdb/stap-probe.c
@@ -1708,7 +1708,7 @@ const struct probe_ops stap_probe_ops =
 /* Implementation of the `info probes stap' command.  */
 
 static void
-info_probes_stap_command (char *arg, int from_tty)
+info_probes_stap_command (const char *arg, int from_tty)
 {
   info_probes_for_ops (arg, from_tty, &stap_probe_ops);
 }
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 49/67] Constify some commands in btrace.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (31 preceding siblings ...)
  2017-09-21  5:39 ` [RFA 33/67] Constify some commands in target-descriptions.c Tom Tromey
@ 2017-09-21  5:39 ` Tom Tromey
  2017-09-21  7:02   ` Metzger, Markus T
  2017-09-21  5:39 ` [RFA 52/67] Constify save_gdb_index_command Tom Tromey
                   ` (34 subsequent siblings)
  67 siblings, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:39 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* btrace.c (get_uint, get_context_size, no_chunk)
	(maint_btrace_packet_history_cmd)
	(maint_btrace_clear_packet_history_cmd, maint_btrace_clear_cmd)
	(maint_info_btrace_cmd): Constify.
---
 gdb/ChangeLog |  7 +++++++
 gdb/btrace.c  | 24 ++++++++++++++----------
 2 files changed, 21 insertions(+), 10 deletions(-)

diff --git a/gdb/btrace.c b/gdb/btrace.c
index 8527c6f..b42e68e 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -3180,9 +3180,10 @@ btrace_maint_print_packets (struct btrace_thread_info *btinfo,
 /* Read a number from an argument string.  */
 
 static unsigned int
-get_uint (char **arg)
+get_uint (const char **arg)
 {
-  char *begin, *end, *pos;
+  const char *begin, *pos;
+  char *end;
   unsigned long number;
 
   begin = *arg;
@@ -3203,9 +3204,9 @@ get_uint (char **arg)
 /* Read a context size from an argument string.  */
 
 static int
-get_context_size (char **arg)
+get_context_size (const char **arg)
 {
-  char *pos;
+  const char *pos;
   int number;
 
   pos = skip_spaces (*arg);
@@ -3213,13 +3214,16 @@ get_context_size (char **arg)
   if (!isdigit (*pos))
     error (_("Expected positive number, got: %s."), pos);
 
-  return strtol (pos, arg, 10);
+  char *end;
+  long result = strtol (pos, &end, 10);
+  *arg = end;
+  return result;
 }
 
 /* Complain about junk at the end of an argument string.  */
 
 static void
-no_chunk (char *arg)
+no_chunk (const char *arg)
 {
   if (*arg != 0)
     error (_("Junk after argument: %s."), arg);
@@ -3228,7 +3232,7 @@ no_chunk (char *arg)
 /* The "maintenance btrace packet-history" command.  */
 
 static void
-maint_btrace_packet_history_cmd (char *arg, int from_tty)
+maint_btrace_packet_history_cmd (const char *arg, int from_tty)
 {
   struct btrace_thread_info *btinfo;
   struct thread_info *tp;
@@ -3333,7 +3337,7 @@ maint_btrace_packet_history_cmd (char *arg, int from_tty)
 /* The "maintenance btrace clear-packet-history" command.  */
 
 static void
-maint_btrace_clear_packet_history_cmd (char *args, int from_tty)
+maint_btrace_clear_packet_history_cmd (const char *args, int from_tty)
 {
   struct btrace_thread_info *btinfo;
   struct thread_info *tp;
@@ -3355,7 +3359,7 @@ maint_btrace_clear_packet_history_cmd (char *args, int from_tty)
 /* The "maintenance btrace clear" command.  */
 
 static void
-maint_btrace_clear_cmd (char *args, int from_tty)
+maint_btrace_clear_cmd (const char *args, int from_tty)
 {
   struct btrace_thread_info *btinfo;
   struct thread_info *tp;
@@ -3418,7 +3422,7 @@ maint_btrace_pt_show_cmd (char *args, int from_tty)
 /* The "maintenance info btrace" command.  */
 
 static void
-maint_info_btrace_cmd (char *args, int from_tty)
+maint_info_btrace_cmd (const char *args, int from_tty)
 {
   struct btrace_thread_info *btinfo;
   struct thread_info *tp;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 33/67] Constify some commands in target-descriptions.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (30 preceding siblings ...)
  2017-09-21  5:39 ` [RFA 50/67] Constify unset_exec_wrapper_command Tom Tromey
@ 2017-09-21  5:39 ` Tom Tromey
  2017-09-21  5:39 ` [RFA 49/67] Constify some commands in btrace.c Tom Tromey
                   ` (35 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:39 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* target-descriptions.c (unset_tdesc_filename_cmd)
	(maint_print_c_tdesc_cmd, maintenance_check_xml_descriptions):
	Constify.
---
 gdb/ChangeLog             | 6 ++++++
 gdb/target-descriptions.c | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gdb/target-descriptions.c b/gdb/target-descriptions.c
index 877fd68..6858ee1 100644
--- a/gdb/target-descriptions.c
+++ b/gdb/target-descriptions.c
@@ -1899,7 +1899,7 @@ show_tdesc_filename_cmd (struct ui_file *file, int from_tty,
 }
 
 static void
-unset_tdesc_filename_cmd (char *args, int from_tty)
+unset_tdesc_filename_cmd (const char *args, int from_tty)
 {
   xfree (target_description_filename);
   target_description_filename = NULL;
@@ -2288,7 +2288,7 @@ private:
 };
 
 static void
-maint_print_c_tdesc_cmd (char *args, int from_tty)
+maint_print_c_tdesc_cmd (const char *args, int from_tty)
 {
   const struct target_desc *tdesc;
   const char *filename;
@@ -2362,7 +2362,7 @@ record_xml_tdesc (const char *xml_file, const struct target_desc *tdesc)
    found in the specified directory DIR.  */
 
 static void
-maintenance_check_xml_descriptions (char *dir, int from_tty)
+maintenance_check_xml_descriptions (const char *dir, int from_tty)
 {
   if (dir == NULL)
     error (_("Missing dir name"));
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 32/67] Constify maintenance_print_dummy_frames
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (34 preceding siblings ...)
  2017-09-21  5:39 ` [RFA 48/67] Constify delete_bookmark_command Tom Tromey
@ 2017-09-21  5:39 ` Tom Tromey
  2017-09-21  5:39 ` [RFA 31/67] Constify some commands in tui.c Tom Tromey
                   ` (31 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:39 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* dummy-frame.c (maintenance_print_dummy_frames): Constify.
---
 gdb/ChangeLog     | 4 ++++
 gdb/dummy-frame.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/dummy-frame.c b/gdb/dummy-frame.c
index 8dc4c9b..a08031c 100644
--- a/gdb/dummy-frame.c
+++ b/gdb/dummy-frame.c
@@ -403,7 +403,7 @@ fprint_dummy_frames (struct ui_file *file)
 }
 
 static void
-maintenance_print_dummy_frames (char *args, int from_tty)
+maintenance_print_dummy_frames (const char *args, int from_tty)
 {
   if (args == NULL)
     fprint_dummy_frames (gdb_stdout);
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 48/67] Constify delete_bookmark_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (33 preceding siblings ...)
  2017-09-21  5:39 ` [RFA 52/67] Constify save_gdb_index_command Tom Tromey
@ 2017-09-21  5:39 ` Tom Tromey
  2017-09-21  5:39 ` [RFA 32/67] Constify maintenance_print_dummy_frames Tom Tromey
                   ` (32 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:39 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* reverse.c (delete_bookmark_command): Constify.
---
 gdb/ChangeLog | 4 ++++
 gdb/reverse.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/reverse.c b/gdb/reverse.c
index 80e414a..e7ef5c3 100644
--- a/gdb/reverse.c
+++ b/gdb/reverse.c
@@ -201,7 +201,7 @@ delete_all_bookmarks (void)
 }
 
 static void
-delete_bookmark_command (char *args, int from_tty)
+delete_bookmark_command (const char *args, int from_tty)
 {
   if (bookmark_chain == NULL)
     {
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 50/67] Constify unset_exec_wrapper_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (29 preceding siblings ...)
  2017-09-21  5:39 ` [RFA 51/67] Constify info_probes_stap_command Tom Tromey
@ 2017-09-21  5:39 ` Tom Tromey
  2017-09-21  5:39 ` [RFA 33/67] Constify some commands in target-descriptions.c Tom Tromey
                   ` (36 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:39 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* fork-child.c (unset_exec_wrapper_command): Constify.
---
 gdb/ChangeLog    | 4 ++++
 gdb/fork-child.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/fork-child.c b/gdb/fork-child.c
index 194aab5..eb884a7 100644
--- a/gdb/fork-child.c
+++ b/gdb/fork-child.c
@@ -144,7 +144,7 @@ gdb_startup_inferior (pid_t pid, int num_traps)
 /* Implement the "unset exec-wrapper" command.  */
 
 static void
-unset_exec_wrapper_command (char *args, int from_tty)
+unset_exec_wrapper_command (const char *args, int from_tty)
 {
   xfree (exec_wrapper);
   exec_wrapper = NULL;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 64/67] Constify some commands in inferior.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (38 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 46/67] Constify some commands in mips-tdep.c Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 56/67] Constify demangle_command Tom Tromey
                   ` (27 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* inferior.c (detach_inferior_command, kill_inferior_command)
	(inferior_command): Constify.
---
 gdb/ChangeLog  | 5 +++++
 gdb/inferior.c | 6 +++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/gdb/inferior.c b/gdb/inferior.c
index b916909..ba8efe2 100644
--- a/gdb/inferior.c
+++ b/gdb/inferior.c
@@ -596,7 +596,7 @@ print_inferior (struct ui_out *uiout, char *requested_inferiors)
 }
 
 static void
-detach_inferior_command (char *args, int from_tty)
+detach_inferior_command (const char *args, int from_tty)
 {
   struct thread_info *tp;
 
@@ -635,7 +635,7 @@ detach_inferior_command (char *args, int from_tty)
 }
 
 static void
-kill_inferior_command (char *args, int from_tty)
+kill_inferior_command (const char *args, int from_tty)
 {
   struct thread_info *tp;
 
@@ -676,7 +676,7 @@ kill_inferior_command (char *args, int from_tty)
 }
 
 static void
-inferior_command (char *args, int from_tty)
+inferior_command (const char *args, int from_tty)
 {
   struct inferior *inf;
   int num;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 66/67] Constify some commands in ada-tasks.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (49 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 63/67] Constify some commands in regcache.c Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 62/67] Constify some commands in printcmd.c Tom Tromey
                   ` (16 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* ada-tasks.c (task_command_1, task_command): Constify.
---
 gdb/ChangeLog   | 4 ++++
 gdb/ada-tasks.c | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/ada-tasks.c b/gdb/ada-tasks.c
index 19f74dd..e0070d5 100644
--- a/gdb/ada-tasks.c
+++ b/gdb/ada-tasks.c
@@ -1265,7 +1265,7 @@ display_current_task_id (void)
    that task.  Print an error message if the task switch failed.  */
 
 static void
-task_command_1 (char *taskno_str, int from_tty, struct inferior *inf)
+task_command_1 (const char *taskno_str, int from_tty, struct inferior *inf)
 {
   const int taskno = value_as_long (parse_and_eval (taskno_str));
   struct ada_task_info *task_info;
@@ -1314,7 +1314,7 @@ task_command_1 (char *taskno_str, int from_tty, struct inferior *inf)
    Otherwise, switch to the task indicated by TASKNO_STR.  */
 
 static void
-task_command (char *taskno_str, int from_tty)
+task_command (const char *taskno_str, int from_tty)
 {
   struct ui_out *uiout = current_uiout;
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 63/67] Constify some commands in regcache.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (48 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 54/67] Constify some commands in compile.c Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 66/67] Constify some commands in ada-tasks.c Tom Tromey
                   ` (17 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* regcache.c (regcache_print, maintenance_print_registers)
	(maintenance_print_raw_registers)
	(maintenance_print_cooked_registers)
	(maintenance_print_register_groups)
	(maintenance_print_remote_registers): Constify.
---
 gdb/ChangeLog  |  8 ++++++++
 gdb/regcache.c | 12 ++++++------
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/gdb/regcache.c b/gdb/regcache.c
index 4ef9151..1262a5a 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1619,7 +1619,7 @@ regcache::dump (ui_file *file, enum regcache_dump_what what_to_dump)
 }
 
 static void
-regcache_print (char *args, enum regcache_dump_what what_to_dump)
+regcache_print (const char *args, enum regcache_dump_what what_to_dump)
 {
   if (args == NULL)
     get_current_regcache ()->dump (gdb_stdout, what_to_dump);
@@ -1634,31 +1634,31 @@ regcache_print (char *args, enum regcache_dump_what what_to_dump)
 }
 
 static void
-maintenance_print_registers (char *args, int from_tty)
+maintenance_print_registers (const char *args, int from_tty)
 {
   regcache_print (args, regcache_dump_none);
 }
 
 static void
-maintenance_print_raw_registers (char *args, int from_tty)
+maintenance_print_raw_registers (const char *args, int from_tty)
 {
   regcache_print (args, regcache_dump_raw);
 }
 
 static void
-maintenance_print_cooked_registers (char *args, int from_tty)
+maintenance_print_cooked_registers (const char *args, int from_tty)
 {
   regcache_print (args, regcache_dump_cooked);
 }
 
 static void
-maintenance_print_register_groups (char *args, int from_tty)
+maintenance_print_register_groups (const char *args, int from_tty)
 {
   regcache_print (args, regcache_dump_groups);
 }
 
 static void
-maintenance_print_remote_registers (char *args, int from_tty)
+maintenance_print_remote_registers (const char *args, int from_tty)
 {
   regcache_print (args, regcache_dump_remote);
 }
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 53/67] Constify maintenance_print_reggroups
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (45 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 36/67] Constify some commands in source.c Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 44/67] Constify some commands in thread.c Tom Tromey
                   ` (20 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* reggroups.c (maintenance_print_reggroups): Constify.
---
 gdb/ChangeLog   | 4 ++++
 gdb/reggroups.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/reggroups.c b/gdb/reggroups.c
index 512fe11..2ecd0b4 100644
--- a/gdb/reggroups.c
+++ b/gdb/reggroups.c
@@ -262,7 +262,7 @@ reggroups_dump (struct gdbarch *gdbarch, struct ui_file *file)
 }
 
 static void
-maintenance_print_reggroups (char *args, int from_tty)
+maintenance_print_reggroups (const char *args, int from_tty)
 {
   struct gdbarch *gdbarch = get_current_arch ();
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 45/67] Constify cd_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (43 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 55/67] Constify maintenance_info_program_spaces_command Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21 12:48   ` Sergio Durigan Junior
  2017-09-21  5:40 ` [RFA 36/67] Constify some commands in source.c Tom Tromey
                   ` (22 subsequent siblings)
  67 siblings, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* cli/cli-cmds.h (cd_command): Constify.
	* cli/cli-cmds.c (cd_command): Constify.
---
 gdb/ChangeLog      | 5 +++++
 gdb/cli/cli-cmds.c | 2 +-
 gdb/cli/cli-cmds.h | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index 4cc9fa6..d87722f 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -392,7 +392,7 @@ pwd_command (char *args, int from_tty)
 }
 
 void
-cd_command (char *dir, int from_tty)
+cd_command (const char *dir, int from_tty)
 {
   int len;
   /* Found something other than leading repetitions of "/..".  */
diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h
index 1122a97..34d19f5 100644
--- a/gdb/cli/cli-cmds.h
+++ b/gdb/cli/cli-cmds.h
@@ -110,7 +110,7 @@ int is_complete_command (struct cmd_list_element *cmd);
 
 /* Exported to gdb/main.c */
 
-extern void cd_command (char *, int);
+extern void cd_command (const char *, int);
 
 /* Exported to gdb/top.c and gdb/main.c */
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 34/67] Constify unwind_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (53 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 65/67] Constify some commands in symtab.c Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 38/67] Constify some linespec functions Tom Tromey
                   ` (12 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* hppa-tdep.c (unwind_command): Constify.
---
 gdb/ChangeLog   | 4 ++++
 gdb/hppa-tdep.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/hppa-tdep.c b/gdb/hppa-tdep.c
index 1a04588..141399f 100644
--- a/gdb/hppa-tdep.c
+++ b/gdb/hppa-tdep.c
@@ -2572,7 +2572,7 @@ hppa_lookup_stub_minimal_symbol (const char *name,
 }
 
 static void
-unwind_command (char *exp, int from_tty)
+unwind_command (const char *exp, int from_tty)
 {
   CORE_ADDR address;
   struct unwind_table_entry *u;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 55/67] Constify maintenance_info_program_spaces_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (42 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 47/67] Constify some commands in remote.c Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 45/67] Constify cd_command Tom Tromey
                   ` (23 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* progspace.c (maintenance_info_program_spaces_command):
	Constify.
---
 gdb/ChangeLog   | 5 +++++
 gdb/progspace.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/gdb/progspace.c b/gdb/progspace.c
index 0f3ac81..41e8cd0 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -345,7 +345,7 @@ valid_program_space_id (int num)
    indicating which the program space to print information about.  */
 
 static void
-maintenance_info_program_spaces_command (char *args, int from_tty)
+maintenance_info_program_spaces_command (const char *args, int from_tty)
 {
   int requested = -1;
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 38/67] Constify some linespec functions
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (54 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 34/67] Constify unwind_command Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21 10:04   ` Pedro Alves
  2017-09-21  5:41 ` [RFA 41/67] Constify some commands in remote-fileio.c Tom Tromey
                   ` (11 subsequent siblings)
  67 siblings, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This changes a few linespec functions to work on "const char *" and
then fixes up all the callers.  This allows further constification
elsewhere.

ChangeLog
2017-09-20  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.
---
 gdb/ChangeLog              | 32 ++++++++++++++++++++++++++++++++
 gdb/ada-lang.c             |  4 ++--
 gdb/ax-gdb.c               |  2 +-
 gdb/breakpoint.c           | 44 +++++++++++++++++++++++---------------------
 gdb/breakpoint.h           | 10 +++++-----
 gdb/cli/cli-cmds.c         |  4 ++--
 gdb/guile/scm-breakpoint.c |  2 +-
 gdb/linespec.c             | 18 ++++++++++--------
 gdb/linespec.h             |  8 +++++---
 gdb/location.c             | 10 +++++-----
 gdb/location.h             |  6 +++---
 gdb/mi/mi-cmd-break.c      |  2 +-
 gdb/python/py-breakpoint.c |  2 +-
 gdb/python/python.c        |  2 +-
 gdb/tracepoint.c           |  5 +++--
 15 files changed, 95 insertions(+), 56 deletions(-)

diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c
index 64f1a33..ea051c3 100644
--- a/gdb/ada-lang.c
+++ b/gdb/ada-lang.c
@@ -12925,7 +12925,7 @@ ada_exception_catchpoint_cond_string (const char *excep_string)
 
 static struct symtab_and_line
 ada_exception_sal (enum ada_exception_catchpoint_kind ex, char *excep_string,
-		   char **addr_string, const struct breakpoint_ops **ops)
+		   const char **addr_string, const struct breakpoint_ops **ops)
 {
   const char *sym_name;
   struct symbol *sym;
@@ -12984,7 +12984,7 @@ create_ada_exception_catchpoint (struct gdbarch *gdbarch,
 				 int disabled,
 				 int from_tty)
 {
-  char *addr_string = NULL;
+  const char *addr_string = NULL;
   const struct breakpoint_ops *ops = NULL;
   struct symtab_and_line sal
     = ada_exception_sal (ex_kind, excep_string, &addr_string, &ops);
diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index 227590b..c4bf2a6 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -2622,7 +2622,7 @@ agent_eval_command_one (const char *exp, int eval, CORE_ADDR pc)
 }
 
 static void
-agent_command_1 (char *exp, int eval)
+agent_command_1 (const char *exp, int eval)
 {
   /* We don't deal with overlay debugging at the moment.  We need to
      think more carefully about this.  If you copy this code into
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 5549fe7..1073418 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -138,8 +138,6 @@ static void catch_command (char *, int);
 
 static int can_use_hardware_watchpoint (struct value *);
 
-static void break_command_1 (char *, int, int);
-
 static void mention (struct breakpoint *);
 
 static struct breakpoint *set_raw_breakpoint_without_location (struct gdbarch *,
@@ -9679,7 +9677,7 @@ create_breakpoint (struct gdbarch *gdbarch,
    and BP_TEMPFLAG.  */
 
 static void
-break_command_1 (char *arg, int flag, int from_tty)
+break_command_1 (const char *arg, int flag, int from_tty)
 {
   int tempflag = flag & BP_TEMPFLAG;
   enum bptype type_wanted = (flag & BP_HARDWAREFLAG
@@ -9867,8 +9865,9 @@ stopat_command (char *arg, int from_tty)
    line.  */
 
 static void
-dprintf_command (char *arg, int from_tty)
+dprintf_command (char *arg_in, int from_tty)
 {
+  const char *arg = arg_in;
   event_location_up location = string_to_event_location (&arg, current_language);
 
   /* If non-NULL, ARG should have been advanced past the location;
@@ -10082,9 +10081,11 @@ find_breakpoint_range_end (struct symtab_and_line sal)
 /* Implement the "break-range" CLI command.  */
 
 static void
-break_range_command (char *arg, int from_tty)
+break_range_command (char *arg_in, int from_tty)
 {
-  char *arg_start, *addr_string_start;
+  const char *arg = arg_in;
+  const char *arg_start;
+  char *addr_string_start;
   struct linespec_result canonical_start, canonical_end;
   int bp_count, can_use_bp, length;
   CORE_ADDR end;
@@ -11189,7 +11190,7 @@ can_use_hardware_watchpoint (struct value *v)
 }
 
 void
-watch_command_wrapper (char *arg, int from_tty, int internal)
+watch_command_wrapper (const char *arg, int from_tty, int internal)
 {
   watch_command_1 (arg, hw_write, from_tty, 0, internal);
 }
@@ -11220,7 +11221,7 @@ watch_command (char *arg, int from_tty)
 }
 
 void
-rwatch_command_wrapper (char *arg, int from_tty, int internal)
+rwatch_command_wrapper (const char *arg, int from_tty, int internal)
 {
   watch_command_1 (arg, hw_read, from_tty, 0, internal);
 }
@@ -11232,7 +11233,7 @@ rwatch_command (char *arg, int from_tty)
 }
 
 void
-awatch_command_wrapper (char *arg, int from_tty, int internal)
+awatch_command_wrapper (const char *arg, int from_tty, int internal)
 {
   watch_command_1 (arg, hw_access, from_tty, 0, internal);
 }
@@ -11353,7 +11354,7 @@ until_break_fsm_async_reply_reason (struct thread_fsm *self)
 }
 
 void
-until_break_command (char *arg, int from_tty, int anywhere)
+until_break_command (const char *arg, int from_tty, int anywhere)
 {
   struct frame_info *frame;
   struct gdbarch *frame_gdbarch;
@@ -11577,7 +11578,7 @@ void
 init_ada_exception_breakpoint (struct breakpoint *b,
 			       struct gdbarch *gdbarch,
 			       struct symtab_and_line sal,
-			       char *addr_string,
+			       const char *addr_string,
 			       const struct breakpoint_ops *ops,
 			       int tempflag,
 			       int enabled,
@@ -13337,16 +13338,13 @@ strace_marker_create_sals_from_location (const struct event_location *location,
 {
   struct linespec_sals lsal;
   const char *arg_start, *arg;
-  char *str;
-  struct cleanup *cleanup;
 
   arg = arg_start = get_linespec_location (location);
   lsal.sals = decode_static_tracepoint_spec (&arg);
 
-  str = savestring (arg_start, arg - arg_start);
-  cleanup = make_cleanup (xfree, str);
-  canonical->location = new_linespec_location (&str);
-  do_cleanups (cleanup);
+  std::string str (arg_start, arg - arg_start);
+  const char *ptr = str.c_str ();
+  canonical->location = new_linespec_location (&ptr);
 
   lsal.canonical
     = xstrdup (event_location_to_string (canonical->location.get ()));
@@ -14786,8 +14784,9 @@ set_tracepoint_count (int num)
 }
 
 static void
-trace_command (char *arg, int from_tty)
+trace_command (char *arg_in, int from_tty)
 {
+  const char *arg = arg_in;
   struct breakpoint_ops *ops;
 
   event_location_up location = string_to_event_location (&arg,
@@ -14812,8 +14811,9 @@ trace_command (char *arg, int from_tty)
 }
 
 static void
-ftrace_command (char *arg, int from_tty)
+ftrace_command (char *arg_in, int from_tty)
 {
+  const char *arg = arg_in;
   event_location_up location = string_to_event_location (&arg,
 							 current_language);
   create_breakpoint (get_current_arch (),
@@ -14832,8 +14832,9 @@ ftrace_command (char *arg, int from_tty)
 /* strace command implementation.  Creates a static tracepoint.  */
 
 static void
-strace_command (char *arg, int from_tty)
+strace_command (char *arg_in, int from_tty)
 {
+  const char *arg = arg_in;
   struct breakpoint_ops *ops;
   event_location_up location;
   struct cleanup *back_to;
@@ -14891,7 +14892,8 @@ read_uploaded_action (void)
 struct tracepoint *
 create_tracepoint_from_upload (struct uploaded_tp *utp)
 {
-  char *addr_str, small_buf[100];
+  const char *addr_str;
+  char small_buf[100];
   struct tracepoint *tp;
 
   if (utp->at_string)
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 6afe4cc..154ff3a 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1206,7 +1206,7 @@ extern int breakpoint_address_match (struct address_space *aspace1,
 				     struct address_space *aspace2,
 				     CORE_ADDR addr2);
 
-extern void until_break_command (char *, int, int);
+extern void until_break_command (const char *, int, int);
 
 /* Initialize a struct bp_location.  */
 
@@ -1255,9 +1255,9 @@ extern void break_command (char *, int);
 extern void hbreak_command_wrapper (char *, int);
 extern void thbreak_command_wrapper (char *, int);
 extern void rbreak_command_wrapper (char *, int);
-extern void watch_command_wrapper (char *, int, int);
-extern void awatch_command_wrapper (char *, int, int);
-extern void rwatch_command_wrapper (char *, int, int);
+extern void watch_command_wrapper (const char *, int, int);
+extern void awatch_command_wrapper (const char *, int, int);
+extern void rwatch_command_wrapper (const char *, int, int);
 extern void tbreak_command (char *, int);
 
 extern struct breakpoint_ops base_breakpoint_ops;
@@ -1288,7 +1288,7 @@ extern void
   init_ada_exception_breakpoint (struct breakpoint *b,
 				 struct gdbarch *gdbarch,
 				 struct symtab_and_line sal,
-				 char *addr_string,
+				 const char *addr_string,
 				 const struct breakpoint_ops *ops,
 				 int tempflag,
 				 int enabled,
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index e6239ca..4cc9fa6 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -807,7 +807,7 @@ edit_command (char *arg, int from_tty)
     }
   else
     {
-      char *arg1;
+      const char *arg1;
 
       /* Now should only be one argument -- decode it in SAL.  */
       arg1 = arg;
@@ -885,7 +885,7 @@ static void
 list_command (char *arg, int from_tty)
 {
   struct symbol *sym;
-  char *arg1;
+  const char *arg1;
   int no_end = 1;
   int dummy_end = 0;
   int dummy_beg = 0;
diff --git a/gdb/guile/scm-breakpoint.c b/gdb/guile/scm-breakpoint.c
index 9165684..b6b6810 100644
--- a/gdb/guile/scm-breakpoint.c
+++ b/gdb/guile/scm-breakpoint.c
@@ -412,7 +412,7 @@ gdbscm_register_breakpoint_x (SCM self)
   breakpoint_smob *bp_smob
     = bpscm_get_breakpoint_smob_arg_unsafe (self, SCM_ARG1, FUNC_NAME);
   struct gdb_exception except = exception_none;
-  char *location, *copy;
+  const char *location, *copy;
 
   /* We only support registering breakpoints created with make-breakpoint.  */
   if (!bp_smob->is_scheme_bkpt)
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 6e472e2..19db83e 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -2793,7 +2793,7 @@ linespec_parser_delete (void *arg)
 /* See description in linespec.h.  */
 
 void
-linespec_lex_to_end (char **stringp)
+linespec_lex_to_end (const char **stringp)
 {
   linespec_parser parser;
   struct cleanup *cleanup;
@@ -3338,7 +3338,7 @@ decode_line_1 (const struct event_location *location, int flags,
 /* See linespec.h.  */
 
 std::vector<symtab_and_line>
-decode_line_with_current_source (char *string, int flags)
+decode_line_with_current_source (const char *string, int flags)
 {
   if (string == 0)
     error (_("Empty line specification."));
@@ -3361,7 +3361,7 @@ decode_line_with_current_source (char *string, int flags)
 /* See linespec.h.  */
 
 std::vector<symtab_and_line>
-decode_line_with_last_displayed (char *string, int flags)
+decode_line_with_last_displayed (const char *string, int flags)
 {
   if (string == 0)
     error (_("Empty line specification."));
@@ -3472,19 +3472,21 @@ decode_objc (struct linespec_state *self, linespec_p ls, const char *arg)
 
       if (self->canonical)
 	{
-	  char *str;
+	  std::string holder;
+	  const char *str;
 
 	  self->canonical->pre_expanded = 1;
 
 	  if (ls->explicit_loc.source_filename)
 	    {
-	      str = xstrprintf ("%s:%s",
-				ls->explicit_loc.source_filename, saved_arg);
+	      holder = string_printf ("%s:%s",
+				      ls->explicit_loc.source_filename,
+				      saved_arg);
+	      str = holder.c_str ();
 	    }
 	  else
-	    str = xstrdup (saved_arg);
+	    str = saved_arg;
 
-	  make_cleanup (xfree, str);
 	  self->canonical->location = new_linespec_location (&str);
 	}
     }
diff --git a/gdb/linespec.h b/gdb/linespec.h
index 6c9b0b3..b955728 100644
--- a/gdb/linespec.h
+++ b/gdb/linespec.h
@@ -136,12 +136,14 @@ extern void decode_line_full (const struct event_location *location, int flags,
    source symtab and line as defaults.
    This is for commands like "list" and "breakpoint".  */
 
-extern std::vector<symtab_and_line> decode_line_with_current_source (char *, int);
+extern std::vector<symtab_and_line> decode_line_with_current_source
+    (const char *, int);
 
 /* Given a string, return the line specified by it, using the last displayed
    codepoint's values as defaults, or nothing if they aren't valid.  */
 
-extern std::vector<symtab_and_line> decode_line_with_last_displayed (char *, int);
+extern std::vector<symtab_and_line> decode_line_with_last_displayed
+    (const char *, int);
 
 /* Does P represent one of the keywords?  If so, return
    the keyword.  If not, return NULL.  */
@@ -171,7 +173,7 @@ extern const char *find_toplevel_char (const char *s, char c);
 /* Find the end of the (first) linespec pointed to by *STRINGP.
    STRINGP will be advanced to this point.  */
 
-extern void linespec_lex_to_end (char **stringp);
+extern void linespec_lex_to_end (const char **stringp);
 
 extern const char * const linespec_keywords[];
 
diff --git a/gdb/location.c b/gdb/location.c
index cda26e8..c78778e 100644
--- a/gdb/location.c
+++ b/gdb/location.c
@@ -83,7 +83,7 @@ initialize_explicit_location (struct explicit_location *explicit_loc)
 /* See description in location.h.  */
 
 event_location_up
-new_linespec_location (char **linespec)
+new_linespec_location (const char **linespec)
 {
   struct event_location *location;
 
@@ -91,8 +91,8 @@ new_linespec_location (char **linespec)
   EL_TYPE (location) = LINESPEC_LOCATION;
   if (*linespec != NULL)
     {
-      char *p;
-      char *orig = *linespec;
+      const char *p;
+      const char *orig = *linespec;
 
       linespec_lex_to_end (linespec);
       p = remove_trailing_whitespace (orig, *linespec);
@@ -836,7 +836,7 @@ string_to_explicit_location (const char **argp,
 /* See description in location.h.  */
 
 event_location_up
-string_to_event_location_basic (char **stringp,
+string_to_event_location_basic (const char **stringp,
 				const struct language_defn *language)
 {
   event_location_up location;
@@ -875,7 +875,7 @@ string_to_event_location_basic (char **stringp,
 /* See description in location.h.  */
 
 event_location_up
-string_to_event_location (char **stringp,
+string_to_event_location (const char **stringp,
 			  const struct language_defn *language)
 {
   const char *arg, *orig;
diff --git a/gdb/location.h b/gdb/location.h
index 58536e0..d954eac 100644
--- a/gdb/location.h
+++ b/gdb/location.h
@@ -127,7 +127,7 @@ typedef std::unique_ptr<event_location, event_location_deleter>
 
 /* Create a new linespec location.  */
 
-extern event_location_up new_linespec_location (char **linespec);
+extern event_location_up new_linespec_location (const char **linespec);
 
 /* Return the linespec location (a string) of the given event_location
    (which must be of type LINESPEC_LOCATION).  */
@@ -208,14 +208,14 @@ extern event_location_up
    legacy specifications of probe, address, and linespec locations.  */
 
 extern event_location_up
-  string_to_event_location (char **argp,
+  string_to_event_location (const char **argp,
 			    const struct language_defn *langauge);
 
 /* Like string_to_event_location, but does not attempt to parse explicit
    locations.  */
 
 extern event_location_up
-  string_to_event_location_basic (char **argp,
+  string_to_event_location_basic (const char **argp,
 				  const struct language_defn *language);
 
 /* Structure filled in by string_to_explicit_location to aid the
diff --git a/gdb/mi/mi-cmd-break.c b/gdb/mi/mi-cmd-break.c
index bae8711..188e4e2 100644
--- a/gdb/mi/mi-cmd-break.c
+++ b/gdb/mi/mi-cmd-break.c
@@ -165,7 +165,7 @@ mi_argv_to_format (char **argv, int argc)
 static void
 mi_cmd_break_insert_1 (int dprintf, const char *command, char **argv, int argc)
 {
-  char *address = NULL;
+  const char *address = NULL;
   int hardware = 0;
   int temp_p = 0;
   int thread = -1;
diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c
index d57c2fa..86719d1 100644
--- a/gdb/python/py-breakpoint.c
+++ b/gdb/python/py-breakpoint.c
@@ -674,7 +674,7 @@ bppy_init (PyObject *self, PyObject *args, PyObject *kwargs)
     {
       gdb::unique_xmalloc_ptr<char>
 	copy_holder (xstrdup (skip_spaces (spec)));
-      char *copy = copy_holder.get ();
+      const char *copy = copy_holder.get ();
 
       switch (type)
 	{
diff --git a/gdb/python/python.c b/gdb/python/python.c
index ff757fd..b04057e 100644
--- a/gdb/python/python.c
+++ b/gdb/python/python.c
@@ -647,7 +647,7 @@ gdbpy_solib_name (PyObject *self, PyObject *args)
 static PyObject *
 gdbpy_decode_line (PyObject *self, PyObject *args)
 {
-  char *arg = NULL;
+  const char *arg = NULL;
   gdbpy_ref<> result;
   gdbpy_ref<> unparsed;
   event_location_up location;
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 12cc2fb..52a449a 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -2550,17 +2550,18 @@ tfind_outside_command (char *args, int from_tty)
 
 /* info scope command: list the locals for a scope.  */
 static void
-info_scope_command (char *args, int from_tty)
+info_scope_command (char *args_in, int from_tty)
 {
   struct symbol *sym;
   struct bound_minimal_symbol msym;
   const struct block *block;
   const char *symname;
-  char *save_args = args;
+  const char *save_args = args_in;
   struct block_iterator iter;
   int j, count = 0;
   struct gdbarch *gdbarch;
   int regno;
+  const char *args = args_in;
 
   if (args == 0 || *args == 0)
     error (_("requires an argument (function, "
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 36/67] Constify some commands in source.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (44 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 45/67] Constify cd_command Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 53/67] Constify maintenance_print_reggroups Tom Tromey
                   ` (21 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* source.c (show_substitute_path_command)
	(unset_substitute_path_command, set_substitute_path_command):
	Constify.
---
 gdb/ChangeLog | 6 ++++++
 gdb/source.c  | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gdb/source.c b/gdb/source.c
index 0564c15..aa672fd 100644
--- a/gdb/source.c
+++ b/gdb/source.c
@@ -1850,7 +1850,7 @@ delete_substitute_path_rule (struct substitute_path_rule *rule)
 /* Implement the "show substitute-path" command.  */
 
 static void
-show_substitute_path_command (char *args, int from_tty)
+show_substitute_path_command (const char *args, int from_tty)
 {
   struct substitute_path_rule *rule = substitute_path_rules;
   char *from = NULL;
@@ -1884,7 +1884,7 @@ show_substitute_path_command (char *args, int from_tty)
 /* Implement the "unset substitute-path" command.  */
 
 static void
-unset_substitute_path_command (char *args, int from_tty)
+unset_substitute_path_command (const char *args, int from_tty)
 {
   struct substitute_path_rule *rule = substitute_path_rules;
   gdb_argv argv (args);
@@ -1935,7 +1935,7 @@ unset_substitute_path_command (char *args, int from_tty)
 /* Add a new source path substitution rule.  */
 
 static void
-set_substitute_path_command (char *args, int from_tty)
+set_substitute_path_command (const char *args, int from_tty)
 {
   struct substitute_path_rule *rule;
   
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 35/67] Constify commands maint.c, plus maintenance_print_type
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (36 preceding siblings ...)
  2017-09-21  5:39 ` [RFA 31/67] Constify some commands in tui.c Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21 10:06   ` Pedro Alves
  2017-09-21  5:40 ` [RFA 46/67] Constify some commands in mips-tdep.c Tom Tromey
                   ` (29 subsequent siblings)
  67 siblings, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* typeprint.c (maintenance_print_type): Constify.
	* maint.c (maintenance_dump_me, maintenance_demangle)
	(maintenance_time_display, maintenance_info_sections)
	(maintenance_print_statistics, maintenance_deprecate)
	(maintenance_undeprecate): Constify.
	(maintenance_do_deprecate): Constify.  Use std::string.
	(maintenance_selftest): Constify.
	* gdbtypes.h (maintenance_print_type): Constify.
---
 gdb/ChangeLog   | 11 +++++++++++
 gdb/gdbtypes.h  |  2 +-
 gdb/maint.c     | 39 +++++++++++++++------------------------
 gdb/typeprint.c |  2 +-
 4 files changed, 28 insertions(+), 26 deletions(-)

diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
index 9d9b09f..8d6fd9b 100644
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -1931,7 +1931,7 @@ extern int is_scalar_type_recursive (struct type *);
 
 extern int class_or_union_p (const struct type *);
 
-extern void maintenance_print_type (char *, int);
+extern void maintenance_print_type (const char *, int);
 
 extern htab_t create_copied_types_hash (struct objfile *objfile);
 
diff --git a/gdb/maint.c b/gdb/maint.c
index b540d1c..6c0dec2 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -48,19 +48,13 @@ static void maintenance_command (char *, int);
 
 static void maintenance_internal_error (char *args, int from_tty);
 
-static void maintenance_demangle (char *, int);
-
-static void maintenance_time_display (char *, int);
-
 static void maintenance_space_display (char *, int);
 
 static void maintenance_info_command (char *, int);
 
-static void maintenance_info_sections (char *, int);
-
 static void maintenance_print_command (char *, int);
 
-static void maintenance_do_deprecate (char *, int);
+static void maintenance_do_deprecate (const char *, int);
 
 /* Set this to the maximum number of seconds to wait instead of waiting forever
    in target_wait().  If this timer times out, then it generates an error and
@@ -88,7 +82,7 @@ maintenance_command (char *args, int from_tty)
 
 #ifndef _WIN32
 static void
-maintenance_dump_me (char *args, int from_tty)
+maintenance_dump_me (const char *args, int from_tty)
 {
   if (query (_("Should GDB dump core? ")))
     {
@@ -140,13 +134,13 @@ maintenance_demangler_warning (char *args, int from_tty)
    "mt demangler-warning" which artificially creates an internal gdb error.  */
 
 static void
-maintenance_demangle (char *args, int from_tty)
+maintenance_demangle (const char *args, int from_tty)
 {
   printf_filtered (_("This command has been moved to \"demangle\".\n"));
 }
 
 static void
-maintenance_time_display (char *args, int from_tty)
+maintenance_time_display (const char *args, int from_tty)
 {
   if (args == NULL || *args == '\0')
     printf_unfiltered (_("\"maintenance time\" takes a numeric argument.\n"));
@@ -354,7 +348,7 @@ print_objfile_section_info (bfd *abfd,
 }
 
 static void
-maintenance_info_sections (char *arg, int from_tty)
+maintenance_info_sections (const char *arg, int from_tty)
 {
   if (exec_bfd)
     {
@@ -385,7 +379,7 @@ maintenance_info_sections (char *arg, int from_tty)
 	    }
 	}
       else 
-	bfd_map_over_sections (exec_bfd, print_bfd_section_info, arg);
+	bfd_map_over_sections (exec_bfd, print_bfd_section_info, (void *) arg);
     }
 
   if (core_bfd)
@@ -394,12 +388,12 @@ maintenance_info_sections (char *arg, int from_tty)
       printf_filtered ("    `%s', ", bfd_get_filename (core_bfd));
       wrap_here ("        ");
       printf_filtered (_("file type %s.\n"), bfd_get_target (core_bfd));
-      bfd_map_over_sections (core_bfd, print_bfd_section_info, arg);
+      bfd_map_over_sections (core_bfd, print_bfd_section_info, (void *) arg);
     }
 }
 
 static void
-maintenance_print_statistics (char *args, int from_tty)
+maintenance_print_statistics (const char *args, int from_tty)
 {
   print_objfile_statistics ();
   print_symbol_bcache_statistics ();
@@ -525,7 +519,7 @@ maintenance_translate_address (char *arg, int from_tty)
    offered.  */
 
 static void
-maintenance_deprecate (char *args, int from_tty)
+maintenance_deprecate (const char *args, int from_tty)
 {
   if (args == NULL || *args == '\0')
     {
@@ -535,12 +529,11 @@ enclosed in quotes.\n"));
     }
 
   maintenance_do_deprecate (args, 1);
-
 }
 
 
 static void
-maintenance_undeprecate (char *args, int from_tty)
+maintenance_undeprecate (const char *args, int from_tty)
 {
   if (args == NULL || *args == '\0')
     {
@@ -549,7 +542,6 @@ the command you want to undeprecate.\n"));
     }
 
   maintenance_do_deprecate (args, 0);
-
 }
 
 /* You really shouldn't be using this.  It is just for the testsuite.
@@ -560,14 +552,14 @@ the command you want to undeprecate.\n"));
    replacement.  */
 
 static void
-maintenance_do_deprecate (char *text, int deprecate)
+maintenance_do_deprecate (const char *text, int deprecate)
 {
   struct cmd_list_element *alias = NULL;
   struct cmd_list_element *prefix_cmd = NULL;
   struct cmd_list_element *cmd = NULL;
 
-  char *start_ptr = NULL;
-  char *end_ptr = NULL;
+  const char *start_ptr = NULL;
+  const char *end_ptr = NULL;
   int len;
   char *replacement = NULL;
 
@@ -591,8 +583,7 @@ maintenance_do_deprecate (char *text, int deprecate)
 	  if (end_ptr != NULL)
 	    {
 	      len = end_ptr - start_ptr;
-	      start_ptr[len] = '\0';
-	      replacement = xstrdup (start_ptr);
+	      replacement = savestring (start_ptr, len);
 	    }
 	}
     }
@@ -955,7 +946,7 @@ show_per_command_cmd (char *args, int from_tty)
 /* The "maintenance selftest" command.  */
 
 static void
-maintenance_selftest (char *args, int from_tty)
+maintenance_selftest (const char *args, int from_tty)
 {
   selftests::run_tests (args);
 }
diff --git a/gdb/typeprint.c b/gdb/typeprint.c
index c82e623..8ee44af 100644
--- a/gdb/typeprint.c
+++ b/gdb/typeprint.c
@@ -629,7 +629,7 @@ print_type_scalar (struct type *type, LONGEST val, struct ui_file *stream)
    and whatis_command().  */
 
 void
-maintenance_print_type (char *type_name, int from_tty)
+maintenance_print_type (const char *type_name, int from_tty)
 {
   struct value *val;
   struct type *type;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 54/67] Constify some commands in compile.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (47 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 44/67] Constify some commands in thread.c Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 63/67] Constify some commands in regcache.c Tom Tromey
                   ` (18 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* compile/compile.c (check_raw_argument, compile_file_command)
	(compile_code_command, compile_print_command): Constify.
---
 gdb/ChangeLog         | 5 +++++
 gdb/compile/compile.c | 9 ++++-----
 2 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/gdb/compile/compile.c b/gdb/compile/compile.c
index 4a2f339..35d8c86 100644
--- a/gdb/compile/compile.c
+++ b/gdb/compile/compile.c
@@ -71,7 +71,7 @@ show_compile_debug (struct ui_file *file, int from_tty,
    Return 1 if seen and update *ARG.  */
 
 static int
-check_raw_argument (char **arg)
+check_raw_argument (const char **arg)
 {
   *arg = skip_spaces (*arg);
 
@@ -87,7 +87,7 @@ check_raw_argument (char **arg)
    that may contain calls to the GCC compiler.  */
 
 static void
-compile_file_command (char *arg, int from_tty)
+compile_file_command (const char *arg, int from_tty)
 {
   enum compile_i_scope_types scope = COMPILE_I_SIMPLE_SCOPE;
 
@@ -124,7 +124,7 @@ compile_file_command (char *arg, int from_tty)
    compile command is the language currently set in GDB.  */
 
 static void
-compile_code_command (char *arg, int from_tty)
+compile_code_command (const char *arg, int from_tty)
 {
   enum compile_i_scope_types scope = COMPILE_I_SIMPLE_SCOPE;
 
@@ -171,9 +171,8 @@ compile_print_value (struct value *val, void *data_voidp)
    compile command is the language currently set in GDB.  */
 
 static void
-compile_print_command (char *arg_param, int from_tty)
+compile_print_command (const char *arg, int from_tty)
 {
-  const char *arg = arg_param;
   enum compile_i_scope_types scope = COMPILE_I_PRINT_ADDRESS_SCOPE;
   struct format_data fmt;
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 47/67] Constify some commands in remote.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (41 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 37/67] Constify some commands in record.c Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 55/67] Constify maintenance_info_program_spaces_command Tom Tromey
                   ` (24 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* remote.c (set_memory_packet_size)
	(set_memory_write_packet_size, show_memory_write_packet_size)
	(set_memory_read_packet_size, show_memory_read_packet_size)
	(compare_sections_command, packet_command, remote_put_command)
	(remote_get_command, remote_delete_command): Constify.
---
 gdb/ChangeLog |  8 ++++++++
 gdb/remote.c  | 24 ++++++++++--------------
 2 files changed, 18 insertions(+), 14 deletions(-)

diff --git a/gdb/remote.c b/gdb/remote.c
index 0988a25..12766e7 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -170,10 +170,6 @@ static CORE_ADDR remote_address_masked (CORE_ADDR);
 
 static void print_packet (const char *);
 
-static void compare_sections_command (char *, int);
-
-static void packet_command (char *, int);
-
 static int stub_unpack_int (char *buff, int fieldlength);
 
 static ptid_t remote_current_thread (ptid_t oldptid);
@@ -1090,7 +1086,7 @@ get_memory_packet_size (struct memory_packet_config *config)
    something really big then do a sanity check.  */
 
 static void
-set_memory_packet_size (char *args, struct memory_packet_config *config)
+set_memory_packet_size (const char *args, struct memory_packet_config *config)
 {
   int fixed_p = config->fixed_p;
   long size = config->size;
@@ -1151,13 +1147,13 @@ static struct memory_packet_config memory_write_packet_config =
 };
 
 static void
-set_memory_write_packet_size (char *args, int from_tty)
+set_memory_write_packet_size (const char *args, int from_tty)
 {
   set_memory_packet_size (args, &memory_write_packet_config);
 }
 
 static void
-show_memory_write_packet_size (char *args, int from_tty)
+show_memory_write_packet_size (const char *args, int from_tty)
 {
   show_memory_packet_size (&memory_write_packet_config);
 }
@@ -1174,13 +1170,13 @@ static struct memory_packet_config memory_read_packet_config =
 };
 
 static void
-set_memory_read_packet_size (char *args, int from_tty)
+set_memory_read_packet_size (const char *args, int from_tty)
 {
   set_memory_packet_size (args, &memory_read_packet_config);
 }
 
 static void
-show_memory_read_packet_size (char *args, int from_tty)
+show_memory_read_packet_size (const char *args, int from_tty)
 {
   show_memory_packet_size (&memory_read_packet_config);
 }
@@ -10214,7 +10210,7 @@ remote_verify_memory (struct target_ops *ops,
    Useful for verifying the image on the target against the exec file.  */
 
 static void
-compare_sections_command (char *args, int from_tty)
+compare_sections_command (const char *args, int from_tty)
 {
   asection *s;
   struct cleanup *old_chain;
@@ -10818,7 +10814,7 @@ remote_memory_map (struct target_ops *ops)
 }
 
 static void
-packet_command (char *args, int from_tty)
+packet_command (const char *args, int from_tty)
 {
   struct remote_state *rs = get_remote_state ();
 
@@ -12099,7 +12095,7 @@ remote_file_delete (const char *remote_file, int from_tty)
 }
 
 static void
-remote_put_command (char *args, int from_tty)
+remote_put_command (const char *args, int from_tty)
 {
   if (args == NULL)
     error_no_arg (_("file to put"));
@@ -12112,7 +12108,7 @@ remote_put_command (char *args, int from_tty)
 }
 
 static void
-remote_get_command (char *args, int from_tty)
+remote_get_command (const char *args, int from_tty)
 {
   if (args == NULL)
     error_no_arg (_("file to get"));
@@ -12125,7 +12121,7 @@ remote_get_command (char *args, int from_tty)
 }
 
 static void
-remote_delete_command (char *args, int from_tty)
+remote_delete_command (const char *args, int from_tty)
 {
   if (args == NULL)
     error_no_arg (_("file to delete"));
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 37/67] Constify some commands in record.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (40 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 56/67] Constify demangle_command Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  7:02   ` Metzger, Markus T
  2017-09-21 10:00   ` Pedro Alves
  2017-09-21  5:40 ` [RFA 47/67] Constify some commands in remote.c Tom Tromey
                   ` (25 subsequent siblings)
  67 siblings, 2 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* record.c (cmd_record_delete, cmd_record_stop, cmd_record_save)
	(cmd_record_goto_begin, cmd_record_goto_end, get_insn_number)
	(get_context_size, no_chunk, get_insn_history_modifiers)
	(cmd_record_insn_history, get_call_history_modifiers)
	(cmd_record_call_history): Constify.
---
 gdb/ChangeLog |  8 ++++++++
 gdb/record.c  | 36 ++++++++++++++++++++----------------
 2 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/gdb/record.c b/gdb/record.c
index 59fb240..a1d0f3c 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -272,7 +272,7 @@ cmd_record_start (char *args, int from_tty)
    of replay until the end.  */
 
 static void
-cmd_record_delete (char *args, int from_tty)
+cmd_record_delete (const char *args, int from_tty)
 {
   require_record_target ();
 
@@ -298,7 +298,7 @@ cmd_record_delete (char *args, int from_tty)
 /* Implement the "stoprecord" or "record stop" command.  */
 
 static void
-cmd_record_stop (char *args, int from_tty)
+cmd_record_stop (const char *args, int from_tty)
 {
   struct target_ops *t;
 
@@ -354,7 +354,8 @@ info_record_command (char *args, int from_tty)
 static void
 cmd_record_save (char *args, int from_tty)
 {
-  char *recfilename, recfilename_buffer[40];
+  const char *recfilename;
+  char recfilename_buffer[40];
 
   require_record_target ();
 
@@ -401,7 +402,7 @@ cmd_record_goto (char *arg, int from_tty)
 /* The "record goto begin" command.  */
 
 static void
-cmd_record_goto_begin (char *arg, int from_tty)
+cmd_record_goto_begin (const char *arg, int from_tty)
 {
   if (arg != NULL && *arg != '\0')
     error (_("Junk after argument: %s."), arg);
@@ -413,7 +414,7 @@ cmd_record_goto_begin (char *arg, int from_tty)
 /* The "record goto end" command.  */
 
 static void
-cmd_record_goto_end (char *arg, int from_tty)
+cmd_record_goto_end (const char *arg, int from_tty)
 {
   if (arg != NULL && *arg != '\0')
     error (_("Junk after argument: %s."), arg);
@@ -425,7 +426,7 @@ cmd_record_goto_end (char *arg, int from_tty)
 /* Read an instruction number from an argument string.  */
 
 static ULONGEST
-get_insn_number (char **arg)
+get_insn_number (const char **arg)
 {
   ULONGEST number;
   const char *begin, *end, *pos;
@@ -446,9 +447,10 @@ get_insn_number (char **arg)
 /* Read a context size from an argument string.  */
 
 static int
-get_context_size (char **arg)
+get_context_size (const char **arg)
 {
-  char *pos;
+  const char *pos;
+  char *end;
   int number;
 
   pos = skip_spaces (*arg);
@@ -456,13 +458,15 @@ get_context_size (char **arg)
   if (!isdigit (*pos))
     error (_("Expected positive number, got: %s."), pos);
 
-  return strtol (pos, arg, 10);
+   long result = strtol (pos, &end, 10);
+   *arg = end;
+   return result;
 }
 
 /* Complain about junk at the end of an argument string.  */
 
 static void
-no_chunk (char *arg)
+no_chunk (const char *arg)
 {
   if (*arg != 0)
     error (_("Junk after argument: %s."), arg);
@@ -471,10 +475,10 @@ no_chunk (char *arg)
 /* Read instruction-history modifiers from an argument string.  */
 
 static gdb_disassembly_flags
-get_insn_history_modifiers (char **arg)
+get_insn_history_modifiers (const char **arg)
 {
   gdb_disassembly_flags modifiers;
-  char *args;
+  const char *args;
 
   modifiers = 0;
   args = *arg;
@@ -549,7 +553,7 @@ command_size_to_target_size (unsigned int size)
 /* The "record instruction-history" command.  */
 
 static void
-cmd_record_insn_history (char *arg, int from_tty)
+cmd_record_insn_history (const char *arg, int from_tty)
 {
   require_record_target ();
 
@@ -612,10 +616,10 @@ cmd_record_insn_history (char *arg, int from_tty)
 /* Read function-call-history modifiers from an argument string.  */
 
 static int
-get_call_history_modifiers (char **arg)
+get_call_history_modifiers (const char **arg)
 {
   int modifiers;
-  char *args;
+  const char *args;
 
   modifiers = 0;
   args = *arg;
@@ -666,7 +670,7 @@ get_call_history_modifiers (char **arg)
 /* The "record function-call-history" command.  */
 
 static void
-cmd_record_call_history (char *arg, int from_tty)
+cmd_record_call_history (const char *arg, int from_tty)
 {
   int flags, size;
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 44/67] Constify some commands in thread.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (46 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 53/67] Constify maintenance_print_reggroups Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 54/67] Constify some commands in compile.c Tom Tromey
                   ` (19 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* thread.c (thread_name_command, thread_find_command): Constify.
---
 gdb/ChangeLog | 4 ++++
 gdb/thread.c  | 4 ++--
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/gdb/thread.c b/gdb/thread.c
index 2539d43..1d7cb55 100644
--- a/gdb/thread.c
+++ b/gdb/thread.c
@@ -1900,7 +1900,7 @@ thread_command (char *tidstr, int from_tty)
 /* Implementation of `thread name'.  */
 
 static void
-thread_name_command (char *arg, int from_tty)
+thread_name_command (const char *arg, int from_tty)
 {
   struct thread_info *info;
 
@@ -1917,7 +1917,7 @@ thread_name_command (char *arg, int from_tty)
 /* Find thread ids with a name, target pid, or extra info matching ARG.  */
 
 static void
-thread_find_command (char *arg, int from_tty)
+thread_find_command (const char *arg, int from_tty)
 {
   struct thread_info *tp;
   const char *tmp;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 65/67] Constify some commands in symtab.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (52 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 67/67] Constify find_command Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 34/67] Constify unwind_command Tom Tromey
                   ` (13 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* symtab.c (maintenance_print_symbol_cache)
	(maintenance_flush_symbol_cache)
	(maintenance_print_symbol_cache_statistics): Constify.
---
 gdb/ChangeLog | 6 ++++++
 gdb/symtab.c  | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gdb/symtab.c b/gdb/symtab.c
index bf7ee64..2da37e8 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1500,7 +1500,7 @@ symbol_cache_dump (const struct symbol_cache *cache)
 /* The "mt print symbol-cache" command.  */
 
 static void
-maintenance_print_symbol_cache (char *args, int from_tty)
+maintenance_print_symbol_cache (const char *args, int from_tty)
 {
   struct program_space *pspace;
 
@@ -1527,7 +1527,7 @@ maintenance_print_symbol_cache (char *args, int from_tty)
 /* The "mt flush-symbol-cache" command.  */
 
 static void
-maintenance_flush_symbol_cache (char *args, int from_tty)
+maintenance_flush_symbol_cache (const char *args, int from_tty)
 {
   struct program_space *pspace;
 
@@ -1572,7 +1572,7 @@ symbol_cache_stats (struct symbol_cache *cache)
 /* The "mt print symbol-cache-statistics" command.  */
 
 static void
-maintenance_print_symbol_cache_statistics (char *args, int from_tty)
+maintenance_print_symbol_cache_statistics (const char *args, int from_tty)
 {
   struct program_space *pspace;
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 62/67] Constify some commands in printcmd.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (50 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 66/67] Constify some commands in ada-tasks.c Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 67/67] Constify find_command Tom Tromey
                   ` (15 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* printcmd.c (map_display_numbers, undisplay_command)
	(enable_disable_display_command, enable_display_command)
	(disable_display_command): Constify.
---
 gdb/ChangeLog  |  6 ++++++
 gdb/printcmd.c | 10 +++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 033d687..de1f76c 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -1795,7 +1795,7 @@ delete_display (struct display *display)
    ARGS.  DATA is passed unmodified to FUNCTION.  */
 
 static void
-map_display_numbers (char *args,
+map_display_numbers (const char *args,
 		     void (*function) (struct display *,
 				       void *),
 		     void *data)
@@ -1840,7 +1840,7 @@ do_delete_display (struct display *d, void *data)
 /* "undisplay" command.  */
 
 static void
-undisplay_command (char *args, int from_tty)
+undisplay_command (const char *args, int from_tty)
 {
   if (args == NULL)
     {
@@ -2085,7 +2085,7 @@ do_enable_disable_display (struct display *d, void *data)
    commands.  ENABLE decides what to do.  */
 
 static void
-enable_disable_display_command (char *args, int from_tty, int enable)
+enable_disable_display_command (const char *args, int from_tty, int enable)
 {
   if (args == NULL)
     {
@@ -2102,7 +2102,7 @@ enable_disable_display_command (char *args, int from_tty, int enable)
 /* The "enable display" command.  */
 
 static void
-enable_display_command (char *args, int from_tty)
+enable_display_command (const char *args, int from_tty)
 {
   enable_disable_display_command (args, from_tty, 1);
 }
@@ -2110,7 +2110,7 @@ enable_display_command (char *args, int from_tty)
 /* The "disable display" command.  */
 
 static void
-disable_display_command (char *args, int from_tty)
+disable_display_command (const char *args, int from_tty)
 {
   enable_disable_display_command (args, from_tty, 0);
 }
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 67/67] Constify find_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (51 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 62/67] Constify some commands in printcmd.c Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 65/67] Constify some commands in symtab.c Tom Tromey
                   ` (14 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* findcmd.c (find_command): Constify.
---
 gdb/ChangeLog | 4 ++++
 gdb/findcmd.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/findcmd.c b/gdb/findcmd.c
index 5eba2dc..b43fefc 100644
--- a/gdb/findcmd.c
+++ b/gdb/findcmd.c
@@ -209,7 +209,7 @@ parse_find_args (const char *args, ULONGEST *max_countp,
 }
 
 static void
-find_command (char *args, int from_tty)
+find_command (const char *args, int from_tty)
 {
   struct gdbarch *gdbarch = get_current_arch ();
   bfd_boolean big_p = gdbarch_byte_order (gdbarch) == BFD_ENDIAN_BIG;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 56/67] Constify demangle_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (39 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 64/67] Constify some commands in inferior.c Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 37/67] Constify some commands in record.c Tom Tromey
                   ` (26 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* demangle.c (demangle_command): Constify.
---
 gdb/ChangeLog  | 4 ++++
 gdb/demangle.c | 4 +---
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/gdb/demangle.c b/gdb/demangle.c
index 5430fb6..1a97fb7 100644
--- a/gdb/demangle.c
+++ b/gdb/demangle.c
@@ -43,8 +43,6 @@
 #define DEFAULT_DEMANGLING_STYLE AUTO_DEMANGLING_STYLE_STRING
 #endif
 
-static void demangle_command (char *, int);
-
 /* See documentation in gdb-demangle.h.  */
 int demangle = 1;
 
@@ -159,7 +157,7 @@ is_cplus_marker (int c)
 /* Demangle the given string in the current language.  */
 
 static void
-demangle_command (char *args, int from_tty)
+demangle_command (const char *args, int from_tty)
 {
   char *demangled;
   const char *name;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 46/67] Constify some commands in mips-tdep.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (37 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 35/67] Constify commands maint.c, plus maintenance_print_type Tom Tromey
@ 2017-09-21  5:40 ` Tom Tromey
  2017-09-21  5:40 ` [RFA 64/67] Constify some commands in inferior.c Tom Tromey
                   ` (28 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:40 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* mips-tdep.c (show_mipsfpu_command, set_mipsfpu_single_command)
	(set_mipsfpu_double_command, set_mipsfpu_none_command)
	(set_mipsfpu_auto_command): Constify.
---
 gdb/ChangeLog   |  6 ++++++
 gdb/mips-tdep.c | 10 +++++-----
 2 files changed, 11 insertions(+), 5 deletions(-)

diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 9cde2f4..5fc0618 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -6894,7 +6894,7 @@ set_mips_command (char *args, int from_tty)
 /* Commands to show/set the MIPS FPU type.  */
 
 static void
-show_mipsfpu_command (char *args, int from_tty)
+show_mipsfpu_command (const char *args, int from_tty)
 {
   const char *fpu;
 
@@ -6939,7 +6939,7 @@ set_mipsfpu_command (char *args, int from_tty)
 }
 
 static void
-set_mipsfpu_single_command (char *args, int from_tty)
+set_mipsfpu_single_command (const char *args, int from_tty)
 {
   struct gdbarch_info info;
   gdbarch_info_init (&info);
@@ -6953,7 +6953,7 @@ set_mipsfpu_single_command (char *args, int from_tty)
 }
 
 static void
-set_mipsfpu_double_command (char *args, int from_tty)
+set_mipsfpu_double_command (const char *args, int from_tty)
 {
   struct gdbarch_info info;
   gdbarch_info_init (&info);
@@ -6967,7 +6967,7 @@ set_mipsfpu_double_command (char *args, int from_tty)
 }
 
 static void
-set_mipsfpu_none_command (char *args, int from_tty)
+set_mipsfpu_none_command (const char *args, int from_tty)
 {
   struct gdbarch_info info;
   gdbarch_info_init (&info);
@@ -6981,7 +6981,7 @@ set_mipsfpu_none_command (char *args, int from_tty)
 }
 
 static void
-set_mipsfpu_auto_command (char *args, int from_tty)
+set_mipsfpu_auto_command (const char *args, int from_tty)
 {
   mips_fpu_type_auto = 1;
 }
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 58/67] Constify some commands in i386-tdep.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (57 preceding siblings ...)
  2017-09-21  5:41 ` [RFA 59/67] Constify some commands in infcmd.c Tom Tromey
@ 2017-09-21  5:41 ` Tom Tromey
  2017-09-21  5:41 ` [RFA 43/67] Constify some commands in probes.c Tom Tromey
                   ` (8 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:41 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* i386-tdep.c (i386_mpx_info_bounds, i386_mpx_set_bounds):
	Constify.
---
 gdb/ChangeLog   | 5 +++++
 gdb/i386-tdep.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index eefa03a..f26d624 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -8874,7 +8874,7 @@ i386_mpx_print_bounds (const CORE_ADDR bt_entry[4])
 /* Implement the command "show mpx bound".  */
 
 static void
-i386_mpx_info_bounds (char *args, int from_tty)
+i386_mpx_info_bounds (const char *args, int from_tty)
 {
   CORE_ADDR bd_base = 0;
   CORE_ADDR addr;
@@ -8916,7 +8916,7 @@ i386_mpx_info_bounds (char *args, int from_tty)
 /* Implement the command "set mpx bound".  */
 
 static void
-i386_mpx_set_bounds (char *args, int from_tty)
+i386_mpx_set_bounds (const char *args, int from_tty)
 {
   CORE_ADDR bd_base = 0;
   CORE_ADDR addr, lower, upper;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 41/67] Constify some commands in remote-fileio.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (55 preceding siblings ...)
  2017-09-21  5:40 ` [RFA 38/67] Constify some linespec functions Tom Tromey
@ 2017-09-21  5:41 ` Tom Tromey
  2017-09-21  5:41 ` [RFA 59/67] Constify some commands in infcmd.c Tom Tromey
                   ` (10 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:41 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* remote-fileio.c (set_system_call_allowed)
	(show_system_call_allowed): Constify.
---
 gdb/ChangeLog       | 5 +++++
 gdb/remote-fileio.c | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/remote-fileio.c b/gdb/remote-fileio.c
index 252b423..c305171 100644
--- a/gdb/remote-fileio.c
+++ b/gdb/remote-fileio.c
@@ -1272,7 +1272,7 @@ remote_fileio_to_host_stat (struct fio_stat *fst, struct stat *st)
 \f
 
 static void
-set_system_call_allowed (char *args, int from_tty)
+set_system_call_allowed (const char *args, int from_tty)
 {
   if (args)
     {
@@ -1289,7 +1289,7 @@ set_system_call_allowed (char *args, int from_tty)
 }
 
 static void
-show_system_call_allowed (char *args, int from_tty)
+show_system_call_allowed (const char *args, int from_tty)
 {
   if (args)
     error (_("Garbage after \"show remote "
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 59/67] Constify some commands in infcmd.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (56 preceding siblings ...)
  2017-09-21  5:41 ` [RFA 41/67] Constify some commands in remote-fileio.c Tom Tromey
@ 2017-09-21  5:41 ` Tom Tromey
  2017-09-21  9:56   ` Pedro Alves
  2017-09-21  5:41 ` [RFA 58/67] Constify some commands in i386-tdep.c Tom Tromey
                   ` (9 subsequent siblings)
  67 siblings, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:41 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* infcmd.c (environment_info, set_environment_command)
	(unset_environment_command, path_info, info_proc_cmd_1)
	(info_proc_cmd_mappings, info_proc_cmd_stat)
	(info_proc_cmd_status, info_proc_cmd_cwd, info_proc_cmd_cmdline)
	(info_proc_cmd_exe, info_proc_cmd_all): Constify.
---
 gdb/ChangeLog |  8 ++++++++
 gdb/infcmd.c  | 43 +++++++++++++++++--------------------------
 2 files changed, 25 insertions(+), 26 deletions(-)

diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 9c0cead..da16f5e 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -68,8 +68,6 @@ static void until_next_command (int);
 
 static void until_command (char *, int);
 
-static void path_info (char *, int);
-
 static void path_command (char *, int);
 
 static void unset_command (char *, int);
@@ -78,12 +76,6 @@ static void info_float_command (char *, int);
 
 static void disconnect_command (char *, int);
 
-static void unset_environment_command (char *, int);
-
-static void set_environment_command (char *, int);
-
-static void environment_info (char *, int);
-
 static void info_program_command (char *, int);
 
 static void finish_command (char *, int);
@@ -2148,7 +2140,7 @@ info_program_command (char *args, int from_tty)
 }
 \f
 static void
-environment_info (char *var, int from_tty)
+environment_info (const char *var, int from_tty)
 {
   if (var)
     {
@@ -2181,9 +2173,9 @@ environment_info (char *var, int from_tty)
 }
 
 static void
-set_environment_command (char *arg, int from_tty)
+set_environment_command (const char *arg, int from_tty)
 {
-  char *p, *val, *var;
+  const char *p, *val;
   int nullset = 0;
 
   if (arg == 0)
@@ -2230,21 +2222,20 @@ set_environment_command (char *arg, int from_tty)
   while (p != arg && (p[-1] == ' ' || p[-1] == '\t'))
     p--;
 
-  var = savestring (arg, p - arg);
+  std::string var (arg, p - arg);
   if (nullset)
     {
       printf_filtered (_("Setting environment variable "
 			 "\"%s\" to null value.\n"),
-		       var);
-      current_inferior ()->environment.set (var, "");
+		       var.c_str ());
+      current_inferior ()->environment.set (var.c_str (), "");
     }
   else
-    current_inferior ()->environment.set (var, val);
-  xfree (var);
+    current_inferior ()->environment.set (var.c_str (), val);
 }
 
 static void
-unset_environment_command (char *var, int from_tty)
+unset_environment_command (const char *var, int from_tty)
 {
   if (var == 0)
     {
@@ -2262,7 +2253,7 @@ unset_environment_command (char *var, int from_tty)
 static const char path_var_name[] = "PATH";
 
 static void
-path_info (char *args, int from_tty)
+path_info (const char *args, int from_tty)
 {
   puts_filtered ("Executable and object file path: ");
   puts_filtered (current_inferior ()->environment.get (path_var_name));
@@ -3133,7 +3124,7 @@ unset_command (char *args, int from_tty)
 /* Implement `info proc' family of commands.  */
 
 static void
-info_proc_cmd_1 (char *args, enum info_proc_what what, int from_tty)
+info_proc_cmd_1 (const char *args, enum info_proc_what what, int from_tty)
 {
   struct gdbarch *gdbarch = get_current_arch ();
 
@@ -3157,7 +3148,7 @@ info_proc_cmd (char *args, int from_tty)
 /* Implement `info proc mappings'.  */
 
 static void
-info_proc_cmd_mappings (char *args, int from_tty)
+info_proc_cmd_mappings (const char *args, int from_tty)
 {
   info_proc_cmd_1 (args, IP_MAPPINGS, from_tty);
 }
@@ -3165,7 +3156,7 @@ info_proc_cmd_mappings (char *args, int from_tty)
 /* Implement `info proc stat'.  */
 
 static void
-info_proc_cmd_stat (char *args, int from_tty)
+info_proc_cmd_stat (const char *args, int from_tty)
 {
   info_proc_cmd_1 (args, IP_STAT, from_tty);
 }
@@ -3173,7 +3164,7 @@ info_proc_cmd_stat (char *args, int from_tty)
 /* Implement `info proc status'.  */
 
 static void
-info_proc_cmd_status (char *args, int from_tty)
+info_proc_cmd_status (const char *args, int from_tty)
 {
   info_proc_cmd_1 (args, IP_STATUS, from_tty);
 }
@@ -3181,7 +3172,7 @@ info_proc_cmd_status (char *args, int from_tty)
 /* Implement `info proc cwd'.  */
 
 static void
-info_proc_cmd_cwd (char *args, int from_tty)
+info_proc_cmd_cwd (const char *args, int from_tty)
 {
   info_proc_cmd_1 (args, IP_CWD, from_tty);
 }
@@ -3189,7 +3180,7 @@ info_proc_cmd_cwd (char *args, int from_tty)
 /* Implement `info proc cmdline'.  */
 
 static void
-info_proc_cmd_cmdline (char *args, int from_tty)
+info_proc_cmd_cmdline (const char *args, int from_tty)
 {
   info_proc_cmd_1 (args, IP_CMDLINE, from_tty);
 }
@@ -3197,7 +3188,7 @@ info_proc_cmd_cmdline (char *args, int from_tty)
 /* Implement `info proc exe'.  */
 
 static void
-info_proc_cmd_exe (char *args, int from_tty)
+info_proc_cmd_exe (const char *args, int from_tty)
 {
   info_proc_cmd_1 (args, IP_EXE, from_tty);
 }
@@ -3205,7 +3196,7 @@ info_proc_cmd_exe (char *args, int from_tty)
 /* Implement `info proc all'.  */
 
 static void
-info_proc_cmd_all (char *args, int from_tty)
+info_proc_cmd_all (const char *args, int from_tty)
 {
   info_proc_cmd_1 (args, IP_ALL, from_tty);
 }
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 39/67] Constify some commands in ax-gdb.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (59 preceding siblings ...)
  2017-09-21  5:41 ` [RFA 43/67] Constify some commands in probes.c Tom Tromey
@ 2017-09-21  5:41 ` Tom Tromey
  2017-09-21  5:41 ` [RFA 60/67] Constify some commands in macrocmd.c Tom Tromey
                   ` (6 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:41 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* ax-gdb.c (maint_agent_printf_command, agent_command)
	(agent_eval_command): Constify.
---
 gdb/ChangeLog |  5 +++++
 gdb/ax-gdb.c  | 13 ++++---------
 2 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/gdb/ax-gdb.c b/gdb/ax-gdb.c
index c4bf2a6..52ca081 100644
--- a/gdb/ax-gdb.c
+++ b/gdb/ax-gdb.c
@@ -158,8 +158,6 @@ static void gen_expr_binop_rest (struct expression *exp,
 				 struct axs_value *value,
 				 struct axs_value *value1,
 				 struct axs_value *value2);
-
-static void agent_command (char *exp, int from_tty);
 \f
 
 /* Detecting constant expressions.  */
@@ -2661,7 +2659,7 @@ agent_command_1 (const char *exp, int eval)
 }
 
 static void
-agent_command (char *exp, int from_tty)
+agent_command (const char *exp, int from_tty)
 {
   agent_command_1 (exp, 0);
 }
@@ -2671,7 +2669,7 @@ agent_command (char *exp, int from_tty)
    expression.  */
 
 static void
-agent_eval_command (char *exp, int from_tty)
+agent_eval_command (const char *exp, int from_tty)
 {
   agent_command_1 (exp, 1);
 }
@@ -2680,12 +2678,11 @@ agent_eval_command (char *exp, int from_tty)
    that does a printf, and display the resulting expression.  */
 
 static void
-maint_agent_printf_command (char *exp, int from_tty)
+maint_agent_printf_command (const char *cmdrest, int from_tty)
 {
   struct cleanup *old_chain = 0;
   struct expression *argvec[100];
   struct frame_info *fi = get_current_frame ();	/* need current scope */
-  const char *cmdrest;
   const char *format_start, *format_end;
   struct format_piece *fpieces;
   int nargs;
@@ -2697,11 +2694,9 @@ maint_agent_printf_command (char *exp, int from_tty)
   if (overlay_debugging)
     error (_("GDB can't do agent expression translation with overlays."));
 
-  if (exp == 0)
+  if (cmdrest == 0)
     error_no_arg (_("expression to translate"));
 
-  cmdrest = exp;
-
   cmdrest = skip_spaces (cmdrest);
 
   if (*cmdrest++ != '"')
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 43/67] Constify some commands in probes.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (58 preceding siblings ...)
  2017-09-21  5:41 ` [RFA 58/67] Constify some commands in i386-tdep.c Tom Tromey
@ 2017-09-21  5:41 ` Tom Tromey
  2017-09-21 12:47   ` Sergio Durigan Junior
  2017-09-21  5:41 ` [RFA 39/67] Constify some commands in ax-gdb.c Tom Tromey
                   ` (7 subsequent siblings)
  67 siblings, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:41 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* probe.c (enable_probes_command, disable_probes_command):
	Constify.
---
 gdb/ChangeLog | 5 +++++
 gdb/probe.c   | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/gdb/probe.c b/gdb/probe.c
index f44d25d..c6435e4 100644
--- a/gdb/probe.c
+++ b/gdb/probe.c
@@ -674,7 +674,7 @@ info_probes_command (char *arg, int from_tty)
 /* Implementation of the `enable probes' command.  */
 
 static void
-enable_probes_command (char *arg, int from_tty)
+enable_probes_command (const char *arg, int from_tty)
 {
   std::string provider, probe_name, objname;
   struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
@@ -713,7 +713,7 @@ enable_probes_command (char *arg, int from_tty)
 /* Implementation of the `disable probes' command.  */
 
 static void
-disable_probes_command (char *arg, int from_tty)
+disable_probes_command (const char *arg, int from_tty)
 {
   std::string provider, probe_name, objname;
   struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 60/67] Constify some commands in macrocmd.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (60 preceding siblings ...)
  2017-09-21  5:41 ` [RFA 39/67] Constify some commands in ax-gdb.c Tom Tromey
@ 2017-09-21  5:41 ` Tom Tromey
  2017-09-21  5:42 ` [RFA 42/67] Constify some commands in exec.c, plus symbol_file_command Tom Tromey
                   ` (5 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:41 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* macrocmd.c (macro_expand_command, macro_expand_once_command)
	(skip_ws, extract_identifier, macro_define_command)
	(macro_undef_command, macro_list_command): Constify.
---
 gdb/ChangeLog  |  6 ++++++
 gdb/macrocmd.c | 16 ++++++++--------
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/gdb/macrocmd.c b/gdb/macrocmd.c
index 957c479..0db43dc 100644
--- a/gdb/macrocmd.c
+++ b/gdb/macrocmd.c
@@ -53,7 +53,7 @@ macro_inform_no_debuginfo (void)
 }
 
 static void
-macro_expand_command (char *exp, int from_tty)
+macro_expand_command (const char *exp, int from_tty)
 {
   struct macro_scope *ms = NULL;
   char *expanded = NULL;
@@ -88,7 +88,7 @@ macro_expand_command (char *exp, int from_tty)
 
 
 static void
-macro_expand_once_command (char *exp, int from_tty)
+macro_expand_once_command (const char *exp, int from_tty)
 {
   struct macro_scope *ms = NULL;
   char *expanded = NULL;
@@ -298,7 +298,7 @@ info_macros_command (char *args, int from_tty)
 /* User-defined macros.  */
 
 static void
-skip_ws (char **expp)
+skip_ws (const char **expp)
 {
   while (macro_is_whitespace (**expp))
     ++*expp;
@@ -312,10 +312,10 @@ skip_ws (char **expp)
    parameters.  */
 
 static char *
-extract_identifier (char **expp, int is_parameter)
+extract_identifier (const char **expp, int is_parameter)
 {
   char *result;
-  char *p = *expp;
+  const char *p = *expp;
   unsigned int len;
 
   if (is_parameter && startswith (p, "..."))
@@ -358,7 +358,7 @@ free_macro_definition_ptr (void *ptr)
 }
 
 static void
-macro_define_command (char *exp, int from_tty)
+macro_define_command (const char *exp, int from_tty)
 {
   struct macro_definition new_macro;
   char *name = NULL;
@@ -440,7 +440,7 @@ macro_define_command (char *exp, int from_tty)
 
 
 static void
-macro_undef_command (char *exp, int from_tty)
+macro_undef_command (const char *exp, int from_tty)
 {
   char *name;
 
@@ -476,7 +476,7 @@ print_one_macro (const char *name, const struct macro_definition *macro,
 
 
 static void
-macro_list_command (char *exp, int from_tty)
+macro_list_command (const char *exp, int from_tty)
 {
   macro_for_each (macro_user_macros, print_one_macro);
 }
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 30/67] Constify tui_reg_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (64 preceding siblings ...)
  2017-09-21  5:42 ` [RFA 40/67] Constify some commands in tracepoint.c Tom Tromey
@ 2017-09-21  5:42 ` Tom Tromey
  2017-09-21  5:42 ` [RFA 61/67] Constify some commands in breakpoint.c Tom Tromey
  2017-09-21 10:26 ` [RFA 00/67] Simple add_cmd constification Pedro Alves
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:42 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* tui/tui-regs.c (tui_reg_command): Constify.
---
 gdb/ChangeLog      | 4 ++++
 gdb/tui/tui-regs.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c
index 838172e..be735b3 100644
--- a/gdb/tui/tui-regs.c
+++ b/gdb/tui/tui-regs.c
@@ -600,7 +600,7 @@ tui_reg_prev (struct gdbarch *gdbarch)
    not already on display.  */
 
 static void
-tui_reg_command (char *args, int from_tty)
+tui_reg_command (const char *args, int from_tty)
 {
   struct gdbarch *gdbarch = get_current_arch ();
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 40/67] Constify some commands in tracepoint.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (63 preceding siblings ...)
  2017-09-21  5:42 ` [RFA 57/67] Constify add_symbol_file_from_memory_command Tom Tromey
@ 2017-09-21  5:42 ` Tom Tromey
  2017-09-21 10:03   ` Pedro Alves
  2017-09-21  5:42 ` [RFA 30/67] Constify tui_reg_command Tom Tromey
                   ` (2 subsequent siblings)
  67 siblings, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:42 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* tracepoint.c (delete_trace_variable_command)
	(tfind_end_command, tfind_start_command, tfind_pc_command)
	(tfind_tracepoint_command, tfind_line_command)
	(tfind_range_command, tfind_outside_command): Constify.
---
 gdb/ChangeLog    |  7 +++++++
 gdb/tracepoint.c | 42 ++++++++++++++++--------------------------
 2 files changed, 23 insertions(+), 26 deletions(-)

diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 52a449a..30e3a3a 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -165,18 +165,6 @@ char *trace_notes = NULL;
 
 char *trace_stop_notes = NULL;
 
-/* ======= Important command functions: ======= */
-static void actions_command (char *, int);
-static void tstart_command (char *, int);
-static void tstop_command (char *, int);
-static void tstatus_command (char *, int);
-static void tfind_pc_command (char *, int);
-static void tfind_tracepoint_command (char *, int);
-static void tfind_line_command (char *, int);
-static void tfind_range_command (char *, int);
-static void tfind_outside_command (char *, int);
-static void tdump_command (char *, int);
-
 /* support routines */
 
 struct collection_list;
@@ -442,7 +430,7 @@ trace_variable_command (char *args, int from_tty)
 }
 
 static void
-delete_trace_variable_command (char *args, int from_tty)
+delete_trace_variable_command (const char *args, int from_tty)
 {
   if (args == NULL)
     {
@@ -2362,21 +2350,21 @@ tfind_command (char *args, int from_tty)
 
 /* tfind end */
 static void
-tfind_end_command (char *args, int from_tty)
+tfind_end_command (const char *args, int from_tty)
 {
   tfind_command_1 ("-1", from_tty);
 }
 
 /* tfind start */
 static void
-tfind_start_command (char *args, int from_tty)
+tfind_start_command (const char *args, int from_tty)
 {
   tfind_command_1 ("0", from_tty);
 }
 
 /* tfind pc command */
 static void
-tfind_pc_command (char *args, int from_tty)
+tfind_pc_command (const char *args, int from_tty)
 {
   CORE_ADDR pc;
 
@@ -2392,7 +2380,7 @@ tfind_pc_command (char *args, int from_tty)
 
 /* tfind tracepoint command */
 static void
-tfind_tracepoint_command (char *args, int from_tty)
+tfind_tracepoint_command (const char *args, int from_tty)
 {
   int tdp;
   struct tracepoint *tp;
@@ -2428,7 +2416,7 @@ tfind_tracepoint_command (char *args, int from_tty)
    corresponding to a source line OTHER THAN THE CURRENT ONE.  */
 
 static void
-tfind_line_command (char *args, int from_tty)
+tfind_line_command (const char *args, int from_tty)
 {
   check_trace_running (current_trace_status ());
 
@@ -2486,10 +2474,10 @@ tfind_line_command (char *args, int from_tty)
 
 /* tfind range command */
 static void
-tfind_range_command (char *args, int from_tty)
+tfind_range_command (const char *args, int from_tty)
 {
   static CORE_ADDR start, stop;
-  char *tmp;
+  const char *tmp;
 
   check_trace_running (current_trace_status ());
 
@@ -2501,9 +2489,10 @@ tfind_range_command (char *args, int from_tty)
 
   if (0 != (tmp = strchr (args, ',')))
     {
-      *tmp++ = '\0';	/* Terminate start address.  */
+      std::string start_addr (args, tmp);
+      ++tmp;
       tmp = skip_spaces (tmp);
-      start = parse_and_eval_address (args);
+      start = parse_and_eval_address (start_addr.c_str ());
       stop = parse_and_eval_address (tmp);
     }
   else
@@ -2517,10 +2506,10 @@ tfind_range_command (char *args, int from_tty)
 
 /* tfind outside command */
 static void
-tfind_outside_command (char *args, int from_tty)
+tfind_outside_command (const char *args, int from_tty)
 {
   CORE_ADDR start, stop;
-  char *tmp;
+  const char *tmp;
 
   if (current_trace_status ()->running
       && current_trace_status ()->filename == NULL)
@@ -2534,9 +2523,10 @@ tfind_outside_command (char *args, int from_tty)
 
   if (0 != (tmp = strchr (args, ',')))
     {
-      *tmp++ = '\0';	/* Terminate start address.  */
+      std::string start_addr (args, tmp);
+      ++tmp;
       tmp = skip_spaces (tmp);
-      start = parse_and_eval_address (args);
+      start = parse_and_eval_address (start_addr.c_str ());
       stop = parse_and_eval_address (tmp);
     }
   else
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 61/67] Constify some commands in breakpoint.c
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (65 preceding siblings ...)
  2017-09-21  5:42 ` [RFA 30/67] Constify tui_reg_command Tom Tromey
@ 2017-09-21  5:42 ` Tom Tromey
  2017-09-21  9:56   ` Pedro Alves
  2017-09-21 10:26 ` [RFA 00/67] Simple add_cmd constification Pedro Alves
  67 siblings, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:42 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

This also makes delete_command static; but now I wonder if it is used
in Insight and should not be touched.

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* breakpoint.h (delete_command): Don't declare.
	* breakpoint.c (delete_command, enable_once_command)
	(enable_count_command, enable_delete_command, breakpoint_1)
	(maintenance_info_breakpoints, stopin_command, stopat_command)
	(delete_command, delete_trace_command, save_breakpoints)
	(save_breakpoints_command, save_tracepoints_command): Constify.
---
 gdb/ChangeLog    |  9 +++++++++
 gdb/breakpoint.c | 45 ++++++++++++++-------------------------------
 gdb/breakpoint.h |  4 ----
 3 files changed, 23 insertions(+), 35 deletions(-)

diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 1073418..59cb354 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -94,12 +94,6 @@ enum exception_event_kind
 
 /* Prototypes for local functions.  */
 
-static void enable_delete_command (char *, int);
-
-static void enable_once_command (char *, int);
-
-static void enable_count_command (char *, int);
-
 static void disable_command (char *, int);
 
 static void enable_command (char *, int);
@@ -184,9 +178,6 @@ static void info_breakpoints_command (char *, int);
 
 static void info_watchpoints_command (char *, int);
 
-static int breakpoint_1 (char *, int, 
-			 int (*) (const struct breakpoint *));
-
 static int breakpoint_cond_eval (void *);
 
 static void cleanup_executing_breakpoints (void *);
@@ -202,8 +193,6 @@ static enum print_stop_action print_bp_stop_message (bpstat bs);
 
 static int watchpoint_check (void *);
 
-static void maintenance_info_breakpoints (char *, int);
-
 static int hw_breakpoint_used_count (void);
 
 static int hw_watchpoint_use_count (struct breakpoint *);
@@ -221,10 +210,6 @@ static void enable_breakpoint_disp (struct breakpoint *, enum bpdisp,
 
 static void stop_command (char *arg, int from_tty);
 
-static void stopin_command (char *arg, int from_tty);
-
-static void stopat_command (char *arg, int from_tty);
-
 static void tcatch_command (char *arg, int from_tty);
 
 static void free_bp_location (struct bp_location *loc);
@@ -278,8 +263,6 @@ static void insert_breakpoint_locations (void);
 
 static void info_tracepoints_command (char *, int);
 
-static void delete_trace_command (char *, int);
-
 static void enable_trace_command (char *, int);
 
 static void disable_trace_command (char *, int);
@@ -6679,7 +6662,7 @@ pending_breakpoint_p (struct breakpoint *b)
    breakpoints listed.  */
 
 static int
-breakpoint_1 (char *args, int allflag, 
+breakpoint_1 (const char *args, int allflag, 
 	      int (*filter) (const struct breakpoint *))
 {
   struct breakpoint *b;
@@ -6864,7 +6847,7 @@ info_watchpoints_command (char *args, int from_tty)
 }
 
 static void
-maintenance_info_breakpoints (char *args, int from_tty)
+maintenance_info_breakpoints (const char *args, int from_tty)
 {
   breakpoint_1 (args, 1, NULL);
 
@@ -9795,7 +9778,7 @@ Usage: stop in <function | address>\n\
 }
 
 static void
-stopin_command (char *arg, int from_tty)
+stopin_command (const char *arg, int from_tty)
 {
   int badInput = 0;
 
@@ -9803,7 +9786,7 @@ stopin_command (char *arg, int from_tty)
     badInput = 1;
   else if (*arg != '*')
     {
-      char *argptr = arg;
+      const char *argptr = arg;
       int hasColon = 0;
 
       /* Look for a ':'.  If this is a line number specification, then
@@ -9828,7 +9811,7 @@ stopin_command (char *arg, int from_tty)
 }
 
 static void
-stopat_command (char *arg, int from_tty)
+stopat_command (const char *arg, int from_tty)
 {
   int badInput = 0;
 
@@ -9836,7 +9819,7 @@ stopat_command (char *arg, int from_tty)
     badInput = 1;
   else
     {
-      char *argptr = arg;
+      const char *argptr = arg;
       int hasColon = 0;
 
       /* Look for a ':'.  If there is a '::' then get out, otherwise
@@ -13568,7 +13551,7 @@ iterate_over_related_breakpoints (struct breakpoint *b,
   while (related != b);
 }
 
-void
+static void
 delete_command (char *arg, int from_tty)
 {
   struct breakpoint *b, *b_tmp;
@@ -14596,7 +14579,7 @@ enable_command (char *args, int from_tty)
 }
 
 static void
-enable_once_command (char *args, int from_tty)
+enable_once_command (const char *args, int from_tty)
 {
   map_breakpoint_numbers
     (args, [&] (breakpoint *b)
@@ -14610,7 +14593,7 @@ enable_once_command (char *args, int from_tty)
 }
 
 static void
-enable_count_command (char *args, int from_tty)
+enable_count_command (const char *args, int from_tty)
 {
   int count;
 
@@ -14631,7 +14614,7 @@ enable_count_command (char *args, int from_tty)
 }
 
 static void
-enable_delete_command (char *args, int from_tty)
+enable_delete_command (const char *args, int from_tty)
 {
   map_breakpoint_numbers
     (args, [&] (breakpoint *b)
@@ -15014,7 +14997,7 @@ disable_trace_command (char *args, int from_tty)
 
 /* Remove a tracepoint (or all if no argument).  */
 static void
-delete_trace_command (char *arg, int from_tty)
+delete_trace_command (const char *arg, int from_tty)
 {
   struct breakpoint *b, *b_tmp;
 
@@ -15208,7 +15191,7 @@ print_recreate_thread (struct breakpoint *b, struct ui_file *fp)
    non-zero.  */
 
 static void
-save_breakpoints (char *filename, int from_tty,
+save_breakpoints (const char *filename, int from_tty,
 		  int (*filter) (const struct breakpoint *))
 {
   struct breakpoint *tp;
@@ -15326,7 +15309,7 @@ save_breakpoints (char *filename, int from_tty,
 /* The `save breakpoints' command.  */
 
 static void
-save_breakpoints_command (char *args, int from_tty)
+save_breakpoints_command (const char *args, int from_tty)
 {
   save_breakpoints (args, from_tty, NULL);
 }
@@ -15334,7 +15317,7 @@ save_breakpoints_command (char *args, int from_tty)
 /* The `save tracepoints' command.  */
 
 static void
-save_tracepoints_command (char *args, int from_tty)
+save_tracepoints_command (const char *args, int from_tty)
 {
   save_breakpoints (args, from_tty, is_tracepoint);
 }
diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h
index 154ff3a..ff49cd2 100644
--- a/gdb/breakpoint.h
+++ b/gdb/breakpoint.h
@@ -1521,10 +1521,6 @@ extern int is_catchpoint (struct breakpoint *);
 extern void add_solib_catchpoint (const char *arg, int is_load, int is_temp,
                                   int enabled);
 
-/* Enable breakpoints and delete when hit.  Called with ARG == NULL
-   deletes all breakpoints.  */
-extern void delete_command (char *arg, int from_tty);
-
 /* Create and insert a new software single step breakpoint for the
    current thread.  May be called multiple times; each time will add a
    new location to the set of potential addresses the next instruction
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 57/67] Constify add_symbol_file_from_memory_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (62 preceding siblings ...)
  2017-09-21  5:42 ` [RFA 42/67] Constify some commands in exec.c, plus symbol_file_command Tom Tromey
@ 2017-09-21  5:42 ` Tom Tromey
  2017-09-21  5:42 ` [RFA 40/67] Constify some commands in tracepoint.c Tom Tromey
                   ` (3 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:42 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* symfile-mem.c (add_symbol_file_from_memory_command): Constify.
---
 gdb/ChangeLog     | 4 ++++
 gdb/symfile-mem.c | 2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index b3543d6..6f34cab 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -145,7 +145,7 @@ symbol_file_add_from_memory (struct bfd *templ, CORE_ADDR addr,
 
 
 static void
-add_symbol_file_from_memory_command (char *args, int from_tty)
+add_symbol_file_from_memory_command (const char *args, int from_tty)
 {
   CORE_ADDR addr;
   struct bfd *templ;
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* [RFA 42/67] Constify some commands in exec.c, plus symbol_file_command
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (61 preceding siblings ...)
  2017-09-21  5:41 ` [RFA 60/67] Constify some commands in macrocmd.c Tom Tromey
@ 2017-09-21  5:42 ` Tom Tromey
  2017-09-21  5:42 ` [RFA 57/67] Constify add_symbol_file_from_memory_command Tom Tromey
                   ` (4 subsequent siblings)
  67 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-21  5:42 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Note that this commit also changes deprecated_file_changed_hook -- not
used in the tree, but Insight will require a (presumably minor)
change.

ChangeLog
2017-09-20  Tom Tromey  <tom@tromey.com>

	* symfile.c (symbol_file_command): Constify.
	* gdbcore.h (deprecated_file_changed_hook): Constify.
	* exec.c (deprecated_file_changed_hook, exec_file_command)
	(file_command): Constify.
	* defs.h (symbol_file_command): Constify.
---
 gdb/ChangeLog | 8 ++++++++
 gdb/defs.h    | 2 +-
 gdb/exec.c    | 8 +++-----
 gdb/gdbcore.h | 2 +-
 gdb/symfile.c | 2 +-
 5 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/gdb/defs.h b/gdb/defs.h
index af9e32e..a25ebf6 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -304,7 +304,7 @@ EXTERN_C char *re_comp (const char *);
 
 /* From symfile.c */
 
-extern void symbol_file_command (char *, int);
+extern void symbol_file_command (const char *, int);
 
 /* * Remote targets may wish to use this as their load function.  */
 extern void generic_load (const char *name, int from_tty);
diff --git a/gdb/exec.c b/gdb/exec.c
index d20afdc..6eda9b2 100644
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -45,12 +45,10 @@
 #include "solist.h"
 #include <algorithm>
 
-void (*deprecated_file_changed_hook) (char *);
+void (*deprecated_file_changed_hook) (const char *);
 
 /* Prototypes for local functions */
 
-static void file_command (char *, int);
-
 static void set_section_command (char *, int);
 
 static void exec_files_info (struct target_ops *);
@@ -398,7 +396,7 @@ exec_file_attach (const char *filename, int from_tty)
    If ARGS is NULL, we just want to close the exec file.  */
 
 static void
-exec_file_command (char *args, int from_tty)
+exec_file_command (const char *args, int from_tty)
 {
   char *filename;
 
@@ -433,7 +431,7 @@ exec_file_command (char *args, int from_tty)
    command was added?  */
 
 static void
-file_command (char *arg, int from_tty)
+file_command (const char *arg, int from_tty)
 {
   /* FIXME, if we lose on reading the symbol file, we should revert
      the exec file, but that's rough.  */
diff --git a/gdb/gdbcore.h b/gdb/gdbcore.h
index 7554245..5c86e98 100644
--- a/gdb/gdbcore.h
+++ b/gdb/gdbcore.h
@@ -127,7 +127,7 @@ extern void (*deprecated_exec_file_display_hook) (const char *filename);
 /* Hook for "file_command", which is more useful than above
    (because it is invoked AFTER symbols are read, not before).  */
 
-extern void (*deprecated_file_changed_hook) (char *filename);
+extern void (*deprecated_file_changed_hook) (const char *filename);
 
 extern void specify_exec_file_hook (void (*hook) (const char *filename));
 
diff --git a/gdb/symfile.c b/gdb/symfile.c
index c6e3b90..c6d657b 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1617,7 +1617,7 @@ find_separate_debug_file_by_debuglink (struct objfile *objfile)
    conventions (because it is confusing and inconvenient).  */
 
 void
-symbol_file_command (char *args, int from_tty)
+symbol_file_command (const char *args, int from_tty)
 {
   dont_repeat ();
 
-- 
2.9.4

^ permalink raw reply	[flat|nested] 110+ messages in thread

* RE: [RFA 01/67] Add add_cmd function overloads
  2017-09-21  5:16 ` [RFA 01/67] Add add_cmd function overloads Tom Tromey
@ 2017-09-21  7:02   ` Metzger, Markus T
  2017-09-21 10:25     ` Pedro Alves
  2017-09-23  4:14     ` Tom Tromey
  2017-09-21 10:25   ` Pedro Alves
  1 sibling, 2 replies; 110+ messages in thread
From: Metzger, Markus T @ 2017-09-21  7:02 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Tom Tromey
> Sent: Thursday, September 21, 2017 7:09 AM
> To: gdb-patches@sourceware.org
> Cc: Tom Tromey <tom@tromey.com>
> Subject: [RFA 01/67] Add add_cmd function overloads

Hello Tom,

>  static void
> +do_const_cfunc (struct cmd_list_element *c, char *args, int from_tty)
> +{
> +  c->function.const_cfunc (args, from_tty); /* Ok.  */
> +}

Ok.?


> +void
> +set_cmd_cfunc (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfunc)
> +{
> +  if (cfunc == NULL)
> +    cmd->func = NULL;
> +  else
> +    cmd->func = do_const_cfunc;
> +  cmd->function.const_cfunc = cfunc; /* Ok.  */
> +}

We shouldn't really have the NULL case, anymore.  It is still possible  but I don't expect it to be used.  Should we assert CFUNC != NULL?

Should we also set CMD->FUNCTION.CFUNC to NULL?


> @@ -229,7 +251,6 @@ add_cmd (const char *name, enum command_class
> theclass, cmd_cfunc_ftype *fun,
> 
>    c->name = name;
>    c->theclass = theclass;
> -  set_cmd_cfunc (c, fun);

Should we instead set all the respective fields to NULL?


> +struct cmd_list_element *
> +add_cmd (const char *name, enum command_class theclass,
> +	 const char *doc, struct cmd_list_element **list)
> +{
> +  cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
> +  result->func = NULL;
> +  result->function.cfunc = NULL; /* Ok.  */
> +  return result;
> +}

Should we also set RESULT->FUNCTION.CONST_CFUNC to NULL?


Regards,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 110+ messages in thread

* RE: [RFA 28/67] Constify some commands in record-btrace.c
  2017-09-21  5:13 ` [RFA 28/67] Constify some commands in record-btrace.c Tom Tromey
@ 2017-09-21  7:02   ` Metzger, Markus T
  0 siblings, 0 replies; 110+ messages in thread
From: Metzger, Markus T @ 2017-09-21  7:02 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Tom Tromey
> Sent: Thursday, September 21, 2017 7:10 AM
> To: gdb-patches@sourceware.org
> Cc: Tom Tromey <tom@tromey.com>
> Subject: [RFA 28/67] Constify some commands in record-btrace.c

Hello Tom,

> ChangeLog
> 2017-09-20  Tom Tromey  <tom@tromey.com>
> 
> 	* record-btrace.c (cmd_record_btrace_bts_start)
> 	(cmd_record_btrace_pt_start): Constify.
> ---
>  gdb/ChangeLog       | 5 +++++
>  gdb/record-btrace.c | 4 ++--
>  2 files changed, 7 insertions(+), 2 deletions(-)

Looks good to me.

Thanks,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 110+ messages in thread

* RE: [RFA 49/67] Constify some commands in btrace.c
  2017-09-21  5:39 ` [RFA 49/67] Constify some commands in btrace.c Tom Tromey
@ 2017-09-21  7:02   ` Metzger, Markus T
  2017-09-21 11:11     ` Pedro Alves
  0 siblings, 1 reply; 110+ messages in thread
From: Metzger, Markus T @ 2017-09-21  7:02 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Tom Tromey
> Sent: Thursday, September 21, 2017 7:10 AM
> To: gdb-patches@sourceware.org
> Cc: Tom Tromey <tom@tromey.com>
> Subject: [RFA 49/67] Constify some commands in btrace.c

Hello Tom,

> ChangeLog
> 2017-09-20  Tom Tromey  <tom@tromey.com>
> 
> 	* btrace.c (get_uint, get_context_size, no_chunk)
> 	(maint_btrace_packet_history_cmd)
> 	(maint_btrace_clear_packet_history_cmd, maint_btrace_clear_cmd)
> 	(maint_info_btrace_cmd): Constify.
> ---
>  gdb/ChangeLog |  7 +++++++
>  gdb/btrace.c  | 24 ++++++++++++++----------
>  2 files changed, 21 insertions(+), 10 deletions(-)

Looks good to me.


> @@ -3213,13 +3214,16 @@ get_context_size (char **arg)
>    if (!isdigit (*pos))
>      error (_("Expected positive number, got: %s."), pos);
> 
> -  return strtol (pos, arg, 10);
> +  char *end;
> +  long result = strtol (pos, &end, 10);
> +  *arg = end;
> +  return result;
>  }

The rest of the declarations are at the beginning.  I'd prefer to keep it that way.

Thanks,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 110+ messages in thread

* RE: [RFA 37/67] Constify some commands in record.c
  2017-09-21  5:40 ` [RFA 37/67] Constify some commands in record.c Tom Tromey
@ 2017-09-21  7:02   ` Metzger, Markus T
  2017-09-23  4:05     ` Tom Tromey
  2017-09-21 10:00   ` Pedro Alves
  1 sibling, 1 reply; 110+ messages in thread
From: Metzger, Markus T @ 2017-09-21  7:02 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Tom Tromey
> Sent: Thursday, September 21, 2017 7:10 AM
> To: gdb-patches@sourceware.org
> Cc: Tom Tromey <tom@tromey.com>
> Subject: [RFA 37/67] Constify some commands in record.c

Hello Tom,

> ChangeLog
> 2017-09-20  Tom Tromey  <tom@tromey.com>
> 
> 	* record.c (cmd_record_delete, cmd_record_stop, cmd_record_save)
> 	(cmd_record_goto_begin, cmd_record_goto_end, get_insn_number)
> 	(get_context_size, no_chunk, get_insn_history_modifiers)
> 	(cmd_record_insn_history, get_call_history_modifiers)
> 	(cmd_record_call_history): Constify.
> ---
>  gdb/ChangeLog |  8 ++++++++
>  gdb/record.c  | 36 ++++++++++++++++++++----------------
>  2 files changed, 28 insertions(+), 16 deletions(-)

Looks good to me.


> @@ -354,7 +354,8 @@ info_record_command (char *args, int from_tty)
>  static void
>  cmd_record_save (char *args, int from_tty)
>  {
> -  char *recfilename, recfilename_buffer[40];
> +  const char *recfilename;
> +  char recfilename_buffer[40];
> 
>    require_record_target ();

This isn't really related to adding a const add_cmd () version.


> @@ -456,13 +458,15 @@ get_context_size (char **arg)
>    if (!isdigit (*pos))
>      error (_("Expected positive number, got: %s."), pos);
> 
> -  return strtol (pos, arg, 10);
> +   long result = strtol (pos, &end, 10);
> +   *arg = end;
> +   return result;
>  }

The rest of the declarations are still at the beginning.


Thanks,
Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 110+ messages in thread

* RE: [RFA 17/67] Constify cmd_record_full_restore
  2017-09-21  5:17 ` [RFA 17/67] Constify cmd_record_full_restore Tom Tromey
@ 2017-09-21  7:02   ` Metzger, Markus T
  0 siblings, 0 replies; 110+ messages in thread
From: Metzger, Markus T @ 2017-09-21  7:02 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Tom Tromey
> Sent: Thursday, September 21, 2017 7:10 AM
> To: gdb-patches@sourceware.org
> Cc: Tom Tromey <tom@tromey.com>
> Subject: [RFA 17/67] Constify cmd_record_full_restore

Hello Tom,

> ChangeLog
> 2017-09-20  Tom Tromey  <tom@tromey.com>
> 
> 	* record-full.c (cmd_record_full_restore): Constify.
> ---
>  gdb/ChangeLog     | 4 ++++
>  gdb/record-full.c | 2 +-
>  2 files changed, 5 insertions(+), 1 deletion(-)

Looks good to me.

Thanks,
Markus.

Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 59/67] Constify some commands in infcmd.c
  2017-09-21  5:41 ` [RFA 59/67] Constify some commands in infcmd.c Tom Tromey
@ 2017-09-21  9:56   ` Pedro Alves
  0 siblings, 0 replies; 110+ messages in thread
From: Pedro Alves @ 2017-09-21  9:56 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 09/21/2017 06:10 AM, Tom Tromey wrote:
> @@ -2230,21 +2222,20 @@ set_environment_command (char *arg, int from_tty)
>    while (p != arg && (p[-1] == ' ' || p[-1] == '\t'))
>      p--;
>  
> -  var = savestring (arg, p - arg);
> +  std::string var (arg, p - arg);
>    if (nullset)
>      {
>        printf_filtered (_("Setting environment variable "
>  			 "\"%s\" to null value.\n"),
> -		       var);
> -      current_inferior ()->environment.set (var, "");
> +		       var.c_str ());
> +      current_inferior ()->environment.set (var.c_str (), "");
>      }
>    else
> -    current_inferior ()->environment.set (var, val);
> -  xfree (var);
> +    current_inferior ()->environment.set (var.c_str (), val);
>  }

Nice, this fixes a potential leak.  OK.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 61/67] Constify some commands in breakpoint.c
  2017-09-21  5:42 ` [RFA 61/67] Constify some commands in breakpoint.c Tom Tromey
@ 2017-09-21  9:56   ` Pedro Alves
  2017-09-21 13:20     ` Patrick Monnerat
  0 siblings, 1 reply; 110+ messages in thread
From: Pedro Alves @ 2017-09-21  9:56 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches, Patrick Monnerat

On 09/21/2017 06:10 AM, Tom Tromey wrote:
> This also makes delete_command static; but now I wonder if it is used
> in Insight and should not be touched.

[Adding Patrick]

Insight git is on sourceware nowadays:
  git://sourceware.org/git/insight.git

$ git grep delete_command
...
gdbtk/generic/gdbtk-cmds.c:  delete_command (NULL, 0);

I guess it'd be mildly nicer to add some "void delete_all_breakpoints();"
API instead of abusing the command callback.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 37/67] Constify some commands in record.c
  2017-09-21  5:40 ` [RFA 37/67] Constify some commands in record.c Tom Tromey
  2017-09-21  7:02   ` Metzger, Markus T
@ 2017-09-21 10:00   ` Pedro Alves
  2017-09-23  4:05     ` Tom Tromey
  2017-09-23  4:29     ` Tom Tromey
  1 sibling, 2 replies; 110+ messages in thread
From: Pedro Alves @ 2017-09-21 10:00 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 09/21/2017 06:09 AM, Tom Tromey wrote:
> @@ -456,13 +458,15 @@ get_context_size (char **arg)
>    if (!isdigit (*pos))
>      error (_("Expected positive number, got: %s."), pos);
>  
> -  return strtol (pos, arg, 10);
> +   long result = strtol (pos, &end, 10);
> +   *arg = end;
> +   return result;
>  }

Indentation looks odd.  [3 spaces instead of 2?]

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 40/67] Constify some commands in tracepoint.c
  2017-09-21  5:42 ` [RFA 40/67] Constify some commands in tracepoint.c Tom Tromey
@ 2017-09-21 10:03   ` Pedro Alves
  2017-09-23  4:34     ` Tom Tromey
  0 siblings, 1 reply; 110+ messages in thread
From: Pedro Alves @ 2017-09-21 10:03 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

This looks OK, but ...

On 09/21/2017 06:09 AM, Tom Tromey wrote:

> @@ -2501,9 +2489,10 @@ tfind_range_command (char *args, int from_tty)
>  
>    if (0 != (tmp = strchr (args, ',')))
>      {
> -      *tmp++ = '\0';	/* Terminate start address.  */
> +      std::string start_addr (args, tmp);
> +      ++tmp;

... this fixes an actual bug:

 (gdb) tfind range 1, 2
 Breakpoint 4, tfind_range_command (args=0x30a0cbc "1, 2", from_tty=1) at src/gdb/tracepoint.c:2496
 ...
 (top gdb) c
 (gdb) <enter again for repeat>
 Breakpoint 4, tfind_range_command (args=0x30a0cbc "1", from_tty=1) at src/gdb/tracepoint.c:2496

Which is great, and shows that constification pays off.

I think it'd have been nice to split fixes like these to a
separate patch, or at least mention them in the commit log, though.

[/me goes read patches 2-40 again to double check.]

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 38/67] Constify some linespec functions
  2017-09-21  5:40 ` [RFA 38/67] Constify some linespec functions Tom Tromey
@ 2017-09-21 10:04   ` Pedro Alves
  2017-09-23  4:03     ` Tom Tromey
  0 siblings, 1 reply; 110+ messages in thread
From: Pedro Alves @ 2017-09-21 10:04 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 09/21/2017 06:09 AM, Tom Tromey wrote:

In several places you followed a pattern like:

>  static void
> -foo_command (char *args, int from_tty)
> +foo_command (char *args_in, int from_tty)

... and then args_in wasn't used.

I'd be nice to mention in the commit log the reason for this.
I assume that it's because we don't have the corresponding
constified add_cmd variant?

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 35/67] Constify commands maint.c, plus maintenance_print_type
  2017-09-21  5:40 ` [RFA 35/67] Constify commands maint.c, plus maintenance_print_type Tom Tromey
@ 2017-09-21 10:06   ` Pedro Alves
  2017-09-23  4:32     ` Tom Tromey
  0 siblings, 1 reply; 110+ messages in thread
From: Pedro Alves @ 2017-09-21 10:06 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 09/21/2017 06:09 AM, Tom Tromey wrote:
>  
> @@ -591,8 +583,7 @@ maintenance_do_deprecate (char *text, int deprecate)
>  	  if (end_ptr != NULL)
>  	    {
>  	      len = end_ptr - start_ptr;
> -	      start_ptr[len] = '\0';
> -	      replacement = xstrdup (start_ptr);
> +	      replacement = savestring (start_ptr, len);
>  	    }

This looks like another "command repeat" bug fix, right?  Yay!  :-)

(Please mention it in the commit log.)

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 01/67] Add add_cmd function overloads
  2017-09-21  5:16 ` [RFA 01/67] Add add_cmd function overloads Tom Tromey
  2017-09-21  7:02   ` Metzger, Markus T
@ 2017-09-21 10:25   ` Pedro Alves
  2017-09-23  4:18     ` Tom Tromey
  2017-09-23  4:30     ` Tom Tromey
  1 sibling, 2 replies; 110+ messages in thread
From: Pedro Alves @ 2017-09-21 10:25 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 09/21/2017 06:09 AM, Tom Tromey wrote:
> @@ -140,6 +141,15 @@ extern struct cmd_list_element *add_cmd (const char *, enum command_class,
>  					 const char *,
>  					 struct cmd_list_element **);
>  
> +extern struct cmd_list_element *add_cmd (const char *, enum command_class,
> +					 const char *,
> +					 struct cmd_list_element **);
> +
> +extern struct cmd_list_element *add_cmd (const char *, enum command_class,
> +					 cmd_const_cfunc_ftype *fun,
> +					 const char *,
> +					 struct cmd_list_element **);
> +

Can you please add some comments describing the difference between the
overloads?  Here and in other cases.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 01/67] Add add_cmd function overloads
  2017-09-21  7:02   ` Metzger, Markus T
@ 2017-09-21 10:25     ` Pedro Alves
  2017-09-23  4:14       ` Tom Tromey
  2017-09-23  4:14     ` Tom Tromey
  1 sibling, 1 reply; 110+ messages in thread
From: Pedro Alves @ 2017-09-21 10:25 UTC (permalink / raw)
  To: Metzger, Markus T, Tom Tromey, gdb-patches

On 09/21/2017 08:02 AM, Metzger, Markus T wrote:

>> +void
>> +set_cmd_cfunc (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfunc)
>> +{
>> +  if (cfunc == NULL)
>> +    cmd->func = NULL;
>> +  else
>> +    cmd->func = do_const_cfunc;
>> +  cmd->function.const_cfunc = cfunc; /* Ok.  */
>> +}
> 
> We shouldn't really have the NULL case, anymore.  It is still possible  but I don't expect it to be used.  Should we assert CFUNC != NULL?

If that's possible, then it'd be nice to add ATTRIBUTE_NONNULL
on the declaration too.

> 
> Should we also set CMD->FUNCTION.CFUNC to NULL?

I think not, because it's a union.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 00/67] Simple add_cmd constification
  2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
                   ` (66 preceding siblings ...)
  2017-09-21  5:42 ` [RFA 61/67] Constify some commands in breakpoint.c Tom Tromey
@ 2017-09-21 10:26 ` Pedro Alves
  2017-09-26 12:19   ` Pedro Alves
  67 siblings, 1 reply; 110+ messages in thread
From: Pedro Alves @ 2017-09-21 10:26 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 09/21/2017 06:09 AM, Tom Tromey wrote:
> First, left me offer my apologies for the length of this series.  It
> was somewhat simpler to break it into many tiny pieces, because
> sometimes when const-ifying it is easy to get in over one's head.  On
> the plus side, nearly all of the patches are trivial and so review
> should not be too difficult -- just boring.
> 
> This starts by adding const-correct overloads of add_cmd and a few
> related functions.  Then, it converts many functions to use the
> const-correct form.  The idea is to gradually convert all commands
> (and set/show, etc) to const-correctness, then remove the non-const
> overloads.
> 
> Regression tested on the buildbot.

I've read the whole series and sent a few comments, but it
all looks generally fine to me.  Those patches that I haven't
commented on looked OK as-is to me.

Thanks for doing all this.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 49/67] Constify some commands in btrace.c
  2017-09-21  7:02   ` Metzger, Markus T
@ 2017-09-21 11:11     ` Pedro Alves
  2017-09-21 13:06       ` Metzger, Markus T
  0 siblings, 1 reply; 110+ messages in thread
From: Pedro Alves @ 2017-09-21 11:11 UTC (permalink / raw)
  To: Metzger, Markus T, Tom Tromey, gdb-patches

On 09/21/2017 08:02 AM, Metzger, Markus T wrote:

>> @@ -3213,13 +3214,16 @@ get_context_size (char **arg)
>>    if (!isdigit (*pos))
>>      error (_("Expected positive number, got: %s."), pos);
>>
>> -  return strtol (pos, arg, 10);
>> +  char *end;
>> +  long result = strtol (pos, &end, 10);
>> +  *arg = end;
>> +  return result;
>>  }
> 
> The rest of the declarations are at the beginning.  I'd prefer to keep it that way.

Interesting.  Out of curiosity, is there a particular reason for
that preference?  I ask because we haven't adjusted our guidelines
in this area yet, but I've been asking people to move
declarations nearer where they're initialized in patch reviews.
My reasoning for that has been that IMHO, declarations nearer to
where they're initialized help with a few things:

 - helps with reasoning about the code, since the type of
   the variable has more changes of being visible.  The
   top of the scope may be a good number of lines above.

 - helps prevent accidental used-uninitialized bugs.

 - avoid gratuitous pessimization when the variable is of
   non-trivial type, by avoiding separate default
   construction + assignment steps.  (though that's not the
   case here, since in this case all variables are scalars).

The point that I feel particularly strongly about is the
last one, about non-trivial types, though as said that
doesn't apply in this case.

For the first two points, in C89, we'd some times open a
extra scope, like in this case you could write:

    {
      char *end;
      long result = strtol (pos, &end, 10);

      *arg = end;
      return result;
    }

In C99/C++, we can write declarations in the middle of
blocks without forcing the extra scope.

It's really up to you the style to use for this code as
btrace maintainer, but I hope that at least this clarifies
things for those that end up being asked different
things from different people.  :-)

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 43/67] Constify some commands in probes.c
  2017-09-21  5:41 ` [RFA 43/67] Constify some commands in probes.c Tom Tromey
@ 2017-09-21 12:47   ` Sergio Durigan Junior
  0 siblings, 0 replies; 110+ messages in thread
From: Sergio Durigan Junior @ 2017-09-21 12:47 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Thursday, September 21 2017, Tom Tromey wrote:

> ChangeLog
> 2017-09-20  Tom Tromey  <tom@tromey.com>
>
> 	* probe.c (enable_probes_command, disable_probes_command):
> 	Constify.

This is OK.

Thanks,

> ---
>  gdb/ChangeLog | 5 +++++
>  gdb/probe.c   | 4 ++--
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/probe.c b/gdb/probe.c
> index f44d25d..c6435e4 100644
> --- a/gdb/probe.c
> +++ b/gdb/probe.c
> @@ -674,7 +674,7 @@ info_probes_command (char *arg, int from_tty)
>  /* Implementation of the `enable probes' command.  */
>  
>  static void
> -enable_probes_command (char *arg, int from_tty)
> +enable_probes_command (const char *arg, int from_tty)
>  {
>    std::string provider, probe_name, objname;
>    struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
> @@ -713,7 +713,7 @@ enable_probes_command (char *arg, int from_tty)
>  /* Implementation of the `disable probes' command.  */
>  
>  static void
> -disable_probes_command (char *arg, int from_tty)
> +disable_probes_command (const char *arg, int from_tty)
>  {
>    std::string provider, probe_name, objname;
>    struct cleanup *cleanup = make_cleanup (null_cleanup, NULL);
> -- 
> 2.9.4

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 45/67] Constify cd_command
  2017-09-21  5:40 ` [RFA 45/67] Constify cd_command Tom Tromey
@ 2017-09-21 12:48   ` Sergio Durigan Junior
  0 siblings, 0 replies; 110+ messages in thread
From: Sergio Durigan Junior @ 2017-09-21 12:48 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Thursday, September 21 2017, Tom Tromey wrote:

> ChangeLog
> 2017-09-20  Tom Tromey  <tom@tromey.com>
>
> 	* cli/cli-cmds.h (cd_command): Constify.
> 	* cli/cli-cmds.c (cd_command): Constify.

I've been meaning to do that.  This is OK by me.  Thanks,

> ---
>  gdb/ChangeLog      | 5 +++++
>  gdb/cli/cli-cmds.c | 2 +-
>  gdb/cli/cli-cmds.h | 2 +-
>  3 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
> index 4cc9fa6..d87722f 100644
> --- a/gdb/cli/cli-cmds.c
> +++ b/gdb/cli/cli-cmds.c
> @@ -392,7 +392,7 @@ pwd_command (char *args, int from_tty)
>  }
>  
>  void
> -cd_command (char *dir, int from_tty)
> +cd_command (const char *dir, int from_tty)
>  {
>    int len;
>    /* Found something other than leading repetitions of "/..".  */
> diff --git a/gdb/cli/cli-cmds.h b/gdb/cli/cli-cmds.h
> index 1122a97..34d19f5 100644
> --- a/gdb/cli/cli-cmds.h
> +++ b/gdb/cli/cli-cmds.h
> @@ -110,7 +110,7 @@ int is_complete_command (struct cmd_list_element *cmd);
>  
>  /* Exported to gdb/main.c */
>  
> -extern void cd_command (char *, int);
> +extern void cd_command (const char *, int);
>  
>  /* Exported to gdb/top.c and gdb/main.c */
>  
> -- 
> 2.9.4

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 04/67] Constify info_probes_dtrace_command
  2017-09-21  5:13 ` [RFA 04/67] Constify info_probes_dtrace_command Tom Tromey
@ 2017-09-21 12:48   ` Sergio Durigan Junior
  0 siblings, 0 replies; 110+ messages in thread
From: Sergio Durigan Junior @ 2017-09-21 12:48 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Thursday, September 21 2017, Tom Tromey wrote:

> ChangeLog
> 2017-09-20  Tom Tromey  <tom@tromey.com>
>
> 	* dtrace-probe.c (info_probes_dtrace_command): Constify.

OK.

> ---
>  gdb/ChangeLog      | 4 ++++
>  gdb/dtrace-probe.c | 2 +-
>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/dtrace-probe.c b/gdb/dtrace-probe.c
> index 5a4daa3..2bbe03e 100644
> --- a/gdb/dtrace-probe.c
> +++ b/gdb/dtrace-probe.c
> @@ -904,7 +904,7 @@ const struct probe_ops dtrace_probe_ops =
>  /* Implementation of the `info probes dtrace' command.  */
>  
>  static void
> -info_probes_dtrace_command (char *arg, int from_tty)
> +info_probes_dtrace_command (const char *arg, int from_tty)
>  {
>    info_probes_for_ops (arg, from_tty, &dtrace_probe_ops);
>  }
> -- 
> 2.9.4

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 51/67] Constify info_probes_stap_command
  2017-09-21  5:39 ` [RFA 51/67] Constify info_probes_stap_command Tom Tromey
@ 2017-09-21 12:48   ` Sergio Durigan Junior
  0 siblings, 0 replies; 110+ messages in thread
From: Sergio Durigan Junior @ 2017-09-21 12:48 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Thursday, September 21 2017, Tom Tromey wrote:

> ChangeLog
> 2017-09-20  Tom Tromey  <tom@tromey.com>
>
> 	* stap-probe.c (info_probes_stap_command): Constify.

OK.

> ---
>  gdb/ChangeLog    | 4 ++++
>  gdb/stap-probe.c | 2 +-
>  2 files changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/stap-probe.c b/gdb/stap-probe.c
> index 61eb8e4..6fa0d20 100644
> --- a/gdb/stap-probe.c
> +++ b/gdb/stap-probe.c
> @@ -1708,7 +1708,7 @@ const struct probe_ops stap_probe_ops =
>  /* Implementation of the `info probes stap' command.  */
>  
>  static void
> -info_probes_stap_command (char *arg, int from_tty)
> +info_probes_stap_command (const char *arg, int from_tty)
>  {
>    info_probes_for_ops (arg, from_tty, &stap_probe_ops);
>  }
> -- 
> 2.9.4

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/

^ permalink raw reply	[flat|nested] 110+ messages in thread

* RE: [RFA 49/67] Constify some commands in btrace.c
  2017-09-21 11:11     ` Pedro Alves
@ 2017-09-21 13:06       ` Metzger, Markus T
  2017-09-21 13:47         ` Pedro Alves
  0 siblings, 1 reply; 110+ messages in thread
From: Metzger, Markus T @ 2017-09-21 13:06 UTC (permalink / raw)
  To: Pedro Alves, Tom Tromey, gdb-patches

> -----Original Message-----
> From: Pedro Alves [mailto:palves@redhat.com]
> Sent: Thursday, September 21, 2017 1:12 PM
> To: Metzger, Markus T <markus.t.metzger@intel.com>; Tom Tromey
> <tom@tromey.com>; gdb-patches@sourceware.org
> Subject: Re: [RFA 49/67] Constify some commands in btrace.c

Hello Pedro,

> >> @@ -3213,13 +3214,16 @@ get_context_size (char **arg)
> >>    if (!isdigit (*pos))
> >>      error (_("Expected positive number, got: %s."), pos);
> >>
> >> -  return strtol (pos, arg, 10);
> >> +  char *end;
> >> +  long result = strtol (pos, &end, 10);
> >> +  *arg = end;
> >> +  return result;
> >>  }
> >
> > The rest of the declarations are at the beginning.  I'd prefer to keep it that way.
> 
> Interesting.  Out of curiosity, is there a particular reason for
> that preference?  I ask because we haven't adjusted our guidelines
> in this area yet, but I've been asking people to move
> declarations nearer where they're initialized in patch reviews.
> My reasoning for that has been that IMHO, declarations nearer to
> where they're initialized help with a few things:
> 
>  - helps with reasoning about the code, since the type of
>    the variable has more changes of being visible.  The
>    top of the scope may be a good number of lines above.
> 
>  - helps prevent accidental used-uninitialized bugs.
> 
>  - avoid gratuitous pessimization when the variable is of
>    non-trivial type, by avoiding separate default
>    construction + assignment steps.  (though that's not the
>    case here, since in this case all variables are scalars).
> 
> The point that I feel particularly strongly about is the
> last one, about non-trivial types, though as said that
> doesn't apply in this case.
> 
> For the first two points, in C89, we'd some times open a
> extra scope, like in this case you could write:
> 
>     {
>       char *end;
>       long result = strtol (pos, &end, 10);
> 
>       *arg = end;
>       return result;
>     }
> 
> In C99/C++, we can write declarations in the middle of
> blocks without forcing the extra scope.

My reason is simply to not mix different styles.


> It's really up to you the style to use for this code as
> btrace maintainer

That shouldn't be the case.  If GDB is moving from a separate
declaration block to mixed-in declarations we should do it
everywhere.

So please ignore my comments on declaration placement.

Regards,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 61/67] Constify some commands in breakpoint.c
  2017-09-21  9:56   ` Pedro Alves
@ 2017-09-21 13:20     ` Patrick Monnerat
  0 siblings, 0 replies; 110+ messages in thread
From: Patrick Monnerat @ 2017-09-21 13:20 UTC (permalink / raw)
  To: Pedro Alves, Tom Tromey, gdb-patches


On 09/21/2017 10:56 AM, Pedro Alves wrote:
> On 09/21/2017 06:10 AM, Tom Tromey wrote:
>> This also makes delete_command static; but now I wonder if it is used
>> in Insight and should not be touched.
> ..
> gdbtk/generic/gdbtk-cmds.c:  delete_command (NULL, 0);
>
> I guess it'd be mildly nicer to add some "void delete_all_breakpoints();"
> API instead of abusing the command callback.
>
I've just added such an API to the insight code:
https://sourceware.org/git/?p=insight.git;a=commit;h=7dc503fbf209ec7f39771c2bf5e45e01974f18c5
It works fine without calling delete_command(). Thus it's OK for me to 
have static delete_command().

@palves: many thanks for having raised the flag before commit.

Patrick

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 49/67] Constify some commands in btrace.c
  2017-09-21 13:06       ` Metzger, Markus T
@ 2017-09-21 13:47         ` Pedro Alves
  2017-09-21 16:53           ` Metzger, Markus T
  2017-09-23  4:28           ` Tom Tromey
  0 siblings, 2 replies; 110+ messages in thread
From: Pedro Alves @ 2017-09-21 13:47 UTC (permalink / raw)
  To: Metzger, Markus T, Tom Tromey, gdb-patches

On 09/21/2017 02:06 PM, Metzger, Markus T wrote:
>> From: Pedro Alves [mailto:palves@redhat.com]
> 
> Hello Pedro,

Hi Markus!

> My reason is simply to not mix different styles.
> 

Alright, that's certainly a valid reason.

My view is that declarations in the middle of blocks are
desirable, and enforcing top-of-block-only consistency too
strongly prevents incremental modernization a bit, since it
puts the bar higher (because either everything is converted,
or else nothing is).  So personally I'm fine with mixed style,
and I try to push for declare-at-initialization when it
makes sense.

> 
>> It's really up to you the style to use for this code as
>> btrace maintainer
> 
> That shouldn't be the case.  If GDB is moving from a separate
> declaration block to mixed-in declarations we should do it
> everywhere.

Ack.  To me, if we need a simpler rationale, it could go
like this: middle-of-block declaration+initialization makes
sense with non-trivial types.  And if we accept middle-of-block
declarations with non-trivial types, then there's no good
rationale for not allowing them with scalar types too.

> 
> So please ignore my comments on declaration placement.

On the contrary, it's not my intention to make your comment
be ignored, rather that we all discuss this and end up on
the same page.  So thanks for the discussion, and really sorry
if I sounded too nit picky.

-----

BTW, looking at the get_context_size function in question, it
seems like the 'number' variable is not used, meaning we could
apply something like this:

 static int
 get_context_size (char **arg)
 {
-   char *pos;
-   int number;
-
-  pos = skip_spaces (*arg);
+  char *pos = skip_spaces (*arg);

   if (!isdigit (*pos))
     error (_("Expected positive number, got: %s."), pos);
 
   return strtol (pos, arg, 10);
 }

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* RE: [RFA 49/67] Constify some commands in btrace.c
  2017-09-21 13:47         ` Pedro Alves
@ 2017-09-21 16:53           ` Metzger, Markus T
  2017-09-23  4:28           ` Tom Tromey
  1 sibling, 0 replies; 110+ messages in thread
From: Metzger, Markus T @ 2017-09-21 16:53 UTC (permalink / raw)
  To: Pedro Alves, Tom Tromey, gdb-patches

> -----Original Message-----
> From: Pedro Alves [mailto:palves@redhat.com]
> Sent: Thursday, September 21, 2017 3:47 PM
> To: Metzger, Markus T <markus.t.metzger@intel.com>; Tom Tromey
> <tom@tromey.com>; gdb-patches@sourceware.org
> Subject: Re: [RFA 49/67] Constify some commands in btrace.c

Hello Pedro,

> > My reason is simply to not mix different styles.
> >
> 
> Alright, that's certainly a valid reason.
> 
> My view is that declarations in the middle of blocks are
> desirable, and enforcing top-of-block-only consistency too
> strongly prevents incremental modernization a bit, since it
> puts the bar higher (because either everything is converted,
> or else nothing is).  So personally I'm fine with mixed style,
> and I try to push for declare-at-initialization when it
> makes sense.

I find top declarations more readable but I see the need for
C++ objects.  And I value consistency.  So let's go with mixed
style everywhere.

 
> Ack.  To me, if we need a simpler rationale, it could go
> like this: middle-of-block declaration+initialization makes
> sense with non-trivial types.  And if we accept middle-of-block
> declarations with non-trivial types, then there's no good
> rationale for not allowing them with scalar types too.

Agreed.


> > So please ignore my comments on declaration placement.
> 
> On the contrary, it's not my intention to make your comment
> be ignored, rather that we all discuss this and end up on
> the same page.  So thanks for the discussion, and really sorry
> if I sounded too nit picky.

Tom still needs to ignore my previous comment on declaration
placement;-)  In this and in other patches of this series.

> 
> -----
> 
> BTW, looking at the get_context_size function in question, it
> seems like the 'number' variable is not used, meaning we could
> apply something like this:
> 
>  static int
>  get_context_size (char **arg)
>  {
> -   char *pos;
> -   int number;
> -
> -  pos = skip_spaces (*arg);
> +  char *pos = skip_spaces (*arg);
> 
>    if (!isdigit (*pos))
>      error (_("Expected positive number, got: %s."), pos);
> 
>    return strtol (pos, arg, 10);
>  }

Tom's patch changed the parameter to const char so we still need the
char *end detour.  You're right, though, that NUMBER is not used and
that the declaration can be removed.

Thanks,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 38/67] Constify some linespec functions
  2017-09-21 10:04   ` Pedro Alves
@ 2017-09-23  4:03     ` Tom Tromey
  2017-09-26 12:17       ` Pedro Alves
  0 siblings, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-23  4:03 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> In several places you followed a pattern like:

>> static void
>> -foo_command (char *args, int from_tty)
>> +foo_command (char *args_in, int from_tty)

Pedro> ... and then args_in wasn't used.

Hmm... normally I think it should be used.
Like in this patch (#38):

-info_scope_command (char *args, int from_tty)
+info_scope_command (char *args_in, int from_tty)
...
-  char *save_args = args;
+  const char *save_args = args_in;
...
+  const char *args = args_in;

Pedro> I'd be nice to mention in the commit log the reason for this.
Pedro> I assume that it's because we don't have the corresponding
Pedro> constified add_cmd variant?

In this case I believe the reason is that info_scope_command could not
be constified yet, because add_info isn't constified; but on the other
hand it calls string_to_event_location, which is now constified, and it
didn't seem worthwhile to overload that.

I think all the cases *should* be things like this, but of course there
may be errors.

Tom

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 37/67] Constify some commands in record.c
  2017-09-21  7:02   ` Metzger, Markus T
@ 2017-09-23  4:05     ` Tom Tromey
  0 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-23  4:05 UTC (permalink / raw)
  To: Metzger, Markus T; +Cc: Tom Tromey, gdb-patches

>>>>> "Markus" == Metzger, Markus T <markus.t.metzger@intel.com> writes:

>> static void
>> cmd_record_save (char *args, int from_tty)
>> {
>> -  char *recfilename, recfilename_buffer[40];
>> +  const char *recfilename;
>> +  char recfilename_buffer[40];
>> 
>> require_record_target ();

Markus> This isn't really related to adding a const add_cmd () version.

Thanks for noticing this.  I forgot to change the signature of
cmd_record_save.  I've updated my patch so that it takes a
"const char *".

Tom

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 37/67] Constify some commands in record.c
  2017-09-21 10:00   ` Pedro Alves
@ 2017-09-23  4:05     ` Tom Tromey
  2017-09-23  4:29     ` Tom Tromey
  1 sibling, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-23  4:05 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> On 09/21/2017 06:09 AM, Tom Tromey wrote:
>> @@ -456,13 +458,15 @@ get_context_size (char **arg)
>> if (!isdigit (*pos))
>> error (_("Expected positive number, got: %s."), pos);
>> 
>> -  return strtol (pos, arg, 10);
>> +   long result = strtol (pos, &end, 10);
>> +   *arg = end;
>> +   return result;
>> }

Pedro> Indentation looks odd.  [3 spaces instead of 2?]

I've fixed it.

Tom

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 01/67] Add add_cmd function overloads
  2017-09-21 10:25     ` Pedro Alves
@ 2017-09-23  4:14       ` Tom Tromey
  0 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-23  4:14 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Metzger, Markus T, Tom Tromey, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

>> We shouldn't really have the NULL case, anymore.  It is still
>> possible but I don't expect it to be used.  Should we assert CFUNC
>> != NULL?

Pedro> If that's possible, then it'd be nice to add ATTRIBUTE_NONNULL
Pedro> on the declaration too.

I added this.

Tom

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 01/67] Add add_cmd function overloads
  2017-09-21  7:02   ` Metzger, Markus T
  2017-09-21 10:25     ` Pedro Alves
@ 2017-09-23  4:14     ` Tom Tromey
  2017-09-26 12:11       ` Pedro Alves
  1 sibling, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-23  4:14 UTC (permalink / raw)
  To: Metzger, Markus T; +Cc: Tom Tromey, gdb-patches

>>>>> "Markus" == Metzger, Markus T <markus.t.metzger@intel.com> writes:

>> static void
>> +do_const_cfunc (struct cmd_list_element *c, char *args, int from_tty)
>> +{
>> +  c->function.const_cfunc (args, from_tty); /* Ok.  */
>> +}

Markus> Ok.?

This is copy-and-paste from the other function like this.
I think this is some way to suppress ARI warnings.
I don't know if ARI is still used...?

Markus> We shouldn't really have the NULL case, anymore.  It is still possible
Markus> but I don't expect it to be used.  Should we assert CFUNC != NULL?

I did this.

Tom

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 01/67] Add add_cmd function overloads
  2017-09-21 10:25   ` Pedro Alves
@ 2017-09-23  4:18     ` Tom Tromey
  2017-09-23  4:30     ` Tom Tromey
  1 sibling, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-23  4:18 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> Can you please add some comments describing the difference between the
Pedro> overloads?  Here and in other cases.

I've done this.

Tom

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 49/67] Constify some commands in btrace.c
  2017-09-21 13:47         ` Pedro Alves
  2017-09-21 16:53           ` Metzger, Markus T
@ 2017-09-23  4:28           ` Tom Tromey
  2017-09-26  8:15             ` Metzger, Markus T
  1 sibling, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-23  4:28 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Metzger, Markus T, Tom Tromey, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> BTW, looking at the get_context_size function in question, it
Pedro> seems like the 'number' variable is not used, meaning we could
Pedro> apply something like this:

Here's the updated version.

Tom

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9889055..92370b6 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
 2017-09-20  Tom Tromey  <tom@tromey.com>
 
+	* btrace.c (get_uint, get_context_size, no_chunk)
+	(maint_btrace_packet_history_cmd)
+	(maint_btrace_clear_packet_history_cmd, maint_btrace_clear_cmd)
+	(maint_info_btrace_cmd): Constify.
+
+2017-09-20  Tom Tromey  <tom@tromey.com>
+
 	* reverse.c (delete_bookmark_command): Constify.
 
 2017-09-20  Tom Tromey  <tom@tromey.com>
diff --git a/gdb/btrace.c b/gdb/btrace.c
index 8527c6f..7990d5f 100644
--- a/gdb/btrace.c
+++ b/gdb/btrace.c
@@ -3180,9 +3180,10 @@ btrace_maint_print_packets (struct btrace_thread_info *btinfo,
 /* Read a number from an argument string.  */
 
 static unsigned int
-get_uint (char **arg)
+get_uint (const char **arg)
 {
-  char *begin, *end, *pos;
+  const char *begin, *pos;
+  char *end;
   unsigned long number;
 
   begin = *arg;
@@ -3203,23 +3204,23 @@ get_uint (char **arg)
 /* Read a context size from an argument string.  */
 
 static int
-get_context_size (char **arg)
+get_context_size (const char **arg)
 {
-  char *pos;
-  int number;
-
-  pos = skip_spaces (*arg);
+  const char *pos = skip_spaces (*arg);
 
   if (!isdigit (*pos))
     error (_("Expected positive number, got: %s."), pos);
 
-  return strtol (pos, arg, 10);
+  char *end;
+  long result = strtol (pos, &end, 10);
+  *arg = end;
+  return result;
 }
 
 /* Complain about junk at the end of an argument string.  */
 
 static void
-no_chunk (char *arg)
+no_chunk (const char *arg)
 {
   if (*arg != 0)
     error (_("Junk after argument: %s."), arg);
@@ -3228,7 +3229,7 @@ no_chunk (char *arg)
 /* The "maintenance btrace packet-history" command.  */
 
 static void
-maint_btrace_packet_history_cmd (char *arg, int from_tty)
+maint_btrace_packet_history_cmd (const char *arg, int from_tty)
 {
   struct btrace_thread_info *btinfo;
   struct thread_info *tp;
@@ -3333,7 +3334,7 @@ maint_btrace_packet_history_cmd (char *arg, int from_tty)
 /* The "maintenance btrace clear-packet-history" command.  */
 
 static void
-maint_btrace_clear_packet_history_cmd (char *args, int from_tty)
+maint_btrace_clear_packet_history_cmd (const char *args, int from_tty)
 {
   struct btrace_thread_info *btinfo;
   struct thread_info *tp;
@@ -3355,7 +3356,7 @@ maint_btrace_clear_packet_history_cmd (char *args, int from_tty)
 /* The "maintenance btrace clear" command.  */
 
 static void
-maint_btrace_clear_cmd (char *args, int from_tty)
+maint_btrace_clear_cmd (const char *args, int from_tty)
 {
   struct btrace_thread_info *btinfo;
   struct thread_info *tp;
@@ -3418,7 +3419,7 @@ maint_btrace_pt_show_cmd (char *args, int from_tty)
 /* The "maintenance info btrace" command.  */
 
 static void
-maint_info_btrace_cmd (char *args, int from_tty)
+maint_info_btrace_cmd (const char *args, int from_tty)
 {
   struct btrace_thread_info *btinfo;
   struct thread_info *tp;

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 37/67] Constify some commands in record.c
  2017-09-21 10:00   ` Pedro Alves
  2017-09-23  4:05     ` Tom Tromey
@ 2017-09-23  4:29     ` Tom Tromey
  1 sibling, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-23  4:29 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

Pedro> Indentation looks odd.  [3 spaces instead of 2?]

Here's the update.

Tom

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9b1af80..0764f07 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,13 @@
 2017-09-20  Tom Tromey  <tom@tromey.com>
 
+	* record.c (cmd_record_delete, cmd_record_stop, cmd_record_save)
+	(cmd_record_goto_begin, cmd_record_goto_end, get_insn_number)
+	(get_context_size, no_chunk, get_insn_history_modifiers)
+	(cmd_record_insn_history, get_call_history_modifiers)
+	(cmd_record_call_history): Constify.
+
+2017-09-20  Tom Tromey  <tom@tromey.com>
+
 	* source.c (show_substitute_path_command)
 	(unset_substitute_path_command, set_substitute_path_command):
 	Constify.
diff --git a/gdb/record.c b/gdb/record.c
index 59fb240..f4ef269 100644
--- a/gdb/record.c
+++ b/gdb/record.c
@@ -272,7 +272,7 @@ cmd_record_start (char *args, int from_tty)
    of replay until the end.  */
 
 static void
-cmd_record_delete (char *args, int from_tty)
+cmd_record_delete (const char *args, int from_tty)
 {
   require_record_target ();
 
@@ -298,7 +298,7 @@ cmd_record_delete (char *args, int from_tty)
 /* Implement the "stoprecord" or "record stop" command.  */
 
 static void
-cmd_record_stop (char *args, int from_tty)
+cmd_record_stop (const char *args, int from_tty)
 {
   struct target_ops *t;
 
@@ -352,9 +352,10 @@ info_record_command (char *args, int from_tty)
 /* The "record save" command.  */
 
 static void
-cmd_record_save (char *args, int from_tty)
+cmd_record_save (const char *args, int from_tty)
 {
-  char *recfilename, recfilename_buffer[40];
+  const char *recfilename;
+  char recfilename_buffer[40];
 
   require_record_target ();
 
@@ -401,7 +402,7 @@ cmd_record_goto (char *arg, int from_tty)
 /* The "record goto begin" command.  */
 
 static void
-cmd_record_goto_begin (char *arg, int from_tty)
+cmd_record_goto_begin (const char *arg, int from_tty)
 {
   if (arg != NULL && *arg != '\0')
     error (_("Junk after argument: %s."), arg);
@@ -413,7 +414,7 @@ cmd_record_goto_begin (char *arg, int from_tty)
 /* The "record goto end" command.  */
 
 static void
-cmd_record_goto_end (char *arg, int from_tty)
+cmd_record_goto_end (const char *arg, int from_tty)
 {
   if (arg != NULL && *arg != '\0')
     error (_("Junk after argument: %s."), arg);
@@ -425,7 +426,7 @@ cmd_record_goto_end (char *arg, int from_tty)
 /* Read an instruction number from an argument string.  */
 
 static ULONGEST
-get_insn_number (char **arg)
+get_insn_number (const char **arg)
 {
   ULONGEST number;
   const char *begin, *end, *pos;
@@ -446,9 +447,10 @@ get_insn_number (char **arg)
 /* Read a context size from an argument string.  */
 
 static int
-get_context_size (char **arg)
+get_context_size (const char **arg)
 {
-  char *pos;
+  const char *pos;
+  char *end;
   int number;
 
   pos = skip_spaces (*arg);
@@ -456,13 +458,15 @@ get_context_size (char **arg)
   if (!isdigit (*pos))
     error (_("Expected positive number, got: %s."), pos);
 
-  return strtol (pos, arg, 10);
+  long result = strtol (pos, &end, 10);
+  *arg = end;
+  return result;
 }
 
 /* Complain about junk at the end of an argument string.  */
 
 static void
-no_chunk (char *arg)
+no_chunk (const char *arg)
 {
   if (*arg != 0)
     error (_("Junk after argument: %s."), arg);
@@ -471,10 +475,10 @@ no_chunk (char *arg)
 /* Read instruction-history modifiers from an argument string.  */
 
 static gdb_disassembly_flags
-get_insn_history_modifiers (char **arg)
+get_insn_history_modifiers (const char **arg)
 {
   gdb_disassembly_flags modifiers;
-  char *args;
+  const char *args;
 
   modifiers = 0;
   args = *arg;
@@ -549,7 +553,7 @@ command_size_to_target_size (unsigned int size)
 /* The "record instruction-history" command.  */
 
 static void
-cmd_record_insn_history (char *arg, int from_tty)
+cmd_record_insn_history (const char *arg, int from_tty)
 {
   require_record_target ();
 
@@ -612,10 +616,10 @@ cmd_record_insn_history (char *arg, int from_tty)
 /* Read function-call-history modifiers from an argument string.  */
 
 static int
-get_call_history_modifiers (char **arg)
+get_call_history_modifiers (const char **arg)
 {
   int modifiers;
-  char *args;
+  const char *args;
 
   modifiers = 0;
   args = *arg;
@@ -666,7 +670,7 @@ get_call_history_modifiers (char **arg)
 /* The "record function-call-history" command.  */
 
 static void
-cmd_record_call_history (char *arg, int from_tty)
+cmd_record_call_history (const char *arg, int from_tty)
 {
   int flags, size;
 

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 01/67] Add add_cmd function overloads
  2017-09-21 10:25   ` Pedro Alves
  2017-09-23  4:18     ` Tom Tromey
@ 2017-09-23  4:30     ` Tom Tromey
  2017-09-23  4:49       ` Tom Tromey
  1 sibling, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-23  4:30 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> Can you please add some comments describing the difference between the
Pedro> overloads?  Here and in other cases.

Here's the updated version.

Tom

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index aa50dc9..4f4b7d7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,22 @@
+2017-09-20  Tom Tromey  <tom@tromey.com>
+
+	* cli/cli-decode.c (add_cmd, set_cmd_cfunc): New function
+	overloads.
+	(do_add_cmd): Rename from add_cmd.  Don't call set_cmd_cfunc.
+	(do_const_cfunc): New function.
+	(cmd_cfunc_eq): New overload.
+	(cli_user_command_p): Check do_const_cfunc.
+	* cli/cli-decode.h (struct cmd_list_element) <function>: New field
+	const_cfunc.
+	* command.h (add_cmd): Add const overload and no-function
+	overload.
+	(set_cmd_cfunc): Add const overload.
+	(cmd_const_cfunc_ftype): Declare.
+	(cmd_cfunc_eq): Add const overload.
+	* breakpoint.c, cli-cmds.c, cli-dump.c, guile/scm-cmd.c,
+	python/py-cmd.c, target.c, tracepoint.c: Use no-function add_cmd
+	overload.
+
 2017-09-22  Tom Tromey  <tom@tromey.com>
 
 	* utils.c (class scoped_input_handler) <m_quit_handler>: Change
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 8585f5e..5549fe7 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15414,13 +15414,13 @@ add_catch_command (const char *name, const char *docstring,
 {
   struct cmd_list_element *command;
 
-  command = add_cmd (name, class_breakpoint, NULL, docstring,
+  command = add_cmd (name, class_breakpoint, docstring,
 		     &catch_cmdlist);
   set_cmd_sfunc (command, sfunc);
   set_cmd_context (command, user_data_catch);
   set_cmd_completer (command, completer);
 
-  command = add_cmd (name, class_breakpoint, NULL, docstring,
+  command = add_cmd (name, class_breakpoint, docstring,
 		     &tcatch_cmdlist);
   set_cmd_sfunc (command, sfunc);
   set_cmd_context (command, user_data_tcatch);
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index cbafb13..67910be 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1693,28 +1693,28 @@ _initialize_cli_cmds (void)
   /* Define the classes of commands.
      They will appear in the help list in alphabetical order.  */
 
-  add_cmd ("internals", class_maintenance, NULL, _("\
+  add_cmd ("internals", class_maintenance, _("\
 Maintenance commands.\n\
 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."),
 	   &cmdlist);
-  add_cmd ("obscure", class_obscure, NULL, _("Obscure features."), &cmdlist);
-  add_cmd ("aliases", class_alias, NULL,
+  add_cmd ("obscure", class_obscure, _("Obscure features."), &cmdlist);
+  add_cmd ("aliases", class_alias,
 	   _("Aliases of other commands."), &cmdlist);
-  add_cmd ("user-defined", class_user, NULL, _("\
+  add_cmd ("user-defined", class_user, _("\
 User-defined commands.\n\
 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, NULL, _("Support facilities."), &cmdlist);
+  add_cmd ("support", class_support, _("Support facilities."), &cmdlist);
   if (!dbx_commands)
-    add_cmd ("status", class_info, NULL, _("Status inquiries."), &cmdlist);
-  add_cmd ("files", class_files, NULL, _("Specifying and examining files."),
+    add_cmd ("status", class_info, _("Status inquiries."), &cmdlist);
+  add_cmd ("files", class_files, _("Specifying and examining files."),
 	   &cmdlist);
-  add_cmd ("breakpoints", class_breakpoint, NULL,
+  add_cmd ("breakpoints", class_breakpoint,
 	   _("Making program stop at certain points."), &cmdlist);
-  add_cmd ("data", class_vars, NULL, _("Examining data."), &cmdlist);
-  add_cmd ("stack", class_stack, NULL, _("\
+  add_cmd ("data", class_vars, _("Examining data."), &cmdlist);
+  add_cmd ("stack", class_stack, _("\
 Examining the stack.\n\
 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\
@@ -1723,7 +1723,7 @@ 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."),
 	   &cmdlist);
-  add_cmd ("running", class_run, NULL, _("Running the program."), &cmdlist);
+  add_cmd ("running", class_run, _("Running the program."), &cmdlist);
 
   /* Define general commands.  */
 
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 1bbbe46..fc4d468 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -109,14 +109,26 @@ do_cfunc (struct cmd_list_element *c, char *args, int from_tty)
 void
 set_cmd_cfunc (struct cmd_list_element *cmd, cmd_cfunc_ftype *cfunc)
 {
-  if (cfunc == NULL)
-    cmd->func = NULL;
-  else
-    cmd->func = do_cfunc;
+  gdb_assert (cfunc != NULL);
+  cmd->func = do_cfunc;
   cmd->function.cfunc = cfunc; /* Ok.  */
 }
 
 static void
+do_const_cfunc (struct cmd_list_element *c, char *args, int from_tty)
+{
+  c->function.const_cfunc (args, from_tty); /* Ok.  */
+}
+
+void
+set_cmd_cfunc (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfunc)
+{
+  gdb_assert (cfunc != NULL);
+  cmd->func = do_const_cfunc;
+  cmd->function.const_cfunc = cfunc; /* Ok.  */
+}
+
+static void
 do_sfunc (struct cmd_list_element *c, char *args, int from_tty)
 {
   c->function.sfunc (args, from_tty, c); /* Ok.  */
@@ -138,6 +150,12 @@ cmd_cfunc_eq (struct cmd_list_element *cmd, cmd_cfunc_ftype *cfunc)
   return cmd->func == do_cfunc && cmd->function.cfunc == cfunc;
 }
 
+int
+cmd_cfunc_eq (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfunc)
+{
+  return cmd->func == do_const_cfunc && cmd->function.const_cfunc == cfunc;
+}
+
 void
 set_cmd_context (struct cmd_list_element *cmd, void *context)
 {
@@ -189,9 +207,9 @@ set_cmd_completer_handle_brkchars (struct cmd_list_element *cmd,
    Returns a pointer to the added command (not necessarily the head 
    of *LIST).  */
 
-struct cmd_list_element *
-add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
-	 const char *doc, struct cmd_list_element **list)
+static struct cmd_list_element *
+do_add_cmd (const char *name, enum command_class theclass,
+	    const char *doc, struct cmd_list_element **list)
 {
   struct cmd_list_element *c = XNEW (struct cmd_list_element);
   struct cmd_list_element *p, *iter;
@@ -229,7 +247,6 @@ add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
 
   c->name = name;
   c->theclass = theclass;
-  set_cmd_cfunc (c, fun);
   set_cmd_context (c, NULL);
   c->doc = doc;
   c->cmd_deprecated = 0;
@@ -259,6 +276,35 @@ add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
   return c;
 }
 
+struct cmd_list_element *
+add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
+	 const char *doc, struct cmd_list_element **list)
+{
+  cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
+  set_cmd_cfunc (result, fun);
+  return result;
+}
+
+struct cmd_list_element *
+add_cmd (const char *name, enum command_class theclass,
+	 const char *doc, struct cmd_list_element **list)
+{
+  cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
+  result->func = NULL;
+  result->function.cfunc = NULL; /* Ok.  */
+  return result;
+}
+
+struct cmd_list_element *
+add_cmd (const char *name, enum command_class theclass,
+	 cmd_const_cfunc_ftype *fun,
+	 const char *doc, struct cmd_list_element **list)
+{
+  cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
+  set_cmd_cfunc (result, fun);
+  return result;
+}
+
 /* Deprecates a command CMD.
    REPLACEMENT is the name of the command which should be used in
    place of this command, or NULL if no such command exists.
@@ -301,7 +347,7 @@ add_alias_cmd (const char *name, cmd_list_element *old,
       return 0;
     }
 
-  struct cmd_list_element *c = add_cmd (name, theclass, NULL, old->doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, old->doc, list);
 
   /* If OLD->DOC can be freed, we should make another copy.  */
   if (old->doc_allocated)
@@ -419,7 +465,7 @@ add_set_or_show_cmd (const char *name,
 		     const char *doc,
 		     struct cmd_list_element **list)
 {
-  struct cmd_list_element *c = add_cmd (name, theclass, NULL, doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, doc, list);
 
   gdb_assert (type == set_cmd || type == show_cmd);
   c->type = type;
@@ -1909,5 +1955,6 @@ int
 cli_user_command_p (struct cmd_list_element *cmd)
 {
   return (cmd->theclass == class_user
-	  && (cmd->func == do_cfunc || cmd->func == do_sfunc));
+	  && (cmd->func == do_cfunc || cmd->func == do_sfunc
+	      || cmd->func == do_const_cfunc));
 }
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index 50b858c..691bfe3 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -114,6 +114,8 @@ struct cmd_list_element
       {
 	/* If type is not_set_cmd, call it like this: */
 	cmd_cfunc_ftype *cfunc;
+	/* ... or like this.  */
+	cmd_const_cfunc_ftype *const_cfunc;
 	/* If type is set_cmd or show_cmd, first set the variables,
 	   and then call this: */
 	cmd_sfunc_ftype *sfunc;
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 8d57119..550548a 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -360,7 +360,7 @@ add_dump_command (const char *name,
   struct cmd_list_element *c;
   struct dump_context *d;
 
-  c = add_cmd (name, all_commands, NULL, descr, &dump_cmdlist);
+  c = add_cmd (name, all_commands, descr, &dump_cmdlist);
   c->completer =  filename_completer;
   d = XNEW (struct dump_context);
   d->func = func;
@@ -368,7 +368,7 @@ add_dump_command (const char *name,
   set_cmd_context (c, d);
   c->func = call_dump_func;
 
-  c = add_cmd (name, all_commands, NULL, descr, &append_cmdlist);
+  c = add_cmd (name, all_commands, descr, &append_cmdlist);
   c->completer =  filename_completer;
   d = XNEW (struct dump_context);
   d->func = func;
diff --git a/gdb/command.h b/gdb/command.h
index 3a4a449..02e9a69 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -117,6 +117,7 @@ var_types;
 struct cmd_list_element;
 
 typedef void cmd_cfunc_ftype (char *args, int from_tty);
+typedef void cmd_const_cfunc_ftype (const char *args, int from_tty);
 
 /* This structure specifies notifications to be suppressed by a cli
    command interpreter.  */
@@ -140,6 +141,19 @@ extern struct cmd_list_element *add_cmd (const char *, enum command_class,
 					 const char *,
 					 struct cmd_list_element **);
 
+/* Like add_cmd, but no command function is specified.  */
+
+extern struct cmd_list_element *add_cmd (const char *, enum command_class,
+					 const char *,
+					 struct cmd_list_element **);
+
+/* Const-correct variant of the above.  */
+
+extern struct cmd_list_element *add_cmd (const char *, enum command_class,
+					 cmd_const_cfunc_ftype *fun,
+					 const char *,
+					 struct cmd_list_element **);
+
 extern struct cmd_list_element *add_alias_cmd (const char *, const char *,
 					       enum command_class, int,
 					       struct cmd_list_element **);
@@ -169,7 +183,14 @@ extern struct cmd_list_element *add_abbrev_prefix_cmd (const char *,
 /* Set the commands corresponding callback.  */
 
 extern void set_cmd_cfunc (struct cmd_list_element *cmd,
-			   cmd_cfunc_ftype *cfunc);
+			   cmd_cfunc_ftype *cfunc)
+  ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
+
+/* Const-correct variant of the above.  */
+
+extern void set_cmd_cfunc (struct cmd_list_element *cmd,
+			   cmd_const_cfunc_ftype *cfunc)
+  ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);
 
 typedef void cmd_sfunc_ftype (char *args, int from_tty,
 			      struct cmd_list_element *c);
@@ -205,6 +226,8 @@ extern void set_cmd_completer_handle_brkchars (struct cmd_list_element *,
    around in cmd objects to test the value of the commands sfunc().  */
 extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
 			 cmd_cfunc_ftype *cfun);
+extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
+			 cmd_const_cfunc_ftype *cfun);
 
 /* Each command object has a local context attached to it.  */
 extern void set_cmd_context (struct cmd_list_element *cmd,
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 5501d31..0bd5105 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -774,7 +774,7 @@ gdbscm_register_command_x (SCM self)
       else
 	{
 	  cmd = add_cmd (c_smob->cmd_name, c_smob->cmd_class,
-			 NULL, c_smob->doc, cmd_list);
+			 c_smob->doc, cmd_list);
 	}
     }
   CATCH (except, RETURN_MASK_ALL)
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index 2a7c613..d969b12 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -612,7 +612,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
 				pfx_name, allow_unknown, cmd_list);
 	}
       else
-	cmd = add_cmd (cmd_name, (enum command_class) cmdtype, NULL,
+	cmd = add_cmd (cmd_name, (enum command_class) cmdtype,
 		       docstring, cmd_list);
 
       /* There appears to be no API to set this.  */
diff --git a/gdb/target.c b/gdb/target.c
index 5a2c087..c26fba7 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -386,7 +386,7 @@ Remaining arguments are interpreted by the target protocol.  For more\n\
 information on the arguments for a particular protocol, type\n\
 `help target ' followed by the protocol name."),
 		    &targetlist, "target ", 0, &cmdlist);
-  c = add_cmd (t->to_shortname, no_class, NULL, t->to_doc, &targetlist);
+  c = add_cmd (t->to_shortname, no_class, t->to_doc, &targetlist);
   set_cmd_sfunc (c, open_target);
   set_cmd_context (c, t);
   if (completer != NULL)
@@ -411,7 +411,7 @@ add_deprecated_target_alias (struct target_ops *t, const char *alias)
 
   /* If we use add_alias_cmd, here, we do not get the deprecated warning,
      see PR cli/15104.  */
-  c = add_cmd (alias, no_class, NULL, t->to_doc, &targetlist);
+  c = add_cmd (alias, no_class, t->to_doc, &targetlist);
   set_cmd_sfunc (c, open_target);
   set_cmd_context (c, t);
   alt = xstrprintf ("target %s", t->to_shortname);
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 437db59..12cc2fb 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -4203,7 +4203,7 @@ _initialize_tracepoint (void)
   add_info ("scope", info_scope_command,
 	    _("List the variables local to a scope"));
 
-  add_cmd ("tracepoints", class_trace, NULL,
+  add_cmd ("tracepoints", class_trace,
 	   _("Tracing of program execution without stopping the program."),
 	   &cmdlist);
 

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 35/67] Constify commands maint.c, plus maintenance_print_type
  2017-09-21 10:06   ` Pedro Alves
@ 2017-09-23  4:32     ` Tom Tromey
  0 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-23  4:32 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> On 09/21/2017 06:09 AM, Tom Tromey wrote:
>> 
>> @@ -591,8 +583,7 @@ maintenance_do_deprecate (char *text, int deprecate)
>> if (end_ptr != NULL)
>> {
>> len = end_ptr - start_ptr;
>> -	      start_ptr[len] = '\0';
>> -	      replacement = xstrdup (start_ptr);
>> +	      replacement = savestring (start_ptr, len);
>> }

Pedro> This looks like another "command repeat" bug fix, right?  Yay!  :-)

I hadn't noticed :)

Pedro> (Please mention it in the commit log.)

I added this to the commit message:

  In addition to the constification, this fixes a command-repeat bug.

Tom

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 40/67] Constify some commands in tracepoint.c
  2017-09-21 10:03   ` Pedro Alves
@ 2017-09-23  4:34     ` Tom Tromey
  0 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-23  4:34 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> I think it'd have been nice to split fixes like these to a
Pedro> separate patch, or at least mention them in the commit log, though.

I wasn't actually even aware of that.

I added this to the commit message:

  In addition to the constification, this fixes a command-repeat bug.

Tom

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 01/67] Add add_cmd function overloads
  2017-09-23  4:30     ` Tom Tromey
@ 2017-09-23  4:49       ` Tom Tromey
  2017-09-26 12:12         ` Pedro Alves
  0 siblings, 1 reply; 110+ messages in thread
From: Tom Tromey @ 2017-09-23  4:49 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Pedro Alves, gdb-patches

>>>>> "Tom" == Tom Tromey <tom@tromey.com> writes:

Tom> Here's the updated version.

Spoke too soon.

Tom> +  gdb_assert (cfunc != NULL);
...]
Tom>  extern void set_cmd_cfunc (struct cmd_list_element *cmd,
Tom> -			   cmd_cfunc_ftype *cfunc);
Tom> +			   cmd_cfunc_ftype *cfunc)
Tom> +  ATTRIBUTE_NONNULL (1) ATTRIBUTE_NONNULL (2);

These aren't correct - add_cmd can still be called with NULL via
add_prefix_cmd, for example.

Tom

diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index aa50dc9..4f4b7d7 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,22 @@
+2017-09-20  Tom Tromey  <tom@tromey.com>
+
+	* cli/cli-decode.c (add_cmd, set_cmd_cfunc): New function
+	overloads.
+	(do_add_cmd): Rename from add_cmd.  Don't call set_cmd_cfunc.
+	(do_const_cfunc): New function.
+	(cmd_cfunc_eq): New overload.
+	(cli_user_command_p): Check do_const_cfunc.
+	* cli/cli-decode.h (struct cmd_list_element) <function>: New field
+	const_cfunc.
+	* command.h (add_cmd): Add const overload and no-function
+	overload.
+	(set_cmd_cfunc): Add const overload.
+	(cmd_const_cfunc_ftype): Declare.
+	(cmd_cfunc_eq): Add const overload.
+	* breakpoint.c, cli-cmds.c, cli-dump.c, guile/scm-cmd.c,
+	python/py-cmd.c, target.c, tracepoint.c: Use no-function add_cmd
+	overload.
+
 2017-09-22  Tom Tromey  <tom@tromey.com>
 
 	* utils.c (class scoped_input_handler) <m_quit_handler>: Change
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 8585f5e..5549fe7 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -15414,13 +15414,13 @@ add_catch_command (const char *name, const char *docstring,
 {
   struct cmd_list_element *command;
 
-  command = add_cmd (name, class_breakpoint, NULL, docstring,
+  command = add_cmd (name, class_breakpoint, docstring,
 		     &catch_cmdlist);
   set_cmd_sfunc (command, sfunc);
   set_cmd_context (command, user_data_catch);
   set_cmd_completer (command, completer);
 
-  command = add_cmd (name, class_breakpoint, NULL, docstring,
+  command = add_cmd (name, class_breakpoint, docstring,
 		     &tcatch_cmdlist);
   set_cmd_sfunc (command, sfunc);
   set_cmd_context (command, user_data_tcatch);
diff --git a/gdb/cli/cli-cmds.c b/gdb/cli/cli-cmds.c
index cbafb13..67910be 100644
--- a/gdb/cli/cli-cmds.c
+++ b/gdb/cli/cli-cmds.c
@@ -1693,28 +1693,28 @@ _initialize_cli_cmds (void)
   /* Define the classes of commands.
      They will appear in the help list in alphabetical order.  */
 
-  add_cmd ("internals", class_maintenance, NULL, _("\
+  add_cmd ("internals", class_maintenance, _("\
 Maintenance commands.\n\
 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."),
 	   &cmdlist);
-  add_cmd ("obscure", class_obscure, NULL, _("Obscure features."), &cmdlist);
-  add_cmd ("aliases", class_alias, NULL,
+  add_cmd ("obscure", class_obscure, _("Obscure features."), &cmdlist);
+  add_cmd ("aliases", class_alias,
 	   _("Aliases of other commands."), &cmdlist);
-  add_cmd ("user-defined", class_user, NULL, _("\
+  add_cmd ("user-defined", class_user, _("\
 User-defined commands.\n\
 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, NULL, _("Support facilities."), &cmdlist);
+  add_cmd ("support", class_support, _("Support facilities."), &cmdlist);
   if (!dbx_commands)
-    add_cmd ("status", class_info, NULL, _("Status inquiries."), &cmdlist);
-  add_cmd ("files", class_files, NULL, _("Specifying and examining files."),
+    add_cmd ("status", class_info, _("Status inquiries."), &cmdlist);
+  add_cmd ("files", class_files, _("Specifying and examining files."),
 	   &cmdlist);
-  add_cmd ("breakpoints", class_breakpoint, NULL,
+  add_cmd ("breakpoints", class_breakpoint,
 	   _("Making program stop at certain points."), &cmdlist);
-  add_cmd ("data", class_vars, NULL, _("Examining data."), &cmdlist);
-  add_cmd ("stack", class_stack, NULL, _("\
+  add_cmd ("data", class_vars, _("Examining data."), &cmdlist);
+  add_cmd ("stack", class_stack, _("\
 Examining the stack.\n\
 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\
@@ -1723,7 +1723,7 @@ 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."),
 	   &cmdlist);
-  add_cmd ("running", class_run, NULL, _("Running the program."), &cmdlist);
+  add_cmd ("running", class_run, _("Running the program."), &cmdlist);
 
   /* Define general commands.  */
 
diff --git a/gdb/cli/cli-decode.c b/gdb/cli/cli-decode.c
index 1bbbe46..55d4124 100644
--- a/gdb/cli/cli-decode.c
+++ b/gdb/cli/cli-decode.c
@@ -117,6 +117,22 @@ set_cmd_cfunc (struct cmd_list_element *cmd, cmd_cfunc_ftype *cfunc)
 }
 
 static void
+do_const_cfunc (struct cmd_list_element *c, char *args, int from_tty)
+{
+  c->function.const_cfunc (args, from_tty); /* Ok.  */
+}
+
+void
+set_cmd_cfunc (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfunc)
+{
+  if (cfunc == NULL)
+    cmd->func = NULL;
+  else
+    cmd->func = do_const_cfunc;
+  cmd->function.const_cfunc = cfunc; /* Ok.  */
+}
+
+static void
 do_sfunc (struct cmd_list_element *c, char *args, int from_tty)
 {
   c->function.sfunc (args, from_tty, c); /* Ok.  */
@@ -138,6 +154,12 @@ cmd_cfunc_eq (struct cmd_list_element *cmd, cmd_cfunc_ftype *cfunc)
   return cmd->func == do_cfunc && cmd->function.cfunc == cfunc;
 }
 
+int
+cmd_cfunc_eq (struct cmd_list_element *cmd, cmd_const_cfunc_ftype *cfunc)
+{
+  return cmd->func == do_const_cfunc && cmd->function.const_cfunc == cfunc;
+}
+
 void
 set_cmd_context (struct cmd_list_element *cmd, void *context)
 {
@@ -189,9 +211,9 @@ set_cmd_completer_handle_brkchars (struct cmd_list_element *cmd,
    Returns a pointer to the added command (not necessarily the head 
    of *LIST).  */
 
-struct cmd_list_element *
-add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
-	 const char *doc, struct cmd_list_element **list)
+static struct cmd_list_element *
+do_add_cmd (const char *name, enum command_class theclass,
+	    const char *doc, struct cmd_list_element **list)
 {
   struct cmd_list_element *c = XNEW (struct cmd_list_element);
   struct cmd_list_element *p, *iter;
@@ -229,7 +251,6 @@ add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
 
   c->name = name;
   c->theclass = theclass;
-  set_cmd_cfunc (c, fun);
   set_cmd_context (c, NULL);
   c->doc = doc;
   c->cmd_deprecated = 0;
@@ -259,6 +280,35 @@ add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
   return c;
 }
 
+struct cmd_list_element *
+add_cmd (const char *name, enum command_class theclass, cmd_cfunc_ftype *fun,
+	 const char *doc, struct cmd_list_element **list)
+{
+  cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
+  set_cmd_cfunc (result, fun);
+  return result;
+}
+
+struct cmd_list_element *
+add_cmd (const char *name, enum command_class theclass,
+	 const char *doc, struct cmd_list_element **list)
+{
+  cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
+  result->func = NULL;
+  result->function.cfunc = NULL; /* Ok.  */
+  return result;
+}
+
+struct cmd_list_element *
+add_cmd (const char *name, enum command_class theclass,
+	 cmd_const_cfunc_ftype *fun,
+	 const char *doc, struct cmd_list_element **list)
+{
+  cmd_list_element *result = do_add_cmd (name, theclass, doc, list);
+  set_cmd_cfunc (result, fun);
+  return result;
+}
+
 /* Deprecates a command CMD.
    REPLACEMENT is the name of the command which should be used in
    place of this command, or NULL if no such command exists.
@@ -301,7 +351,7 @@ add_alias_cmd (const char *name, cmd_list_element *old,
       return 0;
     }
 
-  struct cmd_list_element *c = add_cmd (name, theclass, NULL, old->doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, old->doc, list);
 
   /* If OLD->DOC can be freed, we should make another copy.  */
   if (old->doc_allocated)
@@ -419,7 +469,7 @@ add_set_or_show_cmd (const char *name,
 		     const char *doc,
 		     struct cmd_list_element **list)
 {
-  struct cmd_list_element *c = add_cmd (name, theclass, NULL, doc, list);
+  struct cmd_list_element *c = add_cmd (name, theclass, doc, list);
 
   gdb_assert (type == set_cmd || type == show_cmd);
   c->type = type;
@@ -1909,5 +1959,6 @@ int
 cli_user_command_p (struct cmd_list_element *cmd)
 {
   return (cmd->theclass == class_user
-	  && (cmd->func == do_cfunc || cmd->func == do_sfunc));
+	  && (cmd->func == do_cfunc || cmd->func == do_sfunc
+	      || cmd->func == do_const_cfunc));
 }
diff --git a/gdb/cli/cli-decode.h b/gdb/cli/cli-decode.h
index 50b858c..691bfe3 100644
--- a/gdb/cli/cli-decode.h
+++ b/gdb/cli/cli-decode.h
@@ -114,6 +114,8 @@ struct cmd_list_element
       {
 	/* If type is not_set_cmd, call it like this: */
 	cmd_cfunc_ftype *cfunc;
+	/* ... or like this.  */
+	cmd_const_cfunc_ftype *const_cfunc;
 	/* If type is set_cmd or show_cmd, first set the variables,
 	   and then call this: */
 	cmd_sfunc_ftype *sfunc;
diff --git a/gdb/cli/cli-dump.c b/gdb/cli/cli-dump.c
index 8d57119..550548a 100644
--- a/gdb/cli/cli-dump.c
+++ b/gdb/cli/cli-dump.c
@@ -360,7 +360,7 @@ add_dump_command (const char *name,
   struct cmd_list_element *c;
   struct dump_context *d;
 
-  c = add_cmd (name, all_commands, NULL, descr, &dump_cmdlist);
+  c = add_cmd (name, all_commands, descr, &dump_cmdlist);
   c->completer =  filename_completer;
   d = XNEW (struct dump_context);
   d->func = func;
@@ -368,7 +368,7 @@ add_dump_command (const char *name,
   set_cmd_context (c, d);
   c->func = call_dump_func;
 
-  c = add_cmd (name, all_commands, NULL, descr, &append_cmdlist);
+  c = add_cmd (name, all_commands, descr, &append_cmdlist);
   c->completer =  filename_completer;
   d = XNEW (struct dump_context);
   d->func = func;
diff --git a/gdb/command.h b/gdb/command.h
index 3a4a449..658892f 100644
--- a/gdb/command.h
+++ b/gdb/command.h
@@ -117,6 +117,7 @@ var_types;
 struct cmd_list_element;
 
 typedef void cmd_cfunc_ftype (char *args, int from_tty);
+typedef void cmd_const_cfunc_ftype (const char *args, int from_tty);
 
 /* This structure specifies notifications to be suppressed by a cli
    command interpreter.  */
@@ -140,6 +141,19 @@ extern struct cmd_list_element *add_cmd (const char *, enum command_class,
 					 const char *,
 					 struct cmd_list_element **);
 
+/* Like add_cmd, but no command function is specified.  */
+
+extern struct cmd_list_element *add_cmd (const char *, enum command_class,
+					 const char *,
+					 struct cmd_list_element **);
+
+/* Const-correct variant of the above.  */
+
+extern struct cmd_list_element *add_cmd (const char *, enum command_class,
+					 cmd_const_cfunc_ftype *fun,
+					 const char *,
+					 struct cmd_list_element **);
+
 extern struct cmd_list_element *add_alias_cmd (const char *, const char *,
 					       enum command_class, int,
 					       struct cmd_list_element **);
@@ -171,6 +185,11 @@ extern struct cmd_list_element *add_abbrev_prefix_cmd (const char *,
 extern void set_cmd_cfunc (struct cmd_list_element *cmd,
 			   cmd_cfunc_ftype *cfunc);
 
+/* Const-correct variant of the above.  */
+
+extern void set_cmd_cfunc (struct cmd_list_element *cmd,
+			   cmd_const_cfunc_ftype *cfunc);
+
 typedef void cmd_sfunc_ftype (char *args, int from_tty,
 			      struct cmd_list_element *c);
 extern void set_cmd_sfunc (struct cmd_list_element *cmd,
@@ -205,6 +224,8 @@ extern void set_cmd_completer_handle_brkchars (struct cmd_list_element *,
    around in cmd objects to test the value of the commands sfunc().  */
 extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
 			 cmd_cfunc_ftype *cfun);
+extern int cmd_cfunc_eq (struct cmd_list_element *cmd,
+			 cmd_const_cfunc_ftype *cfun);
 
 /* Each command object has a local context attached to it.  */
 extern void set_cmd_context (struct cmd_list_element *cmd,
diff --git a/gdb/guile/scm-cmd.c b/gdb/guile/scm-cmd.c
index 5501d31..0bd5105 100644
--- a/gdb/guile/scm-cmd.c
+++ b/gdb/guile/scm-cmd.c
@@ -774,7 +774,7 @@ gdbscm_register_command_x (SCM self)
       else
 	{
 	  cmd = add_cmd (c_smob->cmd_name, c_smob->cmd_class,
-			 NULL, c_smob->doc, cmd_list);
+			 c_smob->doc, cmd_list);
 	}
     }
   CATCH (except, RETURN_MASK_ALL)
diff --git a/gdb/python/py-cmd.c b/gdb/python/py-cmd.c
index 2a7c613..d969b12 100644
--- a/gdb/python/py-cmd.c
+++ b/gdb/python/py-cmd.c
@@ -612,7 +612,7 @@ cmdpy_init (PyObject *self, PyObject *args, PyObject *kw)
 				pfx_name, allow_unknown, cmd_list);
 	}
       else
-	cmd = add_cmd (cmd_name, (enum command_class) cmdtype, NULL,
+	cmd = add_cmd (cmd_name, (enum command_class) cmdtype,
 		       docstring, cmd_list);
 
       /* There appears to be no API to set this.  */
diff --git a/gdb/target.c b/gdb/target.c
index 5a2c087..c26fba7 100644
--- a/gdb/target.c
+++ b/gdb/target.c
@@ -386,7 +386,7 @@ Remaining arguments are interpreted by the target protocol.  For more\n\
 information on the arguments for a particular protocol, type\n\
 `help target ' followed by the protocol name."),
 		    &targetlist, "target ", 0, &cmdlist);
-  c = add_cmd (t->to_shortname, no_class, NULL, t->to_doc, &targetlist);
+  c = add_cmd (t->to_shortname, no_class, t->to_doc, &targetlist);
   set_cmd_sfunc (c, open_target);
   set_cmd_context (c, t);
   if (completer != NULL)
@@ -411,7 +411,7 @@ add_deprecated_target_alias (struct target_ops *t, const char *alias)
 
   /* If we use add_alias_cmd, here, we do not get the deprecated warning,
      see PR cli/15104.  */
-  c = add_cmd (alias, no_class, NULL, t->to_doc, &targetlist);
+  c = add_cmd (alias, no_class, t->to_doc, &targetlist);
   set_cmd_sfunc (c, open_target);
   set_cmd_context (c, t);
   alt = xstrprintf ("target %s", t->to_shortname);
diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c
index 437db59..12cc2fb 100644
--- a/gdb/tracepoint.c
+++ b/gdb/tracepoint.c
@@ -4203,7 +4203,7 @@ _initialize_tracepoint (void)
   add_info ("scope", info_scope_command,
 	    _("List the variables local to a scope"));
 
-  add_cmd ("tracepoints", class_trace, NULL,
+  add_cmd ("tracepoints", class_trace,
 	   _("Tracing of program execution without stopping the program."),
 	   &cmdlist);
 

^ permalink raw reply	[flat|nested] 110+ messages in thread

* RE: [RFA 49/67] Constify some commands in btrace.c
  2017-09-23  4:28           ` Tom Tromey
@ 2017-09-26  8:15             ` Metzger, Markus T
  0 siblings, 0 replies; 110+ messages in thread
From: Metzger, Markus T @ 2017-09-26  8:15 UTC (permalink / raw)
  To: Tom Tromey, Pedro Alves; +Cc: gdb-patches

> -----Original Message-----
> From: gdb-patches-owner@sourceware.org [mailto:gdb-patches-
> owner@sourceware.org] On Behalf Of Tom Tromey
> Sent: Saturday, September 23, 2017 6:28 AM
> To: Pedro Alves <palves@redhat.com>
> Cc: Metzger, Markus T <markus.t.metzger@intel.com>; Tom Tromey
> <tom@tromey.com>; gdb-patches@sourceware.org
> Subject: Re: [RFA 49/67] Constify some commands in btrace.c

 
> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
> index 9889055..92370b6 100644
> --- a/gdb/ChangeLog
> +++ b/gdb/ChangeLog
> @@ -1,5 +1,12 @@
>  2017-09-20  Tom Tromey  <tom@tromey.com>
> 
> +	* btrace.c (get_uint, get_context_size, no_chunk)
> +	(maint_btrace_packet_history_cmd)
> +	(maint_btrace_clear_packet_history_cmd, maint_btrace_clear_cmd)
> +	(maint_info_btrace_cmd): Constify.

Looks good to me.

Thanks,
Markus.
Intel Deutschland GmbH
Registered Address: Am Campeon 10-12, 85579 Neubiberg, Germany
Tel: +49 89 99 8853-0, www.intel.de
Managing Directors: Christin Eisenschmid, Christian Lamprechter
Chairperson of the Supervisory Board: Nicole Lau
Registered Office: Munich
Commercial Register: Amtsgericht Muenchen HRB 186928

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 01/67] Add add_cmd function overloads
  2017-09-23  4:14     ` Tom Tromey
@ 2017-09-26 12:11       ` Pedro Alves
  2017-09-27 14:44         ` Tom Tromey
  0 siblings, 1 reply; 110+ messages in thread
From: Pedro Alves @ 2017-09-26 12:11 UTC (permalink / raw)
  To: Tom Tromey, Metzger, Markus T; +Cc: gdb-patches

On 09/23/2017 05:14 AM, Tom Tromey wrote:
>>>>>> "Markus" == Metzger, Markus T <markus.t.metzger@intel.com> writes:
> 
>>> static void
>>> +do_const_cfunc (struct cmd_list_element *c, char *args, int from_tty)
>>> +{
>>> +  c->function.const_cfunc (args, from_tty); /* Ok.  */
>>> +}
> 
> Markus> Ok.?
> 
> This is copy-and-paste from the other function like this.
> I think this is some way to suppress ARI warnings.

I thought so too, though grepping for "Ok" in the ARI finds
no hits.  We have some markers in the tree for ARI, but they
start with "ARI: ".  I'd zap the "Ok." comments see what happens.
You can run the ARI locally and compare with/without "Ok."
comments, with something like:

  gdb/contrib/ari/gdb_ari.sh -Wall gdb/cli/cli-decode.c

> I don't know if ARI is still used...?

It was still sending notifications to the list as recently as
this month.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 01/67] Add add_cmd function overloads
  2017-09-23  4:49       ` Tom Tromey
@ 2017-09-26 12:12         ` Pedro Alves
  2017-09-27 14:42           ` Tom Tromey
  0 siblings, 1 reply; 110+ messages in thread
From: Pedro Alves @ 2017-09-26 12:12 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 09/23/2017 05:48 AM, Tom Tromey wrote:

> --- a/gdb/command.h
> +++ b/gdb/command.h
> @@ -117,6 +117,7 @@ var_types;
>  struct cmd_list_element;
>  
>  typedef void cmd_cfunc_ftype (char *args, int from_tty);
> +typedef void cmd_const_cfunc_ftype (const char *args, int from_tty);
>  
>  /* This structure specifies notifications to be suppressed by a cli
>     command interpreter.  */
> @@ -140,6 +141,19 @@ extern struct cmd_list_element *add_cmd (const char *, enum command_class,
>  					 const char *,
>  					 struct cmd_list_element **);
>  
> +/* Like add_cmd, but no command function is specified.  */
> +
> +extern struct cmd_list_element *add_cmd (const char *, enum command_class,
> +					 const char *,
> +					 struct cmd_list_element **);
> +
> +/* Const-correct variant of the above.  */

It'd seem a tiny bit clearer to swap the two new declarations so
that this "of the above" comment is right below
the const-incorrect one.

> +
> +extern struct cmd_list_element *add_cmd (const char *, enum command_class,
> +					 cmd_const_cfunc_ftype *fun,
> +					 const char *,
> +					 struct cmd_list_element **);

Otherwise OK.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 38/67] Constify some linespec functions
  2017-09-23  4:03     ` Tom Tromey
@ 2017-09-26 12:17       ` Pedro Alves
  0 siblings, 0 replies; 110+ messages in thread
From: Pedro Alves @ 2017-09-26 12:17 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On 09/23/2017 05:03 AM, Tom Tromey wrote:
>>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:
> 
> Pedro> In several places you followed a pattern like:
> 
>>> static void
>>> -foo_command (char *args, int from_tty)
>>> +foo_command (char *args_in, int from_tty)
> 
> Pedro> ... and then args_in wasn't used.
> 
> Hmm... normally I think it should be used.
> Like in this patch (#38):
> 
> -info_scope_command (char *args, int from_tty)
> +info_scope_command (char *args_in, int from_tty)
> ...
> -  char *save_args = args;
> +  const char *save_args = args_in;
> ...
> +  const char *args = args_in;
> 

I meant, used other than for immediately initializating a const version.

> Pedro> I'd be nice to mention in the commit log the reason for this.
> Pedro> I assume that it's because we don't have the corresponding
> Pedro> constified add_cmd variant?
> 
> In this case I believe the reason is that info_scope_command could not
> be constified yet, because add_info isn't constified; but on the other
> hand it calls string_to_event_location, which is now constified, and it
> didn't seem worthwhile to overload that.
> 

Makes sense, and that's exactly the sort of info I was looking for.

> I think all the cases *should* be things like this, but of course there
> may be errors.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 00/67] Simple add_cmd constification
  2017-09-21 10:26 ` [RFA 00/67] Simple add_cmd constification Pedro Alves
@ 2017-09-26 12:19   ` Pedro Alves
  0 siblings, 0 replies; 110+ messages in thread
From: Pedro Alves @ 2017-09-26 12:19 UTC (permalink / raw)
  To: Tom Tromey, gdb-patches

On 09/21/2017 11:26 AM, Pedro Alves wrote:
> On 09/21/2017 06:09 AM, Tom Tromey wrote:
>> First, left me offer my apologies for the length of this series.  It
>> was somewhat simpler to break it into many tiny pieces, because
>> sometimes when const-ifying it is easy to get in over one's head.  On
>> the plus side, nearly all of the patches are trivial and so review
>> should not be too difficult -- just boring.
>>
>> This starts by adding const-correct overloads of add_cmd and a few
>> related functions.  Then, it converts many functions to use the
>> const-correct form.  The idea is to gradually convert all commands
>> (and set/show, etc) to const-correctness, then remove the non-const
>> overloads.
>>
>> Regression tested on the buildbot.
> 
> I've read the whole series and sent a few comments, but it
> all looks generally fine to me.  Those patches that I haven't
> commented on looked OK as-is to me.
> 
> Thanks for doing all this.

I think you're pretty much good to go.  Let me know if you're
waiting for something that I missed.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 01/67] Add add_cmd function overloads
  2017-09-26 12:12         ` Pedro Alves
@ 2017-09-27 14:42           ` Tom Tromey
  0 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-27 14:42 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> It'd seem a tiny bit clearer to swap the two new declarations so
Pedro> that this "of the above" comment is right below
Pedro> the const-incorrect one.

I agree; I made this change.

Tom

^ permalink raw reply	[flat|nested] 110+ messages in thread

* Re: [RFA 01/67] Add add_cmd function overloads
  2017-09-26 12:11       ` Pedro Alves
@ 2017-09-27 14:44         ` Tom Tromey
  0 siblings, 0 replies; 110+ messages in thread
From: Tom Tromey @ 2017-09-27 14:44 UTC (permalink / raw)
  To: Pedro Alves; +Cc: Tom Tromey, Metzger, Markus T, gdb-patches

>>>>> "Pedro" == Pedro Alves <palves@redhat.com> writes:

Pedro> I thought so too, though grepping for "Ok" in the ARI finds
Pedro> no hits.  We have some markers in the tree for ARI, but they
Pedro> start with "ARI: ".  I'd zap the "Ok." comments see what happens.

Seems fine, so I've updated the patch accordingly.

Tom

^ permalink raw reply	[flat|nested] 110+ messages in thread

end of thread, other threads:[~2017-09-27 14:44 UTC | newest]

Thread overview: 110+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-21  5:16 [RFA 00/67] Simple add_cmd constification Tom Tromey
2017-09-21  5:11 ` [RFA 05/67] Constify two functions in valprint.c Tom Tromey
2017-09-21  5:13 ` [RFA 16/67] Constify some functions in memattr.c Tom Tromey
2017-09-21  5:13 ` [RFA 18/67] Constify interpreter_exec_cmd Tom Tromey
2017-09-21  5:13 ` [RFA 10/67] Constify some functions in psymtab.c Tom Tromey
2017-09-21  5:13 ` [RFA 07/67] Constify two functions in cp-abi.c Tom Tromey
2017-09-21  5:13 ` [RFA 28/67] Constify some commands in record-btrace.c Tom Tromey
2017-09-21  7:02   ` Metzger, Markus T
2017-09-21  5:13 ` [RFA 12/67] Constify maintenance_cplus_namespace Tom Tromey
2017-09-21  5:13 ` [RFA 04/67] Constify info_probes_dtrace_command Tom Tromey
2017-09-21 12:48   ` Sergio Durigan Junior
2017-09-21  5:13 ` [RFA 03/67] Constify not_just_help_class_command Tom Tromey
2017-09-21  5:13 ` [RFA 14/67] Constify core_file_command Tom Tromey
2017-09-21  5:13 ` [RFA 25/67] Constify some commands in symfile.c Tom Tromey
2017-09-21  5:13 ` [RFA 09/67] Constify display_tib Tom Tromey
2017-09-21  5:15 ` [RFA 20/67] Constify some commands in cli-cmds.c Tom Tromey
2017-09-21  5:15 ` [RFA 21/67] Constify commands in cli-dump.c Tom Tromey
2017-09-21  5:15 ` [RFA 15/67] Constify show_convenience Tom Tromey
2017-09-21  5:16 ` [RFA 26/67] Constify new_ui_command Tom Tromey
2017-09-21  5:16 ` [RFA 01/67] Add add_cmd function overloads Tom Tromey
2017-09-21  7:02   ` Metzger, Markus T
2017-09-21 10:25     ` Pedro Alves
2017-09-23  4:14       ` Tom Tromey
2017-09-23  4:14     ` Tom Tromey
2017-09-26 12:11       ` Pedro Alves
2017-09-27 14:44         ` Tom Tromey
2017-09-21 10:25   ` Pedro Alves
2017-09-23  4:18     ` Tom Tromey
2017-09-23  4:30     ` Tom Tromey
2017-09-23  4:49       ` Tom Tromey
2017-09-26 12:12         ` Pedro Alves
2017-09-27 14:42           ` Tom Tromey
2017-09-21  5:16 ` [RFA 22/67] Constify user_defined_command Tom Tromey
2017-09-21  5:16 ` [RFA 02/67] Constify add_cmd gdb_bfd.c Tom Tromey
2017-09-21  5:16 ` [RFA 11/67] Constify first_component_command Tom Tromey
2017-09-21  5:17 ` [RFA 13/67] Constify maintenance_print_user_registers Tom Tromey
2017-09-21  5:17 ` [RFA 27/67] Constify some commands in symmisc.c Tom Tromey
2017-09-21  5:17 ` [RFA 29/67] Constify some commands in skip.c Tom Tromey
2017-09-21  5:17 ` [RFA 06/67] Constify dump_arc_instruction_command Tom Tromey
2017-09-21  5:17 ` [RFA 17/67] Constify cmd_record_full_restore Tom Tromey
2017-09-21  7:02   ` Metzger, Markus T
2017-09-21  5:17 ` [RFA 23/67] Constify some commands in cli-logging.c Tom Tromey
2017-09-21  5:17 ` [RFA 08/67] Constify two functions in linux-fork.c Tom Tromey
2017-09-21  5:31 ` [RFA 24/67] Constify some commands in spu-tdep.c Tom Tromey
2017-09-21  5:31 ` [RFA 19/67] Constify maintenance_print_target_stack Tom Tromey
2017-09-21  5:39 ` [RFA 51/67] Constify info_probes_stap_command Tom Tromey
2017-09-21 12:48   ` Sergio Durigan Junior
2017-09-21  5:39 ` [RFA 50/67] Constify unset_exec_wrapper_command Tom Tromey
2017-09-21  5:39 ` [RFA 33/67] Constify some commands in target-descriptions.c Tom Tromey
2017-09-21  5:39 ` [RFA 49/67] Constify some commands in btrace.c Tom Tromey
2017-09-21  7:02   ` Metzger, Markus T
2017-09-21 11:11     ` Pedro Alves
2017-09-21 13:06       ` Metzger, Markus T
2017-09-21 13:47         ` Pedro Alves
2017-09-21 16:53           ` Metzger, Markus T
2017-09-23  4:28           ` Tom Tromey
2017-09-26  8:15             ` Metzger, Markus T
2017-09-21  5:39 ` [RFA 52/67] Constify save_gdb_index_command Tom Tromey
2017-09-21  5:39 ` [RFA 48/67] Constify delete_bookmark_command Tom Tromey
2017-09-21  5:39 ` [RFA 32/67] Constify maintenance_print_dummy_frames Tom Tromey
2017-09-21  5:39 ` [RFA 31/67] Constify some commands in tui.c Tom Tromey
2017-09-21  5:40 ` [RFA 35/67] Constify commands maint.c, plus maintenance_print_type Tom Tromey
2017-09-21 10:06   ` Pedro Alves
2017-09-23  4:32     ` Tom Tromey
2017-09-21  5:40 ` [RFA 46/67] Constify some commands in mips-tdep.c Tom Tromey
2017-09-21  5:40 ` [RFA 64/67] Constify some commands in inferior.c Tom Tromey
2017-09-21  5:40 ` [RFA 56/67] Constify demangle_command Tom Tromey
2017-09-21  5:40 ` [RFA 37/67] Constify some commands in record.c Tom Tromey
2017-09-21  7:02   ` Metzger, Markus T
2017-09-23  4:05     ` Tom Tromey
2017-09-21 10:00   ` Pedro Alves
2017-09-23  4:05     ` Tom Tromey
2017-09-23  4:29     ` Tom Tromey
2017-09-21  5:40 ` [RFA 47/67] Constify some commands in remote.c Tom Tromey
2017-09-21  5:40 ` [RFA 55/67] Constify maintenance_info_program_spaces_command Tom Tromey
2017-09-21  5:40 ` [RFA 45/67] Constify cd_command Tom Tromey
2017-09-21 12:48   ` Sergio Durigan Junior
2017-09-21  5:40 ` [RFA 36/67] Constify some commands in source.c Tom Tromey
2017-09-21  5:40 ` [RFA 53/67] Constify maintenance_print_reggroups Tom Tromey
2017-09-21  5:40 ` [RFA 44/67] Constify some commands in thread.c Tom Tromey
2017-09-21  5:40 ` [RFA 54/67] Constify some commands in compile.c Tom Tromey
2017-09-21  5:40 ` [RFA 63/67] Constify some commands in regcache.c Tom Tromey
2017-09-21  5:40 ` [RFA 66/67] Constify some commands in ada-tasks.c Tom Tromey
2017-09-21  5:40 ` [RFA 62/67] Constify some commands in printcmd.c Tom Tromey
2017-09-21  5:40 ` [RFA 67/67] Constify find_command Tom Tromey
2017-09-21  5:40 ` [RFA 65/67] Constify some commands in symtab.c Tom Tromey
2017-09-21  5:40 ` [RFA 34/67] Constify unwind_command Tom Tromey
2017-09-21  5:40 ` [RFA 38/67] Constify some linespec functions Tom Tromey
2017-09-21 10:04   ` Pedro Alves
2017-09-23  4:03     ` Tom Tromey
2017-09-26 12:17       ` Pedro Alves
2017-09-21  5:41 ` [RFA 41/67] Constify some commands in remote-fileio.c Tom Tromey
2017-09-21  5:41 ` [RFA 59/67] Constify some commands in infcmd.c Tom Tromey
2017-09-21  9:56   ` Pedro Alves
2017-09-21  5:41 ` [RFA 58/67] Constify some commands in i386-tdep.c Tom Tromey
2017-09-21  5:41 ` [RFA 43/67] Constify some commands in probes.c Tom Tromey
2017-09-21 12:47   ` Sergio Durigan Junior
2017-09-21  5:41 ` [RFA 39/67] Constify some commands in ax-gdb.c Tom Tromey
2017-09-21  5:41 ` [RFA 60/67] Constify some commands in macrocmd.c Tom Tromey
2017-09-21  5:42 ` [RFA 42/67] Constify some commands in exec.c, plus symbol_file_command Tom Tromey
2017-09-21  5:42 ` [RFA 57/67] Constify add_symbol_file_from_memory_command Tom Tromey
2017-09-21  5:42 ` [RFA 40/67] Constify some commands in tracepoint.c Tom Tromey
2017-09-21 10:03   ` Pedro Alves
2017-09-23  4:34     ` Tom Tromey
2017-09-21  5:42 ` [RFA 30/67] Constify tui_reg_command Tom Tromey
2017-09-21  5:42 ` [RFA 61/67] Constify some commands in breakpoint.c Tom Tromey
2017-09-21  9:56   ` Pedro Alves
2017-09-21 13:20     ` Patrick Monnerat
2017-09-21 10:26 ` [RFA 00/67] Simple add_cmd constification Pedro Alves
2017-09-26 12:19   ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).