From e3506ead69366c0ed749bf5621eab902003ccfaf Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sat, 1 Mar 2014 21:01:03 -0800 Subject: [PATCH] Clear the symbol map between each test. This way we could, for example, test function replacement properly. Actually slows down tests because it spends more time correctly determining the function boundaries. --- Core/Debugger/SymbolMap.cpp | 14 ++++++++++---- headless/StubHost.h | 5 +++-- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/Core/Debugger/SymbolMap.cpp b/Core/Debugger/SymbolMap.cpp index e3a0b56dae..9e5f07587b 100644 --- a/Core/Debugger/SymbolMap.cpp +++ b/Core/Debugger/SymbolMap.cpp @@ -615,15 +615,21 @@ void SymbolMap::AssignFunctionIndices() { void SymbolMap::UpdateActiveSymbols() { // return; (slow in debug mode) lock_guard guard(lock_); - std::map activeModuleIndexes; - for (auto it = activeModuleEnds.begin(), end = activeModuleEnds.end(); it != end; ++it) { - activeModuleIndexes[it->second.index] = it->second.start; - } activeFunctions.clear(); activeLabels.clear(); activeData.clear(); + // On startup and shutdown, we can skip the rest. Tiny optimization. + if (activeModuleEnds.empty() || (functions.empty() && labels.empty() && data.empty())) { + return; + } + + std::map activeModuleIndexes; + for (auto it = activeModuleEnds.begin(), end = activeModuleEnds.end(); it != end; ++it) { + activeModuleIndexes[it->second.index] = it->second.start; + } + for (auto it = functions.begin(), end = functions.end(); it != end; ++it) { const auto mod = activeModuleIndexes.find(it->second.module); if (it->second.module == 0) { diff --git a/headless/StubHost.h b/headless/StubHost.h index 47ad6886d1..3247abccf1 100644 --- a/headless/StubHost.h +++ b/headless/StubHost.h @@ -17,7 +17,8 @@ #pragma once -#include "../Core/Host.h" +#include "Core/Host.h" +#include "Core/Debugger/SymbolMap.h" #define HEADLESSHOST_CLASS HeadlessHost @@ -44,7 +45,7 @@ public: virtual void BootDone() {} virtual bool IsDebuggingEnabled() {return false;} - virtual bool AttemptLoadSymbolMap() {return false;} + virtual bool AttemptLoadSymbolMap() { symbolMap.Clear(); return false; } virtual bool ShouldSkipUI() { return true; }