SlideShare una empresa de Scribd logo
1 de 13
Descargar para leer sin conexión
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

Más contenido relacionado

La actualidad más candente

Debugging With GNU Debugger GDB
Debugging With GNU Debugger GDBDebugging With GNU Debugger GDB
Debugging With GNU Debugger GDB
kyaw thiha
 
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOSBuilding a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Building a QT based solution on a i.MX7 processor running Linux and FreeRTOS
Fernando Luiz Cola
 

La actualidad más candente (20)

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

Destacado (13)

Representations Of Characters In Music Videos
Representations Of Characters In Music VideosRepresentations Of Characters In Music Videos
Representations Of Characters In Music Videos
 
Lgpl license
Lgpl licenseLgpl license
Lgpl license
 
Trend briefs security
Trend briefs securityTrend briefs security
Trend briefs security
 
How to increase your effectiveness
How to increase your effectivenessHow to increase your effectiveness
How to increase your effectiveness
 
Dma120week01
Dma120week01Dma120week01
Dma120week01
 
Genel Destek Programı
Genel Destek ProgramıGenel Destek Programı
Genel Destek Programı
 
Mail art
Mail artMail art
Mail art
 
Dr Awad CV
Dr Awad CVDr Awad CV
Dr Awad CV
 
PPDHTH3_HoangNhi
PPDHTH3_HoangNhiPPDHTH3_HoangNhi
PPDHTH3_HoangNhi
 
Personal shopper (finally vers.)
Personal shopper (finally vers.)Personal shopper (finally vers.)
Personal shopper (finally vers.)
 
Virtualization
VirtualizationVirtualization
Virtualization
 
Rural dev
Rural devRural dev
Rural dev
 
PPDHTH3_HoangNhi
PPDHTH3_HoangNhiPPDHTH3_HoangNhi
PPDHTH3_HoangNhi
 

Similar a Usage of GDB

gdb-tutorial.pdf
gdb-tutorial.pdfgdb-tutorial.pdf
gdb-tutorial.pdf
ligi14
 
ELC-E Linux Awareness
ELC-E Linux AwarenessELC-E Linux Awareness
ELC-E Linux Awareness
Peter Griffin
 
Debugger Principle Overview & GDB Tricks
Debugger Principle Overview & GDB TricksDebugger Principle Overview & GDB Tricks
Debugger Principle Overview & GDB Tricks
dutor
 
Linux User Space Debugging & Profiling
Linux User Space Debugging & ProfilingLinux User Space Debugging & Profiling
Linux User Space Debugging & Profiling
Anil Kumar Pugalia
 

Similar a Usage of GDB (20)

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

Más de Jongseok Choi

Más de Jongseok Choi (16)

Hyperledger 구조 분석
Hyperledger 구조 분석Hyperledger 구조 분석
Hyperledger 구조 분석
 
Blockchain trends and research
Blockchain trends and researchBlockchain trends and research
Blockchain trends and research
 
블록체인 개요
블록체인 개요블록체인 개요
블록체인 개요
 
Bitcoin and Ethereum
Bitcoin and EthereumBitcoin and Ethereum
Bitcoin and Ethereum
 
Effective Go
Effective GoEffective Go
Effective Go
 
oneM2M security summary
oneM2M security summaryoneM2M security summary
oneM2M security summary
 
Case Study on Intelligent IoT Platform
Case Study on Intelligent IoT PlatformCase Study on Intelligent IoT Platform
Case Study on Intelligent IoT Platform
 
oneM2M Introduction and security
oneM2M Introduction and securityoneM2M Introduction and security
oneM2M Introduction and security
 
IoT Introduction and Security
IoT Introduction and SecurityIoT Introduction and Security
IoT Introduction and Security
 
Gitlab.key
Gitlab.keyGitlab.key
Gitlab.key
 
Basic of Exploitation
Basic of ExploitationBasic of Exploitation
Basic of Exploitation
 
Web penetration
Web penetrationWeb penetration
Web penetration
 
Svn
SvnSvn
Svn
 
wordpress with nginx on virtualization, jail
wordpress with nginx on virtualization, jailwordpress with nginx on virtualization, jail
wordpress with nginx on virtualization, jail
 
Web hacking 개요
Web hacking 개요Web hacking 개요
Web hacking 개요
 
Forensic 2
Forensic 2Forensic 2
Forensic 2
 

Último

Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
amitlee9823
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
Neometrix_Engineering_Pvt_Ltd
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
MsecMca
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 

Último (20)

Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night StandCall Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
Hazard Identification (HAZID) vs. Hazard and Operability (HAZOP): A Comparati...
 
Design For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the startDesign For Accessibility: Getting it right from the start
Design For Accessibility: Getting it right from the start
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Integrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - NeometrixIntegrated Test Rig For HTFE-25 - Neometrix
Integrated Test Rig For HTFE-25 - Neometrix
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Unit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdfUnit 2- Effective stress & Permeability.pdf
Unit 2- Effective stress & Permeability.pdf
 
Work-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptxWork-Permit-Receiver-in-Saudi-Aramco.pptx
Work-Permit-Receiver-in-Saudi-Aramco.pptx
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Netaji Nagar, Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086Minimum and Maximum Modes of microprocessor 8086
Minimum and Maximum Modes of microprocessor 8086
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 

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