ide: PDB debugger now supports ErrorValue

This commit is contained in:
Mirek Fidler 2022-02-11 17:27:54 +01:00
parent 05fdb8a04a
commit 54e8b63ae7
4 changed files with 25 additions and 11 deletions

View file

@ -274,10 +274,11 @@ struct Pdb : Debugger, ParentCtrl {
Vector<String> data_type; // type of data items (usually type_param)
Vector<adr_t> data_ptr; // pointer to items (data_count.GetCount() * data_type.GetCount() items)
Visual text;
bool has_data = true; // do display the data for SINGLE_VALUE (false for e.g. void Value)
void Text(const char *s, Color color = SRed) { text.Cat(s, color); }
void Text(const String& s, Color color = SRed) { text.Cat(s, color); }
void SetNull() { Text("Null", SCyan); }
void Text(const char *s, Color color = SRed) { text.Cat(s, color); has_data = false; }
void Text(const String& s, Color color = SRed) { text.Cat(s, color); has_data = false; }
void SetNull() { Text("Null", SCyan); has_data = false; }
};
VectorMap<String, Tuple<int, Event<Val, const Vector<String>&, int64, int, Pdb::Pretty&>>> pretty;

View file

@ -146,14 +146,13 @@ bool Pdb::VisualisePretty(Visual& result, Pdb::Val val, dword flags)
if(p.kind == SINGLE_VALUE) {
Pretty p;
PrettyVal(val, 0, 1, p);
if(p.text.part.GetCount())
for(const VisualPart& vp : p.text.part)
result.Cat(vp.text, vp.ink);
else
if(p.data_type.GetCount() && p.data_ptr.GetCount())
Visualise(result, MakeVal(p.data_type[0], p.data_ptr[0]), flags);
else
Visualise(result, val, flags | RAW);
for(const VisualPart& vp : p.text.part)
result.Cat(vp.text, vp.ink);
if(p.has_data)
if(p.data_type.GetCount() && p.data_ptr.GetCount())
Visualise(result, MakeVal(p.data_type[0], p.data_ptr[0]), flags);
else
Visualise(result, val, flags | RAW);
}
else { // CONTAINER
int count = (int)min(p.data_count, (int64)40);

View file

@ -174,6 +174,14 @@ void Pdb::PrettyValue(Pdb::Val val, const Vector<String>&, int64 from, int count
p.data_type << "Upp::WString";
p.data_ptr << v.address;
}
if(st == 6) { // ERROR_V
p.Text("ErrorValue ", SLtRed());
p.has_data = true;
a = PeekPtr(a);
Val v = GetAttr(MakeVal("Upp::RawValueRep<Upp::String>", a), "v");
p.data_type << "Upp::String";
p.data_ptr << v.address;
}
if(st == 9) // VALUEARRAY_V
PrettyValueArray_(a, p);
if(st == 12)

View file

@ -196,6 +196,12 @@ GUI_APP_MAIN
v = m;
DDUMP(v);
v = ErrorValue();
DDUMP(v);
v = ErrorValue("HellO!");
DDUMP(v);
Value& ref = v;
Value *ptr = &v;