SlideShare ist ein Scribd-Unternehmen logo
1 von 12
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Ähnlich wie MSL2009. Gdb

Debugging Modern C++ Application with Gdb
Debugging Modern C++ Application with GdbDebugging Modern C++ Application with Gdb
Debugging Modern C++ Application with GdbSenthilKumar Selvaraj
 
gdb-tutorial.pdf
gdb-tutorial.pdfgdb-tutorial.pdf
gdb-tutorial.pdfligi14
 
Extending GDB with Python
Extending GDB with PythonExtending GDB with Python
Extending GDB with PythonLisa Roach
 
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 debuggerNaoto Ono
 
LCU14 201- Binary Analysis Tools
LCU14 201- Binary Analysis ToolsLCU14 201- Binary Analysis Tools
LCU14 201- Binary Analysis ToolsLinaro
 
Writing mruby Debugger
Writing mruby DebuggerWriting mruby Debugger
Writing mruby Debuggeryamanekko
 
Gdb tutorial-handout
Gdb tutorial-handoutGdb tutorial-handout
Gdb tutorial-handoutSuraj Kumar
 
Drupal and contribution (2010 - 2011 / 2)
Drupal and contribution (2010 - 2011 / 2)Drupal and contribution (2010 - 2011 / 2)
Drupal and contribution (2010 - 2011 / 2)Peter Arato
 
Android app to the challenge
Android   app to the challengeAndroid   app to the challenge
Android app to the challengeUdi Cohen
 
Debugging With the GNU Debugger
Debugging With the GNU DebuggerDebugging With the GNU Debugger
Debugging With the GNU Debuggergoakley123
 
Introduction to segmentation fault handling
Introduction to segmentation fault handling Introduction to segmentation fault handling
Introduction to segmentation fault handling Larion
 
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 GUITom Chen
 
Advanced Debugging with GDB
Advanced Debugging with GDBAdvanced Debugging with GDB
Advanced Debugging with GDBDavid Khosid
 
Continuous Deployment Applied at MyHeritage
Continuous Deployment Applied at MyHeritageContinuous Deployment Applied at MyHeritage
Continuous Deployment Applied at MyHeritageRan Levy
 
Debugging of (C)Python applications
Debugging of (C)Python applicationsDebugging of (C)Python applications
Debugging of (C)Python applicationsRoman Podoliaka
 

Ähnlich wie 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
 

Mehr von Juan A. Suárez Romero

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)Juan A. Suárez Romero
 
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...Juan A. Suárez Romero
 
Writing multimedia applications with Grilo
Writing multimedia applications with GriloWriting multimedia applications with Grilo
Writing multimedia applications with GriloJuan A. Suárez Romero
 
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 ContentJuan A. Suárez Romero
 
Logical Volume Manager. An Introduction
Logical Volume Manager. An IntroductionLogical Volume Manager. An Introduction
Logical Volume Manager. An IntroductionJuan A. Suárez Romero
 
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 IntrusosJuan A. Suárez Romero
 
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 JADEJuan A. Suárez Romero
 
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 JADEJuan A. Suárez Romero
 
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...Juan A. Suárez Romero
 
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/OzJuan A. Suárez Romero
 
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 DetectionJuan A. Suárez Romero
 

Mehr von 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
 

Kürzlich hochgeladen

Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinojohnmickonozaleda
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSJoshuaGantuangco2
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxCarlos105
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxAshokKarra1
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17Celine George
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxPoojaSen20
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...JhezDiaz1
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxMaryGraceBautista27
 

Kürzlich hochgeladen (20)

Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
FILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipinoFILIPINO PSYCHology sikolohiyang pilipino
FILIPINO PSYCHology sikolohiyang pilipino
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTSGRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
GRADE 4 - SUMMATIVE TEST QUARTER 4 ALL SUBJECTS
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptxBarangay Council for the Protection of Children (BCPC) Orientation.pptx
Barangay Council for the Protection of Children (BCPC) Orientation.pptx
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Karra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptxKarra SKD Conference Presentation Revised.pptx
Karra SKD Conference Presentation Revised.pptx
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17How to Add Barcode on PDF Report in Odoo 17
How to Add Barcode on PDF Report in Odoo 17
 
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptxCulture Uniformity or Diversity IN SOCIOLOGY.pptx
Culture Uniformity or Diversity IN SOCIOLOGY.pptx
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
ENGLISH 7_Q4_LESSON 2_ Employing a Variety of Strategies for Effective Interp...
 
Science 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptxScience 7 Quarter 4 Module 2: Natural Resources.pptx
Science 7 Quarter 4 Module 2: Natural Resources.pptx
 

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