From f79d50cd1fc290bcc9454aa94114a2b14ea6d11e Mon Sep 17 00:00:00 2001 From: Shao-Ce SUN Date: Wed, 14 Aug 2024 14:51:58 +0800 Subject: [PATCH] Remove the traversal of the SBValue's children values --- src/MICmdCmdVar.cpp | 43 +++++-------------------------------------- 1 file changed, 5 insertions(+), 38 deletions(-) diff --git a/src/MICmdCmdVar.cpp b/src/MICmdCmdVar.cpp index a996058..db18799 100644 --- a/src/MICmdCmdVar.cpp +++ b/src/MICmdCmdVar.cpp @@ -300,18 +300,8 @@ CMICmdBase *CMICmdCmdVarCreate::CreateSelf() { void CMICmdCmdVarCreate::CompleteSBValue(lldb::SBValue &vrwValue) { // Force a value to update vrwValue.GetValueDidChange(); - - // And update its children - lldb::SBType valueType = vrwValue.GetType(); - if (!valueType.IsPointerType() && !valueType.IsReferenceType()) { - const auto temp = vrwValue.GetNumChildren(); - const MIuint nChildren = temp > 64 ? 64 : temp; - for (MIuint i = 0; i < nChildren; ++i) { - lldb::SBValue member = vrwValue.GetChildAtIndex(i); - if (member.IsValid()) - CompleteSBValue(member); - } - } + // Do not traverse the Children values. For reference, see + // https://github.com/lldb-tools/lldb-mi/pull/115#discussion_r1706360623. } //++ @@ -588,33 +578,10 @@ void CMICmdCmdVarUpdate::MIFormResponse(const CMIUtilString &vrStrVarName, //-- bool CMICmdCmdVarUpdate::ExamineSBValueForChange(lldb::SBValue &vrwValue, bool &vrwbChanged) { - // Note SBValue::GetValueDidChange() returns false if value changes from - // invalid (for example if it represents a field of a structure, and - // structure is pointed at with a NULL pointer) to a valid value, which is not - // a desired result for -var-update changelist - it will miss case of - // invalid-to-valid change. - if (vrwValue.GetValueDidChange()) { - vrwbChanged = true; - return MIstatus::success; - } + vrwbChanged = vrwValue.GetValueDidChange(); + // Do not traverse the Children values. For reference, see + // https://github.com/lldb-tools/lldb-mi/pull/115#discussion_r1706367538. - const auto temp = vrwValue.GetNumChildren(); - const MIuint nChildren = temp > 64 ? 64 : temp; - for (MIuint i = 0; i < nChildren; ++i) { - lldb::SBValue member = vrwValue.GetChildAtIndex(i); - if (!member.IsValid()) - continue; - - // skip pointers and references to avoid infinite loop - if (member.GetType().GetTypeFlags() & - (lldb::eTypeIsPointer | lldb::eTypeIsReference)) - continue; - - // Handle composite types (i.e. struct or arrays) - if (ExamineSBValueForChange(member, vrwbChanged) && vrwbChanged) - return MIstatus::success; - } - vrwbChanged = false; return MIstatus::success; }