Disallow null references in safe code?

Jonathan M Davis jmdavisProg at gmx.com
Mon Feb 3 02:41:40 PST 2014


On Monday, February 03, 2014 00:56:05 Walter Bright wrote:
> On 2/3/2014 12:00 AM, Uranuz wrote:
> > At the current state OS send SEGFAULT message and I can't
> > even get some info where is the source of problem.
> 
> 1. Compile with symbolic debug info on (-g switch)
> 
> 2. Run under a debugger, such as gdb
> 
> 3. When it seg faults, type:
> 
>     bt
> 
> and it will give you a "backtrace", i.e. where it faulted, and the functions
> that are on the stack.

I recall there being a change to druntime such that it would print a backtrace 
for you if you hit a segfault, but it doesn't seem to work when I write a 
quick test program which segfaults, so I'm not sure what happened to that. 
Certainly, I think that that solves the issue from the standpoint of the 
program simply printing out "segmentation fault" being too little info (since 
it would then print a stacktrace as well). But as long as that doesn't work, 
using gdb's the best way - and it has the advantage of letting you examine the 
program state at that point in time rather than just see the stacktrace.

- Jonathan M Davis


More information about the Digitalmars-d mailing list