From a5c67f4b5ee3e522ccfacc2ff800cd42e9243c68 Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 15 Feb 2010 17:35:48 +0000 Subject: 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. --- gdb/inf-ptrace.c | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) (limited to 'gdb/inf-ptrace.c') diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index f8050d46a5e..ba9d8a8aec9 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -187,17 +187,9 @@ inf_ptrace_attach (struct target_ops *ops, char *args, int from_tty) { char *exec_file; pid_t pid; - char *dummy; struct inferior *inf; - if (!args) - error_no_arg (_("process-id to attach")); - - dummy = args; - pid = strtol (args, &dummy, 0); - /* Some targets don't set errno on errors, grrr! */ - if (pid == 0 && args == dummy) - error (_("Illegal process-id: %s."), args); + pid = parse_pid_to_attach (args); if (pid == getpid ()) /* Trying to masturbate? */ error (_("I refuse to debug myself!")); -- cgit v1.2.1