Add low and high frame arguments to PrintFrames function
authorIgor Kulaychuk <i.kulaychuk@samsung.com>
Wed, 12 Jul 2017 20:07:27 +0000 (23:07 +0300)
committerIgor Kulaychuk <i.kulaychuk@samsung.com>
Mon, 13 Nov 2017 19:22:40 +0000 (22:22 +0300)
src/debug/debugger/main.cpp

index 6e638ad..944fc72 100644 (file)
@@ -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<ICorDebugFrame> 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<ICorDebugThread> 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))
             {