Re: argc - cant access memory

Hadron
2007-07-10T12:13:38Z

Nick Roberts <nickrob@snap.net.nz> writes:

> > > I recently compiled and executed an opengl programming guide (redbook)
> > > example, hello.c, successfully. However, when I try to debug it under
> > > GUD I get
> > >
> > > ,----
> > > | #0 main (argc=Cannot access memory at address 0x2d
> > > | ) at hello.c:93
> > > `----
> >
> > The code you labeled "hello.c" has no line 93. Are you sure you're
> > debugging the program you intended to?
>
> Aside from that, I think it just means that the arguments have been optimised
> away. I think current GCC does this now even if the user doesn't specify
> optimisation. It doesn't stop you from debugging does it?

There is no 93 you are right as I
clipped the header. Mea culpa.

As for optimizing the arguments away, wouldn't this be the case for all
the lines referencing argc in the main()? But is this the typical
"error" for such a case?

I get the message after stepping over the first line in main and then
when I get to line 3 (in main) then I get

#0 main (argc=191860, argv=0xb7f49850) at hello.c:94

(94 is the line "glutInitWindowSize (250, 250);" in main)

If you say this is normal behaviour then fine, but I haven't experienced
it before. I would be interested to hear if you get the same.