Reading the Frame Live in GDB
Break at a function and inspect its frame:
gdb ./target
(gdb) break add_squares # stop at the function
(gdb) run
(gdb) info frame # frame base, saved regs, return addr
(gdb) bt # backtrace: the frame chain
(gdb) info args # incoming arguments
(gdb) info locals # local variables
info frameshows saved RIP (return addr) and saved RBP.btwalks the whole call chain, frame by frame.