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

On Sunday 14 February 2010 18:56:04, Jan Kratochvil wrote:
> On Sun, 14 Feb 2010 15:54:10 +0100, Pedro Alves wrote:
> > On windows-nat.c, the PID can either be a Windows or Cygwin PID.
> 
> On non-cygwin (mingw?) HAVE_GETPID should be false and in Cygwin it should be
> compatible.  

mingw does have getpid/_getpid.  What I meant was for you to notice
that windows-nat.c when built for Cygwin tries PID as a Windows PID,
and if that fails, tries PID as a Cygwin PID.  Probably doesn't matter
in this case; but this further demonstrates on top of the remote
example, that there's target side tweakable behaviour here.

> But I understand relying on HAVE_* being false is not good.

Yes.

> 
> (moved getpid checking out of parse_pid* + kept "process-id to attach" message
> intact)
> 
> parse_pid_to_attach does not use pid_t return type as while it is
> defined-as-needed by config.h it would not be compatible with windows-nat.c
> expected DWORD type.

(pid_t would only make sense for native targets anyway.  At some
point, we may have to come up with a target_pid_t, or some such,
but we've dodged it so far.)

I'd prefer to make it return int, because it's what we in
use common code to store a pid.  E.g., ptid_t.pid,
inferior->pid. Note that DWORD is always 32-bit, even
on 64-bit Windows.

Can you extend the describing comment of parse_pid_to_attach,
with something like:

  Either returns a valid PID, or throws an error.

Otherwise, looks OK to me.

-- 
Pedro Alves


  reply	other threads:[~2010-02-15 14:57 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
2010-02-14 18:56         ` Jan Kratochvil
2010-02-15 14:57           ` Pedro Alves [this message]
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=201002151457.24814.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