Catching excecptions in the MSVC debugger when running Win64
Lewis
musicaljelly at gmail.com
Mon Apr 26 23:12:59 UTC 2021
I can't seem to catch a D exception on win64 in the Visual Studio
debugger. I'm using:
- DMD compiler (2.094.2)
- VisualD 1.1.0
- Visual Studio 2019
- Building a Win64 executable
- Debugger set to Visual Studio
- All Win32 and D exceptions enabled in the Exception Settings
window in VS
Test code:
```
import std.file : copy;
int main()
{
copy("filethatdoesnotexist.bla", "othernonexistentfile.bla");
return 0;
}
```
I've tried manually rebuilding phobos in debug so I can see
inside it. I can step into the copy(), all the way until the
point where it constructs the FileException object. But the
debugger never seems to catch the exception.
Instead the debugger breaks in deh_win64_posix.d:493 on the call
to terminate() at the end of _d_throwc(). But this just causes
the debugger to catch *0xC0000096: Privileged instruction*
(presumably due to the hlt instruction inside terminate()),
instead of actually understanding the D FileException that got
thrown. Nothing is printed to the output window regarding the D
exception
Is this the expected behaviour? If not, how to I get visual
studio to properly catch D exceptions for a win64 executable?
More information about the Digitalmars-d-debugger
mailing list