You can run gdb with –args parameter,
gdb –args executablename arg1 arg2 arg3
If you want it to run automatically, place some commands in a file (e.g. ‘run’) and give it as argument: -x /tmp/cmds. Optionally you can run with -batch mode.
gdb -batch -x /tmp/cmds –args executablename arg1 arg2 arg3
gdb -ex=r –args myprogram arg1 arg2
-ex=r is short for -ex=run and tells gdb to run your program immediately, rather than wait for you to type “run” at the prompt. Then –args says that everything that follows is the command and arguments, just as you’d normally type them at the commandline prompt.