Thread overview
Access Violation line number
Aug 18, 2005
Sean Kelly
Aug 18, 2005
AJG
Aug 18, 2005
ElfQT
Aug 20, 2005
Chuck Esterbrook
Aug 20, 2005
Ben Hinkle
August 18, 2005
Hi.

How can I obtain the line number where an Access Violation occured?

Up until now I've scattered lots of writefs to see when they would stop printing but it's a lot of guessing work. Can't the access violation message print at least the function/method that is in execution atm?

Thanks.
August 18, 2005
In article <de2828$2qi3$1@digitaldaemon.com>, =?ISO-8859-1?Q?Julio_C=E9sar_Carrascal_Urquijo?= says...
>
>Hi.
>
>How can I obtain the line number where an Access Violation occured?

You can't :p  Access violations are triggered by the hardware and handled by hook functions in Phobos.  Your best bet would be to alter that code to signal the debugger.


Sean


August 18, 2005
"Sean Kelly" <sean@f4.ca> wrote in message news:de29h0$2saa$1@digitaldaemon.com...
> In article <de2828$2qi3$1@digitaldaemon.com>, =?ISO-8859-1?Q?Julio_C=E9sar_Carrascal_Urquijo?= says...
>>
>>Hi.
>>
>>How can I obtain the line number where an Access Violation occured?
>
> You can't :p  Access violations are triggered by the hardware and handled
> by
> hook functions in Phobos.  Your best bet would be to alter that code to
> signal
> the debugger.
>
>
> Sean

You know what would be awesome?  If D did null object checking like it does array bounds checking.  Array bounds checking works like:

assert(someIndex>=0 && someIndex<a.length); x=a[someIndex];

Kind of an implicit assert.  The same could be done for member access, such as

assert(obj !is null); obj.doSomething();

This would help find probably 90% of the access violations that you get in D.


August 18, 2005
>You know what would be awesome?  If D did null object checking like it does array bounds checking.  Array bounds checking works like: assert(someIndex>=0 && someIndex<a.length); x=a[someIndex];

>Kind of an implicit assert.The same could be done for member access, such as
>assert(obj !is null); obj.doSomething();

YES. Please.

Thank you,
--AJG.



August 18, 2005
A bitt off, but speaking of Assert, a text message would be also highly
appreciated.
I guess that was asked before.


August 20, 2005
On Thu, 18 Aug 2005 14:48:26 -0400, "Jarrett Billingsley" <kb3ctd2@yahoo.com> wrote:

>"Sean Kelly" <sean@f4.ca> wrote in message news:de29h0$2saa$1@digitaldaemon.com...
>> In article <de2828$2qi3$1@digitaldaemon.com>, =?ISO-8859-1?Q?Julio_C=E9sar_Carrascal_Urquijo?= says...
>>>
>>>Hi.
>>>
>>>How can I obtain the line number where an Access Violation occured?
>>
>> You can't :p  Access violations are triggered by the hardware and handled
>> by
>> hook functions in Phobos.  Your best bet would be to alter that code to
>> signal
>> the debugger.
>>
>>
>> Sean
>
>You know what would be awesome?  If D did null object checking like it does array bounds checking.  Array bounds checking works like:
>
>assert(someIndex>=0 && someIndex<a.length); x=a[someIndex];
>
>Kind of an implicit assert.  The same could be done for member access, such as
>
>assert(obj !is null); obj.doSomething();
>
>This would help find probably 90% of the access violations that you get in D.
>

I just wanted to cast my vote for this idea. This would be a great productivity boost.

This is also the type of thing we could work in ourselves if we had a D-to-D front end (see my tiny thread in this news group, "D-to-D [was: ...").

-Chuck
August 20, 2005
"Julio César Carrascal Urquijo" <adnoctum@phreaker.net> wrote in message news:de2828$2qi3$1@digitaldaemon.com...
> Hi.
>
> How can I obtain the line number where an Access Violation occured?
>
> Up until now I've scattered lots of writefs to see when they would stop printing but it's a lot of guessing work. Can't the access violation message print at least the function/method that is in execution atm?
>
> Thanks.

Run the program in WinDbg (or gdb on Linux). It will stop at the violation and you can get the stack and open the source and view the problem statement. Compile with -g.


August 20, 2005
This would work exactly as I want. An AssertError before the access violation.

Jarrett Billingsley wrote:
> "Sean Kelly" <sean@f4.ca> wrote in message news:de29h0$2saa$1@digitaldaemon.com...
> 
>>In article <de2828$2qi3$1@digitaldaemon.com>,
>>=?ISO-8859-1?Q?Julio_C=E9sar_Carrascal_Urquijo?= says...
>>
>>>Hi.
>>>
>>>How can I obtain the line number where an Access Violation occured?
>>
>>You can't :p  Access violations are triggered by the hardware and handled by
>>hook functions in Phobos.  Your best bet would be to alter that code to signal
>>the debugger.
>>
>>
>>Sean
> 
> 
> You know what would be awesome?  If D did null object checking like it does array bounds checking.  Array bounds checking works like:
> 
> assert(someIndex>=0 && someIndex<a.length); x=a[someIndex];
> 
> Kind of an implicit assert.  The same could be done for member access, such as
> 
> assert(obj !is null); obj.doSomething();
> 
> This would help find probably 90% of the access violations that you get in D. 
> 
>