summaryrefslogtreecommitdiff
path: root/src/exception_test.cc
diff options
context:
space:
mode:
author Elliott Hughes <enh@google.com> 2011-10-07 11:37:59 -0700
committer Elliott Hughes <enh@google.com> 2011-10-07 12:13:53 -0700
commita43cb5e8fb29989dbb986b9b91a68cda150aa3c8 (patch)
treede48a2f28f3515b8c668adbcf7d632cf6f76bbf1 /src/exception_test.cc
parent3320cf46afd082398aa401b246e6f301cebdf64d (diff)
Fix exception_test.cc and thread.cc and revert 3ddac99d4dc6a036fac59d8f0bdc664ef619fb04.
The test was wrong, and jni_compiler_test failed too because we'd missed one place where we need to mangle the PC. Change-Id: Ib67ca081e17b5ee8b8c64696082858b212b157f1
Diffstat (limited to 'src/exception_test.cc')
-rw-r--r--src/exception_test.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/exception_test.cc b/src/exception_test.cc
index 466211915e..fff638fcde 100644
--- a/src/exception_test.cc
+++ b/src/exception_test.cc
@@ -105,12 +105,13 @@ TEST_F(ExceptionTest, StackTraceElement) {
// Create two fake stack frames with mapping data created in SetUp. We map offset 3 in the code
// to dex pc 3, however, we set the return pc to 5 as the stack walker always subtracts two
// from a return pc.
+ const uintptr_t pc_offset = 3 + 2;
// Create/push fake 16byte stack frame for method g
fake_stack[top_of_stack++] = reinterpret_cast<uintptr_t>(method_g_);
fake_stack[top_of_stack++] = 0;
fake_stack[top_of_stack++] = 0;
- fake_stack[top_of_stack++] = reinterpret_cast<uintptr_t>(method_f_->GetCode()) + 5; // return pc
+ fake_stack[top_of_stack++] = reinterpret_cast<uintptr_t>(method_f_->GetCode()) + pc_offset; // return pc
// Create/push fake 16byte stack frame for method f
fake_stack[top_of_stack++] = reinterpret_cast<uintptr_t>(method_f_);
@@ -123,7 +124,7 @@ TEST_F(ExceptionTest, StackTraceElement) {
// Set up thread to appear as if we called out of method_g_ at pc 3
Thread* thread = Thread::Current();
- thread->SetTopOfStack(fake_stack, reinterpret_cast<uintptr_t>(method_g_->GetCode()) + 3);
+ thread->SetTopOfStack(fake_stack, reinterpret_cast<uintptr_t>(method_g_->GetCode()) + pc_offset); // return pc
JNIEnv* env = thread->GetJniEnv();
jobject internal = thread->CreateInternalStackTrace(env);