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

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