I am trying to automate something in gdb: I want to call monitor rtt setup <addr> <size> with the appropriate values from the _SEGGER_RTT symbol.
This works when I do it manually, but I would like to add it to my .gdbinit script.
I can do this:
(gdb) set $rtt_offset=&_SEGGER_RTT
(gdb) set $rtt_size=sizeof _SEGGER_RTT
(gdb) print $rtt_offset
$3 = (SEGGER_RTT_CB *) 0x20000410 <_SEGGER_RTT>
but if I try to call this, it fails
(gdb) mon rtt setup $rtt_offset $rtt_size "SEGGER RTT"
How do I expand these variables in the call to monitor?
eval "mon rtt setup %p %u \"SEGGER RTT\"",$rtt_offset,$rtt_size.