constify to_attach
This constifies the "args" argument to the target_ops to_attach method. I updated all instances of the method. I could not compile all of them but I hand-inspected them. In all cases either the argument is ignored, or it is passed to parse_pid_to_attach. (linux-nat does some extra stuff, but that one I built...) If you want to try it on your host of choice, please do so. The code in parse_pid_to_attach seems a little bogus to me. If there is a platform with a broken strtoul, we have better methods for fixing the issue now. However, I left the code as is since it is clearly ok to do so. Built and regtested on x86-64 Fedora 20. 2014-06-04 Tom Tromey <tromey@redhat.com> * procfs.c (procfs_attach): Make "args" const. * windows-nat.c (windows_attach): Make "args" const. * nto-procfs.c (procfs_attach): Make "args" const. * inf-ttrace.c (inf_ttrace_attach): Make "args" const. * go32-nat.c (go32_attach): Make "args" const. * gnu-nat.c (gnu_attach): Make "args" const. * darwin-nat.c (darwin_attach): Make "args" const. * inf-ptrace.c (inf_ptrace_attach): Make "args" const. * linux-nat.c (linux_nat_attach): Make "args" const. * remote.c (extended_remote_attach_1, extended_remote_attach): Make "args" const. * target.h (struct target_ops) <to_attach>: Make "args" const. (find_default_attach): Likewise. * utils.c (parse_pid_to_attach): Make "args" const. * utils.h (parse_pid_to_attach): Update.
This commit is contained in:
parent
8eaff7cd13
commit
c0939df1ce
14 changed files with 36 additions and 17 deletions
|
@ -3255,7 +3255,7 @@ gdb_bfd_errmsg (bfd_error_type error_tag, char **matching)
|
|||
/* Return ARGS parsed as a valid pid, or throw an error. */
|
||||
|
||||
int
|
||||
parse_pid_to_attach (char *args)
|
||||
parse_pid_to_attach (const char *args)
|
||||
{
|
||||
unsigned long pid;
|
||||
char *dummy;
|
||||
|
@ -3263,7 +3263,7 @@ parse_pid_to_attach (char *args)
|
|||
if (!args)
|
||||
error_no_arg (_("process-id to attach"));
|
||||
|
||||
dummy = args;
|
||||
dummy = (char *) args;
|
||||
pid = strtoul (args, &dummy, 0);
|
||||
/* Some targets don't set errno on errors, grrr! */
|
||||
if ((pid == 0 && dummy == args) || dummy != &args[strlen (args)])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue