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.
This commit is contained in:
Tom Tromey 2014-06-06 13:38:16 -06:00
parent fee354eeef
commit 7bc112c1b9
9 changed files with 41 additions and 19 deletions

View File

@ -1,3 +1,18 @@
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

View File

@ -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 ();

View File

@ -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);

View File

@ -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

View File

@ -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.

View File

@ -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);

View File

@ -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;

View File

@ -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;

View File

@ -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. */