OSDN Git Service

Logging improvements for C++ / Java structure issues
authorNeil Fuller <nfuller@google.com>
Wed, 17 Aug 2016 10:39:26 +0000 (11:39 +0100)
committerNeil Fuller <nfuller@google.com>
Wed, 17 Aug 2016 10:39:26 +0000 (11:39 +0100)
When C++ and Java structures are different sizes or arranged
differently some log statements are useful but are hard to
pick out because they merge with other log lines. Adding
"\n" to the end of them makes it easier to read.

Change-Id: Ia6d78e0832c7814bf1fef42bb3d8c056f83766bd
Test: make build-art-host

runtime/gc/collector/mark_sweep.cc
runtime/mirror/class.cc

index e276137..1d15ee7 100644 (file)
@@ -413,7 +413,7 @@ class MarkSweep::MarkObjectSlowPath {
     if (UNLIKELY(obj == nullptr || !IsAligned<kPageSize>(obj) ||
                  (kIsDebugBuild && large_object_space != nullptr &&
                      !large_object_space->Contains(obj)))) {
-      LOG(INTERNAL_FATAL) << "Tried to mark " << obj << " not contained by any spaces";
+      LOG(INTERNAL_FATAL) << "Tried to mark " << obj << " not contained by any spaces\n";
       if (holder_ != nullptr) {
         size_t holder_size = holder_->SizeOf();
         ArtField* field = holder_->FindFieldByOffset(offset_);
@@ -442,7 +442,7 @@ class MarkSweep::MarkObjectSlowPath {
         for (size_t i = 0; i < holder_size / sizeof(uint32_t); ++i) {
           uint32_t* p = reinterpret_cast<uint32_t*>(holder_);
           LOG(INTERNAL_FATAL) << &p[i] << ": " << "holder+" << (i * sizeof(uint32_t)) << " = "
-                              << std::hex << p[i];
+                              << std::hex << p[i] << "\n";
         }
       }
       PrintFileToLog("/proc/self/maps", LogSeverity::INTERNAL_FATAL);
index f948be7..1cf9dd1 100644 (file)
@@ -136,7 +136,7 @@ void Class::SetDexCache(DexCache* new_dex_cache) {
 void Class::SetClassSize(uint32_t new_class_size) {
   if (kIsDebugBuild && new_class_size < GetClassSize()) {
     DumpClass(LOG(INTERNAL_FATAL), kDumpClassFullDetail);
-    LOG(INTERNAL_FATAL) << new_class_size << " vs " << GetClassSize();
+    LOG(INTERNAL_FATAL) << new_class_size << " vs " << GetClassSize() << "\n";
     LOG(FATAL) << " class=" << PrettyTypeOf(this);
   }
   // Not called within a transaction.