mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
ide: Standard debugger improved
git-svn-id: svn://ultimatepp.org/upp/trunk@9081 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
17672a6600
commit
6864e90052
6 changed files with 117 additions and 6 deletions
|
|
@ -111,6 +111,7 @@ struct Gdb : Debugger, ParentCtrl {
|
|||
virtual bool Key(dword key, int count);
|
||||
virtual void Stop();
|
||||
virtual bool IsFinished();
|
||||
virtual bool Tip(const String& exp, CodeEditor::MouseTip& mt);
|
||||
|
||||
One<Host> host;
|
||||
One<AProcess> dbg;
|
||||
|
|
@ -130,6 +131,8 @@ struct Gdb : Debugger, ParentCtrl {
|
|||
ArrayCtrl self;
|
||||
ColumnList cpu;
|
||||
Label dlock;
|
||||
|
||||
VectorMap<String, String> expression_cache;
|
||||
|
||||
WithQuickwatchLayout<TopWindow> quickwatch;
|
||||
|
||||
|
|
@ -174,13 +177,17 @@ struct Gdb : Debugger, ParentCtrl {
|
|||
void SwitchFrame();
|
||||
void SwitchThread();
|
||||
|
||||
static void ReadGdbValues(CParser& p, VectorMap<String, String>& val);
|
||||
static void ReadGdbValues(const String& h, VectorMap<String, String>& val);
|
||||
|
||||
String Print0(const String& exp);
|
||||
String Print(const String& exp);
|
||||
void Locals();
|
||||
void Watches();
|
||||
void TryAuto(Index<String>& tested, const String& exp);
|
||||
void Autos();
|
||||
void Data();
|
||||
void Self();
|
||||
void Cpu();
|
||||
void QuickWatch();
|
||||
|
||||
|
|
|
|||
|
|
@ -178,6 +178,7 @@ void Gdb::CheckEnd(const char *s)
|
|||
|
||||
String Gdb::Cmdp(const char *cmdline, bool fr)
|
||||
{
|
||||
expression_cache.Clear();
|
||||
String s = Cmd(cmdline);
|
||||
if(ParsePos(s, file, line, addr)) {
|
||||
IdeSetDebugPos(GetLocalPath(file), line - 1, fr ? DbgImg::FrameLinePtr()
|
||||
|
|
@ -382,21 +383,28 @@ Gdb::Gdb()
|
|||
locals.NoHeader();
|
||||
locals.AddColumn("", 1);
|
||||
locals.AddColumn("", 6);
|
||||
locals.EvenRowColor();
|
||||
watches.NoHeader();
|
||||
watches.AddColumn("", 1).Edit(watchedit);
|
||||
watches.AddColumn("", 6);
|
||||
watches.Inserting().Removing();
|
||||
watches.EvenRowColor();
|
||||
autos.NoHeader();
|
||||
autos.AddColumn("", 1);
|
||||
autos.AddColumn("", 6);
|
||||
autos.EvenRowColor();
|
||||
self.NoHeader();
|
||||
self.AddColumn("", 1);
|
||||
self.AddColumn("", 6);
|
||||
self.EvenRowColor();
|
||||
cpu.Columns(3);
|
||||
cpu.ItemHeight(Courier(Ctrl::HorzLayoutZoom(12)).GetCy());
|
||||
// cpu.SetDisplay(Single<CpuRegisterDisplay>());
|
||||
|
||||
Add(tab.SizePos());
|
||||
tab.Add(autos.SizePos(), "Autos");
|
||||
tab.Add(locals.SizePos(), "Locals");
|
||||
tab.Add(watches.SizePos(), "Watches");
|
||||
tab.Add(self.SizePos(), "this");
|
||||
tab.Add(cpu.SizePos(), "CPU");
|
||||
Add(threads.LeftPosZ(300, 100).TopPos(2));
|
||||
Add(frame.HSizePosZ(404, 0).TopPos(2));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
#include "Debuggers.h"
|
||||
|
||||
#if 0
|
||||
String DataClean(CParser& p)
|
||||
{
|
||||
String r;
|
||||
|
|
@ -70,6 +71,13 @@ String DataClean(const char *s)
|
|||
catch(CParser::Error) {}
|
||||
return Null;
|
||||
}
|
||||
#endif
|
||||
|
||||
String DataClean(const String& exp)
|
||||
{
|
||||
int q = exp.Find('{');
|
||||
return q >= 0 ? TrimBoth(exp.Mid(q)) : exp;
|
||||
}
|
||||
|
||||
void Gdb::Locals()
|
||||
{
|
||||
|
|
@ -93,7 +101,7 @@ void Gdb::Locals()
|
|||
MarkChanged(prev, locals);
|
||||
}
|
||||
|
||||
String Gdb::Print(const String& exp)
|
||||
String Gdb::Print0(const String& exp)
|
||||
{
|
||||
String q = FastCmd("print " + exp);
|
||||
StringStream ss(q);
|
||||
|
|
@ -109,6 +117,16 @@ String Gdb::Print(const String& exp)
|
|||
return DataClean(ln);
|
||||
}
|
||||
|
||||
String Gdb::Print(const String& exp)
|
||||
{
|
||||
int q = expression_cache.Find(exp);
|
||||
if(q >= 0)
|
||||
return expression_cache[q];
|
||||
String r = Print0(exp);
|
||||
expression_cache.Add(exp, r);
|
||||
return r;
|
||||
}
|
||||
|
||||
void Gdb::Watches()
|
||||
{
|
||||
VectorMap<String, String> prev = DataMap(watches);
|
||||
|
|
@ -158,6 +176,65 @@ void Gdb::Autos()
|
|||
MarkChanged(prev, autos);
|
||||
}
|
||||
|
||||
void Gdb::ReadGdbValues(CParser& p, VectorMap<String, String>& val)
|
||||
{
|
||||
if(p.Char('{')) {
|
||||
while(!p.Char('}') && !p.IsEof()) {
|
||||
String id;
|
||||
String value;
|
||||
const char *b = p.GetPtr();
|
||||
while(!p.IsEof())
|
||||
if(p.IsChar('=')) {
|
||||
id = TrimBoth(String(b, p.GetPtr()));
|
||||
p.Char('=');
|
||||
break;
|
||||
}
|
||||
else
|
||||
p.SkipTerm();
|
||||
b = p.GetPtr();
|
||||
int lvl = 0;
|
||||
while(!p.IsEof())
|
||||
if(p.IsChar(',') && lvl == 0) {
|
||||
String v = TrimBoth(String(b, p.GetPtr()));
|
||||
if(*id == '<') // Base class
|
||||
ReadGdbValues(v, val);
|
||||
else
|
||||
val.Add(id, v);
|
||||
p.Char(',');
|
||||
break;
|
||||
}
|
||||
else
|
||||
if(p.Char('{'))
|
||||
lvl++;
|
||||
else
|
||||
if(p.Char('}'))
|
||||
lvl--;
|
||||
else
|
||||
p.SkipTerm();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Gdb::ReadGdbValues(const String& h, VectorMap<String, String>& val)
|
||||
{
|
||||
try {
|
||||
CParser p(h);
|
||||
ReadGdbValues(p, val);
|
||||
}
|
||||
catch(CParser::Error) {}
|
||||
}
|
||||
|
||||
void Gdb::Self()
|
||||
{
|
||||
VectorMap<String, String> prev = DataMap(locals);
|
||||
self.Clear();
|
||||
VectorMap<String, String> val;
|
||||
ReadGdbValues(Print("*this"), val);
|
||||
for(int i = 0; i < val.GetCount(); i++)
|
||||
self.Add(val.GetKey(i), val[i]);
|
||||
MarkChanged(prev, locals);
|
||||
}
|
||||
|
||||
void Gdb::Cpu()
|
||||
{
|
||||
String s = FastCmd("info registers");
|
||||
|
|
@ -180,7 +257,8 @@ void Gdb::Data()
|
|||
case 0: Autos(); break;
|
||||
case 1: Locals(); break;
|
||||
case 2: Watches(); break;
|
||||
case 3: Cpu(); break;
|
||||
case 3: Self(); break;
|
||||
case 4: Cpu(); break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -206,3 +284,21 @@ void Gdb::QuickWatch()
|
|||
}
|
||||
quickwatch.Close();
|
||||
}
|
||||
|
||||
bool Gdb::Tip(const String& exp, CodeEditor::MouseTip& mt)
|
||||
{
|
||||
if(IsNull(exp))
|
||||
return false;
|
||||
String val = Print(exp);
|
||||
if(!IsNull(val) && !val.EndsWith(")}") && !IsAlpha(*val)) {
|
||||
if(val.GetCount() > 100) {
|
||||
val.Trim(100);
|
||||
val << "...";
|
||||
}
|
||||
mt.display = &StdDisplay();
|
||||
mt.value = val;
|
||||
mt.sz = mt.display->GetStdSize(String(mt.value) + "X");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Binary file not shown.
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 2.8 KiB |
|
|
@ -600,8 +600,8 @@ LAYOUT(SetupIdeLayout, 512, 264)
|
|||
ITEM(Label, dv___16, SetLabel(t_("HYDRA threads")).LeftPosZ(212, 80).TopPosZ(4, 19))
|
||||
ITEM(EditIntSpin, hydra1_threads, Max(64).Min(1).LeftPosZ(344, 48).TopPosZ(4, 19))
|
||||
ITEM(Option, output_per_assembly, SetLabel(t_("Use unique output directory per assembly (append assembly name to output directory)")).HSizePosZ(4, 4).TopPosZ(224, 16))
|
||||
ITEM(Switch, gdbSelector, SetLabel(t_("Legacy\nGDB_MI2 (new)")).LeftPosZ(344, 176).TopPosZ(28, 20))
|
||||
ITEM(Label, dv___20, SetLabel(t_("GDB Debugger interface")).LeftPosZ(212, 188).TopPosZ(28, 20))
|
||||
ITEM(Switch, gdbSelector, SetLabel(t_("Standard\nGDB_MI2 (experimental)")).LeftPosZ(344, 176).TopPosZ(28, 36))
|
||||
ITEM(Label, dv___20, SetLabel(t_("GDB Debugger interface")).LeftPosZ(212, 188).TopPosZ(24, 20))
|
||||
ITEM(Label, dv___21, SetLabel(t_("In editor mode, path for .usc files")).LeftPosZ(4, 192).TopPosZ(244, 20))
|
||||
ITEM(EditString, uscpath, LeftPosZ(172, 336).TopPosZ(244, 19))
|
||||
END_LAYOUT
|
||||
|
|
|
|||
|
|
@ -380,7 +380,7 @@ Ide::Ide()
|
|||
build_start_time = Null;
|
||||
hydra1_threads = CPU_Cores();
|
||||
|
||||
gdbSelector = 1;
|
||||
gdbSelector = 0;
|
||||
|
||||
chstyle = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue