views:

690

answers:

2

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?

+9  A: 

I don't believe so (but I may be wrong). You can do something like this:

(gdb) define fn
> finish
> next
> end

And then just type:

(gdb) fn

You can put this in your ~/.gdbinit file as well so it is always available.

Sean Bright
Bad method when gdb is invoked just to print stacktrace of the invoker: `execlp("gdb", "gdb", "-batch", "-n", "-ex", "bt full", ...` and I can't turn off pagination.
Vi
A: 

GDB has no such command separator character. I looked briefly, in case it would be easy to add one, but unfortunately no....

Michael Snyder