From: Hadron <hadronquark@googlemail.com>
To: gdb@sourceware.org
Subject: argc - cant access memory
Date: Mon, 09 Jul 2007 13:26:00 -0000 [thread overview]
Message-ID: <87ejjhg137.fsf@gmail.com> (raw)
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?
next reply other threads:[~2007-07-09 13:26 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-09 13:26 Hadron [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87ejjhg137.fsf@gmail.com \
--to=hadronquark@googlemail.com \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox