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
Certainly it is possible. Given, for example, C code
int a = 3;
double b = 4.4;
short c = 555;
, say we want to ask GDB what is the type of each of those variables. The following sequence of GDB commands will allow us to enter 3 whatis
requests all on a single line:
set prompt #gdb#
#
will work: it just so happens that #
starts a comment in GDB command scripts.set logging overwrite on
set logging redirect on
set logging on
gdb.txt
.printf "\nwhatis a\nwhatis b\nwhatis c\n"
whatis
requests, entered on a single line as promised! Separating the commands, before the first, and after the last is \n
.set logging off
gdb.txt
; that file now contains a valid GDB command script:#gdb# whatis a whatis b whatis c #gdb#
source gdb.txt
type = int
type = double
type = short
shell
would be less cumbersome, and may well be possible; the above method, however, is platform-agnostic.