I am working on a C project in Eclipse CDT on Ubuntu. The project has some test suites invoking a binary run_tests
with different command-line parameters. The test suites are defined with Makefiles and invoked by running make check
in the project root.
My goal is to set up a debugging configuration in Eclipse for debugging the test suites. I want to have the following workflow:
run_tests
How can I achieve this?
My thoughts so far
It is easy to set up a debug configuration to directly run run_tests
without using make
. However, this will force me to manually configure the command line parameters which make check
should figure out for me.
I could edit the makefile rule to run gdb --args run_tests arg1 arg2
instead of run_tests arg1 arg2
. However, will Eclipse recognise and integrate with that gdb
instance?
On Windows, I could edit the makefile rule to run vsjitdebugger run_tests arg1 arg2
. Is there an equivalent to vsjitdebugger
for Eclipse on Linux?
Here is the solution:
Write the following to the gdbinit file:
set detach-on-fork off set target-async on set non-stop on set pagination off # Not necessary but improves performance set auto-solib-add off
Note: this solution can be painfully slow, as gdb will follow every fork initiated by make
. For example, if make
spawns /bin/cp
1000 times to copy setup files, then gdb will debug every one of those processes.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.