ART: Add more logging to ClassLoaderContext mismatches
To aid in debugging, add the original specifications to the warning.
Bug: 63977059
Test: m test-art-host
Change-Id: Icbf7da9cbce1641b99d8572e09d74141c71e9fe9
diff --git a/runtime/class_loader_context.cc b/runtime/class_loader_context.cc
index eab3b86..0723ad3 100644
--- a/runtime/class_loader_context.cc
+++ b/runtime/class_loader_context.cc
@@ -599,7 +599,8 @@
if (expected_context.class_loader_chain_.size() != class_loader_chain_.size()) {
LOG(WARNING) << "ClassLoaderContext size mismatch. expected="
<< expected_context.class_loader_chain_.size()
- << ", actual=" << class_loader_chain_.size();
+ << ", actual=" << class_loader_chain_.size()
+ << " (" << context_spec << " | " << EncodeContextForOatFile("") << ")";
return false;
}
@@ -609,13 +610,15 @@
if (info.type != expected_info.type) {
LOG(WARNING) << "ClassLoaderContext type mismatch for position " << i
<< ". expected=" << GetClassLoaderTypeName(expected_info.type)
- << ", found=" << GetClassLoaderTypeName(info.type);
+ << ", found=" << GetClassLoaderTypeName(info.type)
+ << " (" << context_spec << " | " << EncodeContextForOatFile("") << ")";
return false;
}
if (info.classpath.size() != expected_info.classpath.size()) {
LOG(WARNING) << "ClassLoaderContext classpath size mismatch for position " << i
<< ". expected=" << expected_info.classpath.size()
- << ", found=" << info.classpath.size();
+ << ", found=" << info.classpath.size()
+ << " (" << context_spec << " | " << EncodeContextForOatFile("") << ")";
return false;
}
@@ -626,13 +629,15 @@
if (info.classpath[k] != expected_info.classpath[k]) {
LOG(WARNING) << "ClassLoaderContext classpath element mismatch for position " << i
<< ". expected=" << expected_info.classpath[k]
- << ", found=" << info.classpath[k];
+ << ", found=" << info.classpath[k]
+ << " (" << context_spec << " | " << EncodeContextForOatFile("") << ")";
return false;
}
if (info.checksums[k] != expected_info.checksums[k]) {
LOG(WARNING) << "ClassLoaderContext classpath element checksum mismatch for position " << i
<< ". expected=" << expected_info.checksums[k]
- << ", found=" << info.checksums[k];
+ << ", found=" << info.checksums[k]
+ << " (" << context_spec << " | " << EncodeContextForOatFile("") << ")";
return false;
}
}