Debugging

There are several ways to debug a program.

Debugging locally

To debug a TCL file locally, apply the following steps:

set cc $bb--qq

to:

set cc $bb--qq2

Debugging remotely

To debug a TCL file remotely, apply the following steps:

To debug remotely, in Windows it is necessary to load the package comm in the remote program. To do so use add something similar to the code below in you program, in any place that gets executed before beginning the debug session (typically at the beginning of your program):

lappend ::auto_path <RamDebugger path>/addons

package require commR

comm::register application_name 1

Note: The package commR included in RamDebugger is based on the package comm in tcllib with some modifications. Use always commR instead of comm . This package uses sockets for communication. If you have a firewall in your computer, maybe it will not work. In Linux/Unix, the communication is made with the command send , So, it is only necessary to have this command enabled in the program, which is true by default. Note: It can be necessary to check the security of the server in Unix before being able to use send . As a fast workaround, write command xhost - in the UNIX command line.

Note: Package commR can also be used in Unix and MacOSX .

Debugging as package

Check example4.tcl to see how Ramdebugger can be used as a package.

Wait for RamDebugger

It is possible to add a command in the debugged program that stops execution and waits for RamDebugger to be connected to it remotely. Command is:

commR::wait_for_debugger

Check example "example2b.tcl"for details.

Debugging GiD

GiD is a pre/postprocessing program for Finite Element Analysis that uses TCL/TK as its extension language http://www.gidhome.com .

To debug GiD in Windows, it is necessary to load the comm package. Do it in file: <GiD installation dir>/scripts/tclfile-opengl around line 420 before section Debug funcs .

In UNIX, it should work directly.

Check section Debugging remotely for the rest of the steps to follow. Check section Debugging as package for an alternative way of debugging GiD. Specifically, the package require RamDebugger should be added near the end of file <GiD installation dir>/scripts/tclfile-opengl .

Debugging RamDebugger

As a good debugger must do, RamDebugger permmits to debugger itself. As it is not a simple code, this is a good testing of the program capabilities. It can be debugged either locally or remotely. To debug itself locally, open TCL source file RamDebugger.tcl and choose File->Debug on->Currentfile . See Debugging locally for details. To debug itself remotely, open two RamDebuggers. From one of them, connect to the other with File->Debug on->RamDebugger . In Windows , if option Automatically check remote files is unset (the default), it can be necessary to use Debug on-> Update remotes on both RamDebuggers.