Search⌘ K
AI Features

Disassembly Output Without Optimization

Explore how to reconstruct approximate C/C++ programs from unoptimized disassembly outputs using GDB on Linux ARM64. Understand pointer manipulation, basic arithmetic operations, and debug step-by-step to analyze memory and registers during program execution.

Example of a disassembly output: No-optimization mode

The ability to reconstruct approximate C or C++ code from code disassembly is essential in memory dump analysis and debugging.

Source code

We give a C/C++ code for our project of reconstructing a program through the GDB disassembly output in this lesson:

C++
int a, b;
int *pa, *pb;
int main(int argc, char* argv[])
{
pa = &a;
pb = &b;
*pa = 1;
*pb = 1;
*pb = *pb + *pa;
++*pa;
*pb = *pb * *pa;
return 0;
}

Here is a breakdown of the code presented above:

Explanation

  • Line 1: We declare the two integer variables.
  • Line 2: We declare the two integer pointers.
  • Lines
...