|
|
Re: Using Valgrind with gdb in Eclipse [message #1422276 is a reply to message #1281792] |
Fri, 12 September 2014 15:42 |
Rafael Gago Messages: 1 Registered: September 2014 |
Junior Member |
|
|
I spent a part of my day trying to figure out a better and simpler way to do this (the solution in the previous answer didn't work for me) . I found one. I don't want anyone to lose its time so I'm bumping an old post.
Instructions:
1 - Create a "gdb_init" file (with the name that you want) containing the next lines and store it somewhere in your machine:
target remote | /usr/bin/vgdb
set sysroot /
define run
In my case there is no --pid option after "target remote | /usr/bin/vgdb", as I'm just running one valgring process simultaneously.
2 - Create a new regular "C/C++ Application" debug configuration. Then in the "Debugger" tab set the "GDB command file" field to the path of the file that you created in the previous step.
3 - Make the valgrind gdbserver be ready to run your app (in a separate terminal) "valgrind --vgdb=full --vgdb-error=0 APP ARG1 ARG2 ..."
4 - Start the debugger (gdb client) using the previously created debug configuration.
Now each time that valgrind finds an error the debugger breaks. You have the full stack trace and variable values.
The trick/hack here is that the custom "gdbinit" file runs before gdb executes the "run" command, so redefining the "run" command to do nothing (using the "define" gdb command) workarounds the problem of the eclipse debugger detecting that the first "run" command session has ended.
I don't know the internals, but integrating this with the current "Remote Application" debugger looks like an easy job for some Java developer that already knows the internals.
This was tested in eclipse luna.
[Updated on: Mon, 15 September 2014 07:22] Report message to a moderator
|
|
|
Powered by
FUDForum. Page generated in 0.03303 seconds