diff options
author | Christopher Ferris <cferris@google.com> | 2018-06-13 10:46:34 -0700 |
---|---|---|
committer | Christopher Ferris <cferris@google.com> | 2018-06-15 12:29:13 -0700 |
commit | 2e1a40a2033088e7f2e78424a8b163d3fcf84b1b (patch) | |
tree | 51ec5d1703f6225d6dc58ad5b01f9c728e4f2883 /libc/malloc_debug/tests/malloc_debug_unit_tests.cpp | |
parent | 2583b0adb201233313bbe02f665f5c623f2c5a30 (diff) |
Change heap dump format slightly.
Bump the version from v1.1 to v1.2 and add a build fingerprint line.
Update the heap dump documentation to match the new format and reflect
what made it in P and what made it in Q.
Update the unit tests for this change.
Add -O0 to unit test code to make it easier to debug.
Add an external function that can be used by the framework code
so that there is only one way to dump the heap.
Bug: 110095681
Test: Ran unit tests.
Test: Did a dump of a real process and verified fingerprint.
Test: Did a dump of a process without malloc debug enabled.
Change-Id: I769a476cbeaf4c85c5d75bd6d6385f0e3add948c
Merged-In: I769a476cbeaf4c85c5d75bd6d6385f0e3add948c
(cherry picked from commit c84a2a2601a4112ca6e43a33defb989c1da8c2f4)
Diffstat (limited to 'libc/malloc_debug/tests/malloc_debug_unit_tests.cpp')
-rw-r--r-- | libc/malloc_debug/tests/malloc_debug_unit_tests.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp index 0663f6a46..cd6d2c28e 100644 --- a/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp +++ b/libc/malloc_debug/tests/malloc_debug_unit_tests.cpp @@ -1250,10 +1250,15 @@ static std::string SanitizeHeapData(const std::string& data) { continue; } } - if (line == "MAPS") { - skip_map_data = true; + + if (android::base::StartsWith(line, "Build fingerprint:")) { + sanitized += "Build fingerprint: ''\n"; + } else { + if (line == "MAPS") { + skip_map_data = true; + } + sanitized += line + '\n'; } - sanitized += line + '\n'; } return sanitized; } @@ -1312,7 +1317,9 @@ void MallocDebugTest::BacktraceDumpOnSignal(bool trigger_with_alloc) { std::string sanitized(SanitizeHeapData(actual)); std::string expected = -R"(Android Native Heap Dump v1.1 +R"(Android Native Heap Dump v1.2 + +Build fingerprint: '' Total memory: 405 Allocation records: 6 @@ -1377,7 +1384,9 @@ TEST_F(MallocDebugTest, backtrace_dump_on_exit) { std::string sanitized(SanitizeHeapData(actual)); std::string expected = -R"(Android Native Heap Dump v1.1 +R"(Android Native Heap Dump v1.2 + +Build fingerprint: '' Total memory: 1200 Allocation records: 3 @@ -1426,7 +1435,9 @@ TEST_F(MallocDebugTest, backtrace_dump_on_exit_shared_backtrace) { std::string sanitized(SanitizeHeapData(actual)); std::string expected = -R"(Android Native Heap Dump v1.1 +R"(Android Native Heap Dump v1.2 + +Build fingerprint: '' Total memory: 1000 Allocation records: 2 @@ -1482,7 +1493,9 @@ TEST_F(MallocDebugTest, backtrace_full_dump_on_exit) { std::string sanitized(SanitizeHeapData(actual)); std::string expected = -R"(Android Native Heap Dump v1.1 +R"(Android Native Heap Dump v1.2 + +Build fingerprint: '' Total memory: 1200 Allocation records: 3 |