diff --git a/compiler-rt/lib/memprof/memprof_allocator.cpp b/compiler-rt/lib/memprof/memprof_allocator.cpp --- a/compiler-rt/lib/memprof/memprof_allocator.cpp +++ b/compiler-rt/lib/memprof/memprof_allocator.cpp @@ -252,6 +252,8 @@ InsertLiveBlocks(); if (print_text) { + if (!flags()->print_terse) + Printf("Recorded MIBs (incl. live on exit):\n"); MIBMap.ForEach(PrintCallback, reinterpret_cast(flags()->print_terse)); StackDepotPrintAll(); @@ -271,9 +273,6 @@ // Inserts any blocks which have been allocated but not yet deallocated. void InsertLiveBlocks() { - if (print_text && !flags()->print_terse) - Printf("Live on exit:\n"); - allocator.ForEachChunk( [](uptr chunk, void *alloc) { u64 user_requested_size; diff --git a/compiler-rt/test/memprof/TestCases/memprof_profile_dump.cpp b/compiler-rt/test/memprof/TestCases/memprof_profile_dump.cpp --- a/compiler-rt/test/memprof/TestCases/memprof_profile_dump.cpp +++ b/compiler-rt/test/memprof/TestCases/memprof_profile_dump.cpp @@ -1,7 +1,7 @@ -// RUN: %clangxx_memprof %s -o %t +// RUN: %clangxx_memprof %s -o %t // RUN: %env_memprof_opts=print_text=true:log_path=stdout %run %t | FileCheck --check-prefix=CHECK-TEXT %s -// RUN: %env_memprof_opts=print_text=true:log_path=stdout,print_text=false %run %t > %t.memprofraw +// RUN: %env_memprof_opts=log_path=stdout %run %t > %t.memprofraw // RUN: od -c -N 8 %t.memprofraw | FileCheck --check-prefix=CHECK-RAW %s #include @@ -19,8 +19,12 @@ } // We should get 2 rounds of profile info, one from the explicit dump request, // and one at exit. +// +// CHECK-TEXT: Recorded MIBs (incl. live on exit): // CHECK-TEXT: Memory allocation stack id // CHECK-TEXT: Stack for id +// +// CHECK-TEXT: Recorded MIBs (incl. live on exit): // CHECK-TEXT: Memory allocation stack id // CHECK-TEXT: Stack for id //