https://www.sourceware.org/gdb/

Launch

Supported languages: Ada / Assembly / C / C++ / D / Fortran / Go / Objective-C / OpenCL / Modula-2 / Pascal / Rust

gdb myFile
Open myFile in gdb.

gdb -p 'pidof myFile' Attach GDB to the process id of myFile (running program).

Basis

set disassembly-flavor intel
Make disassemble more readable.

disassemble main
Display all assembler instructions from main.

print myFunction
Display the address of myFunction.

vmmap
Show Virtual Memory Map.

Memory Content

info registers
Give info about registers.

info proc mappings
Give info about memory.

set $eax=0
Set the value (here set eax to 0).

Move in Program Execution

x/s address Go to a specific address.

run
Start the program.

continue
Run the program until next breakpoint.

si
Step one instruction (step into function calls).

ni
Step one instruction (no step into function calls).

Breakpoint

break *main
Add a breakpoint to main function.

break *address
Add a breakpoint to an address.

del
Delete a breakpoint.

Hook

A Hook execute GDB commands when hitting a breakpoint.

define hook-stop
Switches to Hook creation mode (enter commands and end with end).