More New and Used
from Private Sellers
The Art of Debugging with GDB, DDD, and Eclipse
by Matloff, NormanISBN13:
9781593271749
ISBN10:
1593271743
Format:
Paperback
Pub. Date:
9/15/2008
Publisher(s):
Oreilly & Associates Inc
List Price: $39.95
Buy New Textbook
In Stock Usually Ships in 24-48 Hours
$38.95
Rent Textbook
We're Sorry
Sold Out
Used Textbook
We're Sorry
Sold Out
eTextbook
We're Sorry
Not Available
Questions About This Book?
What version or edition is this?
This is the edition with a publication date of 9/15/2008.
What is included with this book?
- The New copy of this book will include any supplemental materials advertised. Please check the title of the book to determine if it should include any CDs, lab manuals, study guides, etc.
Summary
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
| Preface | p. xi |
| Some Preliminaries for Beginners and Pros | p. 1 |
| Debugging Tools Used in This Book | p. 1 |
| Programming Language Focus | p. 2 |
| The Principles of Debugging | p. 2 |
| The Essence of Debugging: The Principle of Confirmation | p. 2 |
| Of What Value Is a Debugging Tool for the Principle of Confirmation? | p. 3 |
| Other Debugging Principles | p. 4 |
| Text-Based vs. GUI-Based Debugging Tools, and a Compromise Between Them | p. 5 |
| Brief Comparison of Interfaces | p. 5 |
| Compromises | p. 12 |
| Main Debugger Operations | p. 14 |
| Stepping Through the Source Code | p. 14 |
| Inspecting Variables | p. 15 |
| Issuing an "All Points Bulletin" for Changes to a Variable | p. 17 |
| Moving Up and Down the Call Stack | p. 17 |
| Online Help | p. 19 |
| Introductory Debugging Session | p. 19 |
| The GDB Approach | p. 22 |
| The Same Session in DDD | p. 36 |
| The Session in Eclipse | p. 38 |
| Use of Startup Files | p. 43 |
| Stopping to Take a Look Around | p. 47 |
| Mechanisms for Pause | p. 47 |
| Overview of Breakpoints | p. 48 |
| Keeping Track of Breakpoints | p. 49 |
| Breakpoint Lists in GDB | p. 49 |
| Breakpoint Lists in DDD | p. 50 |
| Breakpoint Lists in Eclipse | p. 51 |
| Setting Breakpoints | p. 51 |
| Setting Breakpoints in GDB | p. 51 |
| Setting Breakpoints in DDD | p. 55 |
| Setting Breakpoints in Eclipse | p. 56 |
| Extended GDB Example | p. 56 |
| Persistence of Breakpoints | p. 59 |
| Deleting and Disabling Breakpoints | p. 60 |
| Deleting Breakpoints in GDB | p. 61 |
| Disabling Breakpoints in GDB | p. 62 |
| Deleting and Disabling Breakpoints in DDD | p. 62 |
| Deleting and Disabling Breakpoints in Eclipse | p. 63 |
| "Moving" Breakpoints in DDD | p. 64 |
| Undoing/Redoing Breakpoint Actions in DDD | p. 66 |
| More on Viewing Breakpoint Attributes | p. 67 |
| GDB | p. 67 |
| DDD | p. 69 |
| Eclipse | p. 69 |
| Resuming Execution | p. 69 |
| In GDB | p. 70 |
| In DDD | p. 78 |
| In Eclipse | p. 79 |
| Conditional Breakpoints | p. 79 |
| GDB | p. 80 |
| DDD | p. 83 |
| Eclipse | p. 84 |
| Breakpoint Command Lists | p. 85 |
| Watchpoints | p. 89 |
| Setting Watchpoints | p. 90 |
| Expressions | p. 93 |
| Inspecting and Setting Variables | p. 95 |
| Our Main Example Code | p. 95 |
| Advanced Inspection and Setting of Variables | p. 98 |
| Inspection in GDB | p. 98 |
| Inspection in DDD | p. 102 |
| Inspection in Eclipse | p. 103 |
| Inspecting Dynamic Arrays | p. 104 |
| What About C++? | p. 109 |
| Monitoring Local Variables | p. 112 |
| Examining Memory Directly | p. 112 |
| Advanced Options for Print and Display | p. 112 |
| Setting Variables from Within GDB/DDD/Eclipse | p. 113 |
| GDB's Own Variables | p. 113 |
| Making Use of the Value History | p. 114 |
| Convenience Variables | p. 114 |
| When a Program Crashes | p. 117 |
| Background Material: Memory Management | p. 118 |
| Why Does a Program Crash? | p. 118 |
| Program Layout in Memory | p. 118 |
| The Notion of Pages | p. 121 |
| Details on the Role of the Page Table | p. 122 |
| A Slight Memory-Access Bug Might Not Cause a Seg Fault | p. 124 |
| Seg Faults and Unix Signals | p. 125 |
| Other Types of Exceptions | p. 128 |
| Core Files | p. 129 |
| How Core Files Are Created | p. 129 |
| Your Shell May Suppress the Creation of a Core File | p. 130 |
| Extended Example | p. 131 |
| First Bug | p. 135 |
| Don't Leave GDB During a Debugging Session | p. 137 |
| Second and Third Bugs | p. 137 |
| Fourth Bug | p. 139 |
| Fifth and Sixth Bugs | p. 141 |
| Debugging in a Multiple-Activities Context | p. 145 |
| Debugging Client/Server Network Programs | p. 145 |
| Debugging Threaded Code | p. 151 |
| Review of Processes and Threads | p. 151 |
| Basic Example | p. 153 |
| A Variation | p. 159 |
| GDB Threads Command Summary | p. 161 |
| Threads Commands in DDD | p. 161 |
| Threads Commands in Eclipse | p. 161 |
| Debugging Parallel Applications | p. 163 |
| Message-Passing Systems | p. 164 |
| Shared-Memory Systems | p. 170 |
| Extended Example | p. 171 |
| OpenMP Overview | p. 171 |
| OpenMP Example Program | p. 172 |
| Special Topics | p. 185 |
| What If It Doesn't Even Compile or Load? | p. 185 |
| Phantom Line Numbers in Syntax Error Messages | p. 185 |
| Missing Libraries | p. 190 |
| Debugging GUI Programs | p. 194 |
| Debugging Curses Programs | p. 194 |
| Other Tools | p. 205 |
| Making Good Use of a Text Editor | p. 206 |
| Syntax Highlighting | p. 206 |
| Matching Brackets | p. 208 |
| Vim and Makefiles | p. 209 |
| Makefiles and Compiler Warnings | p. 210 |
| Final Thoughts on a Text Editor as an IDE | p. 211 |
| Making Good Use of the Compiler | p. 212 |
| Error Reporting in C | p. 213 |
| Using errno | p. 213 |
| Better Living with strace and Itrace | p. 217 |
| Static Code Checkers: Iint and Friends | p. 219 |
| How to Use splint | p. 221 |
| Last Words | p. 221 |
| Debugging Dynamically Allocated Memory | p. 221 |
| Strategies for Detecting DAM Problems | p. 224 |
| Electric Fence | p. 225 |
| Debugging DAM Problems with GNU C Library Tools | p. 228 |
| Using GDB/DDD/Eclipse for Other Languages | p. 235 |
| Java | p. 236 |
| Direct Use of GDB for Debugging Java | p. 238 |
| Using DDD with GDB to Debug Java | p. 240 |
| Using DDD as a GUI for JDB | p. 241 |
| Debugging Java in Eclipse | p. 241 |
| Perl | p. 242 |
| Debugging Perl via DDD | p. 244 |
| Debugging Perl in Eclipse | p. 246 |
| Python | p. 247 |
| Debugging Python in DDD | p. 249 |
| Debugging Python in Eclipse | p. 250 |
| Debugging SWIG Code | p. 251 |
| Assembly Language | p. 255 |
| Index | p. 259 |
| Table of Contents provided by Ingram. All Rights Reserved. |
CART







