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
  • 100,966
  • 191
  • 140
  • 197
john2994
  • 393
  • 1
  • 3
  • 15
  • 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

2

Add a condition in your code like:

if(eventOccurs){
 //put anything here
}

and then add the breakpoint inside the condition

ZA1NZAFAR
  • 135
  • 2
  • 12
1

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
  • 88
  • 6