Elliott Hughes | 2faa5f1 | 2012-01-30 14:42:07 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 16 | |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 17 | #include "class_linker.h" |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 18 | #include "common_runtime_test.h" |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 19 | #include "dex_file.h" |
Elliott Hughes | 90a3369 | 2011-08-30 13:27:07 -0700 | [diff] [blame] | 20 | #include "gtest/gtest.h" |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 21 | #include "leb128.h" |
Ian Rogers | 4f6ad8a | 2013-03-18 15:27:28 -0700 | [diff] [blame] | 22 | #include "mirror/class-inl.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 23 | #include "mirror/object_array-inl.h" |
Ian Rogers | 04d7aa9 | 2013-03-16 14:29:17 -0700 | [diff] [blame] | 24 | #include "mirror/object-inl.h" |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 25 | #include "mirror/stack_trace_element.h" |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 26 | #include "runtime.h" |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 27 | #include "scoped_thread_state_change.h" |
Ian Rogers | 1f53934 | 2012-10-03 21:09:42 -0700 | [diff] [blame] | 28 | #include "sirt_ref.h" |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 29 | #include "thread.h" |
Elliott Hughes | a168c83 | 2012-06-12 15:34:20 -0700 | [diff] [blame] | 30 | #include "UniquePtr.h" |
Vladimir Marko | 2e589aa | 2014-02-25 17:53:53 +0000 | [diff] [blame] | 31 | #include "vmap_table.h" |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 32 | |
| 33 | namespace art { |
| 34 | |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 35 | class ExceptionTest : public CommonRuntimeTest { |
Shih-wei Liao | 1a18c8c | 2011-08-14 17:47:36 -0700 | [diff] [blame] | 36 | protected: |
| 37 | virtual void SetUp() { |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 38 | CommonRuntimeTest::SetUp(); |
Shih-wei Liao | 1a18c8c | 2011-08-14 17:47:36 -0700 | [diff] [blame] | 39 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 40 | ScopedObjectAccess soa(Thread::Current()); |
Mathieu Chartier | c528dba | 2013-11-26 12:00:11 -0800 | [diff] [blame] | 41 | SirtRef<mirror::ClassLoader> class_loader( |
| 42 | soa.Self(), soa.Decode<mirror::ClassLoader*>(LoadDex("ExceptionHandle"))); |
Ian Rogers | 9837939 | 2014-02-24 16:53:16 -0800 | [diff] [blame] | 43 | my_klass_ = class_linker_->FindClass(soa.Self(), "LExceptionHandle;", class_loader); |
Shih-wei Liao | 1a18c8c | 2011-08-14 17:47:36 -0700 | [diff] [blame] | 44 | ASSERT_TRUE(my_klass_ != NULL); |
Mathieu Chartier | c528dba | 2013-11-26 12:00:11 -0800 | [diff] [blame] | 45 | SirtRef<mirror::Class> sirt_klass(soa.Self(), my_klass_); |
| 46 | class_linker_->EnsureInitialized(sirt_klass, true, true); |
| 47 | my_klass_ = sirt_klass.get(); |
Brian Carlstrom | 33f741e | 2011-10-03 11:24:05 -0700 | [diff] [blame] | 48 | |
Ian Rogers | 4445a7e | 2012-10-05 17:19:13 -0700 | [diff] [blame] | 49 | dex_ = my_klass_->GetDexCache()->GetDexFile(); |
Brian Carlstrom | 33f741e | 2011-10-03 11:24:05 -0700 | [diff] [blame] | 50 | |
Brian Carlstrom | f8bbb84 | 2012-03-14 03:01:42 -0700 | [diff] [blame] | 51 | uint32_t code_size = 12; |
| 52 | fake_code_.push_back((code_size >> 24) & 0xFF); |
| 53 | fake_code_.push_back((code_size >> 16) & 0xFF); |
| 54 | fake_code_.push_back((code_size >> 8) & 0xFF); |
| 55 | fake_code_.push_back((code_size >> 0) & 0xFF); |
| 56 | for (size_t i = 0 ; i < code_size; i++) { |
| 57 | fake_code_.push_back(0x70 | i); |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 58 | } |
| 59 | |
Vladimir Marko | 1e6cb63 | 2013-11-28 16:27:29 +0000 | [diff] [blame] | 60 | fake_mapping_data_.PushBackUnsigned(4); // first element is count |
| 61 | fake_mapping_data_.PushBackUnsigned(4); // total (non-length) elements |
| 62 | fake_mapping_data_.PushBackUnsigned(2); // count of pc to dex elements |
Bill Buzbee | a5b3024 | 2012-09-28 07:19:44 -0700 | [diff] [blame] | 63 | // --- pc to dex table |
Vladimir Marko | 1e6cb63 | 2013-11-28 16:27:29 +0000 | [diff] [blame] | 64 | fake_mapping_data_.PushBackUnsigned(3 - 0); // offset 3 |
| 65 | fake_mapping_data_.PushBackSigned(3 - 0); // maps to dex offset 3 |
Bill Buzbee | a5b3024 | 2012-09-28 07:19:44 -0700 | [diff] [blame] | 66 | // --- dex to pc table |
Vladimir Marko | 1e6cb63 | 2013-11-28 16:27:29 +0000 | [diff] [blame] | 67 | fake_mapping_data_.PushBackUnsigned(3 - 0); // offset 3 |
| 68 | fake_mapping_data_.PushBackSigned(3 - 0); // maps to dex offset 3 |
Brian Carlstrom | 33f741e | 2011-10-03 11:24:05 -0700 | [diff] [blame] | 69 | |
Vladimir Marko | 2e589aa | 2014-02-25 17:53:53 +0000 | [diff] [blame] | 70 | fake_vmap_table_data_.PushBackUnsigned(0 + VmapTable::kEntryAdjustment); |
Mathieu Chartier | 342a262 | 2012-06-28 12:04:52 -0700 | [diff] [blame] | 71 | |
Ian Rogers | 5a6220c | 2012-09-24 10:52:10 -0700 | [diff] [blame] | 72 | fake_gc_map_.push_back(0); // 0 bytes to encode references and native pc offsets. |
| 73 | fake_gc_map_.push_back(0); |
| 74 | fake_gc_map_.push_back(0); // 0 entries. |
| 75 | fake_gc_map_.push_back(0); |
| 76 | |
Shih-wei Liao | 1a18c8c | 2011-08-14 17:47:36 -0700 | [diff] [blame] | 77 | method_f_ = my_klass_->FindVirtualMethod("f", "()I"); |
| 78 | ASSERT_TRUE(method_f_ != NULL); |
Andreas Gampe | cfa5c48 | 2014-03-12 14:11:40 -0700 | [diff] [blame] | 79 | method_f_->SetFrameSizeInBytes(4 * kPointerSize); |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 80 | method_f_->SetEntryPointFromQuickCompiledCode(&fake_code_[sizeof(code_size)]); |
Ian Rogers | 1809a72 | 2013-08-09 22:05:32 -0700 | [diff] [blame] | 81 | method_f_->SetMappingTable(&fake_mapping_data_.GetData()[0]); |
| 82 | method_f_->SetVmapTable(&fake_vmap_table_data_.GetData()[0]); |
Ian Rogers | 5a6220c | 2012-09-24 10:52:10 -0700 | [diff] [blame] | 83 | method_f_->SetNativeGcMap(&fake_gc_map_[0]); |
Brian Carlstrom | 33f741e | 2011-10-03 11:24:05 -0700 | [diff] [blame] | 84 | |
Shih-wei Liao | 1a18c8c | 2011-08-14 17:47:36 -0700 | [diff] [blame] | 85 | method_g_ = my_klass_->FindVirtualMethod("g", "(I)V"); |
| 86 | ASSERT_TRUE(method_g_ != NULL); |
Andreas Gampe | cfa5c48 | 2014-03-12 14:11:40 -0700 | [diff] [blame] | 87 | method_g_->SetFrameSizeInBytes(4 * kPointerSize); |
Brian Carlstrom | a1ce1fe | 2014-02-24 23:23:58 -0800 | [diff] [blame] | 88 | method_g_->SetEntryPointFromQuickCompiledCode(&fake_code_[sizeof(code_size)]); |
Ian Rogers | 1809a72 | 2013-08-09 22:05:32 -0700 | [diff] [blame] | 89 | method_g_->SetMappingTable(&fake_mapping_data_.GetData()[0]); |
| 90 | method_g_->SetVmapTable(&fake_vmap_table_data_.GetData()[0]); |
Ian Rogers | 5a6220c | 2012-09-24 10:52:10 -0700 | [diff] [blame] | 91 | method_g_->SetNativeGcMap(&fake_gc_map_[0]); |
Shih-wei Liao | 1a18c8c | 2011-08-14 17:47:36 -0700 | [diff] [blame] | 92 | } |
| 93 | |
Brian Carlstrom | 33f741e | 2011-10-03 11:24:05 -0700 | [diff] [blame] | 94 | const DexFile* dex_; |
Shih-wei Liao | 1a18c8c | 2011-08-14 17:47:36 -0700 | [diff] [blame] | 95 | |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 96 | std::vector<uint8_t> fake_code_; |
Vladimir Marko | 1e6cb63 | 2013-11-28 16:27:29 +0000 | [diff] [blame] | 97 | Leb128EncodingVector fake_mapping_data_; |
| 98 | Leb128EncodingVector fake_vmap_table_data_; |
Ian Rogers | 5a6220c | 2012-09-24 10:52:10 -0700 | [diff] [blame] | 99 | std::vector<uint8_t> fake_gc_map_; |
Brian Carlstrom | 3320cf4 | 2011-10-04 14:58:28 -0700 | [diff] [blame] | 100 | |
Brian Carlstrom | ea46f95 | 2013-07-30 01:26:50 -0700 | [diff] [blame] | 101 | mirror::ArtMethod* method_f_; |
| 102 | mirror::ArtMethod* method_g_; |
Shih-wei Liao | 1a18c8c | 2011-08-14 17:47:36 -0700 | [diff] [blame] | 103 | |
| 104 | private: |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 105 | mirror::Class* my_klass_; |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 106 | }; |
| 107 | |
Shih-wei Liao | 1a18c8c | 2011-08-14 17:47:36 -0700 | [diff] [blame] | 108 | TEST_F(ExceptionTest, FindCatchHandler) { |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 109 | ScopedObjectAccess soa(Thread::Current()); |
Brian Carlstrom | 33f741e | 2011-10-03 11:24:05 -0700 | [diff] [blame] | 110 | const DexFile::CodeItem* code_item = dex_->GetCodeItem(method_f_->GetCodeItemOffset()); |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 111 | |
| 112 | ASSERT_TRUE(code_item != NULL); |
| 113 | |
| 114 | ASSERT_EQ(2u, code_item->tries_size_); |
Ian Rogers | d81871c | 2011-10-03 13:57:23 -0700 | [diff] [blame] | 115 | ASSERT_NE(0u, code_item->insns_size_in_code_units_); |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 116 | |
Elliott Hughes | 7b9d996 | 2012-04-20 18:48:18 -0700 | [diff] [blame] | 117 | const DexFile::TryItem *t0, *t1; |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 118 | t0 = dex_->GetTryItems(*code_item, 0); |
| 119 | t1 = dex_->GetTryItems(*code_item, 1); |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 120 | EXPECT_LE(t0->start_addr_, t1->start_addr_); |
Ian Rogers | 0571d35 | 2011-11-03 19:51:38 -0700 | [diff] [blame] | 121 | { |
| 122 | CatchHandlerIterator iter(*code_item, 4 /* Dex PC in the first try block */); |
| 123 | EXPECT_STREQ("Ljava/io/IOException;", dex_->StringByTypeIdx(iter.GetHandlerTypeIndex())); |
| 124 | ASSERT_TRUE(iter.HasNext()); |
| 125 | iter.Next(); |
| 126 | EXPECT_STREQ("Ljava/lang/Exception;", dex_->StringByTypeIdx(iter.GetHandlerTypeIndex())); |
| 127 | ASSERT_TRUE(iter.HasNext()); |
| 128 | iter.Next(); |
| 129 | EXPECT_FALSE(iter.HasNext()); |
| 130 | } |
| 131 | { |
| 132 | CatchHandlerIterator iter(*code_item, 8 /* Dex PC in the second try block */); |
| 133 | EXPECT_STREQ("Ljava/io/IOException;", dex_->StringByTypeIdx(iter.GetHandlerTypeIndex())); |
| 134 | ASSERT_TRUE(iter.HasNext()); |
| 135 | iter.Next(); |
| 136 | EXPECT_FALSE(iter.HasNext()); |
| 137 | } |
| 138 | { |
| 139 | CatchHandlerIterator iter(*code_item, 11 /* Dex PC not in any try block */); |
| 140 | EXPECT_FALSE(iter.HasNext()); |
| 141 | } |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 142 | } |
| 143 | |
Shih-wei Liao | 55df06b | 2011-08-26 14:39:27 -0700 | [diff] [blame] | 144 | TEST_F(ExceptionTest, StackTraceElement) { |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 145 | Thread* thread = Thread::Current(); |
Ian Rogers | 0fb6bb5 | 2012-08-14 15:10:19 -0700 | [diff] [blame] | 146 | thread->TransitionFromSuspendedToRunnable(); |
Brian Carlstrom | bd86bcc | 2013-03-10 20:26:16 -0700 | [diff] [blame] | 147 | bool started = runtime_->Start(); |
| 148 | CHECK(started); |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 149 | JNIEnv* env = thread->GetJniEnv(); |
| 150 | ScopedObjectAccess soa(env); |
Brian Carlstrom | 25c3325 | 2011-09-18 15:58:35 -0700 | [diff] [blame] | 151 | |
Elliott Hughes | 3b6baaa | 2011-10-14 19:13:56 -0700 | [diff] [blame] | 152 | std::vector<uintptr_t> fake_stack; |
Brian Carlstrom | ba150c3 | 2013-08-27 17:31:03 -0700 | [diff] [blame] | 153 | ASSERT_EQ(kStackAlignment, 16U); |
Andreas Gampe | cfa5c48 | 2014-03-12 14:11:40 -0700 | [diff] [blame] | 154 | // ASSERT_EQ(sizeof(uintptr_t), sizeof(uint32_t)); |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 155 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 156 | if (!kUsePortableCompiler) { |
| 157 | // Create two fake stack frames with mapping data created in SetUp. We map offset 3 in the code |
| 158 | // to dex pc 3. |
| 159 | const uint32_t dex_pc = 3; |
Ian Rogers | f57c47c | 2011-10-06 00:06:17 -0700 | [diff] [blame] | 160 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 161 | // Create/push fake 16byte stack frame for method g |
| 162 | fake_stack.push_back(reinterpret_cast<uintptr_t>(method_g_)); |
| 163 | fake_stack.push_back(0); |
| 164 | fake_stack.push_back(0); |
| 165 | fake_stack.push_back(method_f_->ToNativePc(dex_pc)); // return pc |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 166 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 167 | // Create/push fake 16byte stack frame for method f |
| 168 | fake_stack.push_back(reinterpret_cast<uintptr_t>(method_f_)); |
| 169 | fake_stack.push_back(0); |
| 170 | fake_stack.push_back(0); |
| 171 | fake_stack.push_back(0xEBAD6070); // return pc |
Ian Rogers | 0cfe1fb | 2011-08-26 03:29:44 -0700 | [diff] [blame] | 172 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 173 | // Pull Method* of NULL to terminate the trace |
| 174 | fake_stack.push_back(0); |
Shih-wei Liao | 55df06b | 2011-08-26 14:39:27 -0700 | [diff] [blame] | 175 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 176 | // Push null values which will become null incoming arguments. |
| 177 | fake_stack.push_back(0); |
| 178 | fake_stack.push_back(0); |
| 179 | fake_stack.push_back(0); |
Mathieu Chartier | 342a262 | 2012-06-28 12:04:52 -0700 | [diff] [blame] | 180 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 181 | // Set up thread to appear as if we called out of method_g_ at pc dex 3 |
Andreas Gampe | bf6b92a | 2014-03-05 16:11:04 -0800 | [diff] [blame] | 182 | thread->SetTopOfStack(reinterpret_cast<mirror::ArtMethod**>(&fake_stack[0]), method_g_->ToNativePc(dex_pc)); // return pc |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 183 | } else { |
| 184 | // Create/push fake 20-byte shadow frame for method g |
| 185 | fake_stack.push_back(0); |
| 186 | fake_stack.push_back(0); |
| 187 | fake_stack.push_back(reinterpret_cast<uintptr_t>(method_g_)); |
| 188 | fake_stack.push_back(3); |
| 189 | fake_stack.push_back(0); |
Shih-wei Liao | 02f01fe | 2012-03-26 12:58:11 -0700 | [diff] [blame] | 190 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 191 | // Create/push fake 20-byte shadow frame for method f |
| 192 | fake_stack.push_back(0); |
| 193 | fake_stack.push_back(0); |
| 194 | fake_stack.push_back(reinterpret_cast<uintptr_t>(method_f_)); |
| 195 | fake_stack.push_back(3); |
| 196 | fake_stack.push_back(0); |
Shih-wei Liao | 02f01fe | 2012-03-26 12:58:11 -0700 | [diff] [blame] | 197 | |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 198 | thread->PushShadowFrame(reinterpret_cast<ShadowFrame*>(&fake_stack[5])); |
| 199 | thread->PushShadowFrame(reinterpret_cast<ShadowFrame*>(&fake_stack[0])); |
| 200 | } |
Shih-wei Liao | 55df06b | 2011-08-26 14:39:27 -0700 | [diff] [blame] | 201 | |
Ian Rogers | 00f7d0e | 2012-07-19 15:28:27 -0700 | [diff] [blame] | 202 | jobject internal = thread->CreateInternalStackTrace(soa); |
Brian Carlstrom | 2673644 | 2012-02-16 18:24:26 -0800 | [diff] [blame] | 203 | ASSERT_TRUE(internal != NULL); |
Ian Rogers | 53b8b09 | 2014-03-13 23:45:53 -0700 | [diff] [blame^] | 204 | jobjectArray ste_array = Thread::InternalStackTraceToStackTraceElementArray(soa, internal); |
Brian Carlstrom | 2673644 | 2012-02-16 18:24:26 -0800 | [diff] [blame] | 205 | ASSERT_TRUE(ste_array != NULL); |
Ian Rogers | 2dd0e2c | 2013-01-24 12:42:14 -0800 | [diff] [blame] | 206 | mirror::ObjectArray<mirror::StackTraceElement>* trace_array = |
| 207 | soa.Decode<mirror::ObjectArray<mirror::StackTraceElement>*>(ste_array); |
Shih-wei Liao | 55df06b | 2011-08-26 14:39:27 -0700 | [diff] [blame] | 208 | |
Brian Carlstrom | 2673644 | 2012-02-16 18:24:26 -0800 | [diff] [blame] | 209 | ASSERT_TRUE(trace_array != NULL); |
Shih-wei Liao | 55df06b | 2011-08-26 14:39:27 -0700 | [diff] [blame] | 210 | ASSERT_TRUE(trace_array->Get(0) != NULL); |
Brian Carlstrom | 33f741e | 2011-10-03 11:24:05 -0700 | [diff] [blame] | 211 | EXPECT_STREQ("ExceptionHandle", |
Shih-wei Liao | 4417536 | 2011-08-28 16:59:17 -0700 | [diff] [blame] | 212 | trace_array->Get(0)->GetDeclaringClass()->ToModifiedUtf8().c_str()); |
Brian Carlstrom | 33f741e | 2011-10-03 11:24:05 -0700 | [diff] [blame] | 213 | EXPECT_STREQ("ExceptionHandle.java", trace_array->Get(0)->GetFileName()->ToModifiedUtf8().c_str()); |
Shih-wei Liao | 55df06b | 2011-08-26 14:39:27 -0700 | [diff] [blame] | 214 | EXPECT_STREQ("g", trace_array->Get(0)->GetMethodName()->ToModifiedUtf8().c_str()); |
Brian Carlstrom | 06ed739 | 2012-01-31 01:25:48 -0800 | [diff] [blame] | 215 | EXPECT_EQ(37, trace_array->Get(0)->GetLineNumber()); |
Shih-wei Liao | 55df06b | 2011-08-26 14:39:27 -0700 | [diff] [blame] | 216 | |
| 217 | ASSERT_TRUE(trace_array->Get(1) != NULL); |
Brian Carlstrom | 33f741e | 2011-10-03 11:24:05 -0700 | [diff] [blame] | 218 | EXPECT_STREQ("ExceptionHandle", |
Shih-wei Liao | 4417536 | 2011-08-28 16:59:17 -0700 | [diff] [blame] | 219 | trace_array->Get(1)->GetDeclaringClass()->ToModifiedUtf8().c_str()); |
Brian Carlstrom | 33f741e | 2011-10-03 11:24:05 -0700 | [diff] [blame] | 220 | EXPECT_STREQ("ExceptionHandle.java", trace_array->Get(1)->GetFileName()->ToModifiedUtf8().c_str()); |
Shih-wei Liao | 55df06b | 2011-08-26 14:39:27 -0700 | [diff] [blame] | 221 | EXPECT_STREQ("f", trace_array->Get(1)->GetMethodName()->ToModifiedUtf8().c_str()); |
Brian Carlstrom | 06ed739 | 2012-01-31 01:25:48 -0800 | [diff] [blame] | 222 | EXPECT_EQ(22, trace_array->Get(1)->GetLineNumber()); |
Elliott Hughes | a43e093 | 2012-03-27 18:35:33 -0700 | [diff] [blame] | 223 | |
Ian Rogers | c928de9 | 2013-02-27 14:30:44 -0800 | [diff] [blame] | 224 | #if !defined(ART_USE_PORTABLE_COMPILER) |
Brian Carlstrom | 7934ac2 | 2013-07-26 10:54:15 -0700 | [diff] [blame] | 225 | thread->SetTopOfStack(NULL, 0); // Disarm the assertion that no code is running when we detach. |
Ian Rogers | 0399dde | 2012-06-06 17:09:28 -0700 | [diff] [blame] | 226 | #else |
| 227 | thread->PopShadowFrame(); |
| 228 | thread->PopShadowFrame(); |
Elliott Hughes | a43e093 | 2012-03-27 18:35:33 -0700 | [diff] [blame] | 229 | #endif |
Shih-wei Liao | 55df06b | 2011-08-26 14:39:27 -0700 | [diff] [blame] | 230 | } |
| 231 | |
Shih-wei Liao | 2fb9753 | 2011-08-11 16:17:23 -0700 | [diff] [blame] | 232 | } // namespace art |