Ide/Debuggers/Gdb_MI2 : small fixes in simplifiers

git-svn-id: svn://ultimatepp.org/upp/trunk@6975 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
micio 2014-03-02 09:11:25 +00:00
parent 76f5958b1d
commit 5b0ca33f38

View file

@ -62,8 +62,6 @@ static int UppStringSimplify(VarItem &varItem, int step)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static int UppVectorSimplify(VarItem &varItem, int step)
{
const char *placeHolder = " = [...]";
// setup item type
varItem.kind = VarItem::ARRAY;
@ -103,22 +101,23 @@ static int UppVectorSimplify(VarItem &varItem, int step)
// start from item 0
step -= 2;
if(!step)
varItem.value << " = [ ]";
// 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>";
varItem.value << " <can't evaluate contents>";
return 0;
}
if(vItem.kind != VarItem::SIMPLE)
{
varItem.value = placeHolder;
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)
@ -130,8 +129,6 @@ static int UppVectorSimplify(VarItem &varItem, int step)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static int UppVectorMapSimplify(VarItem &varItem, int step)
{
const char *placeHolder = " = {...}";
// setup item type
varItem.kind = VarItem::MAP;
@ -172,20 +169,17 @@ static int UppVectorMapSimplify(VarItem &varItem, int step)
// start from item 0
step -= 2;
if(!step)
varItem.value << " = { }";
// fetch elements, check on first if they're SIMPLE, so displayable
VarItem kItem(&varItem.Debugger(), varItem.evaluableExpression + Format(".key.key.vector[%d]", step));
if(!kItem)
{
varItem.value = " <can't evaluate contents>";
varItem.value << " <can't evaluate contents>";
return 0;
}
// for complex types, just return placeholder
if(kItem.kind != VarItem::SIMPLE)
{
varItem.value = placeHolder;
varItem.value << " = {...}";
return 0;
}
kItem.Simplify();
@ -193,17 +187,20 @@ static int UppVectorMapSimplify(VarItem &varItem, int step)
VarItem vItem(&varItem.Debugger(), varItem.evaluableExpression + Format(".value.vector[%d]", step));
if(!vItem)
{
varItem.value = " <can't evaluate contents>";
varItem.value << " <can't evaluate contents>";
return 0;
}
// for complex types, just return placeholder
if(vItem.kind != VarItem::SIMPLE)
{
varItem.value = placeHolder;
return true;
varItem.value << " = {...}";
return 0;
}
vItem.Simplify();
if(!step)
varItem.value << " = { }";
const char *sep = step ? " , " : "";
varItem.value = varItem.value.Left(varItem.value.GetCount() - 2) + sep + "(" + kItem.value + " , " + vItem.value + ") }";
if(++step >= count)
@ -215,8 +212,6 @@ static int UppVectorMapSimplify(VarItem &varItem, int step)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static int UppArraySimplify(VarItem &varItem, int step)
{
const char *placeHolder = " = [...]";
// setup item type
varItem.kind = VarItem::ARRAY;
@ -238,6 +233,7 @@ static int UppArraySimplify(VarItem &varItem, int step)
// get items count
MIValue val = varItem.EvaluateExpression(varItem.evaluableExpression + ".vector.items");
if(val.IsError() || !val.IsString())
return 0;
varItem.items = atoi(val.ToString());
@ -251,29 +247,31 @@ static int UppArraySimplify(VarItem &varItem, int step)
return 2;
}
int count = min(EVALDEEP_VECTOR, varItem.items);
int count = min(EVALDEEP_ARRAY, varItem.items);
// start from item 0
step -= 2;
if(!step)
varItem.value << " = [ ]";
// fetch elements, check on first if they're SIMPLE, so displayable
VarItem vItem(&varItem.Debugger(), varItem.evaluableExpression + Format(".vector.vector[%d][0]", step));
if(!vItem)
{
varItem.value = " <can't evaluate contents>";
varItem.value << " <can't evaluate contents>";
return 0;
}
if(vItem.kind != VarItem::SIMPLE)
{
varItem.value = placeHolder;
varItem.value << " = [...]";
return 0;
}
if(!step)
varItem.value << " = [ ]";
vItem.Simplify();
const char *sep = step ? " , " : "";
varItem.value = varItem.value.Left(varItem.value.GetCount() - 2) + sep + vItem.value + " ]";
if(++step >= count)
return 0;
else
@ -283,8 +281,6 @@ static int UppArraySimplify(VarItem &varItem, int step)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static int UppArrayMapSimplify(VarItem &varItem, int step)
{
const char *placeHolder = " = {...}";
// setup item type
varItem.kind = VarItem::MAP;
@ -325,20 +321,17 @@ static int UppArrayMapSimplify(VarItem &varItem, int step)
// start from item 0
step -= 2;
if(!step)
varItem.value << " = { }";
// fetch elements, check on first if they're SIMPLE, so displayable
VarItem kItem(&varItem.Debugger(), varItem.evaluableExpression + Format(".key.key.vector[%d]", step));
if(!kItem)
{
varItem.value = " <can't evaluate contents>";
varItem.value << " <can't evaluate contents>";
return 0;
}
// for complex types, just return placeholder
if(kItem.kind != VarItem::SIMPLE)
{
varItem.value = placeHolder;
varItem.value << " = {...}";
return 0;
}
kItem.Simplify();
@ -346,17 +339,20 @@ static int UppArrayMapSimplify(VarItem &varItem, int step)
VarItem vItem(&varItem.Debugger(), varItem.evaluableExpression + Format(".value.vector.vector[%d][0]", step));
if(!vItem)
{
varItem.value = " <can't evaluate contents>";
varItem.value << " <can't evaluate contents>";
return 0;
}
// for complex types, just return placeholder
if(vItem.kind != VarItem::SIMPLE)
{
varItem.value = placeHolder;
return true;
varItem.value << " = {...}";
return 0;
}
vItem.Simplify();
if(!step)
varItem.value << " = { }";
const char *sep = step ? " , " : "";
varItem.value = varItem.value.Left(varItem.value.GetCount() - 2) + sep + "(" + kItem.value + " , " + vItem.value + ") }";
if(++step >= count)
@ -368,8 +364,6 @@ static int UppArrayMapSimplify(VarItem &varItem, int step)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
static int UppIndexSimplify(VarItem &varItem, int step)
{
const char *placeHolder = " = [...]";
// setup item type
varItem.kind = VarItem::ARRAY;
@ -409,22 +403,23 @@ static int UppIndexSimplify(VarItem &varItem, int step)
// start from item 0
step -= 2;
if(!step)
varItem.value << " = [ ]";
// fetch elements, check on first if they're SIMPLE, so displayable
VarItem vItem(&varItem.Debugger(), varItem.evaluableExpression + Format(".key.vector[%d]", step));
if(!vItem)
{
varItem.value = " <can't evaluate contents>";
varItem.value << " <can't evaluate contents>";
return 0;
}
if(vItem.kind != VarItem::SIMPLE)
{
varItem.value = placeHolder;
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)