Do You Know Good Points at Conditional Breakpoints?

Published Oct 02, 2017
Do You Know Good Points at Conditional Breakpoints?

Every IDE (Eclipse, Android Studio, Visual Studio, XCode, Google Dev Tools...) has a conditional breakpoint in debugger.


  • It makes it possible to insert print/log into the code without build and code modification and with untouchable source code.
  • It makes it possible to change local or argument values at any place in the source code at any time.


conditional breakpoint is a breakpoint with expressions. It stops your debug process when the expression returns truthy values. Even if the expression returns falsy value, your expressions run every time.

Insert Debug Log on Demand

console's methods return falsy value.
You can always just write console.log method in the expression.


Change Local Value on Demand

You should write a method as a custome data modification method.

function customBehave(method) {
  return false;

Of course, you can insert log in the method.

Write into your breakpoint expression at the source code that you want to change the local value.
Example: avoid too long checks that we don't need when debugging a situation.

customBehave( () => {flagCheckedNetworkInformation = true;} ) // this method always return falsy.

Simple Version

Just return falsy values.

!(flagCheckedNetworkInformation = true)

Change Value With Logging

Here is a change value with logging at one line.

!console.log("** Value changed **") && !(flagValue = true)
Discover and read more posts from Tadayuki Tanigawa
get started