OSDN Git Service

Fix debugger missing handle between adding and tagging object.
authorJeff Hao <jeffhao@google.com>
Mon, 22 Aug 2016 18:34:41 +0000 (11:34 -0700)
committerJeff Hao <jeffhao@google.com>
Mon, 22 Aug 2016 18:35:55 +0000 (11:35 -0700)
Bug: 30951794
Change-Id: Ic9c5f296efe839a8961ab00d08afc54c5443bc17

runtime/debugger.cc

index b4acc27..89bebb4 100644 (file)
@@ -4059,7 +4059,7 @@ void Dbg::ExecuteMethodWithoutPendingException(ScopedObjectAccess& soa, DebugInv
   // Prepare JDWP ids for the reply.
   JDWP::JdwpTag result_tag = BasicTagFromDescriptor(m->GetShorty());
   const bool is_object_result = (result_tag == JDWP::JT_OBJECT);
-  StackHandleScope<2> hs(soa.Self());
+  StackHandleScope<3> hs(soa.Self());
   Handle<mirror::Object> object_result = hs.NewHandle(is_object_result ? result.GetL() : nullptr);
   Handle<mirror::Throwable> exception = hs.NewHandle(soa.Self()->GetException());
   soa.Self()->ClearException();
@@ -4100,9 +4100,9 @@ void Dbg::ExecuteMethodWithoutPendingException(ScopedObjectAccess& soa, DebugInv
     if (exceptionObjectId == 0) {
       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());
+        Handle<mirror::Object> decoded_ref = hs.NewHandle(soa.Self()->DecodeJObject(ref.get()));
         result_value = gRegistry->Add(decoded_ref);
-        result_tag = TagFromObject(soa, decoded_ref);
+        result_tag = TagFromObject(soa, decoded_ref.Get());
       } else {
         // TODO we could keep the receiver ObjectId in the DebugInvokeReq to avoid looking into the
         // object registry.