Fix D's segfaults!

Johnson Jones via Digitalmars-d digitalmars-d at puremagic.com
Sun Aug 20 12:14:10 PDT 2017


On Sunday, 20 August 2017 at 18:35:07 UTC, Daniel Kozak wrote:
> This is not segfault.  This is an uncatched exception.  So it 
> is your error. You does not do proper error handling. But still 
> IIRC you should be able to see place where things go wrong
>
> Dne 20. 8. 2017 8:06 odpoledne napsal uživatel "Johnson Jones 
> via Digitalmars-d" <digitalmars-d at puremagic.com>:
>
>> D has a major issue with segfaults! It always reports the 
>> fault in the lowest function that it occurs! This is 
>> completely useless!
>>
>> std.file.FileException at std\file.d(755): Attempting to rename 
>> file X.lib to Y.lib: The system cannot find the file specified.
>> ----------------
>> 0x0041015E
>> 0x00402C69
>> 0x004025A3
>> 0x00413ECF
>> 0x00413E93
>> 0x00413D94
>> 0x0040DAD7
>> 0x76D78744 in BaseThreadInitThunk
>> 0x76FD582D in RtlGetAppContainerNamedObjectPath
>> 0x76FD57FD in RtlGetAppContainerNamedObjectPath
>>
>> This tells me nothing about where the error occurred in *my* 
>> program!
>>
>> Dmd needs to be modified so that errors try to show from the 
>> source code. This should be obvious the reasons, if it is not 
>> possible, make it possible! There are no excuses why dmd 
>> should make me go on an easter egg hunt when a seg fault 
>> occurs.

Um,

That was just an example, the same type of output occurs with 
segfaults or any error/crash that D outputs stuff trying to be 
"helpful".

Anyways, your missing the point. You expect me to write 
try/catches in every level of my program to create the 
granularity one needs to simply get the location the error 
occured in? Where is that exactly?

How hard is it for dmd to know if 
std.file.FileException at std\file.d occurs in the code I created or 
somewhere else? It should be able to say "Hey, that is part of a 
standard library or other non-user component, let me try to walk 
back a little and see if I can find a location in the user code 
that led to this problem".

This should be quite easy with a stacktrace, simply walk back 
until the location is in user code.

So, regardless of anything, D telling me stuff like "Hey, your 
error occurred in phobos" doesn't tell me shit except the error 
occurred in phobos. I'm still looking for easter eggs, and I 
don't like easter(which is why I don't capitalize it).





More information about the Digitalmars-d mailing list