Ide/Debuggers/Gdb_MI2 : fixed a crash reading local variables

git-svn-id: svn://ultimatepp.org/upp/trunk@6885 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
micio 2014-02-08 09:39:04 +00:00
parent 9ed1133656
commit 376ada44b1
3 changed files with 23 additions and 3 deletions

View file

@ -1061,7 +1061,7 @@ void Gdb_MI2::UpdateLocalVars(void)
localVarNames.Clear();
localVarValues.Clear();
MIValue iLoc = MICmd("stack-list-variables 2");
MIValue iLoc = MICmd("stack-list-variables 1");
if(!iLoc || iLoc.IsEmpty())
return;
MIValue &loc = iLoc["variables"];
@ -1079,6 +1079,15 @@ void Gdb_MI2::UpdateLocalVars(void)
}
}
// update 'this' inspector data
void Gdb_MI2::UpdateThis(void)
{
/*
MIValue thisVal = MICmd("data-evaluate-expression *this");
RLOG(thisVal.Dump());
*/
}
// sync watches treectrl
void Gdb_MI2::SyncLocals()
{
@ -1147,6 +1156,10 @@ void Gdb_MI2::SyncData()
// those are needed for Autos, Locals and Tooltips
UpdateLocalVars();
// update stored 'this' member data
// also used for tooltips and 'this' pane page
UpdateThis();
switch(tab.Get())
{
case 0:

View file

@ -109,14 +109,19 @@ class Gdb_MI2 : public Debugger, public ParentCtrl
Index<String>watchesExpressions;
Vector<String>watchesValues;
// 'this' variable inspection data
Index<String>thisNames;
Vector<String>thisFullNames;
Vector<String>thisValues;
// stored autos expressions, values and types
String autoLine;
// update local variables on demand
void UpdateLocalVars(void);
// update stored watches values on demand
void UpdateWatches(void);
// update 'this' inspector data
void UpdateThis(void);
// logs frame data on console
void LogFrame(String const &msg, MIValue &frame);

View file

@ -291,6 +291,8 @@ MIValue &MIValue::Get(const char *key)
{
if(type != MITuple)
return ErrorMIValue("Not a Tuple value type");
if(tuple.Find(key) < 0)
return ErrorMIValue(String("key '") + key + "' not found");
return tuple.Get(key);
}