TOC PREV NEXT INDEX

 


Using Custom Tcl Interpreters with TclPro Debugger


TclPro Debugger works properly with most custom Tcl interpreters. However, to properly instrument and execute your application, TclPro Debugger must be able to pass debugging information to your Tcl script as command-line arguments. Therefore, if your interpreter doesn't accept as its first command-line argument a Tcl script to execute or if it doesn't pass subsequent command-line arguments to the script using the standard argc and argv Tcl variables, then you must take special steps to use your interpreter with TclPro Debugger.

First, you must create a special Tcl wrapper script. The listing below shows a sample implementation of such a script for Unix systems. To use it, you must either change the line setting the cmdPrefix variable, replacing "tclsh" with whatever command you need to run your Tcl interpreter, or you must set your PRODEBUG_TCLSH environment variable to contain that command.

#!/bin/sh
#\
exec protclsh83 $0 ${1+"$@"}

if {$argc < 1} {
    puts stderr "wrong # args: location of appLaunch.tcl is required"
}

if {[info exists env(PRODEBUG_TCLSH)]} {
    set cmdPrefix "$env(PRODEBUG_TCLSH)"
} else {
    set cmdPrefix "tclsh"
}

set customScriptName "/tmp/launchScript.[pid]"
set appLaunchPath [lindex $argv 0]

set f [open $customScriptName w]
puts $f "
file delete -force $customScriptName
set argv0 [list $appLaunchPath]
set argv [list [lrange $argv 1 end]]
set argc \[llength \$argv\]
source \$argv0
"
close $f

catch {
    eval exec $cmdPrefix [list $customScriptName 2>@stderr >@stdout <@stdin]
}

Then, to debug your application select the wrapper script as your interpreter (that is, type the path and name of the wrapper script in the Interpreter field of the Project Application Settings Tab). Specify the script and any script arguments for your application in the Project Application Settings Tab as normal.




http://www.ajubasolutions.com
Voice: (650) 210-0100
Fax: (650) 210-0101
support@ajubasolutions.com
TOC PREV NEXT INDEX