summaryrefslogtreecommitdiff
path: root/runtime/debugger.cc
diff options
context:
space:
mode:
Diffstat (limited to 'runtime/debugger.cc')
-rw-r--r--runtime/debugger.cc15
1 files changed, 10 insertions, 5 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 541bd1da81..b5ae09f701 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -4379,15 +4379,20 @@ bool Dbg::DdmHandleChunk(JNIEnv* env,
replyData.get(),
offset,
length);
- if (length == 0 || replyData.get() == nullptr) {
- return false;
- }
-
out_data->resize(length);
env->GetByteArrayRegion(replyData.get(),
offset,
length,
reinterpret_cast<jbyte*>(out_data->data()));
+
+ if (env->ExceptionCheck()) {
+ LOG(INFO) << StringPrintf("Exception thrown when reading response data from dispatcher 0x%08x",
+ type);
+ env->ExceptionDescribe();
+ env->ExceptionClear();
+ return false;
+ }
+
return true;
}
@@ -4421,7 +4426,7 @@ bool Dbg::DdmHandlePacket(JDWP::Request* request, uint8_t** pReplyBuf, int* pRep
std::vector<uint8_t> out_data;
uint32_t out_type = 0;
request->Skip(request_length);
- if (!DdmHandleChunk(env, type, data, &out_type, &out_data)) {
+ if (!DdmHandleChunk(env, type, data, &out_type, &out_data) || out_data.empty()) {
return false;
}
const uint32_t kDdmHeaderSize = 8;