[GRASS5] Grass 5.1

Glynn Clements glynn.clements at virgin.net
Mon Jan 7 07:20:46 EST 2002


Radim Blazek wrote:

> 2) Debug
> New function G_debug (int  level, char * msg) prints message if enviroment 
> variable GRASS_DEBUG_LEVEL is set to level equal or higher.
> My proposal for levels is:
>  * Levels: (recommended levels)
>  * 1 - messages printed once or few times per module
>  * 3 - each row (raster) or line (vector)
>  * 5 - each cell (raster) or point (vector)
> and I use optional compilation (speed): 
> #ifdef GDEBUG
>       G_debug (1, "Vect_open_old(): name = %s mapset= %s", name, mapset);
> #endif

Too much of this can make the code messy. Parameter tracing is usually
better performed with gdb command sequences, e.g.

	break Vect_open_old
	commands
	silent
	printf "Vect_open_old(): name = %s mapset= %s", name, mapset
	continue
	end

Unfortunately, it isn't straightforward to set a breakpoint in the
middle of a function without using line numbers (which need to be
updated whenever the source changes).

I do think that we should have something similar to G_warning() for
user messages, rather than just printing to stdout/stderr.

-- 
Glynn Clements <glynn.clements at virgin.net>



More information about the grass-dev mailing list