Repository navigation
Conversation
eppleton
left a comment
There was a problem hiding this comment.
Thanks, linking the console message to the breakpoint customizer is a nice touch, and replacing the two reflective hacks with isThreadDeath() and evaluate(String, CallStackFrame) is a clear improvement. I built api.io, api.debugger.jpda, debugger.jpda and debugger.jpda.ui from 7b35b38 locally, and they compile.
I have one suggestion about what the hyperlink keeps alive, one question about the build.xml change, and a few small points inline.
eppleton
left a comment
There was a problem hiding this comment.
Thanks. Moving the lookup to the session is a good direction. I re-checked 67972ed, and debugger.jpda.ui and debugger.jpda.heapwalk build locally. I haven't run it in the IDE.
The new link still holds the debugger through two of the objects it captures (details inline). The findProvider() debug output and the dependency version need a look before this goes in. The two failonerror="false" changes you mentioned reverting are also still in the build.xml files.
| if (refValue instanceof ObjectVariable obj) { | ||
| io.printWithAction(" " + obj.getType() + " " + expression + " = ", null, false); | ||
| var sessionRef = new WeakReference<>(session); | ||
| io.printWithAction("#" + obj.getUniqueID(), () -> { |
There was a problem hiding this comment.
The WeakReference to the session helps, but javap shows the lambda as lambda$printOutEvent$0(WeakReference, ObjectVariable, DebuggerConsoleIO), so it still captures obj and io strongly. Both reach the debugger:
objis anAbstractVariable, which hasprivate JPDADebuggerImpl debugger, plus the JDIValue.ioisDebuggerConsoleIO, which hasprivate final JPDADebuggerImpl debugger.
The output window keeps the listener: NbIOProvider.hyperlinkToOutputListener wraps the Hyperlink, and AbstractLines stores it per line. DebuggerOutput closes the old tab only when a new session starts as the only session. A heap dump taken after starting the next session therefore wouldn't show it. I traced this in the code and haven't taken a heap dump myself, so it may be worth checking with the console tab still open after the session ends.
Maybe hold obj weakly too, as ShowObjectVariableInHeap already does? The "Cannot display details" fallback is the only reason to capture io.
There was a problem hiding this comment.
- changed in a27977e to not capture anything else than the breakpoint again
- e.g.
ioisn't captured
- e.g.
using weak reference in 408884c as suggested- no, weak references don't work!
- there can be many
ObjectVariableinstances pointing to the same object in the debugee - cannot hold weak reference, as it gets GCed
- returned back to regular reference in a6e613c
|
I am pretty happy with current behavior. I'd like to get it into NetBeans 32 - e.g. to integrate by Oct 15, 2026. Reviewers, please review (again). Update: needed 6b2999e bugfix to build. |
|
It doesn't seem to build in its current state?! |
|
I am not an expert on the debugger, but makes sense to me. |
|
Adding a test for the behavior in 9ffb3a4 |
lahodaj
left a comment
There was a problem hiding this comment.
(Note you should squash before merging, as per existing rules.)
eppleton
left a comment
There was a problem hiding this comment.
Looked at 9ffb3a4 again. The ObjectInfoProvider SPI is a nice cleanup, the four touched modules build for me, and the test is a great addition.
On weak references: agreed. Your point that the link may be the only holder of the ObjectVariable is right, and since the old console tab is closed when a new session starts, the strong references are fine with me.
Two things below: an exception regression in printExpressions, and the test failing on my machine (JDK 21, macOS).
87ddf47 to
72436ab
Compare
|
Thanks for reviews. Squashed. Once the CI is green, I integrate. |
ObjectInfoProviderthat displays more info about debugger objects in the heapHyperlink to Instances View