From 579b02416e05e32e535126e1ed61613a2cdb030e Mon Sep 17 00:00:00 2001 From: Jeff Hao Date: Mon, 18 Nov 2013 13:16:49 -0800 Subject: Add support for JDWP METHOD_EXIT_WITH_RETURN_VALUE events. Bug: 11569539 Change-Id: Ibc7a80df83470ffd726d73695a05f4938248f292 --- runtime/jdwp/jdwp.h | 6 +++++- runtime/jdwp/jdwp_event.cc | 10 ++++++---- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'runtime/jdwp') diff --git a/runtime/jdwp/jdwp.h b/runtime/jdwp/jdwp.h index a1657d0..fd78bf2 100644 --- a/runtime/jdwp/jdwp.h +++ b/runtime/jdwp/jdwp.h @@ -31,6 +31,7 @@ struct iovec; namespace art { + union JValue; namespace mirror { class ArtMethod; } // namespace mirror @@ -185,8 +186,11 @@ struct JdwpState { * issuing a MethodEntry on a native method. * * "eventFlags" indicates the types of events that have occurred. + * + * "returnValue" is non-null for MethodExit events only. */ - bool PostLocationEvent(const JdwpLocation* pLoc, ObjectId thisPtr, int eventFlags) + bool PostLocationEvent(const JdwpLocation* pLoc, ObjectId thisPtr, int eventFlags, + const JValue* returnValue) SHARED_LOCKS_REQUIRED(Locks::mutator_lock_); /* diff --git a/runtime/jdwp/jdwp_event.cc b/runtime/jdwp/jdwp_event.cc index 345549d..61bd1ed 100644 --- a/runtime/jdwp/jdwp_event.cc +++ b/runtime/jdwp/jdwp_event.cc @@ -719,7 +719,8 @@ bool JdwpState::PostVMStart() { * - Single-step to a line with a breakpoint. Should get a single * event message with both events in it. */ -bool JdwpState::PostLocationEvent(const JdwpLocation* pLoc, ObjectId thisPtr, int eventFlags) { +bool JdwpState::PostLocationEvent(const JdwpLocation* pLoc, ObjectId thisPtr, int eventFlags, + const JValue* returnValue) { ModBasket basket; basket.pLoc = pLoc; basket.classId = pLoc->class_id; @@ -771,9 +772,7 @@ bool JdwpState::PostLocationEvent(const JdwpLocation* pLoc, ObjectId thisPtr, in } if ((eventFlags & Dbg::kMethodExit) != 0) { FindMatchingEvents(EK_METHOD_EXIT, &basket, match_list, &match_count); - - // TODO: match EK_METHOD_EXIT_WITH_RETURN_VALUE too; we need to include the 'value', though. - // FindMatchingEvents(EK_METHOD_EXIT_WITH_RETURN_VALUE, &basket, match_list, &match_count); + FindMatchingEvents(EK_METHOD_EXIT_WITH_RETURN_VALUE, &basket, match_list, &match_count); } if (match_count != 0) { VLOG(jdwp) << "EVENT: " << match_list[0]->eventKind << "(" << match_count << " total) " @@ -792,6 +791,9 @@ bool JdwpState::PostLocationEvent(const JdwpLocation* pLoc, ObjectId thisPtr, in expandBufAdd4BE(pReq, match_list[i]->requestId); expandBufAdd8BE(pReq, basket.threadId); expandBufAddLocation(pReq, *pLoc); + if (match_list[i]->eventKind == EK_METHOD_EXIT_WITH_RETURN_VALUE) { + Dbg::OutputMethodReturnValue(pLoc->method_id, returnValue, pReq); + } } } -- cgit v1.1