Date: Fri, 6 Jan 95 12:45:06 MST From: craig AT sunspot DOT noao DOT edu (Craig Gullixson) To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: Re: Debugging graphics programs ----- Begin Included Message ----- >What are your suggestions about the best way to debug a graphics >program? gdb runs my program fine, but when a breakpoint is hit with >the screen in a graphics mode I can't read the text printed by gdb. I have two crude tools I use. The first is that I reserve area for one line of text at the top of the screen and use GrDrawString or GrTextXY to write status messages there. The second (more useful tool) is the assertion macro includeded below. /************************************************/ /* gxassert.h */ /* */ /* assertion macro for graphics mode assertions */ /************************************************/ /***** identification * * $Id: gxassert.h,v 1.1 1995/01/06 19:32:59 craig Exp $ * */ /***** modification history * * $Log: gxassert.h,v $ * Revision 1.1 1995/01/06 19:32:59 craig * Initial revision * */ #ifndef INClclgrxassert #define INClclgrxassert #ifdef NDEBUG #define gxassert(ignore) ((void) 0) #else #include /* for fprintf */ #include /* graphics library - just in case */ #define __gxassert(expression, file, lineno) \ ( GrSetMode (GR_default_text), \ fprintf (stderr, "%s:%u assertion failed: %s\n", \ file, lineno, expression), abort (), 0) #define gxassert(expression) \ ((void) ((expression) ? 0 : \ __gxassert(#expression, __FILE__, __LINE__))) #endif /* defined NDEBUG */ #endif /* INClclgrxassert */ ________________________________________________________________________ Craig A. Gullixson Senior Research Associate INTERNET: craig AT sunspot DOT noao DOT edu National Solar Observatory/Sac. Peak PHONE: (505) 434-7065 Sunspot, NM 88349 USA