Skip to content

Commit a89b9cb

Browse files
committed
Cygwin: Only return true from try_to_debug() if we launched a JIT debugger
This fixes constantly replaying the exception if we have a segfault while a debugger is already attached, e.g. stracing a segv, see: https://cygwin.com/pipermail/cygwin/2025-May/258144.html Future work: The 'debugging' static in exception::handle(), which makes us replay the exception the next half a million times it's hit seems like cruft, maybe we should look at if it's possible to remove that? Fixes: 9145737 ("Cygwin: Make 'ulimit -c' control writing a coredump") Reported-by: Christian Franke <[email protected]> Signed-off-by: Jon Turney <[email protected]> (cherry picked from commit b39b510)
1 parent ffb3379 commit a89b9cb

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

winsup/cygwin/exceptions.cc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -597,7 +597,7 @@ try_to_debug ()
597597
{
598598
extern void break_here ();
599599
break_here ();
600-
return 1;
600+
return 0;
601601
}
602602

603603
/* Otherwise, invoke the JIT debugger, if set */
@@ -812,6 +812,8 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
812812
else if (try_to_debug ())
813813
{
814814
debugging = 1;
815+
/* If a JIT debugger just attached, replay the exception for the benefit
816+
of that */
815817
return ExceptionContinueExecution;
816818
}
817819

winsup/cygwin/release/3.6.2

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ Fixes:
2525

2626
- Fix deadlock for opening both side of a fifo in a process.
2727
Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258138.html
28+
29+
- Fix infinite exception loop on segmentation fault when strace-ing
30+
Addresses: https://cygwin.com/pipermail/cygwin/2025-May/258144.html

0 commit comments

Comments
 (0)