public VariableInfo(string name, string type, string baseType, string value, EventDispatcher dispatcher, ArrayList GDBNames, ArrayList VSNames)
{
/// numChildren - The result of the createvar returns ERROR or a number from 0 to "n" where "n" is the number of children
/// of the variable.
string numChildren = "";
_name = name;
_type = type;
_value = value;
_children = null;
_GDBName = null;
if (baseType != "")
type = baseType;
if (GDBNames == null)
{
GDBNames = new ArrayList();
VSNames = new ArrayList();
}
if (value == null || (type.Contains("*") && (value != "0x0")))
{
// This is an array, struct, union, or pointer.
// Create a variable object so we can list this variable's children.
/// Some VS variable names cannot be used by GDB. When that happens, it is added the prefix VsNdK_ to the GDB variable
/// name and it is stored in the GDBNames array. At the same time, the VS name is stored in the VSNames array using the
/// same index position. This bool variable just indicate if this prefix is used or not.
bool hasVsNdK_ = false;
numChildren = dispatcher.createVar(_name, ref hasVsNdK_);
if (hasVsNdK_)
{
_GDBName = "VsNdK_" + _name;
GDBNames.Add("VsNdK_" + _name);
VSNames.Add(_name);
}
try // Catch non-numerical data
{
if (Convert.ToInt32(numChildren) > 0) // If the variable has children, evaluate them.
{
_children = new ArrayList();
if (type.Contains("struct"))
if (type[type.Length - 1] == '*')
this.listChildren(dispatcher, "*", GDBNames, VSNames, hasVsNdK_, null);
else if (type.Contains("["))
this.listChildren(dispatcher, "struct[]", GDBNames, VSNames, hasVsNdK_, null);
else
this.listChildren(dispatcher, "struct", GDBNames, VSNames, hasVsNdK_, null);
else if (type.Contains("["))
this.listChildren(dispatcher, "[]", GDBNames, VSNames, hasVsNdK_, null);
else if (type.Contains("*"))
this.listChildren(dispatcher, "*", GDBNames, VSNames, hasVsNdK_, null);
else
this.listChildren(dispatcher, "", GDBNames, VSNames, hasVsNdK_, null);
}
}
catch (FormatException e)
{
}
dispatcher.deleteVar(_name, hasVsNdK_);
}
if (value == null)
evaluateExpression(name, ref _value, null);
}