
Ask HN: Good books on debugging? - antonpirker
Are there any good books on debugging? I think debugging is one of the key skills of a good developer, but I have never seen a book (or blog) especially about debugging code and distributed systems.
======
wyclif
Working Effectively With Legacy Code by Michael Feathers
[http://www.amazon.com/Working-Effectively-Legacy-Michael-
Fea...](http://www.amazon.com/Working-Effectively-Legacy-Michael-
Feathers/dp/0131177052)

Debugging with GDB: The GNU Source-Level Debugger by Stallman, Pesch, and
Shebs [http://www.amazon.com/Debugging-GDB-GNU-Source-Level-
Debugge...](http://www.amazon.com/Debugging-GDB-GNU-Source-Level-
Debugger/dp/1882114884/)

The Art of Debugging with GDB, DDD, and Eclipse by Matloff & Salzman
[http://www.amazon.com/gp/product/1593271743](http://www.amazon.com/gp/product/1593271743)

------
arihant
While there are great options mentioned here, I would actually be suggesting
that you stick to a very good systems book. A standing knowledge of lower
level systems and instruction code will give great depth to your debugging
skills. Nothing teaches reverse engineering better than experience.

At CMU, we used CS:APP (Computer Systems: A Programmer's Perspective). It's
written by Randy Bryant, the same professor who used to teach it. I still have
that book, it's updated for Ivy Bridge, and I truly believe that this book
changed my approach towards debugging more than any other text. It will push
you to the next curve.

Towards the end of the book you'd find some programming labs. I highly suggest
you do them religiously. Many great men have failed at them.

~~~
troydj
Nice recommendation. Looks like the 3rd edition was just published this month.
Bryant's blog describes the updates to the 3rd edition here:
[http://csappbook.blogspot.com/2015/02/the-third-edition-
will...](http://csappbook.blogspot.com/2015/02/the-third-edition-will-be-out-
march-11.html)

------
blatherard
I've read a number of books on debugging, it's something of an interest of
mine. The best general-purpose debugging book I've read is the cumbersomely
named

Debugging: The 9 Indispensible Rules for Finding Even the Most Elusive
Software and Hardware Problems by David J. Agans

Amazon link: [http://www.amazon.com/Debugging-Indispensable-Software-
Hardw...](http://www.amazon.com/Debugging-Indispensable-Software-Hardware-
Problems/dp/0814474578/)

What I really like about it is that it gives a number of high-level approaches
to solving debugging problems and is written very accessibly.

------
danparsonson
Tess Ferrandez's blog is worth a look if you're doing .NET debugging
(particularly outside of the IDE - she's a windbg wizard):

[http://blogs.msdn.com/b/tess/archive/tags/debugging/](http://blogs.msdn.com/b/tess/archive/tags/debugging/)

She has written some labs covering common debugging scenarios:

[http://blogs.msdn.com/b/tess/archive/2008/02/04/net-
debuggin...](http://blogs.msdn.com/b/tess/archive/2008/02/04/net-debugging-
demos-information-and-setup-instructions.aspx)

------
joefreeman
I haven't read it, but a really smart ex-colleague is the author of 'Debug
It': [https://pragprog.com/book/pbdp/debug-
it](https://pragprog.com/book/pbdp/debug-it)

~~~
lylejohnson
I have read it, and it's quite good. Was about to post the link myself until I
saw that you had.

------
iosengineer
Any Sherlock Holmes adventure book. Technique is good. Attitude is better.

------
adolgert
"Debugging Applications" by John Robbins is an old MS Press book, now 43 cents
on Amazon, that covers everything from high level code structure to a nice
primer on reading x86 assembly. I have more recent books, but this is the one
that taught me to gird my coding loins for a fight.

------
serve_yay
"Find the Bug: a Book of Incorrect Programs" by Adam Barr:
[http://www.amazon.com/gp/aw/d/0321223918/ref=mp_s_a_1_1?qid=...](http://www.amazon.com/gp/aw/d/0321223918/ref=mp_s_a_1_1?qid=1426946354&sr=8-1&keywords=find+the+bug&pi=AC_SY200_QL40&dpPl=1&dpID=51n%2B4Yc628L&ref=plSrch)

It has a bunch of examples of bugs, classified by type of bug, and gives you
tools for diagnosing and fixing them.

------
panamafrank
Giving tips very much depends on the language you're using and the
capabilities of your debugger, having worked on large legacy VC++ projects
knowing the "bad smells" and common mistakes to spot is helpful, but you'll
struggle to debug projects you don't have a solid knowledge of.

To improve, try learning cracking;
[https://microcorruption.com/](https://microcorruption.com/) is a CTF game
based around gaining access to embedded devices, it's rather fun too. I think
what the most common mistake I find is two programmers having different
assumptions on how some subsystem should work, so try improving your working
memory as being able to remember the seemingly ok code 10 frames ago that
conflicts with what's in front of you could be the key.

try:

Working Effectively with Legacy Code Martin, R.

API Design for C++ Reddy, M.

Were both full of indispensable advice.

------
aerohit
There is a course on udacity called software debugging
[https://www.udacity.com/course/cs259](https://www.udacity.com/course/cs259)

------
troydj
Andreas Zeller, original author of GNU DDD, has a good book called "Why
Programs Fail: A Guide to Systematic Debugging", 2nd edition.

[http://www.amazon.com/Why-Programs-Fail-Systematic-
Debugging...](http://www.amazon.com/Why-Programs-Fail-Systematic-Debugging-
ebook/dp/B0092L8LCW)

------
ilaksh
You need to understand how your system works and then get a good tool that
allows you to observe its behavior in as much detail as possible.

I don't believe books are likely to be particularly relevant with the
diversity of tools and platforms. Google the platform name plus 'debugging
tool'. Then practice debugging.

If you have to, step through every single line of code and observe the program
state closely at each step.

What kind of distributed system is it exactly? If it is a highly distributed
system you can mock parts of it or find/ build a tool for fine-grain
inspection and integrated reporting of the state of the system.

A book is not going to be able to keep up with platform and tool development.

You want to learn to Google, find good tools, practice a lot.

------
Balija
Software Exorcism: A Handbook for Debugging and Optimizing Legacy Code by Bill
Blunden

------
tkfx
The Takipi blog deals a lot with debugging related issues:
[http://blog.takipi.com/](http://blog.takipi.com/)

Some more posts worth checking out in the JVM domain:

[http://highscalability.com/blog/2015/1/7/the-ultimate-
guide-...](http://highscalability.com/blog/2015/1/7/the-ultimate-
guide-5-methods-for-debugging-production-server.html)

[http://www.infoq.com/articles/Advanced-Java-Debugging-
Techni...](http://www.infoq.com/articles/Advanced-Java-Debugging-Techniques)

(Disclaimer: I'm from Takipi)

------
antonpirker
Somewhere on the internet the book "The Medical Detective" by Bertone Roueche
should be a really good read about debugging. But I did not find a place on
the internet where you can buy it. Here is a link to goodreads:
[http://www.goodreads.com/book/show/106164.The_Medical_Detect...](http://www.goodreads.com/book/show/106164.The_Medical_Detectives)

Has anyone read this book and can recommend it?

~~~
signa11
oh yes ! heartily recommended. i have a copy from amazon, and the stories are
just incredible. it is just like a magicians trick. you know it's a trick
because laws of physics and all that, but quite fun to deduce.

the writing style is very engaging. some stories are fully resolved, others
just conclude with a plausible hypothesis that explains the data, but due to
lack of sufficient evidence cannot be confirmed.

------
FaisalRashid
Check this one:
[https://books.google.com/books?isbn=0549783229](https://books.google.com/books?isbn=0549783229)

------
dlss
Surprised this wasn't already mentioned, but the best description I've ever
read of debugging is in Zen and The Art of Motorcycle Maintenance.
(Unsurprisingly, it's about debugging motorcycles, but the author was a
programmer so it's directly transferable)

------
vdm
The Scientific Method of Troubleshooting (Blithe Rocher @ GoGaRuCo 2014)
[https://www.youtube.com/watch?v=h9YZXuUjyOs](https://www.youtube.com/watch?v=h9YZXuUjyOs)

------
p0nce
Work on legacy systems.

------
MichaelCrawford
Robert Ward, "Debugging C". There is a second edition with a somewhat
different title that I have not read, but expect would be good.

He emphasizes the use of the scientific method - observe your program's
behavior, form a hypothesis as to what the bug could be, design an experiment
to test your hypothesis. Just learning to be methodical rather than thrashing
around mindlessly helped me tremendously.

It's out of print but I expect you could find it on Alibris.

