Access violation in trying to use a class

Derek Parnell derek at psych.ward
Mon May 28 15:34:47 PDT 2007


On Mon, 28 May 2007 22:05:44 +0000 (UTC), gerleim wrote:

> The key thing is, if:
> "It is detected at run time by the hardware/operating system and by that time,
> things like source code line numbers are lost. "
> then _because_ line number is lost to check it at another level. And the best
> would be the compiler.

In the past, I'd tried some of the debuggers with D and had bad experience
with them. I just gave ddbg another try and it is now quite useful.

Test file: test.d

 class Foo
 { int xx; } 
 
 void main()
 {
   Foo f;
 
   f.xx = 1;
   bool assign = false;
   int x;
   assert(assign);
   {x = 1;}
 }


I compiled with "dmd test.d -g" the fired up ddbg with "ddbg test.exe".

I used the "r" command and it ran the program and halted at the Access
Exception...

C:\temp>ddbg test.exe
Ddbg 0.08.1 beta - D Debugger
Copyright (c) 2007 Jascha Wetzel
see http://ddbg.mainia.de/doc.html for documentation

Loading symbols from test.exe
->r
ntdll.dll loaded
KERNEL32.dll loaded
USER32.dll loaded
GDI32.dll loaded
IMM32.dll loaded
ADVAPI32.dll loaded
RPCRT4.dll loaded
unknown DLL loaded
OUTPUT DEBUG STRING:
test.exe
OUTPUT DEBUG STRING:
Query the registry to get manually configured process list.
Unhandled Exception: EXCEPTION_ACCESS_VIOLATION(0xc0000005) at _Dmain
test.d:8 (
0x0040201e)
->q

Which is exactly what I hoped it would show. So maybe now I can live
without compiler code checking for access violations.


THANKS JASCHA.

-- 
Derek Parnell
Melbourne, Australia
"Justice for David Hicks!"
skype: derek.j.parnell



More information about the Digitalmars-d mailing list