L6_gdb_tutorial - was compiled without debugging...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
1 GDB For : COP 3330. Object oriented Programming (Using C++) http://www.compgeom.com/~piyush/teach/3330 Piyush Kumar GDB | Lot of tutorials on google. | Debugging tool, see what happens as your program runs | Needs the –g flag while compiling z This adds additional information (i.e. line numbers) in the binary executable | Execution: z Invoke by typing “gdb <executable name>” z E.g.: gdb a.out Basic Commands | quit z Quits gdb. Note that it is NOT exit… | run z Run the program; it stops at each break point set by break command | x (address) z Examine the CONTENTS of the memory at (address) | print (expression) z Print the value of the expression - can be registers or simple equations | break (function name or *memory address) z Set breakpoints z E.g. : break main z break x.cpp:15 Basic Commands | continue z Resume execution | step (s) z Step to the next line in CODE. z Warning: If you use the step command while control is within a function that
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: was compiled without debugging information, execution proceeds until control reaches a function that does have debugging information. | next (n) z Similar to step z This is similar to step, but function calls that appear within the line of code are executed without stopping. | disas z Show assembly instructions for the current function Basic Commands | where/bt z Shows the current line and stack backtrace. Very useful for segmentation faults. | info registers z Shows the current state of the registers | display &amp;lt;var/register&amp;gt; z display the contents of the register/var. z E.g. : display count z display $eax | More Commands: z http://sources.redhat.com/gdb/onlinedocs/gdb_toc.html | Graphical User interface: ddd | Screen shots/movies : http://undo-software.com/undodb_screens.html...
View Full Document

This note was uploaded on 02/27/2012 for the course CS 251 taught by Professor Staff during the Fall '08 term at Purdue.

Ask a homework question - tutors are online