Going further with debugging

First, we need to install gdb by running the following command:

sudo apt install gdb

The installation should look something like this:

Then, use gdb to debug the hello program, as follows:

gdb ./hello

gdb can be controlled using commands. The commands are fully listed in online documentation, but simply entering help can aid us with the basics.

You can also use gdb to show the disassembly of specified functions, using the disass command. For example, let's see what happens if we use the disass main command:

Then, ...

Get Mastering Reverse Engineering now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.