netbeanstcl debugger

For Tcl Plugin for Netbeans 1.0 - GSoC 2011 Executed Projects.

Tcl Plugin for Netbeans - Debugger Overview

Debug Process

Debugger is separated into two parts: Java (implements Netbeans Debugger Core API and Debugger Core - UI) and Tcl part (debugServer.tcl). Java part communicates with debugServer.tcl using socket and simple "newline" based protocol. To handle script execution Tcl's trace and info are used.
To start debug process use Debug Project (Ctrl+F5) then following state will appear:

Netbeans window after Debug Project (Ctrl+F5):

Tclsh executes debugServer.tcl. It's waiting for connection from Netbeans Interface. Click any (except Stop) debugger control button to make a connection. debugServer.tcl will put appropriate information. Execution stops at the very first step of script. Now use debugger interface to control debug process. Output window with debugServer.tcl displays stderr as debugger messages and all messages have ">>>" at the beginning of line. Stdin for script that's currently debugged is connected to Output - debugServer.tcl, so if some gets stdin appears please write input inside Output - debugServer.tcl window.

After connection:

Debugger Control Buttons
From the left side:

  • Finish Debugger Session: To quit debug mode. Terminates script execution.
  • Pause: Unused.
  • Continue: Run script until it reaches breakpoint.
  • Step Over: Single step, stepping over instruction if available.
  • Step Into: Single step, stepping into instruction if available.
  • Run To Cursor: Run script until it reaches cursor position or next breakpoint. Simply adds a temporary breakpoint (unvisible for user interface, but works the same as visible one) in line where cursor is present.

Debugger Views


Set breakpoint by click line number inside editor. To run properly breakpoint must be set in the line with some code, because empty lines are ommited by trace steps. Using Breakpoints View you could Jump To place where selected breakpoint is located or Delete one.

Breakpoints View


Formatted content of [info locals%|%[info locals] and [info globals%|%[info globals]. Using the diamond with plus (on the left side of Variables View) - a Watch could be added. Other diamonds may be used to show watches inside Variables View or Evaluation Result (Evaluation is unused).

Variables View


Appears as a separate window when Show Watches Inside Variables View option (inside Variables View) is disabled. Watches just display value for given variable name when it's set. I found it useful when variable view contains a lot of variables or you want to watch element from array. You could type tcl_platform(osVersion) for example to see element of array in the watch.

Watches View

Call Stack

Displays elements (places in code) where script changes its [info level].

Call Stack View


Ability to select verbose mode (for debugServer.tcl output) and set port number for communication between Netbeans Debugger API and debugServer.tcl.

Tcl Plugin Options