SlideShare uma empresa Scribd logo
1 de 12
Baixar para ler offline
Gdb


Juan A. Suárez Romero



          Master on Free Software
List of topics
●   Bugs
●   Fixing bugs
●   GDB
●   Ways of working
●   Coredumps
●   Main basic commands


                      Master on Free Software
What is a bug?
●   Basically, an error in a program
●    When a program performs as it shouldn't
    perform
●   All software have bugs
    –   Programming is complex
    –   Human task -> errors



                       Master on Free Software
Fixing bugs
●   Have you ever debugged a program?
●   Have you ever debugged a C program?
●   A debugger allows you to check how a
    program is executed or checking what
    was doing when it crashed
●   In gnome we use gdb for debugging



                     Master on Free Software
GDB
●   GNU Debugger
●   Text mode
    –   Other frontends: IDEs, emacs, DDD, XXGDB
●   Trace the code
    –   See what is doing
    –   Inspect the data



                            Master on Free Software
GDB


●   Requirements to debug an application
    –   Add debugging symbols -> not stripped
    –   Remove optimizations (-O0)




                         Master on Free Software
Ways of working


●   debug a program, start and stop


●   debug a running process


●   debug a core file (cores activate)


                      Master on Free Software
Core dumps
●   Dump of information of a process when it
    crashes
    –   See while it crashed
    –   Inspect data
●   ulimit -c <size of core>
●   ./gdb <program> <core>



                          Master on Free Software
Commands
●   Run: runs the program from start
●   Continue: continues running a stopped program
●   Backtrace: show the stack
●   Break: add a breakpoint
●   Delete: delete a breakpoint
●   Next: runs the current line to next
●   Step: same as Next, but if current is a function, enter
    inside
●   Print: print the content of a variable
●   Display: same as Print, but more permanent
                              Master on Free Software
Other commands
●   Watchpoints (slow)
●   Handle signals
●   Remote debug
●   Use the refcard:
        http://www.cs.dal.ca/studentservices/refcards/gdbref.pdf




                             Master on Free Software
References


●   refcard:
    www.cs.dal.ca/studentservices/refcards/gdbref.pdf
●   http://www.gnu.org/software/gdb/gdb.html




                          Master on Free Software
Acknowledgments


●   Alejandro García Castro




                     Master on Free Software

Mais conteúdo relacionado

Semelhante a MSL2009. Gdb

gdb-tutorial.pdf
gdb-tutorial.pdfgdb-tutorial.pdf
gdb-tutorial.pdf
ligi14
 
Gdb tutorial-handout
Gdb tutorial-handoutGdb tutorial-handout
Gdb tutorial-handout
Suraj Kumar
 

Semelhante a MSL2009. Gdb (20)

Debugging Modern C++ Application with Gdb
Debugging Modern C++ Application with GdbDebugging Modern C++ Application with Gdb
Debugging Modern C++ Application with Gdb
 
gdb-tutorial.pdf
gdb-tutorial.pdfgdb-tutorial.pdf
gdb-tutorial.pdf
 
Debuging like a pro
Debuging like a proDebuging like a pro
Debuging like a pro
 
Extending GDB with Python
Extending GDB with PythonExtending GDB with Python
Extending GDB with Python
 
GNU Debugger
GNU DebuggerGNU Debugger
GNU Debugger
 
Gnu debugger
Gnu debuggerGnu debugger
Gnu debugger
 
Introduction of Tools for providing rich user experience in debugger
Introduction of Tools for providing rich user experience in debuggerIntroduction of Tools for providing rich user experience in debugger
Introduction of Tools for providing rich user experience in debugger
 
LCU14 201- Binary Analysis Tools
LCU14 201- Binary Analysis ToolsLCU14 201- Binary Analysis Tools
LCU14 201- Binary Analysis Tools
 
Writing mruby Debugger
Writing mruby DebuggerWriting mruby Debugger
Writing mruby Debugger
 
Gdb tutorial-handout
Gdb tutorial-handoutGdb tutorial-handout
Gdb tutorial-handout
 
Gccgdb
GccgdbGccgdb
Gccgdb
 
Drupal and contribution (2010 - 2011 / 2)
Drupal and contribution (2010 - 2011 / 2)Drupal and contribution (2010 - 2011 / 2)
Drupal and contribution (2010 - 2011 / 2)
 
Android app to the challenge
Android   app to the challengeAndroid   app to the challenge
Android app to the challenge
 
Debugging With the GNU Debugger
Debugging With the GNU DebuggerDebugging With the GNU Debugger
Debugging With the GNU Debugger
 
Introduction to segmentation fault handling
Introduction to segmentation fault handling Introduction to segmentation fault handling
Introduction to segmentation fault handling
 
Debug JNI code with ndk-gdb and eclipse GUI
Debug JNI code with ndk-gdb and eclipse GUIDebug JNI code with ndk-gdb and eclipse GUI
Debug JNI code with ndk-gdb and eclipse GUI
 
Advanced Debugging with GDB
Advanced Debugging with GDBAdvanced Debugging with GDB
Advanced Debugging with GDB
 
Continuous Deployment Applied at MyHeritage
Continuous Deployment Applied at MyHeritageContinuous Deployment Applied at MyHeritage
Continuous Deployment Applied at MyHeritage
 
lab1-ppt.pdf
lab1-ppt.pdflab1-ppt.pdf
lab1-ppt.pdf
 
Debugging of (C)Python applications
Debugging of (C)Python applicationsDebugging of (C)Python applications
Debugging of (C)Python applications
 

Mais de Juan A. Suárez Romero

Mais de Juan A. Suárez Romero (15)

Graphics stack updates for Raspberry Pi devices (FOSDEM 2024)
Graphics stack updates for Raspberry Pi devices (FOSDEM 2024)Graphics stack updates for Raspberry Pi devices (FOSDEM 2024)
Graphics stack updates for Raspberry Pi devices (FOSDEM 2024)
 
On-going challenges in the Raspberry Pi driver stack: OpenGL 3, Vulkan and mo...
On-going challenges in the Raspberry Pi driver stack: OpenGL 3, Vulkan and mo...On-going challenges in the Raspberry Pi driver stack: OpenGL 3, Vulkan and mo...
On-going challenges in the Raspberry Pi driver stack: OpenGL 3, Vulkan and mo...
 
Writing multimedia applications with Grilo
Writing multimedia applications with GriloWriting multimedia applications with Grilo
Writing multimedia applications with Grilo
 
Grilo: Easy Access to Online Multimedia Content
Grilo: Easy Access to Online Multimedia ContentGrilo: Easy Access to Online Multimedia Content
Grilo: Easy Access to Online Multimedia Content
 
Grilo: present and future
Grilo: present and futureGrilo: present and future
Grilo: present and future
 
Rygel-Grilo
Rygel-GriloRygel-Grilo
Rygel-Grilo
 
MSL2009. Valgrind
MSL2009. ValgrindMSL2009. Valgrind
MSL2009. Valgrind
 
Logical Volume Manager. An Introduction
Logical Volume Manager. An IntroductionLogical Volume Manager. An Introduction
Logical Volume Manager. An Introduction
 
Una Arquitectura Multiagente Inteligente para la Detección de Intrusos
Una Arquitectura Multiagente Inteligente para la Detección de IntrusosUna Arquitectura Multiagente Inteligente para la Detección de Intrusos
Una Arquitectura Multiagente Inteligente para la Detección de Intrusos
 
An add-on for managing behaviours with priority in JADE
An add-on for managing behaviours with priority in JADEAn add-on for managing behaviours with priority in JADE
An add-on for managing behaviours with priority in JADE
 
Integrating a Priority-Based Scheduler of Behaviours in JADE
Integrating a Priority-Based Scheduler of Behaviours in JADEIntegrating a Priority-Based Scheduler of Behaviours in JADE
Integrating a Priority-Based Scheduler of Behaviours in JADE
 
A New Learning Method for Single Layer Neural Networks Based on a Regularized...
A New Learning Method for Single Layer Neural Networks Based on a Regularized...A New Learning Method for Single Layer Neural Networks Based on a Regularized...
A New Learning Method for Single Layer Neural Networks Based on a Regularized...
 
A Tool for Agent Communication in Mozart/Oz
A Tool for Agent Communication in Mozart/OzA Tool for Agent Communication in Mozart/Oz
A Tool for Agent Communication in Mozart/Oz
 
A Multi-Agent Architecture for Intrusion Detection
A Multi-Agent Architecture for Intrusion DetectionA Multi-Agent Architecture for Intrusion Detection
A Multi-Agent Architecture for Intrusion Detection
 
The KNITTER System: KQML for Erlang
The KNITTER System: KQML for ErlangThe KNITTER System: KQML for Erlang
The KNITTER System: KQML for Erlang
 

Último

Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
fonyou31
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
SoniaTolstoy
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
heathfieldcps1
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Krashi Coaching
 

Último (20)

SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
General AI for Medical Educators April 2024
General AI for Medical Educators April 2024General AI for Medical Educators April 2024
General AI for Medical Educators April 2024
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 

MSL2009. Gdb

  • 1. Gdb Juan A. Suárez Romero Master on Free Software
  • 2. List of topics ● Bugs ● Fixing bugs ● GDB ● Ways of working ● Coredumps ● Main basic commands Master on Free Software
  • 3. What is a bug? ● Basically, an error in a program ● When a program performs as it shouldn't perform ● All software have bugs – Programming is complex – Human task -> errors Master on Free Software
  • 4. Fixing bugs ● Have you ever debugged a program? ● Have you ever debugged a C program? ● A debugger allows you to check how a program is executed or checking what was doing when it crashed ● In gnome we use gdb for debugging Master on Free Software
  • 5. GDB ● GNU Debugger ● Text mode – Other frontends: IDEs, emacs, DDD, XXGDB ● Trace the code – See what is doing – Inspect the data Master on Free Software
  • 6. GDB ● Requirements to debug an application – Add debugging symbols -> not stripped – Remove optimizations (-O0) Master on Free Software
  • 7. Ways of working ● debug a program, start and stop ● debug a running process ● debug a core file (cores activate) Master on Free Software
  • 8. Core dumps ● Dump of information of a process when it crashes – See while it crashed – Inspect data ● ulimit -c <size of core> ● ./gdb <program> <core> Master on Free Software
  • 9. Commands ● Run: runs the program from start ● Continue: continues running a stopped program ● Backtrace: show the stack ● Break: add a breakpoint ● Delete: delete a breakpoint ● Next: runs the current line to next ● Step: same as Next, but if current is a function, enter inside ● Print: print the content of a variable ● Display: same as Print, but more permanent Master on Free Software
  • 10. Other commands ● Watchpoints (slow) ● Handle signals ● Remote debug ● Use the refcard: http://www.cs.dal.ca/studentservices/refcards/gdbref.pdf Master on Free Software
  • 11. References ● refcard: www.cs.dal.ca/studentservices/refcards/gdbref.pdf ● http://www.gnu.org/software/gdb/gdb.html Master on Free Software
  • 12. Acknowledgments ● Alejandro García Castro Master on Free Software