[Lldb-commits] [PATCH] Add low-frame/high-frame options to -stack-list-arguments (MI)

Ilia K ki.stfu at gmail.com
Thu Mar 12 00:37:23 PDT 2015


Hi abidh, clayborg,

Add low-frame/high-frame options to -stack-list-arguments

All tests pass on OS X.

http://reviews.llvm.org/D8282

Files:
  tools/lldb-mi/MICmdCmdStack.cpp
  tools/lldb-mi/MICmdCmdStack.h

Index: tools/lldb-mi/MICmdCmdStack.cpp
===================================================================
--- tools/lldb-mi/MICmdCmdStack.cpp
+++ tools/lldb-mi/MICmdCmdStack.cpp
@@ -462,6 +462,8 @@
     , m_constStrArgNoValues("no-values")
     , m_constStrArgAllValues("all-values")
     , m_constStrArgSimpleValues("simple-values")
+    , m_constStrArgFrameLow("low-frame")
+    , m_constStrArgFrameHigh("high-frame")
 {
     // Command factory matches this name with that received from the stdin stream
     m_strMiCmd = "stack-list-arguments";
@@ -499,6 +501,8 @@
     bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgNoValues, false, true)));
     bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgAllValues, false, true)));
     bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValOptionLong(m_constStrArgSimpleValues, false, true)));
+    bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValNumber(m_constStrArgFrameLow, false, true)));
+    bOk = bOk && m_setCmdArgs.Add(*(new CMICmdArgValNumber(m_constStrArgFrameHigh, false, true)));
     return (bOk && ParseValidateCmdOptions());
 }
 
@@ -519,6 +523,8 @@
     CMICMDBASE_GETOPTION(pArgNoValues, OptionLong, m_constStrArgNoValues);
     CMICMDBASE_GETOPTION(pArgAllValues, OptionLong, m_constStrArgAllValues);
     CMICMDBASE_GETOPTION(pArgSimpleValues, OptionLong, m_constStrArgSimpleValues);
+    CMICMDBASE_GETOPTION(pArgFrameLow, Number, m_constStrArgFrameLow);
+    CMICMDBASE_GETOPTION(pArgFrameHigh, Number, m_constStrArgFrameHigh);
 
     // Retrieve the --thread option's thread ID (only 1)
     MIuint64 nThreadId = UINT64_MAX;
@@ -554,6 +560,19 @@
         return MIstatus::failure;
     }
 
+    MIuint nFrameLow = 0;
+    MIuint nFrameHigh = UINT32_MAX;
+    if (pArgFrameLow->GetFound() && pArgFrameHigh->GetFound())
+    {
+        nFrameLow = pArgFrameLow->GetFound() ? pArgFrameLow->GetValue() : 0;
+        nFrameHigh = pArgFrameHigh->GetFound() ? pArgFrameHigh->GetValue() : UINT32_MAX;
+    }
+    else if (pArgFrameLow->GetFound() || pArgFrameHigh->GetFound())
+    {
+        SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_THREAD_FRAME_RANGE_INVALID), m_cmdData.strMiCmd.c_str()));
+        return MIstatus::failure;
+    }
+
     CMICmnLLDBDebugSessionInfo &rSessionInfo(CMICmnLLDBDebugSessionInfo::Instance());
     lldb::SBProcess sbProcess = rSessionInfo.GetProcess();
     lldb::SBThread thread = (nThreadId != UINT64_MAX) ? sbProcess.GetThreadByIndexID(nThreadId) : sbProcess.GetSelectedThread();
@@ -569,7 +588,8 @@
     }
 
     const MIuint nFrames = thread.GetNumFrames();
-    for (MIuint i = 0; i < nFrames; i++)
+    nFrameHigh = std::max(nFrameHigh, nFrames);
+    for (MIuint i = nFrameLow; i < nFrameHigh; i++)
     {
         lldb::SBFrame frame = thread.GetFrameAtIndex(i);
         CMICmnMIValueList miValueList(true);
Index: tools/lldb-mi/MICmdCmdStack.h
===================================================================
--- tools/lldb-mi/MICmdCmdStack.h
+++ tools/lldb-mi/MICmdCmdStack.h
@@ -179,6 +179,8 @@
     const CMIUtilString m_constStrArgNoValues;
     const CMIUtilString m_constStrArgAllValues;
     const CMIUtilString m_constStrArgSimpleValues;
+    const CMIUtilString m_constStrArgFrameLow;
+    const CMIUtilString m_constStrArgFrameHigh;
 };
 
 //++ ============================================================================

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D8282.21805.patch
Type: text/x-patch
Size: 3390 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20150312/a6b1ac7f/attachment.bin>


More information about the lldb-commits mailing list