ide: PDB debugger now prints Nulls

git-svn-id: svn://ultimatepp.org/upp/trunk@7684 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-09-13 20:47:12 +00:00
parent a26c7629a2
commit cc66d93e8a
5 changed files with 20 additions and 5 deletions

View file

@ -467,7 +467,7 @@ extern const Nuller Null;
template <class T> void SetNull(T& x) { x = Null; }
template <class T> bool IsNull(const T& x) { return x.IsNullInstance(); }
template <class T> bool IsNull(const T& x) { return x.IsNullInstance(); }
template<> inline bool IsNull(const int& i) { return i == INT_NULL; }
template<> inline bool IsNull(const int64& i) { return i == INT64_NULL; }

View file

@ -118,6 +118,7 @@ void Pdb::Autos()
{
VectorMap<String, Value> prev = DataMap(autos);
autos.Clear();
autotext.Replace("//", "");
CParser p(autotext);
TryAuto("this", prev);
while(!p.IsEof())
@ -295,6 +296,7 @@ bool Pdb::Tip(const String& exp, CodeEditor::MouseTip& mt)
void Pdb::Data()
{
DLOG("Data");
switch(tab.Get()) {
case TAB_AUTOS: Autos(); break;
case TAB_LOCALS: Locals(); break;

View file

@ -233,6 +233,8 @@ Pdb::Pdb()
autos.WhenBar = THISBACK(AutosMenu);
autos.WhenLeftDouble = THISBACK1(ExploreKey, &autos);
DLOG("TEST");
int c = EditField::GetStdHeight();
explorer.AddColumn("", 1);
explorer.AddColumn("", 6).SetDisplay(Single<VisualDisplay>());

View file

@ -327,6 +327,7 @@ struct Pdb : Debugger, ParentCtrl {
Val Comparison(CParser& p);
Val Exp0(CParser& p);
Val Exp(CParser& p);
void CatInt(Visual& result, int64 val);
void Visualise(Visual& result, Pdb::Val val, int expandptr, int slen);
void Visualise(Visual& result, Pdb::Val val, int expandptr);
Visual Visualise(Val v);

View file

@ -48,6 +48,11 @@ bool IsOk(const String& q)
return true;
}
void Pdb::CatInt(Visual& result, int64 val)
{
result.Cat(IntFormat(val), Red);
}
void Pdb::Visualise(Visual& result, Pdb::Val val, int expandptr, int slen)
{
const int maxlen = 300;
@ -79,7 +84,8 @@ void Pdb::Visualise(Visual& result, Pdb::Val val, int expandptr, int slen)
return;
}
if(val.type < 0) {
#define RESULTINT(x, type) case x: result.Cat(IntFormat((type)val.ival), Red); break;
#define RESULTINT(x, type) case x: CatInt(result, (type)val.ival); break;
#define RESULTINTN(x, type, t2) case x: if(IsNull((t2)val.ival)) result.Cat("Null ", Magenta); CatInt(result, (type)val.ival); break;
switch(val.type) {
RESULTINT(BOOL1, bool)
RESULTINT(UINT1, byte)
@ -87,12 +93,16 @@ void Pdb::Visualise(Visual& result, Pdb::Val val, int expandptr, int slen)
RESULTINT(UINT2, uint16)
RESULTINT(SINT2, int16)
RESULTINT(UINT4, uint32)
RESULTINT(SINT4, int32)
RESULTINT(UINT8, uint64)
RESULTINT(SINT8, int64)
RESULTINTN(SINT4, int32, int)
RESULTINTN(SINT8, int64, int64)
case DBL:
case FLT:
result.Cat(FormatDouble(val.fval, 20), Red); break;
if(IsNull(val.fval))
result.Cat("Null", Magenta);
else
result.Cat(FormatDouble(val.fval, 20), Red);
break;
case PFUNC: {
result.Cat(Hex(val.address), Red);
FnInfo fi = GetFnInfo(val.address);