Debugging
Debugging
The Nine Indispensable Rules for Finding Even the
Most Elusive Software and Hardware Problems
David J. Agans
AMACOM
American Management Association
New York Atlanta Brussels Buenos Aires Chicago London Mexico City
San Francisco Shanghai Tokyo Toronto Washington, D.C.
Special discounts on bulk quantities of AMACOM books are available to corporations, professional associations, and other organizations. For details, contact Special Sales Department, AMACOM, a division of American Management Association, 1601 Broadway, New York, NY 10019.
Tel.: 212-903-8316. Fax: 212-903-8083.
Web site: www.amacombooks.org
This publication is designed to provide accurate and authoritative information in regard to the subject matter covered. It is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional service. If legal advice or other expert assistance is required, the services of a competent professional person should be sought.
Library of Congress Cataloging-in-Publication Data
Agans, David J., 1954
Debugging: the 9 indispensable rules for finding even the most elusive software and hardware problems / David J. Agans.
p. cm.
Includes index.
ISBN-13: 978-0-8144-7457-0 (pbk)
ISBN-13: 978-0-8144-2678-4 (ebook)
1. Debugging in computer science. 2. Computer softwareQuality control. I. Title.
QA76.9.D43 A35 2002 |
005.14dc21 | 2002007990 |
2002 David J. Agans.
All rights reserved.
Printed in the United States of America.
This publication may not be reproduced,
stored in a retrieval system,
or transmitted in whole or in part,
in any form or by any means, electronic,
mechanical, photocopying, recording, or otherwise,
without the prior written permission of AMACOM,
a division of American Management Association,
1601 Broadway, New York, NY 10019.
Printing number
10 9 8 7 6 5 4 3 2 1
To my mom, Ruth (Worsley) Agans, who debugged Fortran listings by hand at our dining room table, fueled by endless cups of strong coffee.
And to my dad, John Agans, who taught me to think, to use my common sense, and to laugh.
Your spirits are with me in all my endeavors.
Contents
Acknowledgments
This book was born in 1981 when a group of test technicians at Gould asked me if I could write a document on how to troubleshoot our hardware products. I was at a lossthe products were boards with hundreds of chips on them, several microprocessors, and numerous communications buses. I knew there was no magical recipe; they would just have to learn how to debug things. I discussed this with Mike Bromberg, a long time mentor of mine, and we decided the least we could do was write up some general rules of debugging. The Ten Debugging Commandments were the result, a single sheet of brief rules for debugging which quickly appeared on the wall above the test benches. Over the years, this list was compressed by one rule and generalized to software and systems, but it remains the core of this book. So to Mike, and to the floor techs who expressed the need, thanks.
Over the years, Ive had the pleasure of working for and with a number of inspirational people who helped me develop both my debugging skills and my sense of humor. Id like to recognize Doug Currie, Scott Ross, Glen Dash, Dick Morley, Mike Greenberg, Cos Fricano, John Aylesworth (one of the original techs), Bob DeSimone, and Warren Bayek for making challenging work a lot of fun. I should also mention three teachers who expected excellence and made learning enjoyable: Nick Menutti (it aint the Nobel Prize, but heres your good word), Ray Fields, and Professor Francis F. Lee. And while I never met them, their books have made a huge difference in my writing career: William Strunk Jr. and E. B. White (The Elements of Style), and Jeff Herman and Deborah Adams (Write the Perfect Book Proposal).
To the Delt Dawgs, my summer softball team of 28 years and counting, thanks for the reviews and networking help. Im indebted to Charlie Seddon, who gave me a detailed review with many helpful comments, and to Bob Siedensticker, who did that and also gave me war stories, topic suggestions, and advice on the publishing biz. Several people, most of whom I did not know personally at the time, reviewed the book and sent me nice letters of endorsement, which helped get it published. Warren Bayek and Charlie Seddon (mentioned above), Dick Riley, Bob Oakes, Dave Miller, and Professor Terry Simkin: thank you for your time and words of encouragement.
Im grateful to the Sesame Workshop, Tom and Ray Magliozzi (Click and Clack of Car Talkor is it Clack and Click?), and Steve Martin for giving me permission to use their stories and jokes; to Sir Arthur Conan Doyle for creating Sherlock Holmes and having him make so many apropos comments; and to Seymour Friedel, Bob McIlvaine, and my brother Tom Agans for relating interesting war stories. And for giving me the examples I needed both to discover the rules and to demonstrate them, thanks to all the war story participants, both heroes and fools (you know who you are).
Working with my editors at Amacom has been a wonderful and enlightening experience. To Jacquie Flynn and Jim Bessent, thank you for your enthusiasm and great advice. And to the designers and other creative hands in the process, nice work; it came out great.
Special appreciation goes to my agent, Jodie Rhodes, for taking a chance on a first-time author with an offbeat approach to an unfamiliar subject. You know your markets, and it shows.
For their support, encouragement, and countless favors large and small, a special thanks to my in-laws, Dick and Joan Blagbrough. To my daughters, Jen and Liz, hugs and kisses for being fun and believing in me. (Also for letting me have a shot at the computer in the evenings between high-scoring games and instant messenger sessions.)
And finally, my eternal love and gratitude to my wife Gail, for encouraging me to turn the rules into a book, for getting me started on finding an agent, for giving me the time and space to write, and for proofreading numerous drafts that I wouldnt dare show anyone else. You can light up a chandelier with a vacuum cleaner, but you light up my life all by yourself.
Dave Agans
June 2002
chapter
Introduction
At present I am, as you know, fairly busy, but I propose to devote my declining years to the composition of a textbook which shall focus the whole art of detection into one volume.
SHERLOCK HOLMES, THE ADVENTURE OF THE ABBEY GRANGE
This book tells you how to find out whats wrong with stuff, quick. Its short and fun because it has to beif youre an engineer, youre too busy debugging to read anything more than the daily comics. Even if youre not an engineer, you often come across something thats broken, and you have to figure out how to fix it.
Now, maybe some of you never need to debug. Maybe you sold your dot.com IPO stock before the company went belly-up and you simply have your people look into the problem. Maybe you always luck out and your design just worksor, even less likely, the bug is always easy to find. But the odds are that you and all your competitors have a few hard-to-find bugs in your designs, and whoever fixes them quickest has an advantage. When you can find bugs fast, not only do you get quality products to customers quicker, you get yourself home earlier for quality time with your loved ones.