views:

411

answers:

1

Pretty much a total newbie here, using xcode to write a c++ program. I don't know how to use gdb yet and I'm not sure how you can turn it off..(if you can?) Just added some openGL texture loading code and when I call it I get this error message in my console and the program freezes... what is happening?

Here's the code that throws the errors:

tex_2d = LoadTextureRAW("texture.raw", 0 );


GLuint LoadTextureRAW( const char * filename, int wrap )
{
GLuint texture;
int width, height;

FILE * file;

// open texture data
file = fopen( filename, "rb" );
if ( file == NULL ) return 0;

// allocate buffer
width = 256;
height = 256;
unsigned char *data = new unsigned char[256*256*3];

// read texture data
fread( data, width * height * 3, 1, file );
fclose( file );

// allocate a texture name
glGenTextures( 1, &texture );

// select our current texture
glBindTexture( GL_TEXTURE_2D, texture );

// select modulate to mix texture with color for shading
glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE );

// when texture area is small, bilinear filter the closest mipmap
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER,
    GL_LINEAR_MIPMAP_NEAREST );
// when texture area is large, bilinear filter the first mipmap
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR );

// if wrap is true, the texture wraps over at the edges (repeat)
//       ... false, the texture ends at the edges (clamp)
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,
    wrap ? GL_REPEAT : GL_CLAMP );
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,
    wrap ? GL_REPEAT : GL_CLAMP );

// build our texture mipmaps
gluBuild2DMipmaps( GL_TEXTURE_2D, 3, width, height,
      GL_RGB, GL_UNSIGNED_BYTE, data );

// free buffer
free( data );

return texture;

}

And here is the console output:

Loading program into debugger…
GNU gdb 6.3.50-20050815 (Apple version gdb-962) (Sat Jul 26 08:14:40 UTC 2008)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".Program loaded.
sharedlibrary apply-load-rules all
Attaching to program: `/Users/development/Desktop/devshit/smallermarkers/build/Debug copy/SimpleAR.app/Contents/MacOS/SimpleAR', process 1674.
Error while running hook_stop:
Error while running hook_stop:

Unable to disassemble glgConvertTo_32<GLGConverter_BGR8_ARGB8, (GLGMemory)2>.
(gdb)

I have come across this error before using precompiled libraries to load textures, so now I'm trying for the most simplistic route. Anyone can clue me into this? Googling the hook_stop doesnt seem to give alot of info :(

A: 

Take a look into your .gdbinit file, if you have a define named hook_stop it will get called before any define named stop. I just ran across this also, it is spelled out in the gdb manual:

20.2 User-defined command hooks You may define hooks, which are a special kind of user-defined command. Whenever you run the command ‘foo’, if the user-defined command ‘hook-foo’ exists, it is executed (with no arguments) before that command.

tgunr