summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Jeff Hao <jeffhao@google.com> 2016-08-19 18:31:39 -0700
committer Jeff Hao <jeffhao@google.com> 2016-08-19 18:31:39 -0700
commitf15ec05896ddc5fec1f224ef97bdfebb72b5a855 (patch)
tree9a8c3117d032160e5d8ab63be8465858bc2acef7
parent6670bd2098264d4c4e19750ab4741121da7ee54b (diff)
Fix debugger calling new String().
Used to return an empty string instead of the newly created String. Requires accompanying jdwp test fix to test String contents. Bug: 30951794 Change-Id: I27a8e0afcbe7e32a14dd3c394e44b6cd4d3c58f6 Test: mm -j24 run-jdwp-tests-host
-rw-r--r--runtime/debugger.cc15
1 files changed, 11 insertions, 4 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 2a5198bf01..b4acc27c48 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -4098,10 +4098,17 @@ void Dbg::ExecuteMethodWithoutPendingException(ScopedObjectAccess& soa, DebugInv
// unless we threw, in which case we return null.
DCHECK_EQ(JDWP::JT_VOID, result_tag);
if (exceptionObjectId == 0) {
- // TODO we could keep the receiver ObjectId in the DebugInvokeReq to avoid looking into the
- // object registry.
- result_value = GetObjectRegistry()->Add(pReq->receiver.Read());
- result_tag = TagFromObject(soa, pReq->receiver.Read());
+ if (m->GetDeclaringClass()->IsStringClass()) {
+ // For string constructors, the new string is remapped to the receiver (stored in ref).
+ mirror::Object* decoded_ref = soa.Self()->DecodeJObject(ref.get());
+ result_value = gRegistry->Add(decoded_ref);
+ result_tag = TagFromObject(soa, decoded_ref);
+ } else {
+ // TODO we could keep the receiver ObjectId in the DebugInvokeReq to avoid looking into the
+ // object registry.
+ result_value = GetObjectRegistry()->Add(pReq->receiver.Read());
+ result_tag = TagFromObject(soa, pReq->receiver.Read());
+ }
} else {
result_value = 0;
result_tag = JDWP::JT_OBJECT;