summaryrefslogtreecommitdiffstats
path: root/runtime/debugger.cc
diff options
context:
space:
mode:
authorJeff Hao <jeffhao@google.com>2015-05-19 20:30:23 -0700
committerJeff Hao <jeffhao@google.com>2015-05-20 18:32:14 -0700
commit15e9ad1d028d7f12cb598b075453173532a00d91 (patch)
treef31edd7f7e10d8372c452229b4f9eb749647864f /runtime/debugger.cc
parent5d52f3dca52548f4a4598abd06432cad3dca6b8a (diff)
downloadart-15e9ad1d028d7f12cb598b075453173532a00d91.tar.gz
art-15e9ad1d028d7f12cb598b075453173532a00d91.tar.bz2
art-15e9ad1d028d7f12cb598b075453173532a00d91.zip
Intercept JNI invocation of String.<init> methods.
libmono uses JNI AllocObject and CallNonvirtualVoidMethod to create and initialize a string instead of using the recommended NewObject. This change adds an intercept to change the String.<init> call to a StringFactory call instead. Then, it uses the object id of the original string object referrer and maps it to the result of the StringFactory. Bug: 21288130 Change-Id: Ib4db402c178bc37188d5c5faf30b6e4fdc747b17
Diffstat (limited to 'runtime/debugger.cc')
-rw-r--r--runtime/debugger.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/runtime/debugger.cc b/runtime/debugger.cc
index 852ba49cd2..0eb7f2b855 100644
--- a/runtime/debugger.cc
+++ b/runtime/debugger.cc
@@ -3974,7 +3974,8 @@ void Dbg::ExecuteMethod(DebugInvokeReq* pReq) {
CHECK_EQ(sizeof(jvalue), sizeof(uint64_t));
- JValue result = InvokeWithJValues(soa, pReq->receiver.Read(), soa.EncodeMethod(m.Get()),
+ ScopedLocalRef<jobject> ref(soa.Env(), soa.AddLocalReference<jobject>(pReq->receiver.Read()));
+ JValue result = InvokeWithJValues(soa, ref.get(), soa.EncodeMethod(m.Get()),
reinterpret_cast<jvalue*>(pReq->arg_values));
pReq->result_tag = BasicTagFromDescriptor(m.Get()->GetShorty());