GDB Debugger For Basic Debugging

Vishal patsariya
2 min readJul 4, 2023

--

Multiple Platform

  • x86
  • ARM
  • Opensource and closed source binaries.

Uses of GDB :

  • Runtime Analysis
  • Manipulating Program Flow
  • Disassembly
  • Reverse Engineering

Debuggers Symbol

  • Information about Variables, functions etc. About the binary which can be read by a debugger
  • Debugger now Understands the binary better.
  • It can be included in the binary , if not then it can be parsed separately . Symbol file types are Dwarf 2, COFF, XCOFF, Stabs
  • GCC uses -g option
  • GCC -ggbd for GDB Specific Symbols

NM -(List Symbols from Object Files)

nm 'File_name'

  • Output :
  • Symbol Types :

Commands:

  • nm 'File_name' |grep 'function_name' (will find the symbol in the binary).
  • nm ./* |grep 'function_name' (will find the symbol in every File in the given Directory)
  • nm -n 'File_name'(Sort the output)

Strace :

  • Helper tooll to understand how program interacts with the os.
  • Traces all system calls made by the program
  • strace 'File_name'

GDB Commands :

  • info functions (Will give you all the functions)
  • info variables(will give info about variables but by default it doesn't print local variables {only global variables})
  • break main(Set a Breakpoint at main Function)
  • info registers (Information of CPU Registers)
  • info breakpoints (List all break Points)
  • disable 'breakpoint number' (Disable Selected breakpoint)
  • enable 'breakpoint number'(enable Breakpoint)
  • delete 'breakpoint number'(delete breakpoint)

--

--

Vishal patsariya

PMAT || CRTP || CEH (Practical) || AZ-900 || Pro hacker at Hackthebox || Security researcher || 275@NAHAMCON