https://www.sourceware.org/gdb/
Launch
Supported languages: Ada / Assembly / C / C++ / D / Fortran / Go / Objective-C / OpenCL / Modula-2 / Pascal / Rust
gdb myFileOpen myFile in gdb.
gdb -p 'pidof myFile' Attach GDB to the process id of myFile (running program).
Basis
set disassembly-flavor intelMake disassemble more readable.
disassemble mainDisplay all assembler instructions from main.
print myFunctionDisplay the address of myFunction.
vmmapShow Virtual Memory Map.
Memory Content
info registersGive info about registers.
info proc mappingsGive info about memory.
set $eax=0Set the value (here set eax to 0).
Move in Program Execution
x/s address Go to a specific address.
runStart the program.
continueRun the program until next breakpoint.
siStep one instruction (step into function calls).
niStep one instruction (no step into function calls).
Breakpoint
break *mainAdd a breakpoint to main function.
break *addressAdd a breakpoint to an address.
delDelete a breakpoint.
Hook
A Hook execute GDB commands when hitting a breakpoint.
define hook-stopSwitches to Hook creation mode (enter commands and end with end).