Remote debug for tcl, debugger_init not work

Hi,

I am trying to debug Tcl v8.6 scripts on a remote machine in an EDA tool.

And I use Komodo IDE, version 12.0.1, build 91869, platform linux-x86_64. Built on Mon Feb 10 19:37:24 2020.

I try to “source Komodo-IDE-12/lib/support/tcl/tcldebugger_attach/attach.tcl”, and then “debugger_init <localmachine> <port>”, where I get <port> from Debug->Listener Status.
Then the console in the EDA tool hang, and I can’t type anything. So, it seems that my EDA console try to connect to debugger, but the debugger has no response, causing deadlock.
(I also tried just in tclsh, instead of EDA console, tclsh will also hang there, making no progress. )

I then try to run “Komodo-IDE-12/lib/support/tcl/dbgp_tcldebug -dbgp <localmachine>:<port> -interactive”, the Komodo debugger seems to be connected, showing the image below.
image

I also try TclProv1.4. TclProv1.4 also has similiar “debugger_init” scripts to connect remote application to local debugger, and it succeed. But unfortunately, TclProv1.4 doesn’t support Tcl v8.6.

From the experiment I do, it seems that remote application can’t connect to Komodo debugger using “debugger_init”.

Any suggestions are appreciated. Thanks in advance.

And I attach the log from Help -> Troubleshooting -> View Log File.




Morning @komodo_user,

Please have a read through the Komodo Tcl Remote Debugging docs and see if that works for you.

From what you’ve shared it looks like you’re not following those steps.

If it doesn’t work, in your next msg, please share as close to exact commands run. Copy and pasting your terminal output would be ideal. Redact anything you feel shouldn’t be shared.

  • Carey

Hi @careyh,

Thank you very much for your suggestion. And I tried Komodo Tcl Remote Debugging docs, my EDA console can now connect to Komodo tcl debugger.

But now comes new problem. The EDA define many new commands(sth like proc in Tcl), and the debugger can’t recognize them. When I run “info commands” in EDA console, it will print many commands(Tcl commands and EDA commands). But when I do this in the script to debug, only can print Tcl commands, not EDA commands. I think that is because Komodo create a new tclsh(child tclsh) for debugger, and in the new tclsh, you can’t use procs defined in the parent tclsh.

So, is ther any way the debugger can see EDA commands?

Best Regards,
komodo_user

Morning @komodo_user,

I don’t know much about Tcl so I’m not really clear on what EDA means or what it represents in your code. Could you elaborate on what that means? Perhaps we can figure why the Komodo Tcl debugger tool can’t see it. You could also have a look in Edit menu > Preferences > Languages > Tcl and see if there is a preference that pops out at you that seems like it might effect things.

  • Carey

Hi @careyh,

EDA is not part of Tcl language, EDA(Electronic Design Automation) is a kind of software tools to help design hardwares(e.g. circuit board), and most EDA support Tcl language. If you want to do sth in EDA, you can click on the GUI or write Tcl script to tell the EDA to do what you want. And the EDA vendor may provides many built-in EDA command, just like define new procs in Tcl scripts, those new procs are called EDA commands.

I write Tcl script use both standard functions and those commands defined by EDA vendor. And I want to debug my script now. But komodo can’t recognize the EDA commands. And I can’t redefine the Tclsh interpreter in Edit menu > Preferences > Languages > Tcl, becuase the EDA tool does not expose the interperter to the user, after you start the tool, there is a console you can type commands.

Best regards,
komodo_user

Morning @komodo_user,

Thanks for clarifying. It sounds like what you’re asking for isn’t possible. You’re looking for a debugger for EDA, not Tcl. Unless EDA is a Tcl interpreter? That’s still unclear to me. Komodo isn’t an EDA debugger, it’s a Tcl debugger.

Some ideas to work around this issue could be:

  1. See if there is a way to load EDA scripts into your Tcl code, not the other way around.
  2. Is EDA a Tcl interpreter? Can IT start the debugger process?
  3. Figure out if there is a way to debug your code in isolation from EDA.

So far, if I’m understanding correctly, what you’re asking for isn’t supported. It would be analogous to someone that is debugging Python scripts that are called from a C program. You can’t debug C from a Python debugger.

Hi @careyh,

Thanks for your suggestions. I will try to answer your questions first and then explain my ideas.

  1. EDA and Tcl interpreter
    When I type command in Linux terminal to start the EDA, e.g. start_eda, the EDA tool will implicitly bringup a Tcl interpreter, and you can interact with the Tcl interpreter using EDA console. (You need tell EDA to do things by click on the GUI buttons or type Tcl commands in EDA console) .
    So,
    EDA is of course NOT tcl interpreter, but it has a console for the user to interact with EDA using Tcl script.

  2. “See if there is a way to load EDA scripts into your Tcl code, not the other way around.”
    EDA script is already Tcl script, some of the Tcl commands are defined by EDA vendor.

  3. “Is EDA a Tcl interpreter? Can IT start the debugger process?”
    EDA is NOT tcl interpreter, but it has a console for the user to interact with EDA using Tcl script. I believe the console is some sort of Tcl interpreter. In the console, I can use the way in Komodo Tcl Remote Debugging docs to connect to Komodo debugger.

  4. Figure out if there is a way to debug your code in isolation from EDA.
    I believe that’s impossible, because there are many EDA defined commands. The debugger will report undefined commands if debugging the script in isolation from EDA.

Below is what I think to work-around.

  1. Why Komodo tcl debugger failed to debug my EDA tcl script
    Komodo debugger will bringup a new tclsh in EDA console, in the new tclsh, the debugger can’t recognize commands defined by EDA.
    start_eda
    |-- start_eda_console (I run my EDA tcl script in this console)
    | |-- dbgp_tcldebug -dbgp localhost:37880 -app-file <tcl_program>
    | | |-- <path_to_tclsh> Komodo-IDE-12/lib/support/tcl/appLaunch.tcl 127.0.0.1 17000 <tcl_program> tcldbgp23607

  2. What I think may work
    Maybe there is some tcl script in Komodo, can be sourced in EDA console(directly in EDA console, not bringup another tclsh in EDA console) and make the EDA console a socket sever. The debugger of Komodo acts as a socket client, send debug commands such as “next step”, “run until breakpoint”.

I think the most important thing here is NOT bring up a subprocess of tclsh in EDA console, the Komodo debugger need “attach” directly to EDA console(which is a Tcl interpreter), not debug the Tcl script in the subprocess of tclsh.

So, to summrize, my idea is to “make the EDA console a socket sever(not bringup a new tclsh and make the new tclsh as a server) and Komodo debugger as a client”.

What do you think my idea, any suggestions or concerns?
Is there any code/script in Komodo can help to achieve my idea? (Once, I believed Komodo-IDE-12/lib/support/tcl/tcldebugger_attach/attach.tcl may achieve my idea, but Komodo debugger can’t pop out image below, so EDA console can’t connect to debugger use this attach.tcl)
image

Best regards,
komodo_user

Thanks very much for the thorough response. I think I have a pretty good handle on your env now.

So it sounds like your options are either to use dbgp_tlcdebug binary and pass it the -app-shell argument that would point to EDAs Tcl interpreter and hopefully that knows to load their scripts as well.

Or you could try running Komodo-IDE-12/lib/support/tcl/appLaunch.tcl 127.0.0.1 17000 <tcl_program> tcldbgp23607 on it’s own. You shouldn’t need to run that with <path_to_tclsh> since you’re in a Tcl shell already when running EDA.

I don’t know that much about Tcl but what you need if none of the above works is something equivalent to PERL5LIB or PYTHONPATH in those languages which tells the interpreter where and how to load extra libraries that the interpreter may not know about.

  • Carey

Hi @careyh,

Thanks for your suggestions. I tried them both, but I can’t achieve my goal.

  1. “use dbgp_tlcdebug binary and pass it the -app-shell argument that would point to EDAs Tcl interpreter”
    " what you need if none of the above works is something equivalent to PERL5LIB or PYTHONPATH in those languages which tells the interpreter where"
    The EDA implictly bring-up tclsh, so I can’t find path of EDA’s Tcl interpreter.

  2. " try running Komodo-IDE-12/lib/support/tcl/appLaunch.tcl 127.0.0.1 17000 <tcl_program> tcldbgp23607"
    I tried, but report error “child process exited abnormally”.
    It seems that this appLaunch.tcl must be called by dbgp_tlcdebug binary. Because “tcldbgp23607” is different every time I call dbgp_tlcdebug, and “23067” is not the port from Debug->Listener Status menu.

Could you please send this support link to Komodo developers for Tcl debugger. I am stuck here about 10 days, and really hope I can use Komodo to debug my Tcl script.

Best regards,
komodo_user

Morning @komodo_user,

You’re talking to the Komodo Dev. The Tcl dev has long since left the company but the script is not the issue here. Setting up your environment properly is the issue.

You gave up on point 1 two quickly. It sounds like you only tried part of it. I just Google “TclPath” to see what I can find. The equivalent of PYTHONPATH for Tcl is TCLLIBPATH. So there’s part of the answer.

Next, you need to find where EDA keeps its tcl Scripts and point TCLLIBPATH at it. You can probably Google this as well. If you can’t find that then you need to contact EDA for assistance on how you can mock their shell environment.