chapter three

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
  • Modifying data during debugging to simulate specific app behavior
  • Rerunning part of the code during debugging

Chapter 2 discussed the most common ways to use a debugger. When debugging a piece of implemented logic, developers often use code navigation operations such as stepping over, into, and out of an instruction. Knowing how to properly use these operations helps investigate a piece of code to better understand or find a problem.

However, many developers underestimate just how powerful a debugger can be. Developers sometimes struggle when debugging code, using only the basic navigation, whereas they could save a lot of time if they used 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 such as

  • Conditional breakpoints
  • Breakpoints as log events
  • Modifying in-memory data
  • Dropping execution frames

We’ll discuss some beyond-basic ways to navigate the code you are investigating, and you’ll learn how and when to use these approaches. We’ll also use code examples to discuss these investigation approaches so that you learn how to use them to save time and when to avoid them.

3.1 Minimizing investigation time with conditional breakpoints

3.2 Using breakpoints that don’t pause the execution

3.3 Dynamically altering the investigation scenario

3.4 Rewinding the investigation case

Summary