[Lldb-commits] [lldb] r228296 - Add missing options in -var-list-children command.
Hafiz Abid Qadeer
hafiz_abid at mentor.com
Thu Feb 5 06:06:30 PST 2015
Author: abidh
Date: Thu Feb 5 08:06:30 2015
New Revision: 228296
URL: http://llvm.org/viewvc/llvm-project?rev=228296&view=rev
Log:
Add missing options in -var-list-children command.
The options are checked in the following order.
print-values
no-values
all-values
simple-values
See the following link for the details of these arguments.
https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Variable-Objects.html
Modified:
lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
lldb/trunk/tools/lldb-mi/MICmdCmdVar.h
Modified: lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp?rev=228296&r1=228295&r2=228296&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdVar.cpp Thu Feb 5 08:06:30 2015
@@ -964,7 +964,10 @@ CMICmdCmdVarListChildren::CMICmdCmdVarLi
, m_nChildren(0)
, m_constStrArgPrintValues("print-values")
, m_constStrArgName("name")
-{
+ , m_constStrArgNoValues("no-values")
+ , m_constStrArgAllValues("all-values")
+ , m_constStrArgSimpleValues("simple-values")
+ {
// Command factory matches this name with that received from the stdin stream
m_strMiCmd = "var-list-children";
@@ -996,7 +999,10 @@ CMICmdCmdVarListChildren::~CMICmdCmdVarL
bool
CMICmdCmdVarListChildren::ParseArgs(void)
{
- bool bOk = m_setCmdArgs.Add(*(new CMICmdArgValNumber(m_constStrArgPrintValues, false, false)));
+ bool bOk = m_setCmdArgs.Add(*(new CMICmdArgValNumber(m_constStrArgPrintValues, false, true)));
+ 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 CMICmdArgValString(m_constStrArgName, true, true)));
return (bOk && ParseValidateCmdOptions());
}
@@ -1014,6 +1020,24 @@ bool
CMICmdCmdVarListChildren::Execute(void)
{
CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
+ CMICMDBASE_GETOPTION(pArgPrintValue, Number, m_constStrArgPrintValues);
+ CMICMDBASE_GETOPTION(pArgNoValue, OptionLong, m_constStrArgNoValues);
+ CMICMDBASE_GETOPTION(pArgAllValue, OptionLong, m_constStrArgAllValues);
+ CMICMDBASE_GETOPTION(pArgSimpleValue, OptionLong, m_constStrArgSimpleValues);
+
+ MIuint print_value = 0;
+ if (pArgPrintValue->GetFound())
+ {
+ MIuint tmp = pArgPrintValue->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
const CMIUtilString &rVarObjName(pArgName->GetValue());
CMICmnLLDBDebugSessionInfoVarObj varObj;
@@ -1041,9 +1065,6 @@ CMICmdCmdVarListChildren::Execute(void)
const MIuint nChildren = member.GetNumChildren();
const CMIUtilString strThreadId(CMIUtilString::Format("%u", member.GetThread().GetIndexID()));
- // Varobj gets added to CMICmnLLDBDebugSessionInfoVarObj static container of varObjs
- CMICmnLLDBDebugSessionInfoVarObj var(strExp, name, member, rVarObjName);
-
// MI print "child={name=\"%s\",exp=\"%s\",numchild=\"%d\",value=\"%s\",type=\"%s\",thread-id=\"%u\",has_more=\"%u\"}"
const CMICmnMIValueConst miValueConst(name);
const CMICmnMIValueResult miValueResult("name", miValueConst);
@@ -1061,11 +1082,23 @@ CMICmdCmdVarListChildren::Execute(void)
const CMICmnMIValueConst miValueConst6(strThreadId);
const CMICmnMIValueResult miValueResult6("thread-id", miValueConst6);
miValueTuple.Add(miValueResult6);
- const CMICmnMIValueConst miValueConst7("0");
- const CMICmnMIValueResult miValueResult7("has_more", miValueConst7);
- miValueTuple.Add(miValueResult7);
- const CMICmnMIValueResult miValueResult8("child", miValueTuple);
- m_vecMiValueResult.push_back(miValueResult8);
+ // nChildren == 0 is used to check for simple values
+ if ( (print_value == 2 && nChildren == 0) || (print_value == 1) )
+ {
+ // Varobj gets added to CMICmnLLDBDebugSessionInfoVarObj static container of varObjs
+ CMICmnLLDBDebugSessionInfoVarObj var(strExp, name, member, rVarObjName);
+ const CMIUtilString strValue(
+ CMICmnLLDBDebugSessionInfoVarObj::GetValueStringFormatted(member, CMICmnLLDBDebugSessionInfoVarObj::eVarFormat_Natural));
+ const CMICmnMIValueConst miValueConst7(strValue);
+ const CMICmnMIValueResult miValueResult7("value", miValueConst7);
+ miValueTuple.Add(miValueResult7);
+ }
+ const CMICmnMIValueConst miValueConst8("0");
+ const CMICmnMIValueResult miValueResult8("has_more", miValueConst8);
+ miValueTuple.Add(miValueResult8);
+ const CMICmnMIValueResult miValueResult9("child", miValueTuple);
+ m_vecMiValueResult.push_back(miValueResult9);
+
}
return MIstatus::success;
Modified: lldb/trunk/tools/lldb-mi/MICmdCmdVar.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/lldb-mi/MICmdCmdVar.h?rev=228296&r1=228295&r2=228296&view=diff
==============================================================================
--- lldb/trunk/tools/lldb-mi/MICmdCmdVar.h (original)
+++ lldb/trunk/tools/lldb-mi/MICmdCmdVar.h Thu Feb 5 08:06:30 2015
@@ -274,8 +274,11 @@ class CMICmdCmdVarListChildren : public
bool m_bValueValid; // True = yes SBValue object is valid, false = not valid
VecMIValueResult_t m_vecMiValueResult;
MIuint m_nChildren;
- const CMIUtilString m_constStrArgPrintValues; // Not handled by *this command
+ const CMIUtilString m_constStrArgPrintValues;
const CMIUtilString m_constStrArgName;
+ const CMIUtilString m_constStrArgNoValues;
+ const CMIUtilString m_constStrArgAllValues;
+ const CMIUtilString m_constStrArgSimpleValues;
};
//++ ============================================================================
More information about the lldb-commits
mailing list