Fix SetThreadName with current gdb

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.

Also remove an unnecessary cast in the RaiseException() invocation.

Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
This commit is contained in:
Jon Turney 2016-08-25 10:06:47 +01:00
parent 14228e2d0f
commit eccefd9704
1 changed files with 6 additions and 1 deletions

View File

@ -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), info);
}
__except (NO_ERROR) {
}
__endtry
}