CS631 -- Advanced Programming in the UNIX Environment
Process Execution Exercise: Inspect the call stack
Write a simple program that calls several functions (e.g., "main->func1->func2->func3"), with each function performing a trivial task (e.g., adding or multiplying its arguments).
Use gdb(1) to step through the execution of the program, inspecting the call stack:
(gdb) display $rip (gdb) display $rbp (gdb) display $rsp (gdb) break main
You can manipulate the variables during execution (verify this), but can you manipulate the different registers? What happens when you do so? Can you change the program behavior?