ide: PDB tree now showing pointer arrays

git-svn-id: svn://ultimatepp.org/upp/trunk@13761 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2019-12-13 17:53:59 +00:00
parent b21d66dc05
commit caf9b82767
3 changed files with 31 additions and 14 deletions

View file

@ -1667,7 +1667,6 @@ void WriteClipboardHTML(const String& html);
template <class T>
T *Ctrl::GetAscendant() const
{
T *main;
for(Ctrl *p = GetParent(); p; p = p->GetParent())
if(T *a = dynamic_cast<T*>(p))
return a;

View file

@ -469,7 +469,7 @@ struct Pdb : Debugger, ParentCtrl {
void SetTree(const String& exp);
void SetTreeA(ArrayCtrl *data);
void PrettyTreeNode(int parent, Pdb::Val val, int64 from = 0);
void TreeNode(int parent, const String& name, Val val);
bool TreeNode(int parent, const String& name, Val val, int64 from = 0);
void TreeExpand(int node);
String StoreTree(int parent);
void SaveTree();

View file

@ -65,22 +65,29 @@ void Pdb::PrettyTreeNode(int parent, Pdb::Val val, int64 from)
catch(CParser::Error e) {}
}
void Pdb::TreeNode(int parent, const String& name, Pdb::Val val)
bool Pdb::TreeNode(int parent, const String& name, Pdb::Val val, int64 from)
{
PrettyTreeNode(parent, val);
NamedVal nv;
nv.name = name;
nv.val = val;
nv.from = from;
Visual v;
bool r = true;
try {
v.Cat(name + "=", SGray);
Visualise(v, val, 0);
v.Cat(name);
if(!from) {
v.Cat("=", SGray);
Visualise(v, val, 0);
}
}
catch(LengthLimit) {}
catch(CParser::Error e) {
v.Cat(e, SColorDisabled);
r = false;
}
tree.Add(parent, Null, RawToValue(nv), RawPickToValue(pick(v)), val.type >= 0 || val.ref > 0);
return r;
}
void Pdb::TreeExpand(int node)
@ -97,18 +104,28 @@ void Pdb::TreeExpand(int node)
TreeNode(node, "value", val);
return;
}
if(nv.val.ref > 0) {
Val val0 = val;
val = DeRef(val);
if(val.type < 0 || val.ref > 0) {
int sz = SizeOfType(val.type);
val.address += sz * nv.from;
for(int i = 0; i < (nv.from ? 10000 : 20); i++) {
if(!TreeNode(node, String() << "[" << i + nv.from << "]" , val)) {
SaveTree();
return;
}
val.address += sz;
}
TreeNode(node, "[more]", val0, nv.from ? nv.from + 10000 : 20);
return;
}
}
else
if(nv.from > 0) {
PrettyTreeNode(node, val, nv.from);
return;
}
if(nv.val.ref > 0) {
val = DeRef(val);
if(val.type < 0 || val.ref > 0) {
TreeNode(node, '*' + nv.name, val);
SaveTree();
return;
}
}
if(val.type < 0) {
SaveTree();
return;
@ -263,7 +280,8 @@ void Pdb::SetTree(const String& exp)
Visual v;
try {
v.Cat(n + "=", SGray);
v.Cat(n, SBlack);
v.Cat("=", SGray);
Visualise(v, nv.val, 0);
}
catch(LengthLimit) {}