summaryrefslogtreecommitdiffstats
path: root/vm/jdwp
diff options
context:
space:
mode:
authorAndy McFadden <fadden@android.com>2010-10-15 13:54:28 -0700
committerAndy McFadden <fadden@android.com>2010-10-15 14:37:23 -0700
commit2150b0d21e9db50d76628b6442616489d156b5ad (patch)
tree8d7930cd71e69440cd207eb2ec091edf37a8597c /vm/jdwp
parent1988249e35cd15677bf72f66e50979b5ebd39a28 (diff)
downloadandroid_dalvik-2150b0d21e9db50d76628b6442616489d156b5ad.tar.gz
android_dalvik-2150b0d21e9db50d76628b6442616489d156b5ad.tar.bz2
android_dalvik-2150b0d21e9db50d76628b6442616489d156b5ad.zip
Switch to VMWAIT before sending to DDMS
If you stop DDMS with Ctrl-Z, packets sent from the VM will start to back up and eventually the network write will block. The VM was doing the write in "running" state, which meant that if another thread tried to GC it would be unable to suspend the stalled thread and the VM would abort. Now when this happens the affected thread(s) will be quietly stuck until DDMS is resumed. (We may want to fix that eventually.) Bug 3101425. Change-Id: Ide83c4622137e24c23ee85c006b497d84cf5006b
Diffstat (limited to 'vm/jdwp')
-rw-r--r--vm/jdwp/JdwpEvent.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/vm/jdwp/JdwpEvent.c b/vm/jdwp/JdwpEvent.c
index 69d22373f..371fdda28 100644
--- a/vm/jdwp/JdwpEvent.c
+++ b/vm/jdwp/JdwpEvent.c
@@ -1288,5 +1288,10 @@ void dvmJdwpDdmSendChunkV(JdwpState* state, int type, const struct iovec* iov,
wrapiov[0].iov_base = header;
wrapiov[0].iov_len = sizeof(header);
+ /*
+ * Make sure we're in VMWAIT in case the write blocks.
+ */
+ int oldStatus = dvmDbgThreadWaiting();
dvmJdwpSendBufferedRequest(state, wrapiov, iovcnt+1);
+ dvmDbgThreadContinuing(oldStatus);
}