0

I am wondering if there is a way to search a specific value in variables while debugging.

For example, I have this code:

public void init(){
    int a=5;
    String s="Hello world";
    boolean enable = true;
}

I want to search for value "Hello world" in all variables. So is there a way to put this value somewhere and debugger stops at point when it finds it?

Mark Rotteveel
  • 90,369
  • 161
  • 124
  • 175
john2994
  • 173
  • 1
  • 10
  • Does this answer your question? [How to use conditions in breakpoints in idea?](https://stackoverflow.com/questions/44114474/how-to-use-conditions-in-breakpoints-in-idea) – Martheen Nov 03 '20 at 09:02
  • Unfortunately not, but this post has interesting information. Thanks anyway. – john2994 Nov 03 '20 at 09:35
  • Just create a function to aggregate all your variables? – Martheen Nov 03 '20 at 09:37

2 Answers2

1

Add a condition in your code like:

if(eventOccurs){
 //put anything here
}

and then add the breakpoint at *.

lier wu
  • 620
  • 4
  • 21
zzssrko
  • 125
  • 2
  • 12
0

You can be following like below:

if(value==you want){

 //Then debug and lookup objects values that you want to check.

 System.out.println("Seting debug point of this line!")

}
Allen
  • 90
  • 6