Esempio n. 1
0
static int UppOneSimplify(VarItem &varItem, int step)
{
	// setup item type
	varItem.kind = VarItem::COMPLEX;
	
	// if we're just doing first scan phase, signal that we need further evaluation later
#ifdef EVALDEEP
	if(!step)
		// next step is 1
		return 1;
#else
	varItem.value = placeHolder;
	return 0;
#endif

	// de-reference and forward simplify
	MIValue val = varItem.EvaluateExpression(varItem.evaluableExpression + "." + "ptr");
	if(val.IsError() || !val.IsString())
	{
		varItem.value = "Upp::One<> = <can't evaluate contents>";
		return 0;
	}
	String ptr = val.ToString();
	if(ptr == "0x0")
	{
		varItem.value = "Upp::One<> = <EMPTY>";
		return 0;
	}
	
	// replace variable with de-referenced one
	VarItem vItem(&varItem.Debugger(), "*" + varItem.evaluableExpression + "." + "ptr");
	varItem = vItem;
	return varItem.GetSimplifyStep();
}
Esempio n. 2
0
static int UppVectorSimplify(VarItem &varItem, int step)
{
	// setup item type
	varItem.kind = VarItem::ARRAY;
	
	// if we're just doing first scan phase, signal that we need further evaluation later
#ifdef EVALDEEP
	if(!step)
		// next step is 1
		return 1;
#else
	varItem.value = placeHolder;
	return 0;
#endif
	
	// just getting items count...
	if(step == 1)
	{
		// initialize default value
		varItem.value = "<can't evaluate>";
		
		// get items count
		MIValue val = varItem.EvaluateExpression(varItem.evaluableExpression + ".items");
		if(val.IsError() || !val.IsString())
			return 0;
		varItem.items = atoi(val.ToString());
		
		// update value
		varItem.value = Format("Upp::Vector with %d elements", varItem.items, "");
		
		// if no elements, just quit
		if(!varItem.items)
			return 0;
		return 2;
	}
	
	int count = min(EVALDEEP_VECTOR, varItem.items);
	
	// start from item 0
	step -= 2;
	
	// fetch elements, check on first if they're SIMPLE, so displayable
	VarItem vItem(&varItem.Debugger(), varItem.evaluableExpression + Format(".vector[%d]", step));
	if(!vItem)
	{
		varItem.value << " <can't evaluate contents>";
		return 0;
	}
	if(vItem.kind != VarItem::SIMPLE)
	{
		varItem.value << " = [...]";
		return 0;
	}
	vItem.Simplify();

	if(!step)
		varItem.value << " = [ ]";
	
	const char *sep = step ? " , " : "";
	varItem.value = varItem.value.Left(varItem.value.GetCount() - 2) + sep + vItem.value + " ]";
	if(++step >= count)
		return 0;
	else
		return step + 2;
}