diff options
| author | 2017-06-12 22:22:50 +0000 | |
|---|---|---|
| committer | 2017-06-12 22:22:52 +0000 | |
| commit | a7548fee6122f594c6669e1dcfd7b1637ef19a47 (patch) | |
| tree | cd5f8cbffa0fd8f7225ebfff04d322344b706ef4 /runtime/gc/heap_verification_test.cc | |
| parent | bb5fd1bff12207489353e5f638e49637bbf4b619 (diff) | |
| parent | 4f5e3cb690547c0f85c1e6117786048d0348d3c6 (diff) | |
Merge "Add FirstPathFromRootSet and use it to debug reachability issues"
Diffstat (limited to 'runtime/gc/heap_verification_test.cc')
| -rw-r--r-- | runtime/gc/heap_verification_test.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/runtime/gc/heap_verification_test.cc b/runtime/gc/heap_verification_test.cc index a307c519cb..8ea0459c89 100644 --- a/runtime/gc/heap_verification_test.cc +++ b/runtime/gc/heap_verification_test.cc @@ -141,5 +141,24 @@ TEST_F(VerificationTest, LogHeapCorruption) { v->LogHeapCorruption(nullptr, MemberOffset(0), arr.Get(), false); } +TEST_F(VerificationTest, FindPathFromRootSet) { + TEST_DISABLED_FOR_MEMORY_TOOL(); + ScopedLogSeverity sls(LogSeverity::INFO); + ScopedObjectAccess soa(Thread::Current()); + Runtime* const runtime = Runtime::Current(); + VariableSizedHandleScope hs(soa.Self()); + Handle<mirror::ObjectArray<mirror::Object>> arr( + hs.NewHandle(AllocObjectArray<mirror::Object>(soa.Self(), 256))); + ObjPtr<mirror::String> str = mirror::String::AllocFromModifiedUtf8(soa.Self(), "obj"); + arr->Set(0, str); + const Verification* const v = runtime->GetHeap()->GetVerification(); + std::string path = v->FirstPathFromRootSet(str); + EXPECT_GT(path.length(), 0u); + std::ostringstream oss; + oss << arr.Get(); + EXPECT_NE(path.find(oss.str()), std::string::npos); + LOG(INFO) << path; +} + } // namespace gc } // namespace art |