Disallow null references in safe code?
Walter Bright
newshound2 at digitalmars.com
Mon Feb 3 14:49:53 PST 2014
On 2/3/2014 12:46 PM, Ary Borenszweig wrote:
> On 2/3/14, 5:56 AM, 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.
>
> You keep missing the point that when the segfault happens you might have no idea
> how to reproduce it. You don't even know where it happens. So it's not that easy
> to reach point 3.
The first step is ensuring that people know how to use a debugger. The second
step, for the case you mentioned, is figuring out how to attach a debugger to a
crashed process.
> If a null access raises an exception, you immediately get the backtrace and that
> can help you understand why it happened.
I agree that's certainly more convenient, but I was addressing the "I can't"
issue. The message did not have enough information to determine if he was having
trouble with a basic issue or a more advanced case.
More information about the Digitalmars-d
mailing list