SlideShare uma empresa Scribd logo
1 de 13
Baixar para ler offline
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

Mais conteúdo relacionado

Mais procurados

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 KnewUndo
 
Debugging With GNU Debugger GDB
Debugging With GNU Debugger GDBDebugging With GNU Debugger GDB
Debugging With GNU Debugger GDBkyaw thiha
 
Debugging Applications with GNU Debugger
Debugging Applications with GNU DebuggerDebugging Applications with GNU Debugger
Debugging Applications with GNU DebuggerPriyank Kapadia
 
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 gdbgregthelaw
 
Understand more about C
Understand more about CUnderstand more about C
Understand more about CYi-Hsiu Hsu
 
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 programsDaniel Ilunga
 
Compiling Under Linux
Compiling Under LinuxCompiling Under Linux
Compiling Under LinuxPierreMASURE
 
GNU GCC - what just a compiler...?
GNU GCC - what just a compiler...?GNU GCC - what just a compiler...?
GNU GCC - what just a compiler...?Saket Pathak
 
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 GoYu-Shuan Hsieh
 
GNU Compiler Collection - August 2005
GNU Compiler Collection - August 2005GNU Compiler Collection - August 2005
GNU Compiler Collection - August 2005Saleem Ansari
 
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...Luis Lopez
 
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 Yu-Shuan Hsieh
 
Intro2 Cuda Moayad
Intro2 Cuda MoayadIntro2 Cuda Moayad
Intro2 Cuda MoayadMoayadhn
 
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 FreeRTOSFernando Luiz Cola
 

Mais procurados (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
 

Destaque

Representations Of Characters In Music Videos
Representations Of Characters In Music VideosRepresentations Of Characters In Music Videos
Representations Of Characters In Music VideosOllie Shepherd
 
Lgpl license
Lgpl licenseLgpl license
Lgpl licenseEric Juan
 
Trend briefs security
Trend briefs securityTrend briefs security
Trend briefs securityJongseok Choi
 
How to increase your effectiveness
How to increase your effectivenessHow to increase your effectiveness
How to increase your effectivenessEmad Khamis
 
Mail art
Mail artMail art
Mail artvaom
 
PPDHTH3_HoangNhi
PPDHTH3_HoangNhiPPDHTH3_HoangNhi
PPDHTH3_HoangNhinhi104
 
Personal shopper (finally vers.)
Personal shopper (finally vers.)Personal shopper (finally vers.)
Personal shopper (finally vers.)Edogawa Photos
 
PPDHTH3_HoangNhi
PPDHTH3_HoangNhiPPDHTH3_HoangNhi
PPDHTH3_HoangNhinhi104
 

Destaque (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
 

Semelhante a Usage of GDB

gdb-tutorial.pdf
gdb-tutorial.pdfgdb-tutorial.pdf
gdb-tutorial.pdfligi14
 
Writing mruby Debugger
Writing mruby DebuggerWriting mruby Debugger
Writing mruby Debuggeryamanekko
 
Debugging Modern C++ Application with Gdb
Debugging Modern C++ Application with GdbDebugging Modern C++ Application with Gdb
Debugging Modern C++ Application with GdbSenthilKumar Selvaraj
 
ELC-E Linux Awareness
ELC-E Linux AwarenessELC-E Linux Awareness
ELC-E Linux AwarenessPeter Griffin
 
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 Linaro
 
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 2022ssuser866937
 
Debugger Principle Overview & GDB Tricks
Debugger Principle Overview & GDB TricksDebugger Principle Overview & GDB Tricks
Debugger Principle Overview & GDB Tricksdutor
 
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 Learnedbasisspace
 
Gradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 versionGradle in 45min - JBCN2-16 version
Gradle in 45min - JBCN2-16 versionSchalk Cronjé
 
Linux User Space Debugging & Profiling
Linux User Space Debugging & ProfilingLinux User Space Debugging & Profiling
Linux User Space Debugging & ProfilingAnil Kumar Pugalia
 
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 GoRodolfo Carvalho
 
Info gdal 20150915
Info gdal 20150915Info gdal 20150915
Info gdal 20150915GeoMedeelel
 
Extending GDB with Python
Extending GDB with PythonExtending GDB with Python
Extending GDB with PythonLisa Roach
 
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 GPUsMark Kilgard
 

Semelhante 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
 

Mais de Jongseok Choi

Hyperledger 구조 분석
Hyperledger 구조 분석Hyperledger 구조 분석
Hyperledger 구조 분석Jongseok Choi
 
Blockchain trends and research
Blockchain trends and researchBlockchain trends and research
Blockchain trends and researchJongseok Choi
 
Bitcoin and Ethereum
Bitcoin and EthereumBitcoin and Ethereum
Bitcoin and EthereumJongseok Choi
 
oneM2M security summary
oneM2M security summaryoneM2M security summary
oneM2M security summaryJongseok Choi
 
Case Study on Intelligent IoT Platform
Case Study on Intelligent IoT PlatformCase Study on Intelligent IoT Platform
Case Study on Intelligent IoT PlatformJongseok Choi
 
oneM2M Introduction and security
oneM2M Introduction and securityoneM2M Introduction and security
oneM2M Introduction and securityJongseok Choi
 
IoT Introduction and Security
IoT Introduction and SecurityIoT Introduction and Security
IoT Introduction and SecurityJongseok Choi
 
Basic of Exploitation
Basic of ExploitationBasic of Exploitation
Basic of ExploitationJongseok Choi
 
wordpress with nginx on virtualization, jail
wordpress with nginx on virtualization, jailwordpress with nginx on virtualization, jail
wordpress with nginx on virtualization, jailJongseok Choi
 

Mais 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

Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersMairaAshraf6
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueBhangaleSonal
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Call Girls Mumbai
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"mphochane1998
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiessarkmank1
 
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.pptxJuliansyahHarahap1
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptDineshKumar4165
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.Kamal Acharya
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxMuhammadAsimMuhammad6
 
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 startQuintin Balsdon
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdfKamal Acharya
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationBhangaleSonal
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdfKamal Acharya
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdfKamal Acharya
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...drmkjayanthikannan
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayEpec Engineered Technologies
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadhamedmustafa094
 

Último (20)

Computer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to ComputersComputer Lecture 01.pptxIntroduction to Computers
Computer Lecture 01.pptxIntroduction to Computers
 
Double Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torqueDouble Revolving field theory-how the rotor develops torque
Double Revolving field theory-how the rotor develops torque
 
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
Bhubaneswar🌹Call Girls Bhubaneswar ❤Komal 9777949614 💟 Full Trusted CALL GIRL...
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
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
 
Thermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.pptThermal Engineering -unit - III & IV.ppt
Thermal Engineering -unit - III & IV.ppt
 
Employee leave management system project.
Employee leave management system project.Employee leave management system project.
Employee leave management system project.
 
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptxOrlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
Orlando’s Arnold Palmer Hospital Layout Strategy-1.pptx
 
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
 
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
Call Girls in South Ex (delhi) call me [🔝9953056974🔝] escort service 24X7
 
Online food ordering system project report.pdf
Online food ordering system project report.pdfOnline food ordering system project report.pdf
Online food ordering system project report.pdf
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
Hospital management system project report.pdf
Hospital management system project report.pdfHospital management system project report.pdf
Hospital management system project report.pdf
 
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
 
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
Unit 4_Part 1 CSE2001 Exception Handling and Function Template and Class Temp...
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 

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