From 9236be5acb06ed1281e5e5e051696d4453f67a27 Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Thu, 18 Jan 2018 20:56:19 +0300 Subject: [PATCH] Refactor Modules namespace into Modules class --- src/debug/netcoredbg/breakpoints.cpp | 7 +- src/debug/netcoredbg/commands.cpp | 5 +- src/debug/netcoredbg/debugger.h | 26 +++++ src/debug/netcoredbg/expr.cpp | 40 ++++---- src/debug/netcoredbg/expr.h | 5 - src/debug/netcoredbg/frames.cpp | 7 +- src/debug/netcoredbg/frames.h | 3 +- src/debug/netcoredbg/main.cpp | 12 +-- src/debug/netcoredbg/modules.cpp | 119 +++++++++++------------ src/debug/netcoredbg/modules.h | 138 ++++++++++++++++----------- src/debug/netcoredbg/valuewalk.cpp | 4 +- src/debug/netcoredbg/variables.cpp | 2 - 12 files changed, 194 insertions(+), 174 deletions(-) delete mode 100644 src/debug/netcoredbg/expr.h diff --git a/src/debug/netcoredbg/breakpoints.cpp b/src/debug/netcoredbg/breakpoints.cpp index 6ce65f8..aa7860c 100644 --- a/src/debug/netcoredbg/breakpoints.cpp +++ b/src/debug/netcoredbg/breakpoints.cpp @@ -9,7 +9,6 @@ #include #include "debugger.h" -#include "modules.h" Debugger::ManagedBreakpoint::ManagedBreakpoint() : @@ -45,7 +44,7 @@ HRESULT Debugger::HitBreakpoint(ICorDebugThread *pThread, Breakpoint &breakpoint return E_FAIL; IfFailRet(pFrame->GetFunctionToken(&methodToken)); - IfFailRet(Modules::GetFrameLocation(pFrame, ilOffset, sp)); + IfFailRet(m_modules.GetFrameILAndSequencePoint(pFrame, ilOffset, sp)); std::lock_guard lock(m_breakpointsMutex); @@ -93,7 +92,7 @@ HRESULT Debugger::ResolveBreakpointInModule(ICorDebugModule *pModule, ManagedBre ULONG32 ilOffset; std::string fullname; - IfFailRet(Modules::GetLocationInModule( + IfFailRet(m_modules.GetLocationInModule( pModule, bp.fullname, bp.linenum, @@ -155,7 +154,7 @@ HRESULT Debugger::ResolveBreakpoint(ManagedBreakpoint &bp) ToRelease pModule; - IfFailRet(Modules::GetLocationInAny( + IfFailRet(m_modules.GetLocationInAny( bp.fullname, bp.linenum, ilOffset, diff --git a/src/debug/netcoredbg/commands.cpp b/src/debug/netcoredbg/commands.cpp index 11fbfd7..8b388ea 100644 --- a/src/debug/netcoredbg/commands.cpp +++ b/src/debug/netcoredbg/commands.cpp @@ -18,7 +18,6 @@ #include "platform.h" #include "debugger.h" -#include "modules.h" #include "frames.h" @@ -189,7 +188,7 @@ HRESULT Debugger::SetupStep(ICorDebugThread *pThread, Debugger::StepType stepTyp BOOL bStepIn = stepType == STEP_IN; COR_DEBUG_STEP_RANGE range; - if (SUCCEEDED(Modules::GetStepRangeFromCurrentIP(pThread, &range))) + if (SUCCEEDED(m_modules.GetStepRangeFromCurrentIP(pThread, &range))) { IfFailRet(pStepper->StepRange(bStepIn, &range, 1)); } else { @@ -242,7 +241,7 @@ HRESULT Debugger::GetStackTrace(int threadId, int lowFrame, int highFrame, std:: return E_FAIL; ToRelease pThread; IfFailRet(m_pProcess->GetThread(threadId, &pThread)); - return ::GetStackTrace(pThread, lowFrame, highFrame, stackFrames); + return GetStackTrace(pThread, lowFrame, highFrame, stackFrames); } HRESULT MIProtocol::StepCommand(const std::vector &args, diff --git a/src/debug/netcoredbg/debugger.h b/src/debug/netcoredbg/debugger.h index 563c48f..62dab3e 100644 --- a/src/debug/netcoredbg/debugger.h +++ b/src/debug/netcoredbg/debugger.h @@ -3,6 +3,7 @@ // See the LICENSE file in the project root for more information. #include "protocol.h" +#include "modules.h" #include #include #include @@ -28,6 +29,7 @@ public: typedef std::function WalkMembersCallback; typedef std::function WalkStackVarsCallback; + Modules &m_modules; private: ToRelease m_pRunClassConstructor; @@ -98,8 +100,23 @@ private: ULONG rawValueLength, ICorDebugValue **ppLiteralValue); + HRESULT FindType( + const std::vector &parts, + int &nextPart, + ICorDebugThread *pThread, + ICorDebugModule *pModule, + ICorDebugType **ppType, + ICorDebugModule **ppModule = nullptr); + + HRESULT ResolveParameters( + const std::vector ¶ms, + ICorDebugThread *pThread, + std::vector< ToRelease > &types); + public: + Evaluator(Modules &modules) : m_modules(modules) {} + HRESULT RunClassConstructor(ICorDebugThread *pThread, ICorDebugValue *pValue); HRESULT EvalFunction( @@ -125,6 +142,11 @@ public: std::function cb ); + HRESULT GetType( + const std::string &typeName, + ICorDebugThread *pThread, + ICorDebugType **ppType); + HRESULT WalkMembers( ICorDebugValue *pValue, ICorDebugThread *pThread, @@ -166,6 +188,7 @@ private: void SetLastStoppedThread(ICorDebugThread *pThread); + Modules m_modules; Evaluator m_evaluator; Protocol *m_protocol; ManagedCallback *m_managedCallback; @@ -283,6 +306,9 @@ private: ICorDebugValue *pValue, unsigned int &numchild, bool static_members = false); + + HRESULT GetStackTrace(ICorDebugThread *pThread, int lowFrame, int highFrame, std::vector &stackFrames); + HRESULT GetFrameLocation(ICorDebugFrame *pFrame, int threadId, uint32_t level, StackFrame &stackFrame); public: Debugger(); ~Debugger(); diff --git a/src/debug/netcoredbg/expr.cpp b/src/debug/netcoredbg/expr.cpp index f3b3a16..b58da3d 100644 --- a/src/debug/netcoredbg/expr.cpp +++ b/src/debug/netcoredbg/expr.cpp @@ -16,9 +16,7 @@ #include "debugger.h" #include "typeprinter.h" -#include "modules.h" #include "valueprint.h" -#include "expr.h" static HRESULT ParseIndices(const std::string &s, std::vector &indices) @@ -190,7 +188,7 @@ HRESULT Evaluator::RunClassConstructor(ICorDebugThread *pThread, ICorDebugValue if (!m_pRunClassConstructor && !m_pGetTypeHandle) { ToRelease pModule; - IfFailRet(Modules::GetModuleWithName("System.Private.CoreLib.dll", &pModule)); + IfFailRet(m_modules.GetModuleWithName("System.Private.CoreLib.dll", &pModule)); static const WCHAR helpersName[] = W("System.Runtime.CompilerServices.RuntimeHelpers"); static const WCHAR runCCTorMethodName[] = W("RunClassConstructor"); @@ -463,16 +461,10 @@ HRESULT FindTypeInModule(ICorDebugModule *pModule, const std::vector &parts, - int &nextPart, ICorDebugThread *pThread, - ICorDebugModule *pModule, - ICorDebugType **ppType, - ICorDebugModule **ppModule = nullptr); - -HRESULT GetType(const std::string &typeName, - ICorDebugThread *pThread, - ICorDebugType **ppType) +HRESULT Evaluator::GetType( + const std::string &typeName, + ICorDebugThread *pThread, + ICorDebugType **ppType) { HRESULT Status; std::vector ranks; @@ -506,9 +498,10 @@ HRESULT GetType(const std::string &typeName, return S_OK; } -HRESULT ResolveParameters(const std::vector ¶ms, - ICorDebugThread *pThread, - std::vector< ToRelease > &types) +HRESULT Evaluator::ResolveParameters( + const std::vector ¶ms, + ICorDebugThread *pThread, + std::vector< ToRelease > &types) { HRESULT Status; for (auto &p : params) @@ -520,12 +513,13 @@ HRESULT ResolveParameters(const std::vector ¶ms, return S_OK; } -HRESULT FindType(const std::vector &parts, - int &nextPart, - ICorDebugThread *pThread, - ICorDebugModule *pModule, - ICorDebugType **ppType, - ICorDebugModule **ppModule) +HRESULT Evaluator::FindType( + const std::vector &parts, + int &nextPart, + ICorDebugThread *pThread, + ICorDebugModule *pModule, + ICorDebugType **ppType, + ICorDebugModule **ppModule) { HRESULT Status; @@ -537,7 +531,7 @@ HRESULT FindType(const std::vector &parts, if (!pTypeModule) { - Modules::ForEachModule([&](ICorDebugModule *pModule)->HRESULT { + m_modules.ForEachModule([&](ICorDebugModule *pModule)->HRESULT { if (typeToken != mdTypeDefNil) // already found return S_OK; diff --git a/src/debug/netcoredbg/expr.h b/src/debug/netcoredbg/expr.h deleted file mode 100644 index 619f520..0000000 --- a/src/debug/netcoredbg/expr.h +++ /dev/null @@ -1,5 +0,0 @@ -// Copyright (c) 2017 Samsung Electronics Co., LTD -// Distributed under the MIT License. -// See the LICENSE file in the project root for more information. - -HRESULT GetType(const std::string &typeName, ICorDebugThread *pThread, ICorDebugType **ppType); diff --git a/src/debug/netcoredbg/frames.cpp b/src/debug/netcoredbg/frames.cpp index 708894f..64e2b1d 100644 --- a/src/debug/netcoredbg/frames.cpp +++ b/src/debug/netcoredbg/frames.cpp @@ -15,7 +15,6 @@ #include "typeprinter.h" #include "platform.h" #include "debugger.h" -#include "modules.h" #include "frames.h" @@ -56,7 +55,7 @@ static uint64_t FrameAddr(ICorDebugFrame *pFrame) return startAddr; } -HRESULT GetFrameLocation(ICorDebugFrame *pFrame, int threadId, uint32_t level, StackFrame &stackFrame) +HRESULT Debugger::GetFrameLocation(ICorDebugFrame *pFrame, int threadId, uint32_t level, StackFrame &stackFrame) { HRESULT Status; @@ -65,7 +64,7 @@ HRESULT GetFrameLocation(ICorDebugFrame *pFrame, int threadId, uint32_t level, S ULONG32 ilOffset; Modules::SequencePoint sp; - if (SUCCEEDED(Modules::GetFrameLocation(pFrame, ilOffset, sp))) + if (SUCCEEDED(m_modules.GetFrameILAndSequencePoint(pFrame, ilOffset, sp))) { stackFrame.source = Source(sp.document); stackFrame.line = sp.startLine; @@ -388,7 +387,7 @@ static const char *GetInternalTypeName(CorDebugInternalFrameType frameType) } } -HRESULT GetStackTrace(ICorDebugThread *pThread, int lowFrame, int highFrame, std::vector &stackFrames) +HRESULT Debugger::GetStackTrace(ICorDebugThread *pThread, int lowFrame, int highFrame, std::vector &stackFrames) { HRESULT Status; std::stringstream ss; diff --git a/src/debug/netcoredbg/frames.h b/src/debug/netcoredbg/frames.h index 70f9a4b..62c3670 100644 --- a/src/debug/netcoredbg/frames.h +++ b/src/debug/netcoredbg/frames.h @@ -2,7 +2,6 @@ // Distributed under the MIT License. // See the LICENSE file in the project root for more information. -HRESULT GetFrameLocation(ICorDebugFrame *pFrame, int threadId, uint32_t level, StackFrame &stackFrame); + HRESULT GetFrameAt(ICorDebugThread *pThread, int level, ICorDebugFrame **ppFrame); HRESULT GetThreadsState(ICorDebugController *controller, std::vector &threads); -HRESULT GetStackTrace(ICorDebugThread *pThread, int lowFrame, int highFrame, std::vector &stackFrames); diff --git a/src/debug/netcoredbg/main.cpp b/src/debug/netcoredbg/main.cpp index a6f1c52..1faf90c 100644 --- a/src/debug/netcoredbg/main.cpp +++ b/src/debug/netcoredbg/main.cpp @@ -18,7 +18,6 @@ #include "platform.h" #include "typeprinter.h" #include "debugger.h" -#include "modules.h" #include "frames.h" #define __in @@ -333,7 +332,7 @@ public: ToRelease pFrame; if (SUCCEEDED(pThread->GetActiveFrame(&pFrame)) && pFrame != nullptr) - GetFrameLocation(pFrame, threadId, 0, event.frame); + m_debugger->GetFrameLocation(pFrame, threadId, 0, event.frame); m_debugger->SetLastStoppedThread(pThread); m_debugger->m_protocol->EmitStoppedEvent(event); @@ -354,7 +353,7 @@ public: ToRelease pFrame; HRESULT Status = S_FALSE; if (SUCCEEDED(pThread->GetActiveFrame(&pFrame)) && pFrame != nullptr) - Status = GetFrameLocation(pFrame, threadId, 0, stackFrame); + Status = m_debugger->GetFrameLocation(pFrame, threadId, 0, stackFrame); const bool no_source = Status == S_FALSE; @@ -395,7 +394,7 @@ public: StackFrame stackFrame; ToRelease pFrame; if (SUCCEEDED(pThread->GetActiveFrame(&pFrame)) && pFrame != nullptr) - GetFrameLocation(pFrame, threadId, 0, stackFrame); + m_debugger->GetFrameLocation(pFrame, threadId, 0, stackFrame); m_debugger->SetLastStoppedThread(pThread); @@ -498,7 +497,7 @@ public: CORDB_ADDRESS baseAddress = 0; ULONG32 size = 0; - Modules::TryLoadModuleSymbols(pModule, id, name, symbolsLoaded, baseAddress, size); + m_debugger->m_modules.TryLoadModuleSymbols(pModule, id, name, symbolsLoaded, baseAddress, size); std::stringstream ss; ss << "id=\"{" << id << "}\"," @@ -667,6 +666,7 @@ public: Debugger::Debugger() : m_processAttachedState(ProcessUnattached), + m_evaluator(m_modules), m_managedCallback(new ManagedCallback()), m_pDebug(nullptr), m_pProcess(nullptr), @@ -939,7 +939,7 @@ HRESULT Debugger::TerminateProcess() void Debugger::Cleanup() { - Modules::CleanupAllModules(); + m_modules.CleanupAllModules(); m_evaluator.Cleanup(); m_protocol->Cleanup(); // TODO: Cleanup libcoreclr.so instance diff --git a/src/debug/netcoredbg/modules.cpp b/src/debug/netcoredbg/modules.cpp index 98752e2..e1c9aba 100644 --- a/src/debug/netcoredbg/modules.cpp +++ b/src/debug/netcoredbg/modules.cpp @@ -20,26 +20,13 @@ bool ShouldLoadSymbolsForModule(const std::string &moduleName); HRESULT SetJMCFromAttributes(ICorDebugModule *pModule, SymbolReader *symbolReader); -namespace Modules { -struct ModuleInfo +void Modules::CleanupAllModules() { - std::unique_ptr symbols; - ToRelease module; - - ModuleInfo(ModuleInfo &&) = default; - ModuleInfo(const ModuleInfo &) = delete; -}; - -std::mutex g_modulesInfoMutex; -std::unordered_map g_modulesInfo; - -void CleanupAllModules() -{ - std::lock_guard lock(g_modulesInfoMutex); - g_modulesInfo.clear(); + std::lock_guard lock(m_modulesInfoMutex); + m_modulesInfo.clear(); } -std::string GetModuleFileName(ICorDebugModule *pModule) +std::string Modules::GetModuleFileName(ICorDebugModule *pModule) { WCHAR name[mdNameLen]; ULONG32 name_len = 0; @@ -50,12 +37,13 @@ std::string GetModuleFileName(ICorDebugModule *pModule) return std::string(); } -HRESULT GetLocationInAny(std::string filename, - ULONG linenum, - ULONG32 &ilOffset, - mdMethodDef &methodToken, - std::string &fullname, - ICorDebugModule **ppModule) +HRESULT Modules::GetLocationInAny( + std::string filename, + ULONG linenum, + ULONG32 &ilOffset, + mdMethodDef &methodToken, + std::string &fullname, + ICorDebugModule **ppModule) { HRESULT Status; @@ -63,9 +51,9 @@ HRESULT GetLocationInAny(std::string filename, Status = MultiByteToWideChar(CP_UTF8, 0, filename.c_str(), filename.size() + 1, nameBuffer, MAX_LONGPATH); - std::lock_guard lock(g_modulesInfoMutex); + std::lock_guard lock(m_modulesInfoMutex); - for (auto &info_pair : g_modulesInfo) + for (auto &info_pair : m_modulesInfo) { ModuleInfo &mdInfo = info_pair.second; @@ -88,12 +76,13 @@ HRESULT GetLocationInAny(std::string filename, return E_FAIL; } -HRESULT GetLocationInModule(ICorDebugModule *pModule, - std::string filename, - ULONG linenum, - ULONG32 &ilOffset, - mdMethodDef &methodToken, - std::string &fullname) +HRESULT Modules::GetLocationInModule( + ICorDebugModule *pModule, + std::string filename, + ULONG linenum, + ULONG32 &ilOffset, + mdMethodDef &methodToken, + std::string &fullname) { HRESULT Status; @@ -104,9 +93,9 @@ HRESULT GetLocationInModule(ICorDebugModule *pModule, CORDB_ADDRESS modAddress; IfFailRet(pModule->GetBaseAddress(&modAddress)); - std::lock_guard lock(g_modulesInfoMutex); - auto info_pair = g_modulesInfo.find(modAddress); - if (info_pair == g_modulesInfo.end()) + std::lock_guard lock(m_modulesInfoMutex); + auto info_pair = m_modulesInfo.find(modAddress); + if (info_pair == m_modulesInfo.end()) { return E_FAIL; } @@ -122,9 +111,10 @@ HRESULT GetLocationInModule(ICorDebugModule *pModule, return S_OK; } -HRESULT GetFrameLocation(ICorDebugFrame *pFrame, - ULONG32 &ilOffset, - Modules::SequencePoint &sequencePoint) +HRESULT Modules::GetFrameILAndSequencePoint( + ICorDebugFrame *pFrame, + ULONG32 &ilOffset, + Modules::SequencePoint &sequencePoint) { HRESULT Status; @@ -156,9 +146,9 @@ HRESULT GetFrameLocation(ICorDebugFrame *pFrame, ULONG linenum; { - std::lock_guard lock(g_modulesInfoMutex); - auto info_pair = g_modulesInfo.find(modAddress); - if (info_pair == g_modulesInfo.end()) + std::lock_guard lock(m_modulesInfoMutex); + auto info_pair = m_modulesInfo.find(modAddress); + if (info_pair == m_modulesInfo.end()) { return E_FAIL; } @@ -196,7 +186,7 @@ HRESULT GetFrameLocation(ICorDebugFrame *pFrame, return E_FAIL; } -HRESULT GetStepRangeFromCurrentIP(ICorDebugThread *pThread, COR_DEBUG_STEP_RANGE *range) +HRESULT Modules::GetStepRangeFromCurrentIP(ICorDebugThread *pThread, COR_DEBUG_STEP_RANGE *range) { HRESULT Status; ToRelease pFrame; @@ -227,9 +217,9 @@ HRESULT GetStepRangeFromCurrentIP(ICorDebugThread *pThread, COR_DEBUG_STEP_RANGE ULONG32 ilEndOffset; { - std::lock_guard lock(g_modulesInfoMutex); - auto info_pair = g_modulesInfo.find(modAddress); - if (info_pair == g_modulesInfo.end()) + std::lock_guard lock(m_modulesInfoMutex); + auto info_pair = m_modulesInfo.find(modAddress); + if (info_pair == m_modulesInfo.end()) { return E_FAIL; } @@ -250,7 +240,7 @@ HRESULT GetStepRangeFromCurrentIP(ICorDebugThread *pThread, COR_DEBUG_STEP_RANGE return S_OK; } -HRESULT GetModuleId(ICorDebugModule *pModule, std::string &id) +HRESULT Modules::GetModuleId(ICorDebugModule *pModule, std::string &id) { HRESULT Status; @@ -279,12 +269,13 @@ HRESULT GetModuleId(ICorDebugModule *pModule, std::string &id) return S_OK; } -HRESULT TryLoadModuleSymbols(ICorDebugModule *pModule, - std::string &id, - std::string &name, - bool &symbolsLoaded, - CORDB_ADDRESS &baseAddress, - ULONG32 &size) +HRESULT Modules::TryLoadModuleSymbols( + ICorDebugModule *pModule, + std::string &id, + std::string &name, + bool &symbolsLoaded, + CORDB_ADDRESS &baseAddress, + ULONG32 &size) { HRESULT Status; @@ -318,16 +309,16 @@ HRESULT TryLoadModuleSymbols(ICorDebugModule *pModule, IfFailRet(pModule->GetSize(&size)); { - std::lock_guard lock(g_modulesInfoMutex); + std::lock_guard lock(m_modulesInfoMutex); pModule->AddRef(); ModuleInfo mdInfo { std::move(symbolReader), pModule }; - g_modulesInfo.insert(std::make_pair(baseAddress, std::move(mdInfo))); + m_modulesInfo.insert(std::make_pair(baseAddress, std::move(mdInfo))); } return S_OK; } -HRESULT GetFrameNamedLocalVariable( +HRESULT Modules::GetFrameNamedLocalVariable( ICorDebugModule *pModule, ICorDebugILFrame *pILFrame, mdMethodDef methodToken, @@ -345,9 +336,9 @@ HRESULT GetFrameNamedLocalVariable( WCHAR wParamName[mdNameLen] = W("\0"); { - std::lock_guard lock(g_modulesInfoMutex); - auto info_pair = g_modulesInfo.find(modAddress); - if (info_pair == g_modulesInfo.end()) + std::lock_guard lock(m_modulesInfoMutex); + auto info_pair = m_modulesInfo.find(modAddress); + if (info_pair == m_modulesInfo.end()) { return E_FAIL; } @@ -360,11 +351,11 @@ HRESULT GetFrameNamedLocalVariable( return S_OK; } -HRESULT GetModuleWithName(const std::string &name, ICorDebugModule **ppModule) +HRESULT Modules::GetModuleWithName(const std::string &name, ICorDebugModule **ppModule) { - std::lock_guard lock(g_modulesInfoMutex); + std::lock_guard lock(m_modulesInfoMutex); - for (auto &info_pair : g_modulesInfo) + for (auto &info_pair : m_modulesInfo) { ModuleInfo &mdInfo = info_pair.second; @@ -380,17 +371,15 @@ HRESULT GetModuleWithName(const std::string &name, ICorDebugModule **ppModule) return E_FAIL; } -HRESULT ForEachModule(std::function cb) +HRESULT Modules::ForEachModule(std::function cb) { HRESULT Status; - std::lock_guard lock(g_modulesInfoMutex); + std::lock_guard lock(m_modulesInfoMutex); - for (auto &info_pair : g_modulesInfo) + for (auto &info_pair : m_modulesInfo) { ModuleInfo &mdInfo = info_pair.second; IfFailRet(cb(mdInfo.module)); } return S_OK; } - -} // Modules namespace \ No newline at end of file diff --git a/src/debug/netcoredbg/modules.h b/src/debug/netcoredbg/modules.h index 540fd76..954c18f 100644 --- a/src/debug/netcoredbg/modules.h +++ b/src/debug/netcoredbg/modules.h @@ -2,63 +2,87 @@ // Distributed under the MIT License. // See the LICENSE file in the project root for more information. -namespace Modules +#include +#include + + +class SymbolReader; + +class Modules { + struct ModuleInfo + { + std::unique_ptr symbols; + ToRelease module; -struct SequencePoint { - int32_t startLine; - int32_t startColumn; - int32_t endLine; - int32_t endColumn; - int32_t offset; - std::string document; -}; + ModuleInfo(ModuleInfo &&) = default; + ModuleInfo(const ModuleInfo &) = delete; + }; + + std::mutex m_modulesInfoMutex; + std::unordered_map m_modulesInfo; + + std::string GetModuleFileName(ICorDebugModule *pModule); + +public: + + struct SequencePoint { + int32_t startLine; + int32_t startColumn; + int32_t endLine; + int32_t endColumn; + int32_t offset; + std::string document; + }; + + static HRESULT GetModuleId(ICorDebugModule *pModule, std::string &id); -HRESULT GetModuleId(ICorDebugModule *pModule, std::string &id); - -HRESULT GetModuleWithName(const std::string &name, ICorDebugModule **ppModule); - -std::string GetModuleFileName(ICorDebugModule *pModule); - -HRESULT GetFrameLocation(ICorDebugFrame *pFrame, - ULONG32 &ilOffset, - Modules::SequencePoint &sequencePoint); - -HRESULT GetLocationInModule(ICorDebugModule *pModule, - std::string filename, - ULONG linenum, - ULONG32 &ilOffset, - mdMethodDef &methodToken, - std::string &fullname); - -HRESULT GetLocationInAny(std::string filename, - ULONG linenum, - ULONG32 &ilOffset, - mdMethodDef &methodToken, - std::string &fullname, - ICorDebugModule **ppModule); - -HRESULT GetStepRangeFromCurrentIP(ICorDebugThread *pThread, - COR_DEBUG_STEP_RANGE *range); - -HRESULT TryLoadModuleSymbols(ICorDebugModule *pModule, - std::string &id, - std::string &name, - bool &symbolsLoaded, - CORDB_ADDRESS &baseAddress, - ULONG32 &size); - -void CleanupAllModules(); - -HRESULT GetFrameNamedLocalVariable( - ICorDebugModule *pModule, - ICorDebugILFrame *pILFrame, - mdMethodDef methodToken, - ULONG localIndex, - std::string ¶mName, - ICorDebugValue** ppValue, - ULONG32 *pIlStart, - ULONG32 *pIlEnd); - -HRESULT ForEachModule(std::function cb); -} + HRESULT GetModuleWithName(const std::string &name, ICorDebugModule **ppModule); + + HRESULT GetFrameILAndSequencePoint( + ICorDebugFrame *pFrame, + ULONG32 &ilOffset, + SequencePoint &sequencePoint); + + HRESULT GetLocationInModule( + ICorDebugModule *pModule, + std::string filename, + ULONG linenum, + ULONG32 &ilOffset, + mdMethodDef &methodToken, + std::string &fullname); + + HRESULT GetLocationInAny( + std::string filename, + ULONG linenum, + ULONG32 &ilOffset, + mdMethodDef &methodToken, + std::string &fullname, + ICorDebugModule **ppModule); + + HRESULT GetStepRangeFromCurrentIP( + ICorDebugThread *pThread, + COR_DEBUG_STEP_RANGE *range); + + HRESULT TryLoadModuleSymbols( + ICorDebugModule *pModule, + std::string &id, + std::string &name, + bool &symbolsLoaded, + CORDB_ADDRESS &baseAddress, + ULONG32 &size); + + void CleanupAllModules(); + + HRESULT GetFrameNamedLocalVariable( + ICorDebugModule *pModule, + ICorDebugILFrame *pILFrame, + mdMethodDef methodToken, + ULONG localIndex, + std::string ¶mName, + ICorDebugValue** ppValue, + ULONG32 *pIlStart, + ULONG32 *pIlEnd); + + HRESULT ForEachModule(std::function cb); +}; diff --git a/src/debug/netcoredbg/valuewalk.cpp b/src/debug/netcoredbg/valuewalk.cpp index fbca7f2..d7e84e2 100644 --- a/src/debug/netcoredbg/valuewalk.cpp +++ b/src/debug/netcoredbg/valuewalk.cpp @@ -16,10 +16,8 @@ #include #include "cputil.h" -#include "modules.h" #include "typeprinter.h" #include "valueprint.h" -#include "expr.h" #include "debugger.h" @@ -899,7 +897,7 @@ HRESULT Evaluator::WalkStackVars(ICorDebugFrame *pFrame, WalkStackVarsCallback c ToRelease pValue; ULONG32 ilStart; ULONG32 ilEnd; - Status = Modules::GetFrameNamedLocalVariable(pModule, pILFrame, methodDef, i, paramName, &pValue, &ilStart, &ilEnd); + Status = m_modules.GetFrameNamedLocalVariable(pModule, pILFrame, methodDef, i, paramName, &pValue, &ilStart, &ilEnd); if (FAILED(Status)) continue; diff --git a/src/debug/netcoredbg/variables.cpp b/src/debug/netcoredbg/variables.cpp index 61396c6..ec3600f 100644 --- a/src/debug/netcoredbg/variables.cpp +++ b/src/debug/netcoredbg/variables.cpp @@ -16,9 +16,7 @@ #include "debugger.h" #include "typeprinter.h" -#include "modules.h" #include "valueprint.h" -#include "expr.h" #include "frames.h" -- 2.34.1