Published on March 5, 2014
GNU Debugger email@example.com Glen Oakley
What is a debugger?
The Four Things ● ● ● ● Start your program Make your program stop Examine what has happened Change things in your program
Your Things ● ● ● ● ● ● Start your program Break / Watch Checkpoint Next / Step / Continue Backtrace Print
Debugging Flow ● ● ● ● ● ● ● Testing Brute-forcing Identify symptom - what happened? Identify problem - why? Locate problem Blame someone (else) Fix problem Repeat with the new problems
GDB Execution ● Run program in ‘virtual’ environment ● Run until ○ Termination ○ Breakpoint ● Flow control ● State Information
Commands ● Run ○ Execute program with args ○ Redirection ● Backtrace ○ Stack trace of your location in the program ○ Identify where crash happened
Commands ● Break ○ Location at which to halt the program ○ Breaks before execution of statement(s) ● Watch ○ Monitors a variable for changes ○ Requires variable to be in scope ● Clear ○ Remove breakpoints
Commands ● Checkpoint ○ Store the state of the program ○ Programs can be restarted at checkpoints ● Step ○ Step through the program line by line ● Next ○ Execute the next line in the current frame ○ Does not step through sub-functions
Commands ● Print ○ ○ ○ ○ Show the state of memory/variables Works with array and struct/union notation Will assume c-strings when applicable @ can be used on arrays for grouping prints ● Set Var ○ Change memory/variables ● Continue ○ Run until another break/watch point is triggered
Recap ● Debugging process is unavoidable ● GDB provides assistance ○ If I see one more stray printf()... ● Basic flow control commands ○ Allow tracing a stopped program ○ Set breakpoints to stop the program ○ Enable querying/modifying the program state
Thanks! http://glenoakley.com/ @goakley123 firstname.lastname@example.org
Debugging with GDB. This file documents the gnu debugger gdb. This is the Tenth Edition, of Debugging with gdb: ...
GDB; Bildschirmfoto des GNU Debuggers: Basisdaten; Entwickler: GNU-Projekt: Aktuelle Version: 7.11 (24. Februar 2016) Betriebssystem: Unix-Derivate (u. a ...
The GNU Debugger, usually called just GDB and named gdb as an executable file, is the standard debugger for the GNU operating system. However ...
Using the GNU Compiler Collection (GCC) ... 3.9 Options for Debugging Your Program. To tell GCC to emit extra information for use by a debugger, in almost ...
Debugging Under Unix: gdb Tutorial ... to get started with using the gdb debugger. This tutorial assumes you already know how to ... the gnu package ...
Richard M. Stallman, founder of the Free Software movement, is the original author of GDB. Roland Pesch is a professional technical writer. Stan Shebs was ...
Using the GNU Compiler Collection (GCC) ... 3.9 Options for Debugging Your Program or GCC. GCC has various special options that are used for debugging ...
Most flavours of Linux come with the GNU debugger, or gdb to the shell. Gdb lets you see the internal structure of a program, print out variable values ...
The purpose of a debugger such as gdb is to allow you to ... you cannot generate optimized executables containing debugging information. gcc, the gnu C/C ...
Prime testen Bücher