//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// public void UpdateVariable (MiVariable variable) { LoggingUtils.PrintFunction (); string command = string.Format ("-var-update --all-values \"{0}\"", variable.Name); MiResultRecord resultRecord = m_debugger.GdbClient.SendSyncCommand (command); MiResultRecord.RequireOk (resultRecord, command); if (resultRecord.HasField ("changelist")) { variable.Populate (resultRecord ["changelist"]); } }
//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// private MiVariable [] GetChildVariables (MiVariable parentVariable, int depth) { LoggingUtils.PrintFunction (); List<MiVariable> childVariables = new List<MiVariable> (); if ((depth > 0) && (parentVariable.HasChildren)) { string command = string.Format ("-var-list-children --all-values \"{0}\"", parentVariable.Name); MiResultRecord resultRecord = m_debugger.GdbClient.SendSyncCommand (command); MiResultRecord.RequireOk (resultRecord, command); if (resultRecord.HasField ("children")) { List<MiResultValue> childrenList = resultRecord ["children"] [0] ["child"]; for (int i = 0; i < childrenList.Count; ++i) { MiResultValueTuple childTuple = childrenList [i] as MiResultValueTuple; string variableName = childTuple ["name"] [0].GetString (); MiVariable childVariable = null; bool isPseudoChild = false; if (childTuple.HasField ("exp")) { string variableExpression = childTuple ["exp"] [0].GetString (); if (!string.IsNullOrEmpty (variableExpression)) { childVariable = new MiVariable (variableName, variableExpression); childVariable.Populate (childTuple.Values); isPseudoChild = childVariable.IsPseudoChild; } } if (childVariable == null) { childVariable = new MiVariable (variableName, childTuple.Values); } if (isPseudoChild) { depth += 1; // need an additional level of children. MiVariable [] evaluatedChildren = GetChildVariables (childVariable, depth - 1); foreach (MiVariable child in evaluatedChildren) { childVariable.AddChild (child); } } childVariables.Add (childVariable); } } } return childVariables.ToArray (); }