[Debugging] Multiple commands in gdb separated by some sort of delimiter ';'?


If you are running gdb from command line you can pass multiple commands with the -ex parameter like:

$ gdb ./prog -ex 'b srcfile.c:90' -ex 'b somefunc' -ex 'r -p arg1 -q arg2'

This coupled with display and other commands makes running gdb less cumbersome.


I am trying to execute two commands at once in gdb:

finish; next

I tried using the ';' to separate the commands but gdb did not let me do both at once.

Is it possible to do multiple commands in gdb similar to bash commands separated by ';' delimiter?

i ran across another way to do multiple commands in GDB using a Bash HERE document.


cat << EOF | gdb
print "command_1"
print "..."
print "command_n"

this has limited value/usability IMO because GDB quits after executing the list of commands.