[Lldb-commits] [PATCH] Added long 'print-values' option for var-update MI command.

Ilia K ki.stfu at gmail.com
Mon Mar 2 09:46:35 PST 2015


See my comments.


REPOSITORY
  rL LLVM

================
Comment at: lldb/tools/lldb-mi/MICmdCmdVar.cpp:339-341
@@ -332,2 +338,5 @@
     CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
+    CMICMDBASE_GETOPTION(pArgNoValue, OptionLong, m_constStrArgNoValues);
+    CMICMDBASE_GETOPTION(pArgAllValue, OptionLong, m_constStrArgAllValues);
+    CMICMDBASE_GETOPTION(pArgSimpleValue, OptionLong, m_constStrArgSimpleValues);
 
----------------
I think it should be pArgNoValues/pArgAllValues/pArgSimpleValues (aka --no-value*s*/--all-value*s*/--simple-value*s*)

================
Comment at: lldb/tools/lldb-mi/MICmdCmdVar.cpp:343-357
@@ -333,1 +342,17 @@
 
+    MIuint print_value = 0;
+    if (pArgPrintValues->GetFound())
+    {
+        MIuint tmp = pArgPrintValues->GetValue();
+        if (tmp <= 2)
+            print_value = tmp;
+    }
+    else if (pArgNoValue->GetFound())
+        print_value = 0; // no value
+    else if (pArgAllValue->GetFound())
+        print_value = 1; // all values
+    else if (pArgSimpleValue->GetFound())
+        print_value = 2; // simple values
+
+    m_eVarInfoFormat = static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(print_value);
+
----------------
Use the following:
```
    CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e eVarInfoFormat;
    if (pArgPrintValues->GetFound())
    {
        const MIuint nPrintValues = pArgPrintValues->GetValue();
        if (nPrintValues >= CMICmnLLDBDebugSessionInfo::kNumVariableInfoFormats)
        {
            SetError(CMIUtilString::Format(MIRSRC(IDS_CMD_ERR_INVALID_PRINT_VALUES), m_cmdData.strMiCmd.c_str()));
            return MIstatus::failure;
        }
        eVarInfoFormat = static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(nPrintValues);
    }
    else if (pArgNoValues->GetFound())
        eVarInfoFormat = CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
    else if (pArgAllValues->GetFound())
        eVarInfoFormat = CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues;
    else if (pArgSimpleValues->GetFound())
        eVarInfoFormat = CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_SimpleValues;
    else
        // If no print-values, default is "no-values"
        eVarInfoFormat = CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues;
    m_eVarInfoFormat = eVarInfoFormat;
```

================
Comment at: lldb/tools/lldb-mi/MICmdCmdVar.cpp:532
@@ +531,3 @@
+    bool bOk;
+    if(m_eVarInfoFormat == CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues)
+    {
----------------
why you are ignoring --simple-value?
In addition you should do the same thing in CMICmdCmdVarUpdate::MIFormResponse.

http://reviews.llvm.org/D8008

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the lldb-commits mailing list