The Art of Debugging with GDB, DDD, and Eclipse

  • ISBN13:


  • ISBN10:


  • Format: Paperback
  • Copyright: 2008-09-15
  • Publisher: No Starch Pr

Note: Supplemental materials are not guaranteed with Rental or Used book purchases.

Purchase Benefits

  • Free Shipping On Orders Over $35!
    Your order must be $35 or more to qualify for free economy shipping. Bulk sales, PO's, Marketplace items, eBooks and apparel do not qualify for this offer.
  • Get Rewarded for Ordering Your Textbooks! Enroll Now
List Price: $39.95 Save up to $3.99
  • Rent Book $35.96
    Add to Cart Free Shipping


Supplemental Materials

What is included with this book?


Debugging is of central importance to successful software development, and yet many beginning programmers are unaware of the techniques they can use to reduce the time they spend finding and fixing programming errors. GDB, a popular open source debugger, allows a programmer to trace program execution line by line, set breakpoints, inspect variables, and look at what the program is doing at any given time. Using an assortment of real world coding errors "from simple typos to major logical blunders The Art of Debugging with GDB and DDD discusses how to manage memory, understand core dumps, and trace programming errors to their root cause. The book covers topics other debugging books omit "such as threaded, server/client, GUI, and parallel programming "as well as how to avoid common debugging pitfalls. Readers also learn about techniques and tools they can use to prevent errors, saving themselves valuable time and effort.

Author Biography

Norman Matloff, a computer science professor at UC Davis, is the author of several popular public-domain software packages and online tutorials.

Table of Contents

Prefacep. xi
Some Preliminaries for Beginners and Prosp. 1
Debugging Tools Used in This Bookp. 1
Programming Language Focusp. 2
The Principles of Debuggingp. 2
The Essence of Debugging: The Principle of Confirmationp. 2
Of What Value Is a Debugging Tool for the Principle of Confirmation?p. 3
Other Debugging Principlesp. 4
Text-Based vs. GUI-Based Debugging Tools, and a Compromise Between Themp. 5
Brief Comparison of Interfacesp. 5
Compromisesp. 12
Main Debugger Operationsp. 14
Stepping Through the Source Codep. 14
Inspecting Variablesp. 15
Issuing an "All Points Bulletin" for Changes to a Variablep. 17
Moving Up and Down the Call Stackp. 17
Online Helpp. 19
Introductory Debugging Sessionp. 19
The GDB Approachp. 22
The Same Session in DDDp. 36
The Session in Eclipsep. 38
Use of Startup Filesp. 43
Stopping to Take a Look Aroundp. 47
Mechanisms for Pausep. 47
Overview of Breakpointsp. 48
Keeping Track of Breakpointsp. 49
Breakpoint Lists in GDBp. 49
Breakpoint Lists in DDDp. 50
Breakpoint Lists in Eclipsep. 51
Setting Breakpointsp. 51
Setting Breakpoints in GDBp. 51
Setting Breakpoints in DDDp. 55
Setting Breakpoints in Eclipsep. 56
Extended GDB Examplep. 56
Persistence of Breakpointsp. 59
Deleting and Disabling Breakpointsp. 60
Deleting Breakpoints in GDBp. 61
Disabling Breakpoints in GDBp. 62
Deleting and Disabling Breakpoints in DDDp. 62
Deleting and Disabling Breakpoints in Eclipsep. 63
"Moving" Breakpoints in DDDp. 64
Undoing/Redoing Breakpoint Actions in DDDp. 66
More on Viewing Breakpoint Attributesp. 67
GDBp. 67
DDDp. 69
Eclipsep. 69
Resuming Executionp. 69
In GDBp. 70
In DDDp. 78
In Eclipsep. 79
Conditional Breakpointsp. 79
GDBp. 80
DDDp. 83
Eclipsep. 84
Breakpoint Command Listsp. 85
Watchpointsp. 89
Setting Watchpointsp. 90
Expressionsp. 93
Inspecting and Setting Variablesp. 95
Our Main Example Codep. 95
Advanced Inspection and Setting of Variablesp. 98
Inspection in GDBp. 98
Inspection in DDDp. 102
Inspection in Eclipsep. 103
Inspecting Dynamic Arraysp. 104
What About C++?p. 109
Monitoring Local Variablesp. 112
Examining Memory Directlyp. 112
Advanced Options for Print and Displayp. 112
Setting Variables from Within GDB/DDD/Eclipsep. 113
GDB's Own Variablesp. 113
Making Use of the Value Historyp. 114
Convenience Variablesp. 114
When a Program Crashesp. 117
Background Material: Memory Managementp. 118
Why Does a Program Crash?p. 118
Program Layout in Memoryp. 118
The Notion of Pagesp. 121
Details on the Role of the Page Tablep. 122
A Slight Memory-Access Bug Might Not Cause a Seg Faultp. 124
Seg Faults and Unix Signalsp. 125
Other Types of Exceptionsp. 128
Core Filesp. 129
How Core Files Are Createdp. 129
Your Shell May Suppress the Creation of a Core Filep. 130
Extended Examplep. 131
First Bugp. 135
Don't Leave GDB During a Debugging Sessionp. 137
Second and Third Bugsp. 137
Fourth Bugp. 139
Fifth and Sixth Bugsp. 141
Debugging in a Multiple-Activities Contextp. 145
Debugging Client/Server Network Programsp. 145
Debugging Threaded Codep. 151
Review of Processes and Threadsp. 151
Basic Examplep. 153
A Variationp. 159
GDB Threads Command Summaryp. 161
Threads Commands in DDDp. 161
Threads Commands in Eclipsep. 161
Debugging Parallel Applicationsp. 163
Message-Passing Systemsp. 164
Shared-Memory Systemsp. 170
Extended Examplep. 171
OpenMP Overviewp. 171
OpenMP Example Programp. 172
Special Topicsp. 185
What If It Doesn't Even Compile or Load?p. 185
Phantom Line Numbers in Syntax Error Messagesp. 185
Missing Librariesp. 190
Debugging GUI Programsp. 194
Debugging Curses Programsp. 194
Other Toolsp. 205
Making Good Use of a Text Editorp. 206
Syntax Highlightingp. 206
Matching Bracketsp. 208
Vim and Makefilesp. 209
Makefiles and Compiler Warningsp. 210
Final Thoughts on a Text Editor as an IDEp. 211
Making Good Use of the Compilerp. 212
Error Reporting in Cp. 213
Using errnop. 213
Better Living with strace and Itracep. 217
Static Code Checkers: Iint and Friendsp. 219
How to Use splintp. 221
Last Wordsp. 221
Debugging Dynamically Allocated Memoryp. 221
Strategies for Detecting DAM Problemsp. 224
Electric Fencep. 225
Debugging DAM Problems with GNU C Library Toolsp. 228
Using GDB/DDD/Eclipse for Other Languagesp. 235
Javap. 236
Direct Use of GDB for Debugging Javap. 238
Using DDD with GDB to Debug Javap. 240
Using DDD as a GUI for JDBp. 241
Debugging Java in Eclipsep. 241
Perlp. 242
Debugging Perl via DDDp. 244
Debugging Perl in Eclipsep. 246
Pythonp. 247
Debugging Python in DDDp. 249
Debugging Python in Eclipsep. 250
Debugging SWIG Codep. 251
Assembly Languagep. 255
Indexp. 259
Table of Contents provided by Ingram. All Rights Reserved.

Rewards Program

Write a Review