[GRASS-dev] how to debug TCL

Hi

I tried to debug a module running in tcl/tk window, following the instructions in doc/debugging.txt. It reads:

To debug TCL code, run (example):

GRASS:~> g.gisenv set="DEBUG=1"
GRASS:~> d.text.freetype > dtf_tcl.txt

So I do (using v.overlay instead of d.text.freetype), setup options, press "Run". The module crashes after the 3rd run in average.

then edit 'dtf_tcl.txt' to remove the "| wish &" from the end.

But my dtf_tcl.txt is always empty, no matter what command used instead of d.text.freetype and no matter if it crashed or not. Setting higher DEBUG level or redirecting both stderr and stdout (v.overlay 2>&1 > dtf_tcl.txt) doesn't change anything.

Where do I go from here? Thanks for any hints.

Maciek

tutey wrote:

I tried to debug a module running in tcl/tk window, following the instructions in doc/debugging.txt. It reads:

> To debug TCL code, run (example):
>
> GRASS:~> g.gisenv set="DEBUG=1"
> GRASS:~> d.text.freetype > dtf_tcl.txt

The comments in doc/debugging.txt are misleading. The above won't help
you debug Tcl code, only code which uses C (including hybrid C+Tcl
code, e.g. NVIZ, v.digit).

If you want to debug pure Tcl code, you typically need to add "trace"
commands to the code in question.

--
Glynn Clements <glynn@gclements.plus.com>