Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Christopher Faylor <cgf-use-the-mailinglist-please@sourceware.org>
To: gdb-patches@sourceware.org
Subject: Re: [RFC] win32-nat.c: Handle EXCEPTION_INVALID_HANDLE as SIGSYS
Date: Tue, 23 Oct 2007 22:06:00 -0000	[thread overview]
Message-ID: <20071023214730.GB5570@ednor.casa.cgf.cx> (raw)
In-Reply-To: <008101c814b1$9aeb2dd0$d0c18970$@u-strasbg.fr>

On Mon, Oct 22, 2007 at 03:44:01PM +0200, Pierre Muller wrote:
>  This patch does several things,
>that should probably be separated into several smaller
>patches, but I send it here together as a RFC.
>
>  The patch mainly fixes the problems described in the thread starting with:
>http://sourceware.org/ml/gdb/2007-10/msg00131.html
>
>  The patch first implements recognition of
>the exception EXCEPTION_INVALID_HANDLE generated
>by a call to CloseHandle with an invalid parameter.
>
>  The new variable stop_on_invalid_handle,
>which can be set via "set stoponinvalidhandle",
>allows to either ignore that exception completely
>(with just a comment if verbose is set, default behavior), 
>or to map it to SIGSYS, which can then be handled as any
>target signal via "handle SIGSYS ..." 
>
>  Combined to this I integrated the new variable
>old_behavior, which allowed me to disable
>all CloseHandle calls present in the win32-nat.c source
>that resulted in later INVALID_HANDLE exception.
>  These exceptions come from the fact that the
>win32  API specifications say that the thread and process
>handles are closed by the system after the
>corresponding debug events, and thus they should never be closed by
>the debugger itself.

So if I got this wrong and closed some handles that shouldn't have been
closed why doesn't this patch just get rid of those cases?

This patch seems amazingly complicated to me for something which seems
to just be trapping a behavior that is apparently inappropriate for gdb
to be doing in the first place.  However, if there still is a need for
these CloseHandles then it seems like there should be just one macro or
function which does the equivalent of the many cases of

if (old_behavior)
  CloseHandle(...)

that are sprinkled throughout this patch.

And, amusingly enough, this patch illustrates, within days of making
mingw available, exactly the kind of situation I didn't want to get into
by allowing gdb to build under MinGW.  It forces me to evaluate a
multipage patch which isn't needed for Cygwin.

cgf


  parent reply	other threads:[~2007-10-23 21:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-22 14:14 Pierre Muller
2007-10-22 21:15 ` Eli Zaretskii
2007-10-23 22:06 ` Christopher Faylor [this message]
2007-10-23 22:26   ` Daniel Jacobowitz
2007-10-24  5:21   ` Eli Zaretskii
2007-10-24  8:40     ` Pierre Muller
2007-10-24 19:07       ` Eli Zaretskii
2007-10-24 11:47     ` Pedro Alves
2007-10-24  8:13   ` Pierre Muller
2007-10-24  8:51     ` Pedro Alves
2007-10-24 19:19       ` Eli Zaretskii
2007-10-24 19:37         ` Mark Kettenis
2007-10-24 19:40         ` Daniel Jacobowitz
2007-10-24 20:15           ` Eli Zaretskii
2007-10-29  8:25           ` Christopher Faylor
2007-10-29  3:07       ` Christopher Faylor

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=20071023214730.GB5570@ednor.casa.cgf.cx \
    --to=cgf-use-the-mailinglist-please@sourceware.org \
    --cc=gdb-patches@sourceware.org \
    /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