I\'d like to write a script that (under certain conditions) will execute gdb and automatically run some program X with some set of arguments Y. Once the program has finishe
After trying all of the answers here,
However, it turns out you can just use -ex, like this:
gdb -ex "target remote localhost:1234"
You can also specify -ex multiple times to run multiple commands!