I finally got a stack trace on my InvalidMemoryOperationError

Etienne via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 4 17:03:59 PDT 2015


On Thursday, 4 June 2015 at 23:59:11 UTC, Vladimir Panteleev 
wrote:
> On Thursday, 4 June 2015 at 23:56:28 UTC, Etienne wrote:
>> Since the application will probably have to stop, might as 
>> well use the GC:
>>
>> in GC:
>>
>> if (gcx.running) {
>>    gcx.running = false;
>>    onInvalidMemoryOperationError();
>> }
>>
>> in core.exception:
>>
>> throw new InvalidMemoryOperationError();
>>
>> And there you go, a beautiful stack trace. I now have a 
>> pinpoint of the error within 100k++ LOC. Thank you.
>>
>> Why D? Why fail with a one line message and no debug tools? 
>> Why??
>
> I don't understand what you're grieving about, but:
>
> 1. We can't show a stack trace in an 
> InvalidMemoryOperationError situation because we need to 
> allocate memory for the stack trace, which we can't do in an 
> InvalidMemoryOperationError situation.
>
> 2. Hope this helps: 
> http://wiki.dlang.org/InvalidMemoryOperationError

Apparently GDB couldn't stack trace the error with symbols, was 
limited to 2 frames without symbols:
http://forum.dlang.org/thread/joefjvuxpvwsfozvykgu@forum.dlang.org#post-rpnmeklflyzodhfehari:40forum.dlang.org
http://forum.dlang.org/thread/joefjvuxpvwsfozvykgu@forum.dlang.org?page=2#post-pjntbqmxjbyxiwevdlra:40forum.dlang.org

The error also didn't occur in Windows so I couldn't use that.

I think you're mixing up the "invalid state" and "unusable". The 
GC is fully usable for the purpose of throwing, because I got a 
35 frame stack trace from it.


More information about the Digitalmars-d mailing list