GDB basics
Changing to intel syntax
set disassembly-flavor intelFinding the entry point and sections of a stripped binary
info fileView main function instructions
disassemble mainSetting a break point
break *main
break <ADDR> #0x00000000004005bdRe-run the program
run <args> #(optional)Stepping to the next instruction
Continue running the program
View variables
View registers
Set a value to a register
Display formats
o=> Display in octal.x=> Display in hexadecimal.u=> Display in unsigned, standard base-10 decimal.t=> Display in binary.
Example using examine command ( x ):
The default size of a single unit is a four-byte unit called a word,This can be changed by adding the following letters to the end of the examine command.
b=> A single byte.h=> A halfword, which is two bytes in sizew=> A word, which is four bytes in sizeg=> A giant, which is eight bytes in size
Examples:
Examine command also accepts instruction ( i ) that display the memory as disassembled assembly language instructions.
Working with environment
GDB and other debuggers may add some more env vars, which could change offset of shellcode on the stack, so it's best to remove them.
Last updated