How to debug an embedded tcl interpreter?

Hi

Is possible to debug a tcl script being run in an embedded tcl interpreter running inside a binary? there is a way to get the interpreter name and make it talk with komodo? I’ve read that this was possible with the old TclPro.

Morning @estay,

I think the closest you’ll get is Tcl Remote Debugging. But that might be a non-starter as it looks like you also would need to run dbgp_tcldebug.exe (or your OS equivalent binary of that file) in the your programs binary as well.

There does not appear to be a way to have your Tcl program initiate a debugging session from within your program, ie. how Python has this:

from dbgp.client import brkOnExcept
brkOnExcept(host='**mybox**', port=**9000**)

Hopefully the remote debugging can work for you.

  • Carey

Reading the old tclpro docs and komodo ones, I got into the possible solution, however, it gets stuck at some point.
Scripts running in embedded shells must source the attachment package available at <komodo>/lib/support/tcl/tcldebugger_attach/
it has an initialization procedure and other debugging stub procs. The first that must be sourced is the debugger_init proc. I call this procedure from the embedded shell and gets stuck at line 76
if {[gets $socket bytes] == -1} {
at this point the debugger from host must provide the rest of the debugging stub using the socket, however, this never occurs, and remains listening. Note that the listener status window from komodo report that a connection was done, but not current sessions are open

I watched the connection with Wireshark, but nothing matched the port

Appears that connection is immediately closed without downloading the rest of the debug stub
Is there any way to fix this?

I’m really sorry but I don’t know anything about the underpinnings of the Tcl code that supports the debugging feature. That was all written by a former ActiveState employee that hasn’t been here for some time now. I wish I could help but I don’t think I can help once you start running Tcl code outside Komodo. My appologies.

I’ll keep digging, and if I find something I’ll post it.

I’m facing the same problem. Connection counter goes up, but no active connection, no debugging session. Is there a solution yet?