aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-04-15 09:40:57 -0600
committerTom Tromey <tromey@redhat.com>2014-06-04 11:11:43 -0600
commitc0939df1ce443e82c44188ff988acbb45780bfd7 (patch)
tree7d847e02170ab27d7e9eb7f4a3f406c5a7af5fd1
parent8eaff7cd138d8517f8c2fbc8be9b8c6eaf649bd9 (diff)
downloadgdb-c0939df1ce443e82c44188ff988acbb45780bfd7.zip
gdb-c0939df1ce443e82c44188ff988acbb45780bfd7.tar.gz
gdb-c0939df1ce443e82c44188ff988acbb45780bfd7.tar.bz2
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.
-rw-r--r--gdb/ChangeLog18
-rw-r--r--gdb/darwin-nat.c2
-rw-r--r--gdb/gnu-nat.c2
-rw-r--r--gdb/go32-nat.c2
-rw-r--r--gdb/inf-ptrace.c2
-rw-r--r--gdb/inf-ttrace.c2
-rw-r--r--gdb/linux-nat.c2
-rw-r--r--gdb/nto-procfs.c2
-rw-r--r--gdb/procfs.c4
-rw-r--r--gdb/remote.c5
-rw-r--r--gdb/target.h4
-rw-r--r--gdb/utils.c4
-rw-r--r--gdb/utils.h2
-rw-r--r--gdb/windows-nat.c2
14 files changed, 36 insertions, 17 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8698393..8e48f1f 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,23 @@
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.
+
+2014-06-04 Tom Tromey <tromey@redhat.com>
+
* target-delegates.c: Rebuild.
* target.c (default_thread_address_space): New function.
(target_thread_address_space): Simplify.
diff --git a/gdb/darwin-nat.c b/gdb/darwin-nat.c
index 160329b..5714288 100644
--- a/gdb/darwin-nat.c
+++ b/gdb/darwin-nat.c
@@ -1672,7 +1672,7 @@ darwin_setup_fake_stop_event (struct inferior *inf)
/* Attach to process PID, then initialize for debugging it
and wait for the trace-trap that results from attaching. */
static void
-darwin_attach (struct target_ops *ops, char *args, int from_tty)
+darwin_attach (struct target_ops *ops, const char *args, int from_tty)
{
pid_t pid;
pid_t pid2;
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 516e83d..176f4a1 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2165,7 +2165,7 @@ gnu_create_inferior (struct target_ops *ops,
/* Attach to process PID, then initialize for debugging it
and wait for the trace-trap that results from attaching. */
static void
-gnu_attach (struct target_ops *ops, char *args, int from_tty)
+gnu_attach (struct target_ops *ops, const char *args, int from_tty)
{
int pid;
char *exec_file;
diff --git a/gdb/go32-nat.c b/gdb/go32-nat.c
index d614911..89157d3 100644
--- a/gdb/go32-nat.c
+++ b/gdb/go32-nat.c
@@ -340,7 +340,7 @@ static struct {
};
static void
-go32_attach (struct target_ops *ops, char *args, int from_tty)
+go32_attach (struct target_ops *ops, const char *args, int from_tty)
{
error (_("\
You cannot attach to a running program on this platform.\n\
diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c
index 4736fbd..e1d64f8 100644
--- a/gdb/inf-ptrace.c
+++ b/gdb/inf-ptrace.c
@@ -181,7 +181,7 @@ inf_ptrace_mourn_inferior (struct target_ops *ops)
be chatty about it. */
static void
-inf_ptrace_attach (struct target_ops *ops, char *args, int from_tty)
+inf_ptrace_attach (struct target_ops *ops, const char *args, int from_tty)
{
char *exec_file;
pid_t pid;
diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c
index ee55515..a7c3481 100644
--- a/gdb/inf-ttrace.c
+++ b/gdb/inf-ttrace.c
@@ -747,7 +747,7 @@ inf_ttrace_create_threads_after_attach (int pid)
}
static void
-inf_ttrace_attach (struct target_ops *ops, char *args, int from_tty)
+inf_ttrace_attach (struct target_ops *ops, const char *args, int from_tty)
{
char *exec_file;
pid_t pid;
diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
index 3f6e5ea..6ca5c7e 100644
--- a/gdb/linux-nat.c
+++ b/gdb/linux-nat.c
@@ -1301,7 +1301,7 @@ linux_nat_create_inferior (struct target_ops *ops,
}
static void
-linux_nat_attach (struct target_ops *ops, char *args, int from_tty)
+linux_nat_attach (struct target_ops *ops, const char *args, int from_tty)
{
struct lwp_info *lp;
int status;
diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c
index 2ce9563..728d6f3 100644
--- a/gdb/nto-procfs.c
+++ b/gdb/nto-procfs.c
@@ -602,7 +602,7 @@ procfs_files_info (struct target_ops *ignore)
/* Attach to process PID, then initialize for debugging it. */
static void
-procfs_attach (struct target_ops *ops, char *args, int from_tty)
+procfs_attach (struct target_ops *ops, const char *args, int from_tty)
{
char *exec_file;
int pid;
diff --git a/gdb/procfs.c b/gdb/procfs.c
index cd3301a..6a2aef8 100644
--- a/gdb/procfs.c
+++ b/gdb/procfs.c
@@ -110,7 +110,7 @@
/* This module defines the GDB target vector and its methods. */
-static void procfs_attach (struct target_ops *, char *, int);
+static void procfs_attach (struct target_ops *, const char *, int);
static void procfs_detach (struct target_ops *, const char *, int);
static void procfs_resume (struct target_ops *,
ptid_t, int, enum gdb_signal);
@@ -3039,7 +3039,7 @@ procfs_debug_inferior (procinfo *pi)
}
static void
-procfs_attach (struct target_ops *ops, char *args, int from_tty)
+procfs_attach (struct target_ops *ops, const char *args, int from_tty)
{
char *exec_file;
int pid;
diff --git a/gdb/remote.c b/gdb/remote.c
index 6774d84..8f9478c 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -4365,7 +4365,8 @@ remote_disconnect (struct target_ops *target, char *args, int from_tty)
be chatty about it. */
static void
-extended_remote_attach_1 (struct target_ops *target, char *args, int from_tty)
+extended_remote_attach_1 (struct target_ops *target, const char *args,
+ int from_tty)
{
struct remote_state *rs = get_remote_state ();
int pid;
@@ -4478,7 +4479,7 @@ extended_remote_attach_1 (struct target_ops *target, char *args, int from_tty)
}
static void
-extended_remote_attach (struct target_ops *ops, char *args, int from_tty)
+extended_remote_attach (struct target_ops *ops, const char *args, int from_tty)
{
extended_remote_attach_1 (ops, args, from_tty);
}
diff --git a/gdb/target.h b/gdb/target.h
index b0b9e89..cd5a799 100644
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -409,7 +409,7 @@ struct target_ops
for normal operations, and should be ready to deliver the
status of the process immediately (without waiting) to an
upcoming target_wait call. */
- void (*to_attach) (struct target_ops *ops, char *, int);
+ void (*to_attach) (struct target_ops *ops, const char *, int);
void (*to_post_attach) (struct target_ops *, int)
TARGET_DEFAULT_IGNORE ();
void (*to_detach) (struct target_ops *ops, const char *, int)
@@ -2140,7 +2140,7 @@ extern void noprocess (void) ATTRIBUTE_NORETURN;
extern void target_require_runnable (void);
-extern void find_default_attach (struct target_ops *, char *, int);
+extern void find_default_attach (struct target_ops *, const char *, int);
extern void find_default_create_inferior (struct target_ops *,
char *, char *, char **, int);
diff --git a/gdb/utils.c b/gdb/utils.c
index 86df1c7..6e8f384 100644
--- a/gdb/utils.c
+++ b/gdb/utils.c
@@ -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)])
diff --git a/gdb/utils.h b/gdb/utils.h
index 33371ac..0eba8ae 100644
--- a/gdb/utils.h
+++ b/gdb/utils.h
@@ -63,7 +63,7 @@ struct timeval get_prompt_for_continue_wait_time (void);
/* Parsing utilites. */
-extern int parse_pid_to_attach (char *args);
+extern int parse_pid_to_attach (const char *args);
extern int parse_escape (struct gdbarch *, const char **);
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 16f4efb..e912fa4 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -1834,7 +1834,7 @@ out:
/* Attach to process PID, then initialize for debugging it. */
static void
-windows_attach (struct target_ops *ops, char *args, int from_tty)
+windows_attach (struct target_ops *ops, const char *args, int from_tty)
{
BOOL ok;
DWORD pid;