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

Ewan Crawford ewan at codeplay.com
Tue Mar 3 01:28:42 PST 2015


Thanks for the comments ki.stfu.

My understanding of MIFormResponse() is that it is only called from CMICmdCmdVarUpdate::Execute() when there are composite types, in which case we wouldn't print the values for --simple-values. So we only need to check for --all-values and can ignore --simple-values.
Should MIFormResponse() ever need to print values for --simple-value?

I'll add a check --simple-value to CMICmdCmdVarUpdate::Acknowledge() though, to print values for when m_bValueChangedNormalType is set.


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);
 
----------------
ki.stfu wrote:
> I think it should be pArgNoValues/pArgAllValues/pArgSimpleValues (aka --no-value*s*/--all-value*s*/--simple-value*s*)
Will do

================
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);
+
----------------
ki.stfu wrote:
> 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;
> ```
no problem

http://reviews.llvm.org/D8008

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






More information about the lldb-commits mailing list