The Art of DeBugging with GDB, DDD, and Eclipse

Paperback
from $0.00

Author: Norman Matloff

ISBN-10: 1593271743

ISBN-13: 9781593271749

Category: Quality Control & Testing - Programming

Debugging is crucial to successful software development, but even many experienced programmers find it challenging. Sophisticated debugging tools are available, yet it may be difficult to determine which features are useful in which situations. The Art of Debugging is your guide to making the debugging process more efficient and effective.\ The Art of Debugging illustrates the use three of the most popular debugging tools on Linux/Unix platforms: GDB, DDD, and Eclipse. The text-command based...

Search in google:

This book is an authoritative guide to the art of debugging, covering two of the most popular debuggers—GDB and DDD—and discussing other tools that help prevent, catch, and fix bugs in programs.

Preface xi1 Some Preliminaries for Beginners and Pros 11.1 Debugging Tools Used in This Book 11.2 Programming Language Focus 21.3 The Principles of Debugging 21.3.1 The Essence of Debugging: The Principle of Confirmation 21.3.2 Of What Value Is a Debugging Tool for the Principle of Confirmation? 31.3.3 Other Debugging Principles 41.4 Text-Based vs. GUI-Based Debugging Tools, and a Compromise Between Them 51.4.1 Brief Comparison of Interfaces 51.4.2 Compromises 121.5 Main Debugger Operations 141.5.1 Stepping Through the Source Code 141.5.2 Inspecting Variables 151.5.3 Issuing an "All Points Bulletin" for Changes to a Variable 171.5.4 Moving Up and Down the Call Stack 171.6 Online Help 191.7 Introductory Debugging Session 191.7.1 The GDB Approach 221.7.2 The Same Session in DDD 361.7.3 The Session in Eclipse 381.8 Use of Startup Files 432 Stopping to Take a Look Around 472.1 Mechanisms for Pause 472.2 Overview of Breakpoints 482.3 Keeping Track of Breakpoints 492.3.1 Breakpoint Lists in GDB 492.3.2 Breakpoint Lists in DDD 502.3.3 Breakpoint Lists in Eclipse 512.4 Setting Breakpoints 512.4.1 Setting Breakpoints in GDB 512.4.2 Setting Breakpoints in DDD 552.4.3 Setting Breakpoints in Eclipse 562.5 Extended GDB Example 562.6 Persistence of Breakpoints 592.7 Deleting and Disabling Breakpoints 602.7.1 Deleting Breakpoints in GDB 612.7.2 Disabling Breakpoints in GDB 622.7.3 Deleting and Disabling Breakpoints in DDD 622.7.4 Deleting and Disabling Breakpoints in Eclipse 632.7.5 "Moving" Breakpoints in DDD 642.7.6 Undoing/RedoingBreakpoint Actions in DDD 662.8 More on Viewing Breakpoint Attributes 672.8.1 GDB 672.8.2 DDD 692.8.3 Eclipse 692.9 Resuming Execution 692.9.1 In GDB 702.9.2 In DDD 782.9.3 In Eclipse 792.10 Conditional Breakpoints 792.10.1 GDB 802.10.2 DDD 832.10.3 Eclipse 842.11 Breakpoint Command Lists 852.12 Watchpoints 892.12.1 Setting Watchpoints 902.12.2 Expressions 933 Inspecting and Setting Variables 953.1 Our Main Example Code 953.2 Advanced Inspection and Setting of Variables 983.2.1 Inspection in GDB 983.2.2 Inspection in DDD 1023.2.3 Inspection in Eclipse 1033.2.4 Inspecting Dynamic Arrays 1043.2.5 What About C++? 1093.2.6 Monitoring Local Variables 1123.2.7 Examining Memory Directly 1123.2.8 Advanced Options for Print and Display 1123.3 Setting Variables from Within GDB/DDD/Eclipse 1133.4 GDB's Own Variables 1133.4.1 Making Use of the Value History 1143.4.2 Convenience Variables 1144 When a Program Crashes 1174.1 Background Material: Memory Management 1184.1.1 Why Does a Program Crash? 1184.1.2 Program Layout in Memory 1184.1.3 The Notion of Pages 1214.1.4 Details on the Role of the Page Table 1224.1.5 A Slight Memory-Access Bug Might Not Cause a Seg Fault 1244.1.6 Seg Faults and Unix Signals 1254.1.7 Other Types of Exceptions 1284.2 Core Files 1294.2.1 How Core Files Are Created 1294.2.2 Your Shell May Suppress the Creation of a Core File 1304.3 Extended Example 1314.3.1 First Bug 1354.3.2 Don't Leave GDB During a Debugging Session 1374.3.3 Second and Third Bugs 1374.3.4 Fourth Bug 1394.3.5 Fifth and Sixth Bugs 1415 Debugging in a Multiple-Activities Context 1455.1 Debugging Client/Server Network Programs 1455.2 Debugging Threaded Code 1515.2.1 Review of Processes and Threads 1515.2.2 Basic Example 1535.2.3 A Variation 1595.2.4 GDB Threads Command Summary 1615.2.5 Threads Commands in DDD 1615.2.6 Threads Commands in Eclipse 1615.3 Debugging Parallel Applications 1635.3.1 Message-Passing Systems 1645.3.2 Shared-Memory Systems 1705.4 Extended Example 1715.4.1 OpenMP Overview 1715.4.2 OpenMP Example Program 1726 Special Topics 1856.1 What If It Doesn't Even Compile or Load? 1856.1.1 Phantom Line Numbers in Syntax Error Messages 1856.1.2 Missing Libraries 1906.2 Debugging GUI Programs 1946.2.1 Debugging Curses Programs 1947 Other Tools 2057.1 Making Good Use of a Text Editor 2067.1.1 Syntax Highlighting 2067.1.2 Matching Brackets 2087.1.3 Vim and Makefiles 2097.1.4 Makefiles and Compiler Warnings 2107.1.5 Final Thoughts on a Text Editor as an IDE 2117.2 Making Good Use of the Compiler 2127.3 Error Reporting in C 2137.3.1 Using errno 2137.4 Better Living with strace and Itrace 2177.5 Static Code Checkers: Iint and Friends 2197.5.1 How to Use splint 2217.5.2 Last Words 2217.6 Debugging Dynamically Allocated Memory 2217.6.1 Strategies for Detecting DAM Problems 2247.6.2 Electric Fence 2257.6.3 Debugging DAM Problems with GNU C Library Tools 2288 Using GDB/DDD/Eclipse for Other Languages 2358.1 Java 2368.1.1 Direct Use of GDB for Debugging Java 2388.1.2 Using DDD with GDB to Debug Java 2408.1.3 Using DDD as a GUI for JDB 2418.1.4 Debugging Java in Eclipse 2418.2 Perl 2428.2.1 Debugging Perl via DDD 2448.2.2 Debugging Perl in Eclipse 2468.3 Python 2478.3.1 Debugging Python in DDD 2498.3.2 Debugging Python in Eclipse 2508.4 Debugging SWIG Code 2518.5 Assembly Language 255 Index 259