0

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?

2
  • 1
    Try eval, like eval "mon rtt setup %p %u \"SEGGER RTT\"",$rtt_offset,$rtt_size. Commented Jul 3 at 15:07
  • Worked perfectly, thanks :) Commented Jul 8 at 9:51

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.