Mirror of the gdb mailing list
 help / color / mirror / Atom feed
* argc - cant access memory
@ 2007-07-09 13:26 Hadron
  2007-07-09 21:04 ` Jim Blandy
  0 siblings, 1 reply; 9+ messages in thread
From: Hadron @ 2007-07-09 13:26 UTC (permalink / raw)
  To: gdb


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 can be found here:

http://opengl-redbook.com/code/

but is pasted below for convenience.

It is compiled using the following Linux based makefile:

,----
| CC=gcc
| COMPILE.c=$(CC) $(CFLAGS) -c
| LINK.c=$(CC) $(CFLAGS) $(LDFLAGS)
| LDLIBS=$(EXTRALIBS)
| CFLAGS= -std=c99 -pedantic -Wall -D_GNU_SOURCE -g
| 
| GLUT = -lglut
| EXTRALIBS = $(GLUT) -lGLU -lGL -lXmu -lXext -lX11 -lm
| 
| PROGS =  \
| 		  aaindex aargb accanti accpersp alpha3D \
| 		  alpha bezcurve bezmesh bezsurf blendeqn \
| 		  checker clip colormat combiner cubemap \
| 		  cube dof double drawf feedback \
| 		  fogcoord fogindex fog font hello \
| 		  image light lines list material \
| 		  mipmap model movelight multisamp multitex \
| 		  mvarray pickdepth picksquare planet pointp \
| 		  polyoff polys quadric robot scene \
| 		  select shadowmap smooth stencil stroke \
| 		  surface surfpoints teapots tesswind tess \
| 		  texbind texgen texprox texsub texture3d \
| 		  texturesurf torus trim unproject varray \
| 		  wrap
| 
| IMAGING_SUBSET = colormatrix colortable convolution histogram minmax blendeqn
| 
| all:	$(PROGS)
| 
| clean:
| 	rm -f $(PROGS)
`----

The code is:

,----
| /*
|  * hello.c
|  * This is a simple, introductory OpenGL program.
|  */
| #include <GL/glut.h>
| #include <stdlib.h>
| 
| void display(void)
| {
| /* clear all pixels  */
|    glClear (GL_COLOR_BUFFER_BIT);
| 
| /* draw white polygon (rectangle) with corners at
|  * (0.25, 0.25, 0.0) and (0.75, 0.75, 0.0)  
|  */
|    glColor3f (1.0, 1.0, 1.0);
|    glBegin(GL_POLYGON);
|       glVertex3f (0.25, 0.25, 0.0);
|       glVertex3f (0.75, 0.25, 0.0);
|       glVertex3f (0.75, 0.75, 0.0);
|       glVertex3f (0.25, 0.75, 0.0);
|    glEnd();
| 
| /* don't wait!  
|  * start processing buffered OpenGL routines 
|  */
|    glFlush ();
| }
| 
| void init (void) 
| {
| /* select clearing color 	*/
|    glClearColor (0.0, 0.0, 0.0, 0.0);
| 
| /* initialize viewing values  */
|    glMatrixMode(GL_PROJECTION);
|    glLoadIdentity();
|    glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
| }
| 
| /* 
|  * Declare initial window size, position, and display mode
|  * (single buffer and RGBA).  Open window with "hello"
|  * in its title bar.  Call initialization routines.
|  * Register callback function to display graphics.
|  * Enter main loop and process events.
|  */
| int main(int argc, char** argv)
| {
|    glutInit(&argc, argv);
|    glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
|    glutInitWindowSize (250, 250); 
|    glutInitWindowPosition (100, 100);
|    glutCreateWindow ("hello");
|    init ();
|    glutDisplayFunc(display); 
|    glutMainLoop();
|    return 0;   /* ANSI C requires main to return int. */
| }
`----

It is not on all lines in main that I get this error.

Ideas?


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2007-07-11 21:13 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-07-09 13:26 argc - cant access memory Hadron
2007-07-09 21:04 ` Jim Blandy
2007-07-09 22:34   ` Nick Roberts
2007-07-10 12:13     ` Hadron
2007-07-10 19:41       ` Dave Korn
2007-07-10 19:46         ` Daniel Jacobowitz
2007-07-10 19:50           ` Dave Korn
2007-07-11 21:13         ` Jim Blandy
2007-07-11 17:41       ` Jim Blandy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox