Gdb


Juan A. Suárez Romero



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


              ...
What is a bug?
●   Basically, an error in a program
●    When a program performs as it shouldn't
    perform
●   All softw...
Fixing bugs
●   Have you ever debugged a program?
●   Have you ever debugged a C program?
●   A debugger allows you to che...
GDB
●   GNU Debugger
●   Text mode
    –   Other frontends: IDEs, emacs, DDD, XXGDB
●   Trace the code
    –   See what is...
GDB


●   Requirements to debug an application
    –   Add debugging symbols -> not stripped
    –   Remove optimizations ...
Ways of working


●   debug a program, start and stop


●   debug a running process


●   debug a core file (cores activat...
Core dumps
●   Dump of information of a process when it
    crashes
    –   See while it crashed
    –   Inspect data
●   ...
Commands
●   Run: runs the program from start
●   Continue: continues running a stopped program
●   Backtrace: show the st...
Other commands
●   Watchpoints (slow)
●   Handle signals
●   Remote debug
●   Use the refcard:
        http://www.cs.dal.c...
References


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


●   Alejandro García Castro




                     Master on Free Software
Upcoming SlideShare
Loading in …5
×

MSL2009. Gdb

891 views
827 views

Published on

Presentation about GDB done at Master on Free Software 2009 Edition

Published in: Education
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
891
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
9
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

MSL2009. Gdb

  1. 1. Gdb Juan A. Suárez Romero Master on Free Software
  2. 2. List of topics ● Bugs ● Fixing bugs ● GDB ● Ways of working ● Coredumps ● Main basic commands Master on Free Software
  3. 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. 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. 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. 6. GDB ● Requirements to debug an application – Add debugging symbols -> not stripped – Remove optimizations (-O0) Master on Free Software
  7. 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. 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. 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. 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. 11. References ● refcard: www.cs.dal.ca/studentservices/refcards/gdbref.pdf ● http://www.gnu.org/software/gdb/gdb.html Master on Free Software
  12. 12. Acknowledgments ● Alejandro García Castro Master on Free Software

×