A Disassembly Project with Function and Stack
Explore how to disassemble C++ programs and analyze function parameters and stack usage using GDB. Learn to set breakpoints, examine register contents, and understand parameter-passing mechanisms in x64 Linux architecture for better debugging and memory analysis.
We'll cover the following...
Project disassembled code with comments
Here is the commented code disassembly of main with memory addresses removed for visual clarity.
Below is the commented disassembly of the arithmetic function, with memory addresses removed for visual clarity.
We can put a breakpoint on the first arithmetic calculation’s address and examine the raw stack data pointed to by the %RBP register:
gcc FunctionParameters.cpp Arithmetic.cpp -o FunctionParameters
gdb ./FunctionParameters
After executing and loading the program, we get into the GDB container:
We create the breakpoint of the programs with the break main command:
break main
The breakpoint ...