GDB Disassembly Output – Optimization
Explore how to compile and debug C/C++ programs with optimization flags using GDB on Linux ARM64. Understand how compiler optimizations affect disassembly output and memory updates. Gain hands-on experience running optimization mode commands and interpreting the resulting assembly code.
We'll cover the following...
Disassembly in the optimization mode
Let’s review the disassembly generated by compiling the program in the optimization mode. We will revisit the source code first and review the flags needed to trigger the optimization.
Source code
The source code of the arithmetic program is given below:
The flowchart below shows the working of the source code:
Compilation
We can add certain flags for optimizing the code while compiling our source file. A flag, -O, is used for the optimization of code, and -O1 is an optimization flag that further optimizes the code size and execution time. There are other flags for ...