The easiest way to do this given a program X
and list of parameters a b c
:
X a b c
Is to use gdb
‘s --args
option, as follows:
gdb --args X a b c
gdb --help
has this to say about --args
:
--args Arguments after executable-file are passed to inferior
Which means that the first argument after --args
is the executable to debug, and all the arguments after that are passed as is to that executable.