This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
[PATCH] Fix SetThreadName with current gdb
- From: Jon Turney <jon dot turney at dronecode dot org dot uk>
- To: cygwin-patches at cygwin dot com
- Cc: Jon Turney <jon dot turney at dronecode dot org dot uk>
- Date: Wed, 24 Aug 2016 19:18:57 +0100
- Subject: [PATCH] Fix SetThreadName with current gdb
- Authentication-results: sourceware.org; auth=none
- References: <20160822180848.351616-3-jon.turney@dronecode.org.uk>
Wrap SetThreadName()'s call to RaiseException() in __try/__except/__endtry,
so that if the attached debugger doesn't know about MS_VC_EXCEPTION (e.g.
current gdb and probably strace as well) and continues exception processing,
we ignore it, rather than dying due an unhandled exception.
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
---
winsup/cygwin/miscfuncs.cc | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc
index 5a63b26..7a79359 100644
--- a/winsup/cygwin/miscfuncs.cc
+++ b/winsup/cygwin/miscfuncs.cc
@@ -1134,5 +1134,10 @@ SetThreadName(DWORD dwThreadID, const char* threadName)
#endif
};
- RaiseException (MS_VC_EXCEPTION, 0, sizeof (info)/sizeof (ULONG_PTR), (ULONG_PTR *) &info);
+ __try {
+ RaiseException (MS_VC_EXCEPTION, 0, sizeof (info)/sizeof (ULONG_PTR), (ULONG_PTR *) &info);
+ }
+ __except (NO_ERROR) {
+ }
+ __endtry
}
--
2.8.3