Debugging the compiled programs is one important aspect of learning x86 assembly language. When working with assembly programs, the only way to step through every single instruction written in the code is to debug the program using a debugger.
GDB is one of the most popular debuggers available for debugging linux-based executables. GDB is also extensively used in exploit development and reverse engineering. This article focuses on understanding how to use GDB to step through the instructions of a given x86 assembly program.
See the previous article in the series, How to build a program and execute an application entirely built in x86 assembly.
The target executable
The readers will be introduced to using GDB in the later sections of the article. So, we will prepare a simple binary written in x86 assembly so we can use GDB against it to understand how GDB can be used to debug binaries. Following is the program we will use.
mov eax, 8
mov eax, 0xa
mov ebx, eax
mov ecx, [esp]
We created a file named mov.nasm, and it starts with a directive called global, which tells our linker where the entry point