mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-08-21 22:04:56 -06:00
ide: PDB debugger now has this tab #688
git-svn-id: svn://ultimatepp.org/upp/trunk@7080 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
87e3ac76b2
commit
abcf97acef
5 changed files with 126 additions and 62 deletions
|
|
@ -34,8 +34,6 @@ void Pdb::Vis(ArrayCtrl& a, const String& key, const VectorMap<String, Value>& p
|
|||
{
|
||||
bool ch;
|
||||
a.Add(key, Vis(key, prev, vis, ch));
|
||||
// if(ch)
|
||||
// a.SetDisplay(a.GetCount() - 1, 0, Single<RedDisplay>());
|
||||
}
|
||||
|
||||
void Pdb::Locals()
|
||||
|
|
@ -52,6 +50,94 @@ void Pdb::Locals()
|
|||
}
|
||||
}
|
||||
|
||||
void Pdb::AddThis(const VectorMap<String, Val>& m, adr_t address, const VectorMap<String, Value>& prev)
|
||||
{
|
||||
for(int i = 0; i < m.GetCount() && self.GetCount() < 2000; i++) {
|
||||
Val mv = m[i];
|
||||
mv.address += address;
|
||||
Visual vis;
|
||||
try {
|
||||
vis = Visualise(mv);
|
||||
}
|
||||
catch(CParser::Error e) {
|
||||
vis.Cat(e, SColorDisabled);
|
||||
}
|
||||
Vis(self, m.GetKey(i), prev, vis);
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::AddThis(int type, adr_t address, const VectorMap<String, Value>& prev)
|
||||
{
|
||||
const Type& t = GetType(type);
|
||||
AddThis(t.member, address, prev);
|
||||
AddThis(t.static_member, 0, prev);
|
||||
for(int i = 0; i < t.base.GetCount() && self.GetCount() < 2000; i++)
|
||||
AddThis(t.base[i].type, t.base[i].address + address, prev);
|
||||
}
|
||||
|
||||
void Pdb::This()
|
||||
{
|
||||
VectorMap<String, Value> prev = DataMap(locals);
|
||||
self.Clear();
|
||||
int q = ~framelist;
|
||||
if(q >= 0 && q < frame.GetCount()) {
|
||||
Frame& f = frame[q];
|
||||
for(int i = 0; i < f.local.GetCount(); i++) {
|
||||
if(f.local.GetKey(i) == "this") {
|
||||
Val val = f.local[i];
|
||||
if(val.ref > 0 || val.type < 0)
|
||||
val = GetRVal(val);
|
||||
AddThis(val.type, val.address, prev);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::TryAuto(const String& exp, const VectorMap<String, Value>& prev)
|
||||
{
|
||||
if(autos.Find(exp) < 0) {
|
||||
Visual r;
|
||||
try {
|
||||
CParser p(exp);
|
||||
Val v = Exp(p);
|
||||
Visualise(r, v, 2);
|
||||
}
|
||||
catch(CParser::Error) {
|
||||
r.Clear();
|
||||
}
|
||||
if(r.part.GetCount())
|
||||
Vis(autos, exp, prev, r);
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::Autos()
|
||||
{
|
||||
VectorMap<String, Value> prev = DataMap(autos);
|
||||
autos.Clear();
|
||||
CParser p(autotext);
|
||||
while(!p.IsEof())
|
||||
if(p.IsId()) {
|
||||
String exp = p.ReadId();
|
||||
TryAuto(exp, prev);
|
||||
for(;;) {
|
||||
if(p.Char('.') && p.IsId())
|
||||
exp << '.';
|
||||
else
|
||||
if(p.Char2('-', '>') && p.IsId())
|
||||
exp << "->";
|
||||
else
|
||||
break;
|
||||
exp << p.ReadId();
|
||||
TryAuto(exp, prev);
|
||||
}
|
||||
}
|
||||
else
|
||||
p.SkipTerm();
|
||||
autos.Sort();
|
||||
// MarkChanged(prev, autos);
|
||||
}
|
||||
|
||||
void Pdb::Watches()
|
||||
{
|
||||
VectorMap<String, Value> prev = DataMap(watches);
|
||||
|
|
@ -147,7 +233,7 @@ void Pdb::ExplorerTree()
|
|||
|
||||
void Pdb::DoExplorer()
|
||||
{
|
||||
tab.Set(3);
|
||||
tab.Set(TAB_EXPLORER);
|
||||
expexp.SetFocus();
|
||||
expexp.SetSelection();
|
||||
Explorer();
|
||||
|
|
@ -174,55 +260,11 @@ void Pdb::ExFw()
|
|||
void Pdb::ExploreKey(ArrayCtrl *a)
|
||||
{
|
||||
if(a && a->IsCursor()) {
|
||||
tab.Set(3);
|
||||
tab.Set(TAB_EXPLORER);
|
||||
Explore(a->GetKey());
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::TryAuto(const String& exp, const VectorMap<String, Value>& prev)
|
||||
{
|
||||
if(autos.Find(exp) < 0) {
|
||||
Visual r;
|
||||
try {
|
||||
CParser p(exp);
|
||||
Val v = Exp(p);
|
||||
Visualise(r, v, 2);
|
||||
}
|
||||
catch(CParser::Error) {
|
||||
r.Clear();
|
||||
}
|
||||
if(r.part.GetCount())
|
||||
Vis(autos, exp, prev, r);
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::Autos()
|
||||
{
|
||||
VectorMap<String, Value> prev = DataMap(autos);
|
||||
autos.Clear();
|
||||
CParser p(autotext);
|
||||
while(!p.IsEof())
|
||||
if(p.IsId()) {
|
||||
String exp = p.ReadId();
|
||||
TryAuto(exp, prev);
|
||||
for(;;) {
|
||||
if(p.Char('.') && p.IsId())
|
||||
exp << '.';
|
||||
else
|
||||
if(p.Char2('-', '>') && p.IsId())
|
||||
exp << "->";
|
||||
else
|
||||
break;
|
||||
exp << p.ReadId();
|
||||
TryAuto(exp, prev);
|
||||
}
|
||||
}
|
||||
else
|
||||
p.SkipTerm();
|
||||
autos.Sort();
|
||||
// MarkChanged(prev, autos);
|
||||
}
|
||||
|
||||
bool Pdb::Tip(const String& exp, CodeEditor::MouseTip& mt)
|
||||
{
|
||||
/* mt.display = &StdDisplay();
|
||||
|
|
@ -248,10 +290,11 @@ bool Pdb::Tip(const String& exp, CodeEditor::MouseTip& mt)
|
|||
void Pdb::Data()
|
||||
{
|
||||
switch(tab.Get()) {
|
||||
case 0: Autos(); break;
|
||||
case 1: Locals(); break;
|
||||
case 2: Watches(); break;
|
||||
case 3: Explorer(); break;
|
||||
case TAB_AUTOS: Autos(); break;
|
||||
case TAB_LOCALS: Locals(); break;
|
||||
case TAB_THIS: This(); break;
|
||||
case TAB_WATCHES: Watches(); break;
|
||||
case TAB_EXPLORER: Explorer(); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -477,7 +520,7 @@ void Pdb::MemoryGoto(const String& exp)
|
|||
adr = v.address;
|
||||
memory.SetCursor(adr);
|
||||
memory.SetSc(adr);
|
||||
tab.Set(4);
|
||||
tab.Set(TAB_MEMORY);
|
||||
}
|
||||
catch(CParser::Error e) {
|
||||
Exclamation("Invalid expression!&" + DeQtf(e));
|
||||
|
|
|
|||
|
|
@ -42,18 +42,19 @@ void Pdb::DebugBar(Bar& bar)
|
|||
void Pdb::Tab()
|
||||
{
|
||||
switch(tab.Get()) {
|
||||
case 0: autos.SetFocus(); break;
|
||||
case 1: locals.SetFocus(); break;
|
||||
case 2: watches.SetFocus(); break;
|
||||
case 3: explorer.SetFocus(); break;
|
||||
case 4: memory.SetFocus(); break;
|
||||
case TAB_AUTOS: autos.SetFocus(); break;
|
||||
case TAB_LOCALS: locals.SetFocus(); break;
|
||||
case TAB_THIS: self.SetFocus(); break;
|
||||
case TAB_WATCHES: watches.SetFocus(); break;
|
||||
case TAB_EXPLORER: explorer.SetFocus(); break;
|
||||
case TAB_MEMORY: memory.SetFocus(); break;
|
||||
}
|
||||
Data();
|
||||
}
|
||||
|
||||
bool Pdb::Key(dword key, int count)
|
||||
{
|
||||
if(key >= 32 && key < 65535 && tab.Get() == 2) {
|
||||
if(key >= 32 && key < 65535 && tab.Get() == TAB_LOCALS) {
|
||||
watches.DoInsertAfter();
|
||||
Ctrl* f = GetFocusCtrl();
|
||||
if(f && watches.HasChildDeep(f))
|
||||
|
|
@ -182,6 +183,13 @@ Pdb::Pdb()
|
|||
locals.WhenBar = THISBACK(LocalsMenu);
|
||||
locals.WhenLeftDouble = THISBACK1(ExploreKey, &locals);
|
||||
|
||||
self.NoHeader();
|
||||
self.AddColumn("", 1);
|
||||
self.AddColumn("", 6).SetDisplay(Single<VisualDisplay>());
|
||||
self.WhenEnterRow = THISBACK1(SetTreeA, &self);
|
||||
self.WhenBar = THISBACK(LocalsMenu);
|
||||
self.WhenLeftDouble = THISBACK1(ExploreKey, &self);
|
||||
|
||||
watches.NoHeader();
|
||||
watches.AddColumn("", 1).Edit(watchedit);
|
||||
watches.AddColumn("", 6).SetDisplay(Single<VisualDisplay>());
|
||||
|
|
@ -218,6 +226,7 @@ Pdb::Pdb()
|
|||
|
||||
tab.Add(autos.SizePos(), "Autos");
|
||||
tab.Add(locals.SizePos(), "Locals");
|
||||
tab.Add(self.SizePos(), "this");
|
||||
tab.Add(watches.SizePos(), "Watches");
|
||||
tab.Add(explorer_pane.SizePos(), "Explorer");
|
||||
memory.cdb = this;
|
||||
|
|
@ -231,8 +240,8 @@ Pdb::Pdb()
|
|||
framelist.Ctrl::Add(dlock.SizePos());
|
||||
|
||||
pane.Add(tab.SizePos());
|
||||
pane.Add(threadlist.LeftPosZ(320, 60).TopPos(2, EditField::GetStdHeight()));
|
||||
pane.Add(framelist.HSizePosZ(384, 0).TopPos(2, EditField::GetStdHeight()));
|
||||
pane.Add(threadlist.LeftPosZ(340, 60).TopPos(2, EditField::GetStdHeight()));
|
||||
pane.Add(framelist.HSizePosZ(404, 0).TopPos(2, EditField::GetStdHeight()));
|
||||
split.Horz(pane, tree.SizePos());
|
||||
split.SetPos(8000);
|
||||
Add(split);
|
||||
|
|
|
|||
|
|
@ -180,12 +180,17 @@ struct Pdb : Debugger, ParentCtrl {
|
|||
DbgDisas disas;
|
||||
|
||||
EditString watchedit;
|
||||
|
||||
enum { // Order in this enum has to be same as order of tab.Add
|
||||
TAB_AUTOS, TAB_LOCALS, TAB_THIS, TAB_WATCHES, TAB_EXPLORER, TAB_MEMORY
|
||||
};
|
||||
|
||||
TabCtrl tab;
|
||||
DropList threadlist;
|
||||
DropList framelist;
|
||||
Label dlock;
|
||||
ArrayCtrl locals;
|
||||
ArrayCtrl self;
|
||||
ArrayCtrl watches;
|
||||
ArrayCtrl autos;
|
||||
ArrayCtrl explorer;
|
||||
|
|
@ -311,6 +316,9 @@ struct Pdb : Debugger, ParentCtrl {
|
|||
void Watches();
|
||||
void TryAuto(const String& exp, const VectorMap<String, Value>& prev);
|
||||
void Autos();
|
||||
void AddThis(const VectorMap<String, Val>& m, adr_t address, const VectorMap<String, Value>& prev);
|
||||
void AddThis(int type, adr_t address, const VectorMap<String, Value>& prev);
|
||||
void This();
|
||||
void Explore(const Val& val, const VectorMap<String, Value>& prev);
|
||||
void Explore(const String& exp);
|
||||
void ExploreKey(ArrayCtrl *a);
|
||||
|
|
|
|||
|
|
@ -579,6 +579,10 @@ public:
|
|||
filetime = Null; editpos.Clear(); undodata.Clear();
|
||||
columnline = Null; lineinfo.Clear(); lineinforem.Clear();
|
||||
}
|
||||
void ClearP() {
|
||||
lineinforem.Clear();
|
||||
undodata.Clear();
|
||||
}
|
||||
};
|
||||
|
||||
String posfile[2];
|
||||
|
|
|
|||
|
|
@ -548,7 +548,7 @@ void Ide::EditFile0(const String& path, byte charset, bool astext, const String&
|
|||
editor.SetReadOnly();
|
||||
editor.NoShowReadOnly();
|
||||
}
|
||||
fd.undodata.Clear();
|
||||
fd.ClearP();
|
||||
PosSync();
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue