forked from OSchip/llvm-project
Added long 'print-values' option for var-update MI command.
Summary: The -var-update MI command should take the same print-values options as var-list children, however currently only the integer versions are supported. Added --no-values, --all-values, and --simple-values long options. See: https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-Variable-Objects.html#GDB_002fMI-Variable-Objects Patch from ewan@codeplay.com Reviewers: EwanCrawford Subscribers: ki.stfu, lldb-commits Differential Revision: http://reviews.llvm.org/D8008 llvm-svn: 231233
This commit is contained in:
parent
ccd28a147b
commit
53d33368c4
|
@ -276,6 +276,9 @@ CMICmdCmdVarUpdate::CMICmdCmdVarUpdate(void)
|
|||
: m_eVarInfoFormat(CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues)
|
||||
, m_constStrArgPrintValues("print-values")
|
||||
, m_constStrArgName("name")
|
||||
, m_constStrArgNoValues("no-values")
|
||||
, m_constStrArgAllValues("all-values")
|
||||
, m_constStrArgSimpleValues("simple-values")
|
||||
, m_bValueChangedArrayType(false)
|
||||
, m_bValueChangedCompositeType(false)
|
||||
, m_bValueChangedNormalType(false)
|
||||
|
@ -312,6 +315,9 @@ bool
|
|||
CMICmdCmdVarUpdate::ParseArgs(void)
|
||||
{
|
||||
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());
|
||||
}
|
||||
|
@ -330,6 +336,31 @@ CMICmdCmdVarUpdate::Execute(void)
|
|||
{
|
||||
CMICMDBASE_GETOPTION(pArgPrintValues, Number, m_constStrArgPrintValues);
|
||||
CMICMDBASE_GETOPTION(pArgName, String, m_constStrArgName);
|
||||
CMICMDBASE_GETOPTION(pArgNoValues, OptionLong, m_constStrArgNoValues);
|
||||
CMICMDBASE_GETOPTION(pArgAllValues, OptionLong, m_constStrArgAllValues);
|
||||
CMICMDBASE_GETOPTION(pArgSimpleValues, OptionLong, m_constStrArgSimpleValues);
|
||||
|
||||
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;
|
||||
|
||||
const CMIUtilString &rVarObjName(pArgName->GetValue());
|
||||
CMICmnLLDBDebugSessionInfoVarObj varObj;
|
||||
|
@ -339,14 +370,6 @@ CMICmdCmdVarUpdate::Execute(void)
|
|||
return MIstatus::failure;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
m_eVarInfoFormat = static_cast<CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e>(nPrintValues);
|
||||
|
||||
const CMIUtilString &rVarRealName(varObj.GetNameReal());
|
||||
MIunused(rVarRealName);
|
||||
lldb::SBValue &rValue = const_cast<lldb::SBValue &>(varObj.GetValue());
|
||||
|
@ -436,7 +459,9 @@ CMICmdCmdVarUpdate::Acknowledge(void)
|
|||
const CMICmnMIValueConst miValueConst(m_strValueName);
|
||||
CMICmnMIValueResult miValueResult("name", miValueConst);
|
||||
CMICmnMIValueTuple miValueTuple(miValueResult);
|
||||
if (m_eVarInfoFormat != CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_NoValues)
|
||||
if (m_eVarInfoFormat == CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues ||
|
||||
(m_eVarInfoFormat == CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_SimpleValues
|
||||
&& m_bValueChangedNormalType))
|
||||
{
|
||||
const CMICmnMIValueConst miValueConst2(strValue);
|
||||
CMICmnMIValueResult miValueResult2("value", miValueConst2);
|
||||
|
@ -511,8 +536,12 @@ CMICmdCmdVarUpdate::MIFormResponse(const CMIUtilString &vrStrVarName, const CMIU
|
|||
CMICmnMIValueResult miValueResult("name", miValueConst);
|
||||
CMICmnMIValueTuple miValueTuple(miValueResult);
|
||||
const CMICmnMIValueConst miValueConst2(vrStrValue);
|
||||
CMICmnMIValueResult miValueResult2("value", miValueConst2);
|
||||
bool bOk = miValueTuple.Add(miValueResult2);
|
||||
bool bOk = true;
|
||||
if(m_eVarInfoFormat == CMICmnLLDBDebugSessionInfo::eVariableInfoFormat_AllValues)
|
||||
{
|
||||
CMICmnMIValueResult miValueResult2("value", miValueConst2);
|
||||
bOk = bOk && miValueTuple.Add(miValueResult2);
|
||||
}
|
||||
const CMICmnMIValueConst miValueConst3(vrStrScope);
|
||||
CMICmnMIValueResult miValueResult3("in_scope", miValueConst3);
|
||||
bOk = bOk && miValueTuple.Add(miValueResult3);
|
||||
|
|
|
@ -131,8 +131,11 @@ class CMICmdCmdVarUpdate : public CMICmdBase
|
|||
private:
|
||||
CMIUtilString m_strValueName;
|
||||
CMICmnLLDBDebugSessionInfo::VariableInfoFormat_e m_eVarInfoFormat;
|
||||
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;
|
||||
bool m_bValueChangedArrayType; // True = yes value changed, false = no change
|
||||
bool m_bValueChangedCompositeType; // True = yes value changed, false = no change
|
||||
bool m_bValueChangedNormalType; // True = yes value changed, false = no change
|
||||
|
|
|
@ -255,7 +255,7 @@ const CMICmnResources::SRsrcTextData CMICmnResources::ms_pResourceId2TextData[]
|
|||
{IDS_CMD_ERR_LLDB_ERR_NOT_READ_WHOLE_BLK, "Command '%s'. LLDB unable to read entire memory block of %u bytes at address 0x%08x"},
|
||||
{IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES, "Command '%s'. Unable to read memory block of %u bytes at address 0x%08x: %s "},
|
||||
{IDS_CMD_ERR_INVALID_PROCESS, "Command '%s'. Invalid process during debug session"},
|
||||
{IDS_CMD_ERR_INVALID_PRINT_VALUES, "Command '%s'. Unknown value for PRINT_VALUES: must be: 0 or \"--no-values\", 1 or \"all-values\", 2 or \"simple-values\""},
|
||||
{IDS_CMD_ERR_INVALID_PRINT_VALUES, "Command '%s'. Unknown value for PRINT_VALUES: must be: 0 or \"--no-values\", 1 or \"--all-values\", 2 or \"--simple-values\""},
|
||||
{IDS_CMD_ERR_INVALID_FORMAT_TYPE, "Command '%s'. Invalid var format type '%s'"},
|
||||
{IDS_CMD_ERR_BRKPT_INFO_OBJ_NOT_FOUND, "Command '%s'. Breakpoint information for breakpoint ID %d not found"},
|
||||
{IDS_CMD_ERR_LLDB_ERR_READ_MEM_BYTES, "Command '%s'. Unable to write memory block of %u bytes at address 0x%08x: %s "},
|
||||
|
|
Loading…
Reference in New Issue