This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] win32-nat.c: Handle EXCEPTION_INVALID_HANDLE as SIGSYS


Pierre Muller wrote:
>
>   If I cut my patch into three parts:
> 3) Remove wrong CloseHandle calls

I'd prefer if this went in first.  I'm convinced this is the correct
thing to do everywhere.

(Hey, I'm happy in that allows me to remove an ugly #ifdef in
gdbserver/win32-low.c.)

( ( ( If it isn't [the correct thing to do everywhere], then we can
follow Cygwin's lead, and
install a top level SEH handler in gdb that handles this exception.
It could have
always have been done in gdb the first place, even for Cygwin.  Remember, the
exception is only thrown iff a debugger is attached, and a debugger
can easilly not
pass it to the inferior.  That would mean 0 changes to win32-nat.c debug API
usage.  Of course, any other inferior that throws that exception will have
the same problem. ) ) )

> 1) Handle EXCEPTION_INVALID_HANDLE exception as a SIGSYS target signal
> 2) Add the stoponinvalidhandle

EXCEPTION_INVALID_HANDLE is not quite a SIGSYS.  Plus, a Cygwin inferior should
never see this, as you shouldn't be using CloseHandle in user apps there anyway.
Maybe we can take the oportunity to implement more generic Windows exceptions
support, not just EXCEPTION_INVALID_HANDLE.  Something similar to the "handle"
command.

>
> then, after the 1) is applied,
> you will get several SIGSYS when debugging gdb with itself.
>   I suppose that this would introduce lots of
> new failures to the testsuite, especially in the gdb.gdb subdirectory.
>

Only on MinGW gdb, so they wouldn't qualify as "new" failures.  And only on
tests that load gdb in gdb, or that have a `close' with a broken argument.

>   I would really prefer to keep trace of
> the old CloseHandles, in case we discover that under special
> circumstances, or for some versions of the system,
> these calls are needed.
>

I'd prefer we don't add such ugliness.

Cheers,
Pedro Alves


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]