When running a program on GDB, usually, the arguments for the program are given at the run command. Is there a way to run the program using GDB and as well as g
gdb has --init-command where somefile has a list of gdb commands to run, I use this to have //GDB comments in my code, then `
echo "file ./a.out" > run
grep -nrIH "//GDB"|
sed "s/\(^[^:]\+:[^:]\+\):.*$/\1/g" |
awk '{print "b" " " $1}'|
grep -v $(echo $0|sed "s/.*\///g") >> run
gdb --init-command ./run -ex=r
as a script, which puts the command to load the debug symbols, and then generates a list of break commands to put a break point for each //GDB comment, and starts it running