mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
Ide/Debuggers/Gdb_MI2 : speedup frame droplist omitting argumen values too far from current frame pointer
git-svn-id: svn://ultimatepp.org/upp/trunk@7070 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
e74e816a0d
commit
7f8872b647
2 changed files with 48 additions and 13 deletions
|
|
@ -881,26 +881,25 @@ String Gdb_MI2::FormatFrame(MIValue &fInfo, MIValue &fArgs)
|
|||
return Format("%02d-%s%s at %s:%s", idx, func, argLine, file, line);
|
||||
}
|
||||
|
||||
// re-fills frame's droplist when dropping it
|
||||
void Gdb_MI2::DropFrames()
|
||||
bool Gdb_MI2::FillDropFrames(int min, int max, bool val)
|
||||
{
|
||||
int q = ~frame;
|
||||
frame.Clear();
|
||||
if(min > max)
|
||||
return true;
|
||||
|
||||
// get a list of frames
|
||||
MIValue frameList = pick(MICmd("stack-list-frames")["stack"]);
|
||||
MIValue frameList = pick(MICmd(Format("stack-list-frames %d %d", min, max))["stack"]);
|
||||
if(frameList.IsError() || !frameList.IsArray())
|
||||
{
|
||||
Exclamation("Couldn't get stack frame list");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// get the arguments for all frames, values just for simple types
|
||||
MIValue frameArgs = pick(MICmd("stack-list-arguments 1")["stack-args"]);
|
||||
MIValue frameArgs = pick(MICmd(Format("stack-list-arguments %d %d %d", val ? 2 : 0, min, max))["stack-args"]);
|
||||
if(frameArgs.IsError() || !frameArgs.IsArray())
|
||||
{
|
||||
Exclamation("Couldn't get stack arguments list");
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
// fill the droplist
|
||||
|
|
@ -910,12 +909,40 @@ void Gdb_MI2::DropFrames()
|
|||
MIValue &fArgs = frameArgs[iFrame]["args"];
|
||||
frame.Add(iFrame, FormatFrame(fInfo, fArgs));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// re-fills frame's droplist when dropping it
|
||||
void Gdb_MI2::DropFrames()
|
||||
{
|
||||
int q = ~frame;
|
||||
frame.Clear();
|
||||
|
||||
// getting frame args values is quite slow in gdb
|
||||
// so we get them just for 3+3 frames around current
|
||||
// frame position; for the rest we just get names
|
||||
|
||||
// data must be synced on frame change
|
||||
localSynced = false;
|
||||
thisSynced = false;
|
||||
watchesSynced = false;
|
||||
explorerSynced = false;
|
||||
// get stack depth
|
||||
int depth = atoi(MICmd("stack-info-depth")["depth"].ToString());
|
||||
|
||||
// adjust frame pointer, just in case current depth is less than former
|
||||
if(q >= depth)
|
||||
q = depth - 1;
|
||||
|
||||
int minVal = max(0, q - 3);
|
||||
int maxVal = min(depth - 1, q + 3);
|
||||
|
||||
// first window without values
|
||||
if(!FillDropFrames(0, minVal - 1, false))
|
||||
return;
|
||||
|
||||
// window with values
|
||||
if(!FillDropFrames(minVal, maxVal, true))
|
||||
return;
|
||||
|
||||
// last window without values
|
||||
if(!FillDropFrames(maxVal + 1, depth - 1, false))
|
||||
return;
|
||||
|
||||
frame <<= q;
|
||||
}
|
||||
|
|
@ -929,6 +956,13 @@ void Gdb_MI2::ShowFrame()
|
|||
Exclamation(Format(t_("Couldn't select frame #%d"), i));
|
||||
return;
|
||||
}
|
||||
|
||||
// data must be synced on frame change
|
||||
localSynced = false;
|
||||
thisSynced = false;
|
||||
watchesSynced = false;
|
||||
explorerSynced = false;
|
||||
|
||||
SyncIde(i);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -250,6 +250,7 @@ class Gdb_MI2 : public Debugger, public ParentCtrl
|
|||
String FormatFrame(MIValue &fInfo, MIValue &fArgs);
|
||||
|
||||
// re-fills frame's droplist when dropping it
|
||||
bool FillDropFrames(int min, int max, bool val);
|
||||
void DropFrames();
|
||||
|
||||
// shows selected stack frame in editor
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue