I'm trying to debug an application remotely with Eclipse CDT.
I got gdbserver and gdb running so I can debug via command line.
I'd like to integrate this stuff into Eclipse. I create a .gdbinit file in my home directory which is corretly loaded by Eclipse. However when i start the debug process I get
"the remote target does not support run"
From the command line, I can use "continue" instead, which work. However I cannot use this alternative from CDT since it is somehow automated.
How can I get Eclipse to use continue instead of run, or how can I make my gdbserver to accept run instead of continue?
If your gdb is recent enough to support the alias command, then you can include the line....
alias run = continue
in your .gdbinit file.
Related
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.
I have a C++ program that segfaults occasionally. The answer to this SO question provides a way to make GDB run my program over and over until it catches the segfault.
However, navigating my program via GDB has been a pain and I would like to do this using the Eclipse debugger. I have successfully created a debug configuration that runs my program.
Is there a way to make Eclipse keep running this debug configuration until a segfault (or other error) occurs?
I thought I may be able to do it by providing a GDB command file in the debug configuration that would set a break point at the program's exit and then command GDB to rerun the program.
Attempted GDB command file:
break exit
run
end
But using this GDB command file results in the following error when I attempt to start a debugging session:
Error in final launch sequence
Failed to execute MI command:
source /home/matt/gdb-loop
Error message from debugger back end:
/home/matt/gdb-loop:2: Error in sourced command file:\nNo executable file specified.\nUse the "file" or "exec-file" command.
/home/matt/gdb-loop:2: Error in sourced command file:\nNo executable file specified.\nUse the "file" or "exec-file" command.
So it seems like the command for the program I am debugging gets overridden when I modify the GDB command file being used.
FYI: Running Eclipse Neon (4.6.0 build 20160613-1800) on Ubuntu 14.04.
I wanted to run btrace on a short running program from NetBeans so I started jvisualvm from a Window command prompt then started the program in debug mode from NetBeans and set a breakpoint on the first statement in the "main" class.. I then right-clicked the program from the visualvm Applications window and selected "Trace application". Then I selected continue on netbeans to run the program and the output of the btrace was created on visual VM. Is this the easiest way to run a btrace session on a quick program from NetBeans?
Using VisualVM to generate a trace of short running applications does not seem to be optimal. You would be better of with a CLI approach.
Pre-compile the BTrace script using btracec
Create a new project configuration in NetBeans and add the following VM options
-javaagent:<path-to-btrace-agent.jar>=stdout=true,script=<path-to-compiled-script>
Select this configuration and run the application to obtain the tracing output from stdout
I use Windows xp with cygwin to run web-logic server that is located in my machine.
So I have the whole setup in one machine.
But I couldn't make the remote debugger to work with Eclipse.
Here is the debug command in startWSL.sh
export DEBUG_OPTS = -Xdebug -Xrunjdwp:transport=dt_socket,address=1044,server=y,suspend=y
But I couldn't debug from Eclipse, the connection times out.
Do I miss something that I need to do when using CYGWIN?
Help appreciated!!!
DEBUG_OPTS is not a recognized env variable in startWebLogic.sh standard script. You may want to use JAVA_OPTIONS variable instead.
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