+612 9045 4394
The Art Of Debugging With Gdb, Ddd, And Eclipse : NO STARCH PRESS - Norman Matloff

The Art Of Debugging With Gdb, Ddd, And Eclipse


Paperback Published: 28th September 2008
ISBN: 9781593271749
Number Of Pages: 264

Share This Book:


RRP $120.99
or 4 easy payments of $23.44 with Learn more
Ships in 7 to 10 business days

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 GDB (the GNU Project Debugger) is included with most distributions. DDD is a popular GUI front end for GDB, while Eclipse provides a complete integrated development environment.

In addition to offering specific advice for debugging with each tool, authors Norm Matloff and Pete Salzman cover general strategies for improving the process of finding and fixing coding errors, including how to:

  • Inspect variables and data structures
  • Understand segmentation faults and core dumps
  • Know why your program crashes or throws exceptions
  • Use features like catchpoints, convenience variables, and artificial arrays
  • Avoid common debugging pitfalls

Real world examples of coding errors help to clarify the authors' guiding principles, and coverage of complex topics like thread, client-server, GUI, and parallel programming debugging will make you even more proficient. You'll also learn how to prevent errors in the first place with text editors, compilers, error reporting, and static code checkers.

Whether you dread the thought of debugging your programs or simply want to improve your current debugging efforts, you'll find a valuable ally in The Art of Debugging.

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.

ISBN: 9781593271749
ISBN-10: 1593271743
Audience: Professional
Format: Paperback
Language: English
Number Of Pages: 264
Published: 28th September 2008
Country of Publication: US
Dimensions (cm): 23.32 x 17.93  x 2.26
Weight (kg): 0.54