jtulach commented on code in PR #9732:
URL: https://github.com/apache/netbeans/pull/9732#discussion_r4357090783


##########
java/debugger.jpda.ui/src/org/netbeans/modules/debugger/jpda/ui/BreakpointOutput.java:
##########
@@ -375,13 +376,45 @@ private void printOutEvent(DebuggerConsoleIO io, String 
format, JPDABreakpointEv
                 printText = selectCondition(printText, threadStartedCondition, 
false);
             }
         }
+
+        int printLocals = printText.indexOf(localsPattern);
+        if (printLocals != -1) {
+            printText = printText.substring(0, printLocals) + 
printText.substring(printLocals + localsPattern.length());
+        }
              
         // 5) resolve all expressions {=expression}
         printExpressions(event, printText, (msg, action) -> {
             io.printWithAction(msg, action, false);
         }, (msg) -> {
             io.println(msg, null);
         });
+
+        if (printLocals != -1) {
+            CallStackFrame csf = findTopFrame(event);
+            if (csf != null) {
+                try {
+                    for (var refValue : csf.getLocalVariables()) {
+                        io.printWithAction("  ", null, false);
+                        io.printWithAction(refValue.getName(), null, false);
+                        io.printWithAction(" = ", null, false);
+                        if (refValue instanceof ObjectVariable obj && 
!isNull(obj)) {
+                            var sessionRef = new WeakReference<>(session);
+                            io.printWithAction(obj.getValue(), () -> {

Review Comment:
   Thanks for the test, @MartinBalin(e)! It is valid and demontrates the 
problem quite clearly. It has opened my eyes. Added in e644433cf7 - the test 
really [fails the 
CI](https://github.com/apache/netbeans/actions/runs/39916834275/job/120359063622?pr=9732#step:12:5237).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to