MonoDevelop.Debugger.Gdb.GdbBacktrace.GetChildren C# (CSharp) Method

GetChildren() public method

public GetChildren ( Mono.Debugging.Client.ObjectPath path, int index, int count, Mono.Debugging.Client.EvaluationOptions options ) : Mono.Debugging.Client.ObjectValue[]
path Mono.Debugging.Client.ObjectPath
index int
count int
options Mono.Debugging.Client.EvaluationOptions
return Mono.Debugging.Client.ObjectValue[]
		public ObjectValue[] GetChildren (ObjectPath path, int index, int count, EvaluationOptions options)
		{
			List<ObjectValue> children = new List<ObjectValue> ();
			session.SelectThread (threadId);
			GdbCommandResult res = session.RunCommand ("-var-list-children", "2", path.Join ("."));
			ResultData cdata = res.GetObject ("children");
			
			// The response may not contain the "children" list at all.
			if (cdata == null)
				return children.ToArray ();
			
			if (index == -1) {
				index = 0;
				count = cdata.Count;
			}
			
			for (int n=index; n<cdata.Count && n<index+count; n++) {
				ResultData data = cdata.GetObject (n);
				ResultData child = data.GetObject ("child");
				
				string name = child.GetValueString ("exp");
				if (name.Length > 0 && char.IsNumber (name [0]))
					name = "[" + name + "]";
				
				// C++ structures may contain typeless children named
				// "public", "private" and "protected".
				if (child.GetValue("type") == null) {
					ObjectPath childPath = new ObjectPath (child.GetValueString ("name").Split ('.'));
					ObjectValue[] subchildren = GetChildren (childPath, -1, -1, options);
					children.AddRange(subchildren);
				} else {
					ObjectValue val = CreateObjectValue (name, child);
					children.Add (val);
				}
			}
			return children.ToArray ();
		}