Reputation: 21
I'm trying to debug process with GDB from Eclipse (CDT). I can start debugging, step on code and so on. So, basic setup seems to work.
However, I don't understand how to pass command line arguments to process. Executable is not built with Eclipse, I use separate make files.
Steps I have taken to debug:
So, how I pass command line arguments for attached new application in scenario above?
Thanks in advance!
Upvotes: 1
Views: 3296
Reputation: 21
FYI, if someone is later fighting with same issue:
It seems to be possible to pass arguments to new attached process with gdb command file. I simply attached next line to command file:
set args arg1 arg2 argX
...and selected that file as GDB command line in debugger options. Those arguments were passed to main when process was started.
Upvotes: 1
Reputation: 9476
As "c++ attach to application" attaches debugger to already running application you can't expect to be able to pass command line arguments. You need to pass those whereever you start your executable.
I think you are looking for ordinary "C/C++ application" launch configuration. It does require a project (you can create a dummy one or import your actual makefile project, if you use that). With this type of launch configuration you will get additional "Arguments" tab, where you can enter "command-line" arguments.
Upvotes: 1