How can I examine the stack frame with GDB?

GetOffMyLawn picture GetOffMyLawn · May 5, 2010 · Viewed 90.2k times · Source

Right now I've been using GDB to disassemble a binary file and check out different registers and whatnot. Is there an easy command to examine everything on the stack? Can this be limited to everything in a function?

Answer

Flow picture Flow · Dec 20, 2012

You can view the contents of the stack with x/10x $sp

This will print the top 10 elements of the stack.