changeset 13070:2ec082c65880

8129348: Debugger hangs in trace mode with TRACE_SENDS Reviewed-by: sspitsyn Contributed-by: cheleswer.sahu@oracle.com
author kevinw
date Thu, 29 Oct 2015 05:24:30 -0700
parents ffb1b9f8265b
children 0701fcfde528
files src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java
diffstat 1 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java	Thu Oct 29 21:38:11 2015 -0400
+++ b/src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java	Thu Oct 29 05:24:30 2015 -0700
@@ -236,6 +236,15 @@
                                            final MethodImpl method,
                                            final ValueImpl[] args,
                                            final int options) {
+        /*
+         * Cache the values of args when TRACE_SENDS is enabled, for later printing.
+         * If not cached, printing causes a remote call while synchronized, and deadlock.
+         */
+        if ((vm.traceFlags & VirtualMachineImpl.TRACE_SENDS) != 0) {
+           for (ValueImpl arg: args) {
+              arg.toString();
+           }
+        }
         CommandSender sender = getInvokeMethodSender(thread, method, args, options);
         PacketStream stream;
         if ((options & ClassType.INVOKE_SINGLE_THREADED) != 0) {