From 8b16dbd35ee2fa2a2a611300328c7c62a8805ea5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jos=C3=A9=20Fonseca?= Date: Sat, 7 Apr 2012 10:23:33 +0100 Subject: [PATCH] Debug output of region mappings. --- retrace_stdc.cpp | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/retrace_stdc.cpp b/retrace_stdc.cpp index 53cacb9..e6b108b 100644 --- a/retrace_stdc.cpp +++ b/retrace_stdc.cpp @@ -90,6 +90,17 @@ upperBound(unsigned long long address) { void addRegion(unsigned long long address, void *buffer, unsigned long long size) { + if (retrace::verbosity >= 2) { + std::cout + << "region " + << std::hex + << "0x" << address << "-0x" << (address + size) + << " -> " + << "0x" << (uintptr_t)buffer << "-0x" << ((uintptr_t)buffer + size) + << std::dec + << "\n"; + } + if (!address) { // Ignore NULL pointer assert(!buffer); @@ -166,7 +177,20 @@ lookupAddress(unsigned long long address) { if (it != regionMap.end()) { unsigned long long offset = address - it->first; assert(offset < it->second.size); - return (char *)it->second.buffer + offset; + void *addr = (char *)it->second.buffer + offset; + + if (retrace::verbosity >= 2) { + std::cout + << "region " + << std::hex + << "0x" << address + << " <- " + << "0x" << (uintptr_t)addr + << std::dec + << "\n"; + } + + return addr; } if (address >= 0x00400000) { -- 2.7.4