Bug 5009 – TraceHandler not being called on Access Violation
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86
OS
Windows
Creation time
2010-10-07T02:54:34Z
Last change time
2020-03-21T03:56:42Z
Assigned to
No Owner
Creator
Benjamin Thaut
Comments
Comment #0 by code — 2010-10-07T02:54:34Z
The TraceHandler that is built into the core runtime is not being called on Access Violation errors. Try this piece of sourcecode:
import std.stdio;
import core.runtime;
Throwable.TraceInfo TraceHandler1(void* ptr){
writefln("TraceHandler1");
return null;
}
Throwable.TraceInfo TraceHandler2(void* ptr){
writefln("TraceHandler2");
return null;
}
void main(string[] argv){
Runtime.traceHandler(&TraceHandler1);
try {
int[] array = new int[20];
array[20] = 0;
}
catch(Error e){
}
Runtime.traceHandler(&TraceHandler2);
int* ptr = null;
*ptr = 0;
}
TraceHandler2 is never being called. I tested this with dmd 2.046, 2.048 and 2.049.