Fix JDWP ObjectReference.InvokeMethod for virtual method call.
Fixes virtual method call by invoking the concrete method in sirt reference
after devirtualization, not the original method.
Bug: 13526099
Change-Id: I2e3548eca2f5434e8cece64c22aaf80d1cd8badf
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 2c671aa..036b0c5 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -3071,7 +3071,7 @@
// Translate the method through the vtable, unless the debugger wants to suppress it.
SirtRef<mirror::ArtMethod> m(soa.Self(), pReq->method);
if ((pReq->options & JDWP::INVOKE_NONVIRTUAL) == 0 && pReq->receiver != NULL) {
- mirror::ArtMethod* actual_method = pReq->klass->FindVirtualMethodForVirtualOrInterface(pReq->method);
+ mirror::ArtMethod* actual_method = pReq->klass->FindVirtualMethodForVirtualOrInterface(m.get());
if (actual_method != m.get()) {
VLOG(jdwp) << "ExecuteMethod translated " << PrettyMethod(m.get()) << " to " << PrettyMethod(actual_method);
m.reset(actual_method);
@@ -3084,7 +3084,7 @@
CHECK_EQ(sizeof(jvalue), sizeof(uint64_t));
- pReq->result_value = InvokeWithJValues(soa, pReq->receiver, soa.EncodeMethod(pReq->method),
+ pReq->result_value = InvokeWithJValues(soa, pReq->receiver, soa.EncodeMethod(m.get()),
reinterpret_cast<jvalue*>(pReq->arg_values));
mirror::Throwable* exception = soa.Self()->GetException(NULL);