From 9936dd7c99bc05568846e316bdc0b28be0382530 Mon Sep 17 00:00:00 2001 From: Igor Kulaychuk Date: Wed, 12 Jul 2017 23:07:27 +0300 Subject: [PATCH] Add low and high frame arguments to PrintFrames function --- src/debug/debugger/main.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/debug/debugger/main.cpp b/src/debug/debugger/main.cpp index 6e638ad..944fc72 100644 --- a/src/debug/debugger/main.cpp +++ b/src/debug/debugger/main.cpp @@ -316,7 +316,7 @@ HRESULT RunStep(ICorDebugThread *pThread, StepType stepType) return S_OK; } -HRESULT PrintFrames(ICorDebugThread *pThread, std::string &output) +HRESULT PrintFrames(ICorDebugThread *pThread, std::string &output, int lowFrame = 0, int highFrame = INT_MAX) { HRESULT Status; std::stringstream ss; @@ -340,6 +340,11 @@ HRESULT PrintFrames(ICorDebugThread *pThread, std::string &output) IfFailRet(Status); + if (currentFrame < lowFrame) + continue; + if (currentFrame > highFrame) + break; + ToRelease pFrame; IfFailRet(pStackWalk->GetFrame(&pFrame)); if (Status == S_FALSE) @@ -1127,14 +1132,16 @@ int main(int argc, char *argv[]) } else if (command == "stack-list-frames") { - // TODO: Add parsing frame indeces and --thread + // TODO: Add parsing frame lowFrame, highFrame and --thread std::string output; ToRelease pThread; DWORD threadId = GetLastStoppedThreadId(); HRESULT hr = pProcess->GetThread(threadId, &pThread); + int lowFrame = 0; + int highFrame = INT_MAX; if (SUCCEEDED(hr)) { - hr = PrintFrames(pThread, output); + hr = PrintFrames(pThread, output, lowFrame, highFrame); } if (SUCCEEDED(hr)) { -- 2.7.4