3 Finding problem root causes using advanced debugging techniques
This chapter covers
- Using conditional breakpoints to investigate specific scenarios
- Using breakpoints to log debug messages in the console
- Changing data while debugging to force the app to act in a specific way
- Rerunning a certain part of the code while debugging
In chapter 2, we started discussing the most common ways to use a debugger. When debugging a certain piece of implemented logic, developers often use code navigation operations such as stepping over a line, stepping into a line, and out of it. Knowing how to properly use these operations help you investigate a given piece of code to understand better or find a given issue.
But a debugger is a more powerful tool than many developers are aware of. Now and then, developers struggle a lot when debugging code using the basic navigation operations only. At the same time, developers could spend a lot less time using some of the other (less known) approaches a debugger offers.
In this chapter, you’ll learn how to get the most out of the features the debugger offers:
- Conditional breakpoints
- Breakpoints as log events
- Modifying in-memory data
- Dropping execution frames
We’ll discuss some beyond-basic ways to navigate code you investigate, and you’ll learn how and when using these approaches help you. We’ll use code examples to discuss these investigation approaches so you can understand how you could use them to save time, and when to avoid them.