virtual HRESULT GetThreads(std::vector<Thread> &threads) = 0;
virtual HRESULT SetBreakpoints(std::string filename, const std::vector<int> &lines, std::vector<Breakpoint> &breakpoints) = 0;
virtual void InsertExceptionBreakpoint(const std::string &name, Breakpoint &breakpoint) = 0;
- virtual HRESULT GetStackTrace(int threadId, int lowFrame, int highFrame, std::vector<StackFrame> &stackFrames) = 0;
+ virtual HRESULT GetStackTrace(int threadId, int startFrame, int levels, std::vector<StackFrame> &stackFrames, int &totalFrames) = 0;
virtual HRESULT StepCommand(int threadId, StepType stepType) = 0;
virtual HRESULT GetScopes(uint64_t frameId, std::vector<Scope> &scopes) = 0;
virtual HRESULT GetVariables(uint32_t variablesReference, VariablesFilter filter, int start, int count, std::vector<Variable> &variables) = 0;
}
}
-HRESULT ManagedDebugger::GetStackTrace(ICorDebugThread *pThread, int lowFrame, int highFrame, std::vector<StackFrame> &stackFrames)
+HRESULT ManagedDebugger::GetStackTrace(ICorDebugThread *pThread, int startFrame, int levels, std::vector<StackFrame> &stackFrames, int &totalFrames)
{
HRESULT Status;
std::stringstream ss;
{
currentFrame++;
- if (currentFrame < lowFrame)
+ if (currentFrame < startFrame)
+ return S_OK;
+ if (levels != 0 && currentFrame >= (startFrame + levels))
return S_OK;
- if (currentFrame > highFrame)
- return S_OK; // Todo implement fast break mechanism
switch(frameType)
{
return S_OK;
}));
+ totalFrames = currentFrame + 1;
+
return S_OK;
}
return GetThreadsState(m_pProcess, threads);
}
-HRESULT ManagedDebugger::GetStackTrace(int threadId, int lowFrame, int highFrame, std::vector<StackFrame> &stackFrames)
+HRESULT ManagedDebugger::GetStackTrace(int threadId, int startFrame, int levels, std::vector<StackFrame> &stackFrames, int &totalFrames)
{
HRESULT Status;
if (!m_pProcess)
return E_FAIL;
ToRelease<ICorDebugThread> pThread;
IfFailRet(m_pProcess->GetThread(threadId, &pThread));
- return GetStackTrace(pThread, lowFrame, highFrame, stackFrames);
+ return GetStackTrace(pThread, startFrame, levels, stackFrames, totalFrames);
}
VOID ManagedDebugger::StartupCallback(IUnknown *pCordb, PVOID parameter, HRESULT hr)
HRESULT SetupStep(ICorDebugThread *pThread, StepType stepType);
- HRESULT GetStackTrace(ICorDebugThread *pThread, int lowFrame, int highFrame, std::vector<StackFrame> &stackFrames);
+ HRESULT GetStackTrace(ICorDebugThread *pThread, int startFrame, int levels, std::vector<StackFrame> &stackFrames, int &totalFrames);
HRESULT GetFrameLocation(ICorDebugFrame *pFrame, int threadId, uint32_t level, StackFrame &stackFrame);
HRESULT RunProcess(std::string fileExec, std::vector<std::string> execArgs);
HRESULT GetThreads(std::vector<Thread> &threads) override;
HRESULT SetBreakpoints(std::string filename, const std::vector<int> &lines, std::vector<Breakpoint> &breakpoints) override;
void InsertExceptionBreakpoint(const std::string &name, Breakpoint &breakpoint) override;
- HRESULT GetStackTrace(int threadId, int lowFrame, int highFrame, std::vector<StackFrame> &stackFrames) override;
+ HRESULT GetStackTrace(int threadId, int startFrame, int levels, std::vector<StackFrame> &stackFrames, int &totalFrames) override;
HRESULT StepCommand(int threadId, StepType stepType) override;
HRESULT GetScopes(uint64_t frameId, std::vector<Scope> &scopes) override;
HRESULT GetVariables(uint32_t variablesReference, VariablesFilter filter, int start, int count, std::vector<Variable> &variables) override;
HRESULT Status;
std::stringstream ss;
+ int totalFrames = 0;
std::vector<StackFrame> stackFrames;
- IfFailRet(m_debugger->GetStackTrace(threadId, lowFrame, highFrame, stackFrames));
+ IfFailRet(m_debugger->GetStackTrace(threadId, lowFrame, highFrame - lowFrame, stackFrames, totalFrames));
int currentFrame = lowFrame;