I'm trying to store the output of a gdb command into a gdb variable. I'm following the instruction from here. But when I print the variable it shows empty.
My pop_stack file contains this
20
268435372
I use the following command to store the value 268435372 from the pop_stack into gdb variable $pop_ele. And try to print the value as hexadecimal. But the $pop_ele shows empty.
(gdb) shell echo set \$pop_ele=\"$(tail -n 1 pop_stack)\"
(gdb) p/x $pop_ele
output:
set $pop_ele="268435372"
$8 = 0x0
My desire output for p/x $pop_ele command is 0xfffffac
Please help.