I would like to store the executable name of the current inferior in a variable. I way to obtain the executable name in the gdb CLI is the following:
pipe info inferiors | awk '{ if ($1 == "*") { print $4} }'
But I am unable to store the output of this expression in a variable. The expression uses single and double quotes, which makes gdb complain if it is combined with set
and eval
.
(gdb) set $exec="pipe info inferiors | awk '{ if ($1 == "*") { print $4} }'"
Argument to arithmetic operation not a number or boolean.
(gdb) eval "!echo %s", "pipe info inferiors | awk '{ if ($1 == "*") { print $4} }'"
Argument to arithmetic operation not a number or boolean.
Then, how can I store the executable name in a variable? My goal is to pass the executable name to the file
command to reload the executable when Autotools are used (see using libtool e gdb).