diff options
author | Tom Tromey <tromey@redhat.com> | 2014-06-06 13:38:16 -0600 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2014-06-16 10:29:17 -0600 |
commit | 7bc112c1b9bc6e6346e2afff9174fe4adbce909f (patch) | |
tree | 94d0bc92a585689d50a787af8f24782898f43d65 | |
parent | fee354eeef0b5bb9b1b799e2ce313fc805b2af1a (diff) | |
download | gdb-7bc112c1b9bc6e6346e2afff9174fe4adbce909f.zip gdb-7bc112c1b9bc6e6346e2afff9174fe4adbce909f.tar.gz gdb-7bc112c1b9bc6e6346e2afff9174fe4adbce909f.tar.bz2 |
constify to_info_proc and friends
This makes a parameter of to_info_proc const and then fixes up some
fallout, including parameters in a couple of gdbarch methods.
I could not test the procfs.c change. I verified it by inspection.
If this causes an error here, it will be trivial to fix.
2014-06-16 Tom Tromey <tromey@redhat.com>
* target.h (struct target_ops) <to_info_proc>: Make parameter
const.
(target_info_proc): Update.
* target.c (target_info_proc): Make "args" const.
* procfs.c (procfs_info_proc): Update.
* linux-tdep.c (linux_info_proc): Update.
(linux_core_info_proc_mappings): Make "args" const.
(linux_core_info_proc): Update.
* gdbarch.sh (info_proc, core_info_proc): Make "args" const.
* gdbarch.c: Rebuild.
* gdbarch.h: Rebuild.
* corelow.c (core_info_proc): Update.
-rw-r--r-- | gdb/ChangeLog | 15 | ||||
-rw-r--r-- | gdb/corelow.c | 3 | ||||
-rw-r--r-- | gdb/gdbarch.c | 4 | ||||
-rw-r--r-- | gdb/gdbarch.h | 8 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 4 | ||||
-rw-r--r-- | gdb/linux-tdep.c | 15 | ||||
-rw-r--r-- | gdb/procfs.c | 4 | ||||
-rw-r--r-- | gdb/target.c | 2 | ||||
-rw-r--r-- | gdb/target.h | 5 |
9 files changed, 41 insertions, 19 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 44a05d3..b3aa092 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,20 @@ 2014-06-16 Tom Tromey <tromey@redhat.com> + * target.h (struct target_ops) <to_info_proc>: Make parameter + const. + (target_info_proc): Update. + * target.c (target_info_proc): Make "args" const. + * procfs.c (procfs_info_proc): Update. + * linux-tdep.c (linux_info_proc): Update. + (linux_core_info_proc_mappings): Make "args" const. + (linux_core_info_proc): Update. + * gdbarch.sh (info_proc, core_info_proc): Make "args" const. + * gdbarch.c: Rebuild. + * gdbarch.h: Rebuild. + * corelow.c (core_info_proc): Update. + +2014-06-16 Tom Tromey <tromey@redhat.com> + * target.h (struct target_ops) <to_disconnect>: Make parameter const. (target_disconnect): Update. diff --git a/gdb/corelow.c b/gdb/corelow.c index e6a5cb1..1775a66 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -979,7 +979,8 @@ core_has_registers (struct target_ops *ops) /* Implement the to_info_proc method. */ static void -core_info_proc (struct target_ops *ops, char *args, enum info_proc_what request) +core_info_proc (struct target_ops *ops, const char *args, + enum info_proc_what request) { struct gdbarch *gdbarch = get_current_arch (); diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 4f82095..fe49987 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -4257,7 +4257,7 @@ gdbarch_info_proc_p (struct gdbarch *gdbarch) } void -gdbarch_info_proc (struct gdbarch *gdbarch, char *args, enum info_proc_what what) +gdbarch_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->info_proc != NULL); @@ -4281,7 +4281,7 @@ gdbarch_core_info_proc_p (struct gdbarch *gdbarch) } void -gdbarch_core_info_proc (struct gdbarch *gdbarch, char *args, enum info_proc_what what) +gdbarch_core_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what) { gdb_assert (gdbarch != NULL); gdb_assert (gdbarch->core_info_proc != NULL); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index c621091..5388e6e 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -1250,8 +1250,8 @@ extern void set_gdbarch_gen_return_address (struct gdbarch *gdbarch, gdbarch_gen extern int gdbarch_info_proc_p (struct gdbarch *gdbarch); -typedef void (gdbarch_info_proc_ftype) (struct gdbarch *gdbarch, char *args, enum info_proc_what what); -extern void gdbarch_info_proc (struct gdbarch *gdbarch, char *args, enum info_proc_what what); +typedef void (gdbarch_info_proc_ftype) (struct gdbarch *gdbarch, const char *args, enum info_proc_what what); +extern void gdbarch_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what); extern void set_gdbarch_info_proc (struct gdbarch *gdbarch, gdbarch_info_proc_ftype *info_proc); /* Implement the "info proc" command for core files. Noe that there @@ -1260,8 +1260,8 @@ extern void set_gdbarch_info_proc (struct gdbarch *gdbarch, gdbarch_info_proc_ft extern int gdbarch_core_info_proc_p (struct gdbarch *gdbarch); -typedef void (gdbarch_core_info_proc_ftype) (struct gdbarch *gdbarch, char *args, enum info_proc_what what); -extern void gdbarch_core_info_proc (struct gdbarch *gdbarch, char *args, enum info_proc_what what); +typedef void (gdbarch_core_info_proc_ftype) (struct gdbarch *gdbarch, const char *args, enum info_proc_what what); +extern void gdbarch_core_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what); extern void set_gdbarch_core_info_proc (struct gdbarch *gdbarch, gdbarch_core_info_proc_ftype *core_info_proc); /* Iterate over all objfiles in the order that makes the most sense diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 9f357b6..13db4d4 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -990,12 +990,12 @@ v:int:has_dos_based_file_system:::0:0::0 m:void:gen_return_address:struct agent_expr *ax, struct axs_value *value, CORE_ADDR scope:ax, value, scope::default_gen_return_address::0 # Implement the "info proc" command. -M:void:info_proc:char *args, enum info_proc_what what:args, what +M:void:info_proc:const char *args, enum info_proc_what what:args, what # Implement the "info proc" command for core files. Noe that there # are two "info_proc"-like methods on gdbarch -- one for core files, # one for live targets. -M:void:core_info_proc:char *args, enum info_proc_what what:args, what +M:void:core_info_proc:const char *args, enum info_proc_what what:args, what # Iterate over all objfiles in the order that makes the most sense # for the architecture to make global symbol searches. diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c index c10b8ee..ca19cf4 100644 --- a/gdb/linux-tdep.c +++ b/gdb/linux-tdep.c @@ -315,7 +315,7 @@ read_mapping (const char *line, /* Implement the "info proc" command. */ static void -linux_info_proc (struct gdbarch *gdbarch, char *args, +linux_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what) { /* A long is used for pid instead of an int to avoid a loss of precision @@ -332,7 +332,12 @@ linux_info_proc (struct gdbarch *gdbarch, char *args, int target_errno; if (args && isdigit (args[0])) - pid = strtoul (args, &args, 10); + { + char *tem; + + pid = strtoul (args, &tem, 10); + args = tem; + } else { if (!target_has_execution) @@ -343,7 +348,7 @@ linux_info_proc (struct gdbarch *gdbarch, char *args, pid = current_inferior ()->pid; } - args = skip_spaces (args); + args = skip_spaces_const (args); if (args && args[0]) error (_("Too many parameters: %s"), args); @@ -603,7 +608,7 @@ linux_info_proc (struct gdbarch *gdbarch, char *args, /* Implement "info proc mappings" for a corefile. */ static void -linux_core_info_proc_mappings (struct gdbarch *gdbarch, char *args) +linux_core_info_proc_mappings (struct gdbarch *gdbarch, const char *args) { asection *section; ULONGEST count, page_size; @@ -706,7 +711,7 @@ linux_core_info_proc_mappings (struct gdbarch *gdbarch, char *args) /* Implement "info proc" for a corefile. */ static void -linux_core_info_proc (struct gdbarch *gdbarch, char *args, +linux_core_info_proc (struct gdbarch *gdbarch, const char *args, enum info_proc_what what) { int exe_f = (what == IP_MINIMAL || what == IP_EXE || what == IP_ALL); diff --git a/gdb/procfs.c b/gdb/procfs.c index 6a2aef8..cbb44ce 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -148,7 +148,7 @@ static char * procfs_make_note_section (struct target_ops *self, static int procfs_can_use_hw_breakpoint (struct target_ops *self, int, int, int); -static void procfs_info_proc (struct target_ops *, char *, +static void procfs_info_proc (struct target_ops *, const char *, enum info_proc_what); #if defined (PR_MODEL_NATIVE) && (PR_MODEL_NATIVE == PR_MODEL_LP64) @@ -5141,7 +5141,7 @@ info_proc_mappings (procinfo *pi, int summary) /* Implement the "info proc" command. */ static void -procfs_info_proc (struct target_ops *ops, char *args, +procfs_info_proc (struct target_ops *ops, const char *args, enum info_proc_what what) { struct cleanup *old_chain; diff --git a/gdb/target.c b/gdb/target.c index f3226b9..075425d 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -2542,7 +2542,7 @@ find_run_target (void) /* Implement the "info proc" command. */ int -target_info_proc (char *args, enum info_proc_what what) +target_info_proc (const char *args, enum info_proc_what what) { struct target_ops *t; diff --git a/gdb/target.h b/gdb/target.h index 7f9714e..e563f2f 100644 --- a/gdb/target.h +++ b/gdb/target.h @@ -815,7 +815,8 @@ struct target_ops /* Implement the "info proc" command. */ - void (*to_info_proc) (struct target_ops *, char *, enum info_proc_what); + void (*to_info_proc) (struct target_ops *, const char *, + enum info_proc_what); /* Tracepoint-related operations. */ @@ -1232,7 +1233,7 @@ struct address_space *target_thread_address_space (ptid_t); an error was encountered while attempting to handle the request. */ -int target_info_proc (char *, enum info_proc_what); +int target_info_proc (const char *, enum info_proc_what); /* Returns true if this target can debug multiple processes simultaneously. */ |