Send holder to Mark in ConcurrentCopying::Process for GC verification
Aims to log more when heap corruption is detected.
Test: test-art-host-gtest-verification_test
Test: test-art-host
Bug: 38409177
Change-Id: I6dd1872a707e384ae8b8cb16ec0845852a5dc183
diff --git a/runtime/gc/collector/concurrent_copying.cc b/runtime/gc/collector/concurrent_copying.cc
index b0218b5..ef843c6 100644
--- a/runtime/gc/collector/concurrent_copying.cc
+++ b/runtime/gc/collector/concurrent_copying.cc
@@ -2070,7 +2070,10 @@
DCHECK_EQ(Thread::Current(), thread_running_gc_);
mirror::Object* ref = obj->GetFieldObject<
mirror::Object, kVerifyNone, kWithoutReadBarrier, false>(offset);
- mirror::Object* to_ref = Mark</*kGrayImmuneObject*/false, /*kFromGCThread*/true>(ref);
+ mirror::Object* to_ref = Mark</*kGrayImmuneObject*/false, /*kFromGCThread*/true>(
+ ref,
+ /*holder*/ obj,
+ offset);
if (to_ref == ref) {
return;
}
diff --git a/runtime/gc/verification.cc b/runtime/gc/verification.cc
index 7b31c8a..c14f250 100644
--- a/runtime/gc/verification.cc
+++ b/runtime/gc/verification.cc
@@ -86,8 +86,8 @@
std::ostringstream oss;
oss << "GC tried to mark invalid reference " << ref << std::endl;
oss << DumpObjectInfo(ref, "ref") << "\n";
+ oss << DumpObjectInfo(holder.Ptr(), "holder");
if (holder != nullptr) {
- oss << DumpObjectInfo(holder.Ptr(), "holder");
mirror::Class* holder_klass = holder->GetClass<kVerifyNone, kWithoutReadBarrier>();
if (IsValidClass(holder_klass)) {
oss << "field_offset=" << offset.Uint32Value();