Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/MICmdCmdVar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,14 @@ bool CMICmdCmdVarUpdate::Execute() {
}

lldb::SBValue &rValue = varObj.GetValue();
const bool bVarChanged = varObj.ExchangeChanged(false);
if (!ExamineSBValueForChange(rValue, m_bValueChanged))
return MIstatus::failure;

// SBValue changed state due to a -var-assign may have already been
// cleared so combine it with changed state held by the var object
m_bValueChanged |= bVarChanged;

if (!m_bValueChanged) {
CMICmnLLDBDebugSessionInfo &rSessionInfo(
CMICmnLLDBDebugSessionInfo::Instance());
Expand Down Expand Up @@ -747,10 +752,14 @@ bool CMICmdCmdVarAssign::Execute() {
CMIUtilString strExpression(rExpression.Trim());
strExpression = strExpression.Trim('"');
lldb::SBValue &rValue(varObj.GetValue());
CMIUtilString strOldValue(rValue.GetValue());
m_bOk = rValue.SetValueFromCString(strExpression.c_str());
if (m_bOk)
if (m_bOk) {
CMIUtilString strNewValue(rValue.GetValue());
const bool bVarChanged = !CMIUtilString::Compare(strOldValue, strNewValue);
varObj.ExchangeChanged(bVarChanged);
varObj.UpdateValue();

}
return MIstatus::success;
}

Expand Down
22 changes: 19 additions & 3 deletions src/MICmnLLDBDebugSessionInfoVarObj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ CMICmnLLDBDebugSessionInfoVarObj::varFormat_e
//--
CMICmnLLDBDebugSessionInfoVarObj::CMICmnLLDBDebugSessionInfoVarObj()
: m_eVarFormat(eVarFormat_Natural), m_eVarType(eVarType_Internal),
m_eValObjKind(valObjKind_ec::eValObjKind_Other) {
m_eValObjKind(valObjKind_ec::eValObjKind_Other), m_bChanged(false) {
// Do not call UpdateValue() in here as not necessary
}

Expand All @@ -56,7 +56,7 @@ CMICmnLLDBDebugSessionInfoVarObj::CMICmnLLDBDebugSessionInfoVarObj(
const lldb::SBValue &vrValue, const valObjKind_ec eValObjKind)
: m_eVarFormat(eVarFormat_Natural), m_eVarType(eVarType_Internal),
m_eValObjKind(eValObjKind), m_strName(vrStrName), m_SBValue(vrValue),
m_strNameReal(vrStrNameReal) {
m_strNameReal(vrStrNameReal), m_bChanged(false) {
UpdateValue();
}

Expand All @@ -80,7 +80,7 @@ CMICmnLLDBDebugSessionInfoVarObj::CMICmnLLDBDebugSessionInfoVarObj(
: m_eVarFormat(eVarFormat_Natural), m_eVarType(eVarType_Internal),
m_eValObjKind(eValObjKind), m_strName(vrStrName), m_SBValue(vrValue),
m_strNameReal(vrStrNameReal),
m_strVarObjParentName(vrStrVarObjParentName) {
m_strVarObjParentName(vrStrVarObjParentName), m_bChanged(false) {
UpdateValue();
}

Expand Down Expand Up @@ -159,6 +159,7 @@ void CMICmnLLDBDebugSessionInfoVarObj::CopyOther(
m_strNameReal = vrOther.m_strNameReal;
m_strFormattedValue = vrOther.m_strFormattedValue;
m_strVarObjParentName = vrOther.m_strVarObjParentName;
m_bChanged = vrOther.m_bChanged;
}

//++
Expand All @@ -178,6 +179,7 @@ void CMICmnLLDBDebugSessionInfoVarObj::MoveOther(
m_strNameReal = std::move(vrwOther.m_strNameReal);
m_strFormattedValue = std::move(vrwOther.m_strFormattedValue);
m_strVarObjParentName = std::move(vrwOther.m_strVarObjParentName);
m_bChanged = vrwOther.m_bChanged;

vrwOther.m_eVarFormat = eVarFormat_Natural;
vrwOther.m_eVarType = eVarType_Internal;
Expand All @@ -187,6 +189,7 @@ void CMICmnLLDBDebugSessionInfoVarObj::MoveOther(
vrwOther.m_strNameReal.clear();
vrwOther.m_strFormattedValue.clear();
vrwOther.m_strVarObjParentName.clear();
vrwOther.m_bChanged = false;
}

//++
Expand Down Expand Up @@ -539,6 +542,19 @@ void CMICmnLLDBDebugSessionInfoVarObj::UpdateValue() {
CMICmnLLDBDebugSessionInfoVarObj::VarObjUpdate(*this);
}

//++
// Details: Set the changed state of the var object.
// Type: Method.
// Args: bChanged - New changed state.
// Returns: m_bChanged - Previous changed state.
// Throws: None.
//--
bool CMICmnLLDBDebugSessionInfoVarObj::ExchangeChanged(const bool bChanged) {
const bool bPreviousChanged = m_bChanged;
m_bChanged = bChanged;
return bPreviousChanged;
}

//++
// Details: Retrieve the enumeration type of the var object.
// Type: Method.
Expand Down
2 changes: 2 additions & 0 deletions src/MICmnLLDBDebugSessionInfoVarObj.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ class CMICmnLLDBDebugSessionInfoVarObj {
const CMIUtilString &GetVarParentName() const;
valObjKind_ec GetValObjKind() const;
void UpdateValue();
bool ExchangeChanged(const bool bChanged);

// Overridden:
public:
Expand Down Expand Up @@ -148,6 +149,7 @@ class CMICmnLLDBDebugSessionInfoVarObj {
CMIUtilString m_strNameReal;
CMIUtilString m_strFormattedValue;
CMIUtilString m_strVarObjParentName;
bool m_bChanged;
// *** Update the copy move constructors and assignment operator ***
};

Expand Down
Loading