X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fglprint.c;h=6f645a7175bf6cd6daa746973267190f55dd7622;hb=e7d4e2a75e75ff1a152912f0c19fb72ed63e81bc;hp=8dacdb338b1834765dcb25554835cea5fb31343e;hpb=03c86c2f632b642aa94f721e326787e91aa69c25;p=gldbg.git diff --git a/source/glprint.c b/source/glprint.c index 8dacdb3..6f645a7 100644 --- a/source/glprint.c +++ b/source/glprint.c @@ -14,6 +14,8 @@ Distributed under the GPL #include "glprint.h" #include "tmpalloc.h" +#define UNUSED __attribute__((unused)) + typedef struct sGlPrintData { char *buffer; @@ -24,6 +26,7 @@ typedef struct sGlPrintData static void init_print(GlDecoder *); static void glprint_free(void *); static void print_gldError(void *, GLenum); +static void print_unhandled(void *, unsigned short); GlDecoder *glprint_new(char *buffer, unsigned bufsize) { @@ -45,6 +48,7 @@ GlDecoder *glprint_new(char *buffer, unsigned bufsize) init_print(dec); dec->gldError = print_gldError; + dec->unhandled = print_unhandled; return dec; } @@ -119,6 +123,12 @@ static const char *print_data(const void *data, unsigned size) { if(!data) return "NULL"; + else if((unsigned long)data<0x100000) + { + char *buffer = tmpalloc(20); + snprintf(buffer, 20, "%p", data); + return buffer; + } else if(!size) return "/* data */"; else @@ -136,3 +146,9 @@ static void print_gldError(void *user_data, GLenum code) GlPrintData *gpd = (GlPrintData *)user_data; snprintf(gpd->buffer, gpd->bufsize, "ERROR: %s", describe_enum(code, "ErrorCode")); } + +static void print_unhandled(void *user_data, unsigned short func UNUSED) +{ + GlPrintData *gpd = (GlPrintData *)user_data; + gpd->buffer[0] = 0; +}