I want to enable integrated debugging with gdb for my project in Eclipse CDT. The problem is I can't run the debugger with just a simple command like gdb myapp
, because application starts using various scripts, there are lot of environment variables to set before starts, so there is shell scripts that starts application under gdb debugger, let's say it is run.sh
located in some /workspace/myproject/
. Now I'd like to configure Eclipse to start the debugger from it's interface, is there any way to do that? I'm trying to set my script as debugger, but it does nothing when I start debugger.
Your run.sh
could handle command line parameters. Add a parameter to it, e.g. --debug
, and have it invoke GDB after it has set up whatever environment variables are required, e.g. replace
export FOO=...
... other setup ...
exec /path/to/binary $ARGS
with
... setup ...
exec $GDB /path/to/binary $ARGS
where $GDB
is empty if --debug
was not on command line, or is set to gdb --args
if it was.
Now set up Eclipse to invoke run.sh --debug
when debugging, and you are done.