6

Suppose I saw in debugger that this value for some instance is

{MyClass@6164}

Now, how to set a breakpoint in some method and set its condition so that is stops only if this is the same?

duffymo
  • 305,152
  • 44
  • 369
  • 561
Dims
  • 47,675
  • 117
  • 331
  • 600
  • 1
    The number you're seeing is the [objectId reported to the debugger by the JVM](http://stackoverflow.com/questions/2322903/deciphering-variable-information-while-debugging-java), and I'm not sure you can access it. Your best bet is probably by using the object's hash-code as already suggested. Even if multiple objects can have the same hash-code (normally) I wouldn't expect them to be that many, and when there are a few, you can visually filter them after that particular objectId – Morfic Jul 14 '16 at 12:42

1 Answers1

10

You can use a conditional breakpoint.

Put a condition where you evalute this.hashCode() == HASHCODE. You can get the HASHCODE using the Evaluate Expression feature.

Hope that helps.

Conditional BreakPoint

Peter
  • 4,752
  • 2
  • 20
  • 32