start gdb and run commands from file code example
Example: how to run program with other files in gdb
(gdb) file /tmp/helloworld
Reading symbols from /tmp/helloworld...done.
(gdb) b main
Breakpoint 1 at 0x804860c: file ./main.c, line 5.
(gdb) r
Starting program:
Remote: /tmp/helloworld
Breakpoint 1, main () at ./main.c:5
5 {
(gdb)