SlideShare a Scribd company logo
Introduction Running GDB Experimentation
Usage of GDB
th!nkh@ck-hackartist
cafe.thinkhack.org
December 19, 2014
Introduction Running GDB Experimentation
1 Introduction
Introduction to GDB
2 Running GDB
Starting GDB
Listing Codes
Debugging
Listing Functions and Variables
Breaking Points
Monitoring Registers
Watching Values
Dumping Stack
3 Experimentation
Analysing a Program
Solving the Program
Introduction Running GDB Experimentation
Introduction to GDB
Introduction to GDB
What is GDB?
GNU Project debugger
Supports for Ada, C, C++, Objective-C, Pascal and many
other languages
The latest version is 7.8.1 of GDB
Mac OS X uses modification version of GDB
Features of GDB
Supports for various architectures (Such as ARM, MIPS, i386,
etc.)
Supports for instructions; SSE, AVX, AVX2 MPX, etc.
Various instructions is supported on various architectures
Including all the functionalities of GUI debuggers
Introduction Running GDB Experimentation
Starting GDB
Starting GDB
Debugging a program without any parameters
gdb [options] filename
gdb learn-gdb
Debugging a program with parameters
gdb [options] –args filename arg1 arg2 ...
gdb –args learn-gdb -r
Introduction Running GDB Experimentation
Listing Codes
Listing Codes
Listing All the codes
(gdb) list {line number}
(gdb) list 1
Listing a specific function
(gdb) list {function name}
(gdb) list main
Introduction Running GDB Experimentation
Debugging
Debugging
Starting a program
(gdb) run
(gdb) r
Debugging a program
(gdb) continue
(gdb) next
(gdb) nexti
(gdb) step
(gdb) stepi
Introduction Running GDB Experimentation
Listing Functions and Variables
Listing Functions and Variables
Listing all functions
(gdb) info functions
(gdb) i func
Disassembling a function
(gdb) disass {function name}
(gdb) disass main
Listing global/static variables
(gdb) info variables
(gdb) i var
Introduction Running GDB Experimentation
Breaking Points
Breaking Points
Breaking a function
(gdb) break {function name}
(gbd) b main
Breaking a specific address
(gdb) break *{address}
(gdb) b *0x100000af0
Listing breakpoints
(gdb) info breakpoints
(gdb) i b
Introduction Running GDB Experimentation
Monitoring Registers
Monitoring Registers
Seeing all registers
(gdb) info registers
(gdb) i r
Seeing a specific register
(gdb) info register ${a specific register}
(gdb) i r $rax
Introduction Running GDB Experimentation
Watching Values
Watching Values
Watching variable
(gdb) watch {variable name}
(gdb) watch flag
(gdb) continue (or other debugging command)
Introduction Running GDB Experimentation
Dumping Stack
Dumping Stack
Dumping stack
We can use “x” command with some parameter. In parameters,
count of memeory we want to see, printed radix and unit will be
required.
Usage of “x”
(gdb) x/{count}{radix}{unit} {address}
(gdb) x/4xw
Introduction Running GDB Experimentation
Analysing a Program
Analysing a Program
Problem
Find flag string in the binary files
http://wctf.thinkhack.org
Hints
The binary file performs part of AES encryption
The total of rounds consists of 10 rounds
There are three key functions.
Introduction Running GDB Experimentation
Solving the Program
Solving the Program
Demostration

More Related Content

PDF
GDB Rocks!
PDF
Gdb tutorial-handout
PPTX
Advanced Debugging with GDB
KEY
淺入淺出 GDB
PPTX
Gnu debugger
PPT
Introduction to gdb
PDF
Introduction to segmentation fault handling
PDF
Q2.12: Debugging with GDB
GDB Rocks!
Gdb tutorial-handout
Advanced Debugging with GDB
淺入淺出 GDB
Gnu debugger
Introduction to gdb
Introduction to segmentation fault handling
Q2.12: Debugging with GDB

What's hot (20)

PPTX
GDB: A Lot More Than You Knew
PPTX
Debugging With GNU Debugger GDB
PPT
Debugging Applications with GNU Debugger
PDF
Give me 15 minutes and i'll change your view of gdb
PPTX
Understand more about C
PPT
Gccgdb
PDF
GCC Compiler as a Performance Testing tool for C programs
ODP
GCC, GNU compiler collection
PPT
GCC compiler
PPTX
Compiling Under Linux
ODP
GStreamer Instruments
PPTX
G++ & GCC
DOCX
GNU GCC - what just a compiler...?
PDF
Goroutine stack and local variable allocation in Go
PDF
GNU Compiler Collection - August 2005
PDF
Improving GStreamer performance on large pipelines: from profiling to optimiz...
PDF
Run Go applications on Pico using TinyGo
PPT
Intro2 Cuda Moayad
PDF
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
PPTX
Debuging like a pro
GDB: A Lot More Than You Knew
Debugging With GNU Debugger GDB
Debugging Applications with GNU Debugger
Give me 15 minutes and i'll change your view of gdb
Understand more about C
Gccgdb
GCC Compiler as a Performance Testing tool for C programs
GCC, GNU compiler collection
GCC compiler
Compiling Under Linux
GStreamer Instruments
G++ & GCC
GNU GCC - what just a compiler...?
Goroutine stack and local variable allocation in Go
GNU Compiler Collection - August 2005
Improving GStreamer performance on large pipelines: from profiling to optimiz...
Run Go applications on Pico using TinyGo
Intro2 Cuda Moayad
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Debuging like a pro
Ad

Viewers also liked (13)

PPTX
Representations Of Characters In Music Videos
TXT
Lgpl license
PDF
Trend briefs security
PPTX
How to increase your effectiveness
PPTX
Dma120week01
PPTX
Genel Destek Programı
PPT
Mail art
DOC
Dr Awad CV
DOCX
PPDHTH3_HoangNhi
PDF
Personal shopper (finally vers.)
PDF
Virtualization
PDF
Rural dev
DOCX
PPDHTH3_HoangNhi
Representations Of Characters In Music Videos
Lgpl license
Trend briefs security
How to increase your effectiveness
Dma120week01
Genel Destek Programı
Mail art
Dr Awad CV
PPDHTH3_HoangNhi
Personal shopper (finally vers.)
Virtualization
Rural dev
PPDHTH3_HoangNhi
Ad

Similar to Usage of GDB (20)

PDF
gdb-tutorial.pdf
PDF
Writing mruby Debugger
PDF
GDB tutorial
PDF
lab1-ppt.pdf
PPTX
GNU Debugger
PPTX
OpenGL Introduction
PPTX
Debugging Modern C++ Application with Gdb
PDF
ELC-E Linux Awareness
KEY
LLDB Introduction
PDF
BUD17-310: Introducing LLDB for linux on Arm and AArch64
PDF
Anatomy of ROCgdb presentation at gcc cauldron 2022
PDF
Debugger Principle Overview & GDB Tricks
PPTX
Porting the Source Engine to Linux: Valve's Lessons Learned
PDF
Gradle in 45min - JBCN2-16 version
PPT
Open gl
PDF
Linux User Space Debugging & Profiling
PDF
Go 1.10 Release Party - PDX Go
PPTX
Info gdal 20150915
PPTX
Extending GDB with Python
PPTX
OpenGL 4.5 Update for NVIDIA GPUs
gdb-tutorial.pdf
Writing mruby Debugger
GDB tutorial
lab1-ppt.pdf
GNU Debugger
OpenGL Introduction
Debugging Modern C++ Application with Gdb
ELC-E Linux Awareness
LLDB Introduction
BUD17-310: Introducing LLDB for linux on Arm and AArch64
Anatomy of ROCgdb presentation at gcc cauldron 2022
Debugger Principle Overview & GDB Tricks
Porting the Source Engine to Linux: Valve's Lessons Learned
Gradle in 45min - JBCN2-16 version
Open gl
Linux User Space Debugging & Profiling
Go 1.10 Release Party - PDX Go
Info gdal 20150915
Extending GDB with Python
OpenGL 4.5 Update for NVIDIA GPUs

More from Jongseok Choi (16)

PDF
Hyperledger 구조 분석
PDF
Blockchain trends and research
PDF
블록체인 개요
PDF
Bitcoin and Ethereum
PDF
Effective Go
PPTX
oneM2M security summary
PDF
Case Study on Intelligent IoT Platform
PDF
oneM2M Introduction and security
PDF
IoT Introduction and Security
PDF
Gitlab.key
PDF
Basic of Exploitation
PDF
Web penetration
PDF
wordpress with nginx on virtualization, jail
PDF
Web hacking 개요
PDF
Forensic 2
Hyperledger 구조 분석
Blockchain trends and research
블록체인 개요
Bitcoin and Ethereum
Effective Go
oneM2M security summary
Case Study on Intelligent IoT Platform
oneM2M Introduction and security
IoT Introduction and Security
Gitlab.key
Basic of Exploitation
Web penetration
wordpress with nginx on virtualization, jail
Web hacking 개요
Forensic 2

Recently uploaded (20)

PPT
Mechanical Engineering MATERIALS Selection
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
web development for engineering and engineering
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
PPT on Performance Review to get promotions
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPT
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
Construction Project Organization Group 2.pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
bas. eng. economics group 4 presentation 1.pptx
Mechanical Engineering MATERIALS Selection
Lecture Notes Electrical Wiring System Components
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
UNIT 4 Total Quality Management .pptx
web development for engineering and engineering
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPT on Performance Review to get promotions
UNIT-1 - COAL BASED THERMAL POWER PLANTS
CRASH COURSE IN ALTERNATIVE PLUMBING CLASS
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Operating System & Kernel Study Guide-1 - converted.pdf
Construction Project Organization Group 2.pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Foundation to blockchain - A guide to Blockchain Tech
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
bas. eng. economics group 4 presentation 1.pptx

Usage of GDB

  • 1. Introduction Running GDB Experimentation Usage of GDB th!nkh@ck-hackartist cafe.thinkhack.org December 19, 2014
  • 2. Introduction Running GDB Experimentation 1 Introduction Introduction to GDB 2 Running GDB Starting GDB Listing Codes Debugging Listing Functions and Variables Breaking Points Monitoring Registers Watching Values Dumping Stack 3 Experimentation Analysing a Program Solving the Program
  • 3. Introduction Running GDB Experimentation Introduction to GDB Introduction to GDB What is GDB? GNU Project debugger Supports for Ada, C, C++, Objective-C, Pascal and many other languages The latest version is 7.8.1 of GDB Mac OS X uses modification version of GDB Features of GDB Supports for various architectures (Such as ARM, MIPS, i386, etc.) Supports for instructions; SSE, AVX, AVX2 MPX, etc. Various instructions is supported on various architectures Including all the functionalities of GUI debuggers
  • 4. Introduction Running GDB Experimentation Starting GDB Starting GDB Debugging a program without any parameters gdb [options] filename gdb learn-gdb Debugging a program with parameters gdb [options] –args filename arg1 arg2 ... gdb –args learn-gdb -r
  • 5. Introduction Running GDB Experimentation Listing Codes Listing Codes Listing All the codes (gdb) list {line number} (gdb) list 1 Listing a specific function (gdb) list {function name} (gdb) list main
  • 6. Introduction Running GDB Experimentation Debugging Debugging Starting a program (gdb) run (gdb) r Debugging a program (gdb) continue (gdb) next (gdb) nexti (gdb) step (gdb) stepi
  • 7. Introduction Running GDB Experimentation Listing Functions and Variables Listing Functions and Variables Listing all functions (gdb) info functions (gdb) i func Disassembling a function (gdb) disass {function name} (gdb) disass main Listing global/static variables (gdb) info variables (gdb) i var
  • 8. Introduction Running GDB Experimentation Breaking Points Breaking Points Breaking a function (gdb) break {function name} (gbd) b main Breaking a specific address (gdb) break *{address} (gdb) b *0x100000af0 Listing breakpoints (gdb) info breakpoints (gdb) i b
  • 9. Introduction Running GDB Experimentation Monitoring Registers Monitoring Registers Seeing all registers (gdb) info registers (gdb) i r Seeing a specific register (gdb) info register ${a specific register} (gdb) i r $rax
  • 10. Introduction Running GDB Experimentation Watching Values Watching Values Watching variable (gdb) watch {variable name} (gdb) watch flag (gdb) continue (or other debugging command)
  • 11. Introduction Running GDB Experimentation Dumping Stack Dumping Stack Dumping stack We can use “x” command with some parameter. In parameters, count of memeory we want to see, printed radix and unit will be required. Usage of “x” (gdb) x/{count}{radix}{unit} {address} (gdb) x/4xw
  • 12. Introduction Running GDB Experimentation Analysing a Program Analysing a Program Problem Find flag string in the binary files http://wctf.thinkhack.org Hints The binary file performs part of AES encryption The total of rounds consists of 10 rounds There are three key functions.
  • 13. Introduction Running GDB Experimentation Solving the Program Solving the Program Demostration