[Issue 19397] New: Debugger does not catch unhandled exceptions in druntime threads
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Nov 13 19:34:07 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19397
Issue ID: 19397
Summary: Debugger does not catch unhandled exceptions in
druntime threads
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Severity: normal
Priority: P1
Component: druntime
Assignee: nobody at puremagic.com
Reporter: goalitium at dissues.mail.kapsi.fi
import core.thread;
void fun()
{
throw new Exception("hi");
}
void main()
{
Thread thread = new Thread(&fun);
thread.start();
thread.join();
}
The following program rethrows the exception at join() call as documented, but
the attached debugger (Visual Studio debugger in this case) should be able to
catch it and break at the line where it was originally thrown.
In a similar Windows C++ program, a thread created with either CreateThread or
_beginthread[ex], given a function which throws an std::exception, does indeed
trigger a debug break at the throw site. Only exception to this is std::thread,
which causes the program to abort on the exception instead of hitting debug
break.
A side note to exception handling on Windows systems, there should be more
information provided to debugger about the caught exceptions (namely the type
and the message) when debugger catches the exception, but in this particular
case, all the information printed in debugger output is that an unknown
exception was caught with no strack trace information. I understand Visual
Studio debugger does not support D exceptions, but with the current state in
debugging support, we should have at least the name and the message of the
exception given to debugger in some manner (with OutputDebugMessage?). I have
tried to work around this problem by using custom exceptions which calls
OutputDebugMessage to display this information and while it works, it's a hack
and does not work with exceptions thrown by druntime.
--
More information about the Digitalmars-d-bugs
mailing list