summaryrefslogtreecommitdiff
path: root/gdb/gnu-nat.c
diff options
context:
space:
mode:
authorJan Kratochvil <jan.kratochvil@redhat.com>2010-02-15 17:35:48 +0000
committerJan Kratochvil <jan.kratochvil@redhat.com>2010-02-15 17:35:48 +0000
commita5c67f4b5ee3e522ccfacc2ff800cd42e9243c68 (patch)
treeee7923ad66d1c691d915bf41ec614166ca685f04 /gdb/gnu-nat.c
parentd8be1ca0736a3ff60225468bdefbc9556c97aaaf (diff)
downloadgdb-a5c67f4b5ee3e522ccfacc2ff800cd42e9243c68.tar.gz
gdb/
* defs.h (parse_pid_to_attach): New. * utils.c (parse_pid_to_attach): New. * darwin-nat.c (darwin_attach): Replace ARGS parsing by parse_pid. * gnu-nat.c (gnu_attach): Likewise. * nto-procfs.c (procfs_attach): Likewise. * procfs.c (procfs_attach): Likewise. * windows-nat.c (windows_attach): Likewise. * inf-ptrace.c (inf_ptrace_attach): Likewise. Remove variable dummy. * inf-ttrace.c (inf_ttrace_attach): Likewise. * remote.c (extended_remote_attach_1): Likewise. New comment on getpid check. gdb/testsuite/ * gdb.base/attach.exp (attach to nonsense is prohibited): Make the "Illegal process-id" expect string more exact. (attach to digits-starting nonsense is prohibited): New.
Diffstat (limited to 'gdb/gnu-nat.c')
-rw-r--r--gdb/gnu-nat.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/gdb/gnu-nat.c b/gdb/gnu-nat.c
index 2750f9d5bd4..51dde6f3511 100644
--- a/gdb/gnu-nat.c
+++ b/gdb/gnu-nat.c
@@ -2139,12 +2139,9 @@ gnu_attach (struct target_ops *ops, char *args, int from_tty)
struct inf *inf = cur_inf ();
struct inferior *inferior;
- if (!args)
- error_no_arg (_("process-id to attach"));
-
- pid = atoi (args);
+ pid = parse_pid_to_attach (args);
- if (pid == getpid ()) /* Trying to masturbate? */
+ if (pid == getpid ()) /* Trying to masturbate? */
error (_("I refuse to debug myself!"));
if (from_tty)