skip to content
Ivan's wiki
Site Tools
Search
Tools
Show pagesource
Backlinks
Recent Changes
Media Manager
Sitemap
>
Recent Changes
Media Manager
Sitemap
gdb-call-stack
This page is read only. You can view the source, but not change it.
# GDB call stack **The call stack** is the chain of function calls that led to the current execution point. Navigating it helps you understand how you reached an error and inspect variables in each caller. ```bash (gdb) backtrace # show all stack frames (gdb) backtrace 10 # show last 10 frames (gdb) frame 0 # select innermost frame (current function) (gdb) frame 3 # select frame 3 (third caller up) (gdb) up # move to caller (gdb) down # move to callee (gdb) info frame # details of current frame (gdb) info locals # locals in current frame (gdb) info args # arguments to current frame ``` Backtrace prints the entire stack: frame 0 (current), frame 1 (its caller), frame 2 (caller's caller), etc. Each line shows the function name, source file, and line number. Frame numbering: frame 0 is innermost (where execution paused); higher numbers are older calls. `frame N` jumps directly to frame N. `up` and `down` navigate one step at a time—faster when you need to glance at one or two nearby frames. Once you select a frame with `frame N`, all commands operate in that frame's scope. `print x` shows `x` as it exists in that frame. `info locals` and `info args` show that frame's variables and arguments. `info frame` shows the current frame's details: memory addresses, return address, saved registers, etc.—useful for understanding the calling convention or debugging stack corruption. To debug a crash, run `backtrace` immediately—it shows the call chain that led to the crash. Select each frame to inspect its arguments and locals and understand what went wrong.
Page Tools
Show pagesource
Backlinks
Back to top