April 13, 2020 Is there an exception for access violation on LDC/win64? | ||||
|---|---|---|---|---|
| ||||
Hi,
import std.stdio, std.exception;
void main(){
class C{
void foo(){ writeln(123); }
}
C c;
try{
writeln(1);
c.foo; // access violation here
writeln(2);
}catch(Throwable t){
writeln("exception");
}
writeln(3);
}
When I run this code (using LDC2 64bit Windows), it silently crashes where the access violation happens and returns an %ERRORLEVEL% value of -1073741795 (-0x3FFFFFE3).
On the Online DLang Editor I get some more information:
Error: /tmp/onlineapp-cf8e338-8b2478 failed with status: -2
Error: message: Segmentation fault (core dumped)
Error: program received signal 2 (Interrupt)
This is better, but is there a trick to turn these system errors to an exception, so I would be able to get the location where it crashed in my source code?
The best I've found is this trick for Linux: https://forum.dlang.org/post/atxyappczlyvqyalvwzw@forum.dlang.org
That error message would be so usefull, but is there a way to do it on windows?
| ||||
April 13, 2020 Re: Is there an exception for access violation on LDC/win64? | ||||
|---|---|---|---|---|
| ||||
Posted in reply to realhet | On Monday, 13 April 2020 at 10:18:17 UTC, realhet wrote:
> Hi,
>
> import std.stdio, std.exception;
>
> [...]
Running under the debugger should show you the location of the crash.
| |||
Copyright © 1999-2021 by the D Language Foundation
Permalink
Reply