Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <pedro@codesourcery.com>
To: gdb-patches@sourceware.org
Cc: Jan Kratochvil <jan.kratochvil@redhat.com>,
	 Eli Zaretskii <eliz@gnu.org>
Subject: Re: [patch] PID cmdline argument should be whole from digits  [+testcase]
Date: Sun, 14 Feb 2010 14:54:00 -0000	[thread overview]
Message-ID: <201002141454.11337.pedro@codesourcery.com> (raw)
In-Reply-To: <20100214143716.GA15916@host0.dyn.jankratochvil.net>

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


  reply	other threads:[~2010-02-14 14:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-13 15:20 [patch] PID cmdline argument should be whole from digits Jan Kratochvil
2010-02-13 17:47 ` Eli Zaretskii
2010-02-13 21:03   ` Jan Kratochvil
2010-02-14 14:37     ` [patch] PID cmdline argument should be whole from digits [+testcase] Jan Kratochvil
2010-02-14 14:54       ` Pedro Alves [this message]
2010-02-14 18:56         ` Jan Kratochvil
2010-02-15 14:57           ` Pedro Alves
2010-02-15 15:52             ` Jan Kratochvil
2010-02-15 16:03               ` Mark Kettenis
2010-02-15 17:38               ` Jan Kratochvil

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201002141454.11337.pedro@codesourcery.com \
    --to=pedro@codesourcery.com \
    --cc=eliz@gnu.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox