Welcome to "The Debugging Book"! Software has bugs, and finding bugs can involve lots of effort. This book addresses this problem by automating software debugging, specifically by locating errors and their causes automatically. Recent years have seen the development of novel techniques that lead to dramatic improvements in automated software debugging. They now are mature enough to be assembled in a book – even with executable code.
from bookutils import YouTubeVideo YouTubeVideo("-nOxI6Ev_I4")
You can use this book in four ways:
You can read chapters in your browser. Check out the list of chapters in the menu above, or start right away with the introduction to debugging or how debuggers work. All code is available for download.
You can interact with chapters as Jupyter Notebooks (beta). This allows you to edit and extend the code, experimenting live in your browser. Simply select "Resources → Edit as Notebook" at the top of each chapter. Try interacting with the introduction to interactive debuggers.
You can use the code in your own projects. You can download the code as Python programs; simply select "Resources → Download Code" for one chapter or "Resources → All Code" for all chapters. These code files can be executed, yielding (hopefully) the same results as the notebooks. Once the book is out of beta, you can also install the Python package.
You can present chapters as slides. This allows for presenting the material in lectures. Just select "Resources → View slides" at the top of each chapter. Try viewing the slides for how debuggers work.
This work is designed as a textbook for a course in software debugging; as supplementary material in a software testing or software engineering course; and as a resource for software developers. We cover fault localization, program slicing, input reduction, automated repair, and much more, illustrating all techniques with code examples that you can try out yourself.
The interactive notebook uses the mybinder.org service, which runs notebooks on their own servers. Starting Jupyter through mybinder.org normally takes about 30 seconds, depending on your Internet connection. If, however, you are the first to invoke binder after a book update, binder recreates its environment, which will take a few minutes. Reload the page occasionally.
As mybinder.org is a research pilot project, the main goal for the project is to understand usage patterns and workloads for future project evolution. While we strive for site reliability and availability, we want our users to understand the intent of this service is research and we offer no guarantees of its performance in mission critical uses.
There are alternatives to mybinder.org; see below.
If mybinder.org does not work or match your needs, you have a number of alternatives:
For details, see our article on Using Debuggingbook Code in your own Programs. Enjoy!
We try to keep the code as general as possible, but occasionally, when we interact with the operating system, we assume a Unix-like environment (because that is what Binder provides). To run these examples on your own Windows machine, you can install a Linux VM or a Docker environment.
We use Python to implement our tools and techniques because we can get things done quickly. Building an interactive debugger in Python is less than 100 lines of code and took us 2-3 days; doing the same for C is tens of thousands of lines and a year-long project. Instrumenting code, say for dynamic slicing, gets us savings of similar magnitude. Also, Python code allows us (and you) to focus on the main concepts, rather than implementation details that are out of place in a textbook.
Having said this, many of the techniques in this book can also be applied to C and other code. This is notably true for black-box techniques such as reducing inputs or changes or generalizers; these are all language-agnostic. Tools related to the debugging process such as bug tracking or mining repositories are language-agnostic as well. Finally, in all chapters, we provide pointers to implementations in and for other languages, for instance for assertions or program repair.
Thanks for referring to our work! Just click on the "cite" button at the bottom of the Web page for each chapter to get a citation entry.
We're always happy to get suggestions! If we missed an important reference, we will of course add it. If you'd like specific material to be covered, the best way is to write a notebook yourself; see our Guide for Authors for instructions on coding and writing. We can then refer to it or even host it.
We have successfully used the material in various courses.
Initially, we used the slides and code and did live coding in lectures to illustrate how a technique works.
Now, the goal of the book is to be completely self-contained; that is, it should work without additional support. Hence, we now give out completed chapters to students in a flipped classroom setting, with the students working on the notebooks at their leisure. We would meet in the classroom (or in Zoom) to discuss experiences with past notebooks and discuss future notebooks.
We have the students work on exercises from the book or work on larger (automated debugging) projects. We also have students who use the book as a base for their research; indeed, it is very easy to prototype in Python for Python.
Download the Jupyter Notebooks (using the menu at the top) and adapt the notebooks at your leisure (see above), including "Slide Type" settings. Then,
Technically, we can produce PDF and print versions from notebooks, but it is low on our priority list as we find the interactive formats to be so much superior. Let us know if you'd like PDF versions.
We prioritize issues as follows:
Again, we're glad you're here! We are happy to accept
See our Guide for Authors for instructions on coding and writing.