Hey nulled! Today we will be writing a simple hello world program in C, compiling it, then analyzing the disassembled binary.
The code will be compiled with gcc and disassembled using gdb; if you are using Windows, you can get Dev-C++ that comes with all the gcc utilities, including gdb.
Bear in mind that if you compile the source code yourself, your assembly code may be slightly different from mine due to variations in the different versions of gcc (I am using gcc v3.3.5 on Linux and v3.4.2 on Windows).
Also, your memory addresses probably won’t match mine, but this is normal as they will be different when compiled on different systems.
GDB Basics
GDB is both a debugger and a disassembler. In this example, we will be using gdb as a disassembler to perform a static analysis of our code. Gdb has many commands, but for our purposes there are just a few we will be using:
Hello World!
Good luck.