We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 3645 - Thread naming crashes GDB, "Program received signal ?, unknown signal"
Summary: Thread naming crashes GDB, "Program received signal ?, unknown signal"
Status: RESOLVED FIXED
Alias: None
Product: SDL
Classification: Unclassified
Component: thread (show other bugs)
Version: 2.0.5
Hardware: x86 Windows 7
: P2 major
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-11 19:32 UTC by cremmy
Modified: 2017-06-06 17:15 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description cremmy 2017-05-11 19:32:13 UTC
This problem is present when debugging (GDB, confirmed on versions 7.6.1, 7.11 and 7.12, 32 and 64bit) program compiled unger MinGW (MinGW_w64 and TDM-GCC).
In SDL_SYS_SetupThread (/src/thread/windows/SDL_systhread.c:168) uses Windows' way of naming threads, namely raising an exception. However, many (all available?) versions of GDB don't seem to support that, and if such exception is thrown, then program crashes and GDB shows error "Program received signal ?, unknown signal".

I've confirmed that this happens when calling SDL_Init with EVERYTHING flag OR SDL_OpenAudio OR MIX_OpenAudio - using sound makes one unable to use debugger.

SDL_SYS_SetupThread function checks if SDL_HINT_WINDOWS_DISABLE_THREAD_NAMING hint is false, if not then it returns from function. Possible workaround is to set this hint to "1" early in program.

My suggestion is to set this hint to "1" by default on MinGW builds, as it doesn't seem that GDB will support thread naming soon (this bug was supposed to be fixed in 7.11.1-1, in 7.12 it still doesn't work).
Comment 1 Ryan C. Gordon 2017-06-06 17:15:17 UTC
I've turned off the Visual Studio-style thread naming in https://hg.libsdl.org/SDL/rev/abf45a095845 ...VS users can set the hint if they want to, everyone else will carry on.

(and everything will eventually support the new Win32 SetThreadDescription() API anyhow).

--ryan.