From 579b1893c738c6c905fd3114b0bdf309983e0019 Mon Sep 17 00:00:00 2001 From: baldurk Date: Tue, 18 Feb 2020 23:49:26 +0000 Subject: [PATCH] Make sure out-of-order resume replies are processed in JDWP --- renderdoc/android/jdwp_connection.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/renderdoc/android/jdwp_connection.cpp b/renderdoc/android/jdwp_connection.cpp index 955bb11a6..c15446aa2 100644 --- a/renderdoc/android/jdwp_connection.cpp +++ b/renderdoc/android/jdwp_connection.cpp @@ -472,6 +472,18 @@ Event Connection::WaitForEvent(EventKind kind, const rdcarray &even ReadVector(data, events, [this](CommandData &d, Event &ev) { ReadEvent(d, ev); }); data.Done(); + // if we haven't gotten the resume reply yet, wait for that now so that we're up to date. + if(resumeID != ~0U) + { + Command resumeReply; + resumeReply.Recv(reader); + + if(resumeReply.GetID() != resumeID) + RDCERR("Expected resume reply for %u, but got %u", resumeID, resumeReply.GetID()); + + resumeID = ~0U; + } + // event arrived, we're now suspended if(suspendPolicy != SuspendPolicy::None) suspendRefCount++;