8129348: Debugger hangs in trace mode with TRACE_SENDS
Reviewed-by: sspitsyn
Contributed-by: cheleswer.sahu@oracle.com
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/InvokableTypeImpl.java Thu Oct 29 21:38:11 2015 -0400
+++ b/jdk/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) {