Komodo User Guide

Debugging Tcl

New to Tcl?
Check out the Tcl Tutorial

Use Komodo to debug Tcl programs locally or remotely. See below for instructions on configuring Komodo to debug Tcl programs. For general information about using the Komodo debugger, see Komodo Debugger Functions.

Configuring the Tcl Debugger

You must specify which Tcl interpreter Komodo should use to debug and run Tcl programs.

To specify the Tcl interpreter:

  1. From the Edit menu, select Preferences.
  2. In the Preferences dialog, click Tcl.
    Komodo looks for Tcl interpreters on your system and lists them in this dialog.
  3. If your preferred interpreter is in this list, click to select the interpreter.
    If your preferred interpreter is not in this list, enter the path and file name or click Browse to locate your preferred interpreter.
  4. Click OK.

If no Tcl interpreter is displayed in the list, ensure that the location of the interpreter is specified in your system's PATH variable.

Top

Using the Tcl Remote Debugger

Komodo's remote debugger is used to open a program on another machine and debug the program using Komodo. In order to use Komodo's remote debugger, you must first install the Tcl remote debugger on the remote machine, which calls the machine running Komodo. Then you use the Komodo debugger on your local machine to debug your remote program.

Installing the Tcl Remote Debugger on the Remote Machine

The Tcl remote debugger, "kotcldebug.exe", must be installed on the remote machine. This file was added to the tcl directory when you installed Komodo. By default, on Windows systems, the tcl directory is located under C:\Program Files\Komodo-x.x\ (where "x.x" is the Komodo version).

To install the Tcl Remote Debugger:

  • If necessary, install a Komodo license on the remote machine.
  • Copy the file kotcldebug.exe to a directory on the remote machine.
Top

Invoking the Tcl Remote Debugger

To debug a Tcl script on a remote machine:

  1. On the local machine, select Listen for Remote Debugger from the Debug menu.
    A Listening for Connection dialog opens and indicates the port number for the process.
  2. Connect to your remote machine and log in.
  3. Run kotcldebug.exe using the following options:

    • -port-komodo Remote Debugger Listening Port (by default, port 9000)
    • -host-komodo localhost
    • -file program_name.tcl
    • -app-shell path to the Tcl interpreter (tclsh or wish)
    • arguments desired arguments for the script

On Windows enter:

kotcldebug.exe -port-komodo <komodo-port> -host-komodo <host.location.domain> -file <your-tcl-code> -app-shell <your-tcl-shell>

On Linux enter:

kotcldebug -port-komodo <komodo-port> -host-komodo <host.location.domain> -file <your-tcl-code> -app-shell <your-tcl-shell>

For example, consider the following scenario:

Remote Machine
  • The file kotcldebug.exe is located beneath the directory remote_debug on a Windows machine
  • The Tcl file to be debugged is called test.tcl
Local Machine
  • The local machine is named "mybox".
  • On the local machine, Komodo's Remote Debugger Listening Port is configured to port 9000.
  • The Tcl interpreter is "wish".

In this scenario, you would enter the following command on the remote machine:

C:\remote_debug\kotcldebug.exe -port-komodo 9000 -host-komodo mybox -file test.tcl -app-shell C:\Tcl\bin\wish.exe

Once the connection is established, you can use the full Komodo debugging functionality, including setting breakpoints, stepping, viewing the call stack, and watching variables. The output from the debug process appears in the Output Pane at the bottom of the Komodo Workspace.

To stop the debugger:

  • From the Debug menu, select Stop
    or
  • Press Shift+F5
Top