How to debug a tcl script which is argument to an executable? - eclipse

I have a application which takes tcl script as argument. I want to debug tcl script when the application processes it.
My development environment consists of Dynamic Languages Toolkit along with Active state remote debugger -dbgp_tcldebug. I am able to debug the individual tcl scripts with this setup.
I created a tcl project in eclipse and added 'startup.tcl' and 'argumentScript.tcl' scripts and added following command to the startup script,
set ExecutableName "xyz.exe"
set returnValue [catch {eval exec $ExecutableName "argumentScript.tcl" } result]
My debugger works fine with 'startup.tcl' script. I added the breakpoint in 'argumentScript.tcl' but it is not working. How can I debug the "argumentScript.tcl" script ?
Edit: A solution without using eclipse environment is Tcl Dev Kit with remote debugging feature.

you could use tcls introspective abilities to have the script debug itself e.g. using trace

puts f "debug message" is our all!
Just dump all that you need in log file. Simple, Stupid and Robust :)

Related

Run a local command before starting eclipse debugging

I want to run a terminal command just before a debug configuration starts on Eclipse.
I heard about CDT launch Groups, but couldnt get around it fully. I need to just run a normal terminal command, nothing fancy.
The aim is to copy some stuff over to the execution path before actually starting the debugging.
I managed to do this via "Launch Groups" in the CDT. Creating 2 groups, one as a c/C++ Application which calls a shell script that includes the command I want to run. And then the normal debug configuration I wanted to execute.

eclipse: how to debug a Scala program called from a shell script

I have a Scala program that is triggered from a shell script. I'd like to be able to run the program in eclipse in debug mode. Anybody knows how that can be done?
Thanks.
I'm not sure if there is a way to debug both together, but what you can do is run your script with the option -xv. So...
user#mypc$: bash -xv myscript other_args
That will show you the commands that are executed along with their parameters.
Then in Eclipse you can debug your Scala program normally and pass those parameters to it through the main method or run configuration.
Typically debuggers are language specific and won't be able to do both bash scripts and code in another language, but with this method, you should be able to figure out what's going on.

Eclipse LDT doesn't run local Lua interpreter

I have problem with Eclipse LDT. When I run my test Lua app, it executes just fine using JNLua inside JavaVM environment. But according to this tutorial, when I reference native lua.exe interpreter and set it in Run Configuration as Runtime Interpreter, Run Configuration disables Launch script: and nothing is executed. When I run a same script with a same native local Lua interpreter 5.1, everything works just fine.
So, what is the problem with LDT? Has anyone had the same experience?
EDIT
I've managed to run local lua.exe from Lua Development Tools stand-alone product, but still it doesn't work as Eclipse plug-in.
I'm not sure it's a bug.
I guess when you register your interpreter, you uncheck the checkbox : "Accept file as argument"
This mean LDT will not manage the file to launch (that's why the Launch script is disabled)
The standard lua interpreter support file as argument and -e option, so the two check box should be checked. (It's the default value)
It looks like a bug ... Would you mind filing it in the Koneki bug tracker?

how to execute c program in windows command prompt when run from eclipse cdt

I downloaded and configured eclipse cdt along with MinGW and able to compile c programs.
My question, how to start executing the program in command prompt when Run option clicked from eclipse. Currently it always executes the program in eclipse console.
Reason to have command prompt for executing c programs is to accept user inputs.
I would also like to know is there a way to accept user inputs when c program running in eclipse console.
Thanks in advance,
-Manju
I guess i am quite late but still you can try this out. You can execute c programs through Eclipse cdt by writing a batch file and calling them through a click of button or any other event handler. Just make sure you are in the correct directory before attempting to compile and execute the file.
You can find various resources online to create a batch file which can help you execute programs through the console.
On compiling the file, (if you haven't specified an output file), a.exe file will be created. To execute this file with command line inputs just type the following in cmd (as long as you are in the same directory)
a.exe "command line inputs"
where "command line inputs" are the inputs you want to provide to your program.
Hope this is helpful!
i know 8 years is very late,but maybe somone else like me see this,so my answer is :
you should use:
setvbuf(stdout, NULL, _IONBF, 0);
setvbuf(stderr, NULL, _IONBF, 0);
after every printf statment to be able to input data in eclipse ide console tab ,
as i understood :""The root cause of the I/O problem is that we're using Windows pipes to communicate with the underlying process. The pipes are buffered"
you can refer to this links for more informations;
http://wiki.eclipse.org/CDT/User/FAQ#Eclipse_console_does_not_show_output_on_Windows
https://bugs.eclipse.org/bugs/show_bug.cgi?id=173732

How to do remote debugging in Eclipse CDT without running `gdbserver` manually on the target every time?

Before each debugging cycle I have to run gdbserver on remote target (Linux). So I was thinking to make script that would call python program that would connect over ssh and would run gdbserver.
I cant find any options to run command before debug and I also try to change .gdbinit file but I am unable tu run python script whit that. Since I am using crosscompiler I cant to get other gdb whit such support.
You don't need to run Python to invoke an external command from GDB. This (in .gdbinit) should work:
shell ssh remote-host gdbserver :12345 /path/to/binary/on/remote &
target remote remote-host:12345
If you do need more complicated ssh setup and need Python for that, you can certainly get it with
shell python your_script.py
If you can't get any external program called from your gdbinit, I see one way of doing it within Eclipse that might work (I didn't tested) but it is not really straightforward...
Create an External Tool configuration that launches your gdbserver program (Python or whatever command line script)
Create a C/C++ application launcher that launch your application to debug
Create a launch group that will call the two previously configured configurations.
Launch the group in debug mode
Eclipse 4.7.0 can connect to SSH and launch gdbserver automatically with the automatic launcher set when creating a new debug connection, without the need for any custom scripts.
I have explained the setup in great detail at: Remote debugging C++ applications with Eclipse CDT/RSE/RDT