What is reverse debugging?
When searching the internet for the definition of reverse debugging, you may come across many contradictions. This is because reverse debugging is a relatively new technology, that is still dynamically developing. In order to convey what is reverse debugging in the easiest possible way, one can use an example. Do you know how a flight recorder on the plane works? Reverse debugging is a similar technology, but it is implemented in software, not airplanes. It records everything that happens in your program and delivers you a detailed information about error-root-cause when it crashes.
You may be wondering – how does it work in practice?
Developing software is a game full of surprises, which may disturb the process of continuous delivery of value to your customers. Reverse debugging is a tool which may help to deal with those issues, related to errors appearing in code. Let’s list its main assumptions:
automating the process of errors detection
The applications built with an implementation of reverse debugging send information about occurring problems to members of DevOps team.
delivering a detailed information about the cause of an error
Which version of the application contains the bug? How many users experienced it? Which line of the code is the problematic one? Which values reprocessed by your application caused the problem? All of those are important questions, which answers to are the key when looking for the solution to the problem.
giving you the details of possible solutions
One of the most important assumptions of DevOps is a quick response to appearing problems. Reverse debugging significantly supports this process by boosting obtaining information about the current status of the application on production, and giving you the details for solutions if some problem appeared. For example, you can check which commit of your application caused the error and to which part of the commit history you have to reset your project to, in order to receive a working / bug-free version.
How to get that information?
As we mentioned in the beginning, reverse debugging tools might be compared with a flight recorder. But what actually does it record? The answer is simple: everything. Everything that happens in an application while it’s running on production. Every value of every variable, method, exception, field. etc. It brings to mind putting breakpoints on every single line of your code, and saving the results to a separate file, in order to dive into this data, when the crash appears.
How is this process carried out from the technical side?
First of all, we detect characteristic code structures and it’s AST tree. That part of the process allows you to get to know what changes we have to provide to create code working with an implementation of reverse debugging. At the stage of compiling the code, we are changing it’s AST tree (by static code injections) to create structures responsible for saving everything that happens in the application.
Right now you might be wondering: is it a viable undertaking to a create a whole reverse debugging infrastructure for an application? To answer this question I will share with you numbers that my team had the opportunity to observe thanks to cooperation in projects which implemented this technology:
|What developers spend their time on?|
|The project without implementation of reverse debugging:||The project with the implementation of reverse debugging:|
As you see from the comparison table, the longer a project lasts and the longer we provide maintenance to it, the more profitable it is to use reverse debugging. What’s more, thanks to the existence of some specialized reverse debugging tools, you can use ready-made solutions, instead of coding everything from scratch.
Reverse debugging, therefore, creates a fully automated debugging system. This technology focuses on transforming an errors finding practice into a predictable process.
I and my team share the knowledge about reverse debugging and its implementation in .NET projects. If you want to know more about this idea, sign up for this free online training:
Sign up for free reverse debugging training!
Let’s talk about how you may implement reverse debugging into your own projects.