diff options
author | Andreas Kling <kling@serenityos.org> | 2020-07-16 17:16:21 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-16 19:21:45 +0200 |
commit | dd68370efce4816dabab1b96dcb7ea4dd34c5d27 (patch) | |
tree | 89323979e16a691800bb477700b5a6c181f2960c | |
parent | 441918be7e0e3755979ee94312e6a5d23a2953ac (diff) | |
download | serenity-dd68370efce4816dabab1b96dcb7ea4dd34c5d27.zip |
UserspaceEmulator: Put the memory reachability logging behind a macro
-rw-r--r-- | DevTools/UserspaceEmulator/MallocTracer.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/DevTools/UserspaceEmulator/MallocTracer.cpp b/DevTools/UserspaceEmulator/MallocTracer.cpp index 426d4b89b5..07b8123454 100644 --- a/DevTools/UserspaceEmulator/MallocTracer.cpp +++ b/DevTools/UserspaceEmulator/MallocTracer.cpp @@ -29,6 +29,8 @@ #include "MmapRegion.h" #include <AK/LogStream.h> +//#define REACHABLE_DEBUG + namespace UserspaceEmulator { static pid_t s_pid = getpid(); @@ -140,7 +142,9 @@ bool MallocTracer::is_reachable(const Mallocation& mallocation) const for (size_t i = 0; i < pointers_in_mallocation; ++i) { auto value = Emulator::the().mmu().read32({ 0x20, other_mallocation.address + i * sizeof(u32) }); if (value == mallocation.address) { +#ifdef REACHABLE_DEBUG dbgprintf("mallocation %p is reachable from other mallocation %p\n", mallocation.address, other_mallocation.address); +#endif return true; } } @@ -159,7 +163,9 @@ bool MallocTracer::is_reachable(const Mallocation& mallocation) const for (size_t i = 0; i < pointers_in_region; ++i) { auto value = region.read32(i * sizeof(u32)); if (value == mallocation.address) { +#ifdef REACHABLE_DEBUG dbgprintf("mallocation %p is reachable from region %p-%p\n", mallocation.address, region.base(), region.end() - 1); +#endif return true; } } |