RE: [patch] fix spurious SIGSEGV faults under Cygwin

Dave Korn
2006-02-02T17:47:25Z

On 02 February 2006 17:42, Brian Dessent wrote:

> Dave Korn wrote:
>
>> I'm having a conceptual difficulty here: Under what circumstances
>> would you expect there *not* to be a debugger attached to the inferior
>> to which the debugger is attached? That's a bit zen, isn't it?
>
> The code in question here runs many times in the normal course of any
> Cygwin program -- debugger or no. The idea behind guarding the call to
> OutputDebugString() with "if (being_debugged())" was that the call to
> IsDebuggerPresent() was cheaper than the call to OutputDebugString(), and
> that a well-behaived, non-debug build of a binary should not needlessly
> send tons and tons of nonsense to OutputDebugString unless it's actually
> being debugged and there is something there to interpret the nonsense.

Um, that's two people now who thought I was referring to the cygwin side of the patch.

No, this is the bit of your post that I was replying to:

"then gdb could simply read that variable in the process' memory before deciding whether to handle the fault. "

Is it the case that IsDebuggerPresent doesn't detect when gdb is attached?

cheers,
DaveK
--
Can't think of a witty .sigline today....