Debugging with DDD
Total Page:16
File Type:pdf, Size:1020Kb
Debugging with DDD User’s Guide and Reference Manual First Edition, for DDD Version 3.3.9 Last updated 15 January, 2004 Andreas Zeller Debugging with DDD User’s Guide and Reference Manual Copyright c 2004 Universität des Saarlandes Lehrstuhl Softwaretechnik Postfach 15 11 50 66041 Saarbrücken GERMANY Distributed by Free Software Foundation, Inc. 59 Temple Place – Suite 330 Boston, MA 02111-1307 USA ddd and this manual are available via the ddd www page. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foun- dation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License”; See Appendix I [Documentation License], page 197, for details. Send questions, comments, suggestions, etc. to [email protected]. Send bug reports to [email protected]. i Short Contents Summary of DDD .............................................. 1 1 A Sample DDD Session ....................................... 5 2 Getting In and Out of DDD .................................... 15 3 The DDD Windows ......................................... 41 4 Navigating through the Code ................................... 73 5 Stopping the Program........................................ 81 6 Running the Program ........................................ 91 7 Examining Data .......................................... 105 8 Machine-Level Debugging ................................... 141 9 Changing the Program ...................................... 145 10 The Command-Line Interface ................................. 147 Appendix A Application Defaults ................................. 159 Appendix B Bugs and How To Report Them ......................... 169 Appendix C Configuration Notes ................................. 175 Appendix D Dirty Tricks ....................................... 181 Appendix E Extending DDD .................................... 183 Appendix F Frequently Answered Questions ......................... 185 Appendix G GNU General Public License ........................... 187 Appendix H Help and Assistance ................................. 195 Appendix I GNU Free Documentation License ....................... 197 Label Index ................................................. 203 Key Index .................................................. 207 Command Index .............................................. 209 Resource Index .............................................. 211 File Index .................................................. 215 Concept Index ............................................... 217 ii Debugging with DDD iii Table of Contents Summary of DDD ........................................... 1 About this Manual ................................................... 2 Typographic conventions ............................................. 2 Free software ........................................................ 3 Getting DDD ........................................................ 3 Contributors to DDD................................................. 3 History of DDD ..................................................... 4 1 A Sample DDD Session ................................... 5 1.1 Sample Program .............................................. 14 2 Getting In and Out of DDD ............................... 15 2.1 Invoking DDD ................................................ 15 2.1.1 Choosing an Inferior Debugger....................... 15 2.1.2 DDD Options ....................................... 16 2.1.3 X Options ........................................... 24 2.1.4 Inferior Debugger Options ........................... 24 2.1.4.1 GDB Options .............................. 24 2.1.4.2 DBX and Ladebug Options ................. 25 2.1.4.3 XDB Options .............................. 25 2.1.4.4 JDB Options............................... 25 2.1.4.5 PYDB Options ............................ 27 2.1.4.6 Perl Options ............................... 27 2.1.4.7 Bash Options .............................. 27 2.1.5 Multiple DDD Instances ............................. 28 2.1.6 X warnings.......................................... 28 2.2 Quitting DDD................................................. 28 2.3 Persistent Sessions ............................................ 29 2.3.1 Saving Sessions ..................................... 29 2.3.2 Resuming Sessions .................................. 30 2.3.3 Deleting Sessions.................................... 31 2.3.4 Customizing Sessions................................ 32 2.4 Remote Debugging ............................................ 32 2.4.1 Running DDD on a Remote Host ..................... 32 2.4.2 Using DDD with a Remote Inferior Debugger......... 32 2.4.2.1 Customizing Remote Debugging ........... 33 2.4.3 Debugging a Remote Program........................ 34 2.5 Customizing Interaction with the Inferior Debugger ............. 34 2.5.1 Invoking an Inferior Debugger ....................... 34 2.5.2 Initializing the Inferior Debugger..................... 35 2.5.2.1 GDB Initialization ......................... 35 2.5.2.2 DBX Initialization ......................... 36 iv Debugging with DDD 2.5.2.3 XDB Initialization ......................... 36 2.5.2.4 JDB Initialization .......................... 36 2.5.2.5 PYDB Initialization ........................ 37 2.5.2.6 Perl Initialization .......................... 37 2.5.2.7 Bash Initialization ......................... 37 2.5.2.8 Finding a Place to Start .................... 37 2.5.2.9 Opening the Selection...................... 38 2.5.3 Communication with the Inferior Debugger ........... 38 3 The DDD Windows...................................... 41 3.1 The Menu Bar ................................................ 41 3.1.1 The File Menu ...................................... 42 3.1.2 The Edit Menu ...................................... 43 3.1.3 The View Menu ..................................... 44 3.1.4 The Program Menu .................................. 45 3.1.5 The Commands Menu ............................... 46 3.1.6 The Status Menu .................................... 47 3.1.7 The Source Menu.................................... 47 3.1.8 The Data Menu...................................... 48 3.1.9 The Maintenance Menu .............................. 49 3.1.10 The Help Menu .................................... 50 3.1.11 Customizing the Menu Bar ......................... 50 3.1.11.1 Auto-Raise Menus ........................ 51 3.1.11.2 Customizing the Edit Menu ............... 51 3.2 The Tool Bar.................................................. 52 3.2.1 Customizing the Tool Bar ............................ 54 3.3 The Command Tool ........................................... 55 3.3.1 Customizing the Command Tool ..................... 57 3.3.1.1 Disabling the Command Tool............... 57 3.3.2 Command Tool Position ............................. 58 3.3.2.1 Customizing Tool Decoration............... 59 3.4 Getting Help .................................................. 59 3.5 Undoing and Redoing Commands.............................. 60 3.6 Customizing DDD ............................................ 60 3.6.1 How Customizing DDD Works....................... 60 3.6.1.1 Resources ................................. 60 3.6.1.2 Changing Resources ....................... 61 3.6.1.3 Saving Options ............................ 61 3.6.2 Customizing DDD Help ............................. 61 3.6.2.1 Button Tips................................ 61 3.6.2.2 Tip of the day.............................. 62 3.6.2.3 Help Helpers .............................. 63 3.6.3 Customizing Undo................................... 64 3.6.4 Customizing the DDD Windows ..................... 64 3.6.4.1 Splash Screen ............................. 64 3.6.4.2 Window Layout............................ 65 3.6.4.3 Customizing Fonts ......................... 67 3.6.4.4 Toggling Windows ......................... 70 v 3.6.4.5 Text Fields ................................ 70 3.6.4.6 Icons ...................................... 70 3.6.4.7 Adding Buttons ............................ 71 3.6.4.8 More Customizations ...................... 71 3.6.5 Debugger Settings ................................... 71 4 Navigating through the Code ............................. 73 4.1 Compiling for Debugging...................................... 73 4.2 Opening Files ................................................. 73 4.2.1 Opening Programs................................... 73 4.2.2 Opening Core Dumps................................ 74 4.2.3 Opening Source Files ................................ 74 4.2.4 Filtering Files ....................................... 75 4.3 Looking up Items ............................................. 75 4.3.1 Looking up Definitions .............................. 75 4.3.2 Textual Search ...................................... 76 4.3.3 Looking up Previous Locations....................... 76 4.3.4 Specifying Source Directories ........................ 76 4.4 Customizing the Source Window............................... 77 4.4.1 Customizing Glyphs ................................. 78 4.4.2 Customizing Searching .............................. 79 4.4.3 Customizing Source Appearance ..................... 79 4.4.4 Customizing Source Scrolling ........................ 80 4.4.5 Customizing Source Lookup ......................... 80 4.4.6 Customizing File Filtering ..........................