Why is it so difficult to get a core dump for exceptions/errors?

Nemanja Boric 4burgos at gmail.com
Mon Oct 23 06:58:26 UTC 2017


On Monday, 23 October 2017 at 06:48:50 UTC, Nemanja Boric wrote:
> On Sunday, 22 October 2017 at 11:16:56 UTC, Marenz wrote:
>> One thing that bugged me for years in D is how difficult it is 
>> to get a useful core dump.
>>
>> ```
>> Task terminated with unhandled exception: Invalid memory 
>> operation
>> Full error: 
>> core.exception.InvalidMemoryOperationError at src/core/exception.d(693): Invalid memory operation
>> ----------------
>> uncaught exception
>> dwarfeh(224) fatal error
>> ```
>>
>
> What version of compiler/runtime are you using? I've fixed this 
> behaviour
> (fatal error if no exception handler is found) in v2.076: 
> https://github.com/dlang/druntime/pull/1673 and the fix should 
> actually
> call abort(): 
> https://github.com/dlang/druntime/pull/1673/files#diff-6c3bc1200b51af9b16b902fd88879ca1R227
>
> Judging from the output (dwarfeh(224) fatal error), this patch 
> is not applied
> in your runtime.

As for the core dump - the runtime actually calls abort (pre and 
post my patch, as it looks like). I'm not aware anything in the 
runtime handling SIGABRT, are you doing it in your application? 
Is your system setup to generate core files `ulimit -c unlimited` 
or similar? You should at least get in your stderr (not stdout) 
message that the SIGABRT was raised (and you did before IIRC, 
you've commented it on one PR).


More information about the Digitalmars-d mailing list