From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21520 invoked by alias); 14 Feb 2010 14:54:16 -0000 Received: (qmail 21511 invoked by uid 22791); 14 Feb 2010 14:54:15 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mail.codesourcery.com (HELO mail.codesourcery.com) (38.113.113.100) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 14 Feb 2010 14:54:11 +0000 Received: (qmail 17580 invoked from network); 14 Feb 2010 14:54:09 -0000 Received: from unknown (HELO orlando) (pedro@127.0.0.2) by mail.codesourcery.com with ESMTPA; 14 Feb 2010 14:54:09 -0000 From: Pedro Alves To: gdb-patches@sourceware.org Subject: Re: [patch] PID cmdline argument should be whole from digits [+testcase] Date: Sun, 14 Feb 2010 14:54:00 -0000 User-Agent: KMail/1.9.10 Cc: Jan Kratochvil , Eli Zaretskii References: <20100213152044.GA6115@host0.dyn.jankratochvil.net> <20100213210342.GC17808@host0.dyn.jankratochvil.net> <20100214143716.GA15916@host0.dyn.jankratochvil.net> In-Reply-To: <20100214143716.GA15916@host0.dyn.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <201002141454.11337.pedro@codesourcery.com> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-02/txt/msg00352.txt.bz2 On Sunday 14 February 2010 14:37:16, Jan Kratochvil wrote: > --- a/gdb/remote.c > +++ b/gdb/remote.c > @@ -3857,17 +3857,9 @@ extended_remote_attach_1 (struct target_ops *target, char *args, int from_tty) > { > struct remote_state *rs = get_remote_state (); > int pid; > - char *dummy; > char *wait_status = NULL; > > - 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 (args); > +unsigned long > +parse_pid (char *args) > +{ (...) > +#ifdef HAVE_GETPID > + if (pid == getpid ()) /* Trying to masturbate? */ > + error (_("I refuse to debug myself!")); > +#endif (...) Certainly a remote PID has nothing to do with a local PID. On windows-nat.c, the PID can either be a Windows or Cygwin PID. -- Pedro Alves