Preparing for my OSCE course I find myself re-diving into the SLAE course offered by Security Tube. GDB is not completely foreign to me, but I find if I don’t regularly use it I forget useful commands. Here are some of the ones I find the most useful when working with GDB.

Clearing the Screen

CTRL + L

Setting Disassembly Flavour to Intel

Show Available Variables

Show Available Functions

Show Common Registers

Show All Registers

Execute Shell Commands
Example below uses the readelf command to show information on an executable

View Next Instructions

Move to next Instruction

OR

Set a break Point at a function
You can use the info functions command to find an appropriate breakpoint

Set a break point at a memory address

EXAMINING DATA

Data Types

  • b – bytes
  • h – half words (two bytes)
  • w – words (four bytes)
  • g – giant words (eight bytes)

Examine a specific byte in hex format

Examine a byte of a variable in hex format

Examining Multiple Bytes in Hex Format
Example below will show the next three bytes on the top of the stack

Examine the Stack
Example below will show the next 10 words (16 bits) on the stack

Examine 15 bytes in character format

Print EFLAGS

Examine as instruction at specific memory address

Examine a string in a register