mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-06-13 22:04:36 -06:00
.cosmetics
git-svn-id: svn://ultimatepp.org/upp/trunk@14182 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
11cda24139
commit
6bce2fdcc7
4 changed files with 530 additions and 520 deletions
|
|
@ -33,7 +33,9 @@ file
|
|||
Mem.cpp,
|
||||
Sym.cpp,
|
||||
Exp.cpp,
|
||||
PrettyUpp.cpp,
|
||||
Pretty.cpp,
|
||||
PrettyStd.cpp,
|
||||
Visualise.cpp,
|
||||
Data.cpp,
|
||||
Tree.cpp,
|
||||
|
|
|
|||
|
|
@ -2,526 +2,6 @@
|
|||
|
||||
#ifdef PLATFORM_WIN32
|
||||
|
||||
// THIS is currently hardwired to the current version of U++ Core...
|
||||
|
||||
void Pdb::PrettyString(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
bool small = IntAt(val, "chr", 14) == 0;
|
||||
p.data_count = small ? IntAt(val, "chr", 15) : IntAt(val, "w", 2);
|
||||
adr_t a = (small ? GetAttr(val, "chr") : DeRef(GetAttr(val, "ptr"))).address;
|
||||
p.data_type << "char";
|
||||
for(int i = 0; i < count; i++)
|
||||
p.data_ptr.Add(a + from + i);
|
||||
p.kind = TEXT;
|
||||
}
|
||||
|
||||
void Pdb::PrettyWString(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
p.data_count = GetInt64(GetAttr(val, "length"));
|
||||
adr_t a = DeRef(GetAttr(val, "ptr")).address;
|
||||
p.data_type << "short int";
|
||||
for(int i = 0; i < count; i++)
|
||||
p.data_ptr.Add(a + from + 2 * i);
|
||||
p.kind = TEXT;
|
||||
}
|
||||
|
||||
void Pdb::PrettyVector(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
p.data_count = GetInt64(GetAttr(val, "items"));
|
||||
Val item = DeRef(GetAttr(val, "vector"));
|
||||
int sz = SizeOfType(tparam[0]);
|
||||
for(int i = 0; i < count; i++)
|
||||
p.data_ptr.Add(item.address + (i + from) * sz);
|
||||
}
|
||||
|
||||
void Pdb::PrettyBiVector(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
p.data_count = GetInt64(GetAttr(val, "items"));
|
||||
int start = GetInt(GetAttr(val, "start"));
|
||||
int alloc = GetInt(GetAttr(val, "alloc"));
|
||||
Val item = DeRef(GetAttr(val, "vector"));
|
||||
int sz = SizeOfType(tparam[0]);
|
||||
for(int i = 0; i < count; i++) {
|
||||
int ii = i + start < alloc ? i + start : i + start - alloc;
|
||||
p.data_ptr.Add(item.address + (ii + from) * sz);
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::PrettyIndex(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
return PrettyVector(GetAttr(val, "key"), tparam, from, count, p);
|
||||
}
|
||||
|
||||
void Pdb::PrettyArray(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
PrettyVector(GetAttr(val, "vector"), { "int *" }, from, count, p);
|
||||
for(adr_t& a : p.data_ptr)
|
||||
a = PeekPtr(a);
|
||||
}
|
||||
|
||||
void Pdb::PrettyBiArray(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
PrettyBiVector(GetAttr(val, "bv"), { "int *" }, from, count, p);
|
||||
for(adr_t& a : p.data_ptr)
|
||||
a = PeekPtr(a);
|
||||
}
|
||||
|
||||
void Pdb::PrettyMap(Pdb::Pretty& p, Pdb::Pretty& key, Pdb::Pretty& value)
|
||||
{
|
||||
p.data_count = min(key.data_count, value.data_count);
|
||||
int n = min(key.data_ptr.GetCount(), value.data_ptr.GetCount());
|
||||
for(int i = 0; i < n; i++)
|
||||
p.data_ptr << key.data_ptr[i] << value.data_ptr[i];
|
||||
}
|
||||
|
||||
void Pdb::PrettyVectorMap(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
Pretty key, value;
|
||||
PrettyIndex(GetAttr(val, "key"), { tparam[0] }, from, count, key);
|
||||
PrettyVector(GetAttr(val, "value"), { tparam[1] }, from, count, value);
|
||||
PrettyMap(p, key, value);
|
||||
}
|
||||
|
||||
void Pdb::PrettyArrayMap(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
Pretty key, value;
|
||||
PrettyIndex(GetAttr(val, "key"), { tparam[0] }, from, count, key);
|
||||
PrettyArray(GetAttr(val, "value"), { tparam[1] }, from, count, value);
|
||||
PrettyMap(p, key, value);
|
||||
}
|
||||
|
||||
void Pdb::PrettyDate(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
int day = GetIntAttr(val, "day");
|
||||
int month = GetIntAttr(val, "month");
|
||||
int year = GetIntAttr(val, "year");
|
||||
p.kind = SINGLE_VALUE;
|
||||
if(year < -20000)
|
||||
p.SetNull();
|
||||
else
|
||||
if(day >= 0 && day <= 31 && month >= 1 && month <= 12 && year > 1900 && year < 3000)
|
||||
p.Text(Format("%04d/%02d/%02d", year, month, day));
|
||||
}
|
||||
|
||||
void Pdb::PrettyTime(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
int day = GetIntAttr(val, "day");
|
||||
int month = GetIntAttr(val, "month");
|
||||
int year = GetIntAttr(val, "year");
|
||||
int hour = GetIntAttr(val, "hour");
|
||||
int minute = GetIntAttr(val, "minute");
|
||||
int second = GetIntAttr(val, "second");
|
||||
p.kind = SINGLE_VALUE;
|
||||
if(year < -20000)
|
||||
p.SetNull();
|
||||
else
|
||||
if(day >= 1 && day <= 31 && month >= 1 && month <= 12 && year > 1900 && year < 3000 &&
|
||||
hour >= 0 && hour <= 24 && minute >= 0 && minute < 60 && second >= 0 && second < 60)
|
||||
p.Text(Format("%04d/%02d/%02d %02d:%02d:%02d", year, month, day, hour, minute, second));
|
||||
}
|
||||
|
||||
void Pdb::PrettyColor(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
dword color = GetIntAttr(val, "color");
|
||||
Color c = Color::FromRaw(color);
|
||||
if(IsNull(c))
|
||||
p.SetNull();
|
||||
else {
|
||||
p.Text("\1", c);
|
||||
p.Text(" ");
|
||||
p.Text(ColorToHtml(c));
|
||||
}
|
||||
p.kind = SINGLE_VALUE;
|
||||
}
|
||||
|
||||
void Pdb::PrettyRGBA(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
RGBA rc;
|
||||
rc.r = GetIntAttr(val, "r");
|
||||
rc.g = GetIntAttr(val, "g");
|
||||
rc.b = GetIntAttr(val, "b");
|
||||
rc.a = 255;
|
||||
|
||||
Color c(rc);
|
||||
|
||||
p.Text("\1", c);
|
||||
p.Text(" ");
|
||||
p.Text(ColorToHtml(c));
|
||||
p.Text(", a: " + AsString(GetIntAttr(val, "a")));
|
||||
|
||||
p.kind = SINGLE_VALUE;
|
||||
}
|
||||
|
||||
void Pdb::PrettyFont(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
int64 data = GetInt64Attr(val, "data");
|
||||
Font fnt;
|
||||
memcpy(&fnt, &data, 8);
|
||||
p.Text(AsString(fnt));
|
||||
p.kind = SINGLE_VALUE;
|
||||
}
|
||||
|
||||
void Pdb::PrettyValueArray_(adr_t a, Pdb::Pretty& p)
|
||||
{
|
||||
Val v = GetAttr(MakeVal("Upp::ValueArray::Data", PeekPtr(a)), "data");
|
||||
p.data_type << "Upp::Vector<Upp::Value>";
|
||||
p.data_ptr << v.address;
|
||||
p.kind = SINGLE_VALUE;
|
||||
}
|
||||
|
||||
void Pdb::PrettyValueArray(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
PrettyValueArray_(GetAttr(val, "data").address, p);
|
||||
}
|
||||
|
||||
void Pdb::PrettyValueMap_(adr_t a, Pdb::Pretty& p, int64 from, int count)
|
||||
{
|
||||
p.kind = CONTAINER;
|
||||
p.data_type << "Upp::Value" << "Upp::Value";
|
||||
|
||||
Pretty key, value;
|
||||
Val m = MakeVal("Upp::ValueMap::Data", PeekPtr(a));
|
||||
PrettyIndex(GetAttr(m, "key"), { "Upp::Value" }, from, count, key);
|
||||
PrettyVector(GetAttr(DeRef(GetAttr(GetAttr(m, "value"), "data")), "data"),
|
||||
{ "Upp::Value" }, from, count, value);
|
||||
PrettyMap(p, key, value);
|
||||
}
|
||||
|
||||
void Pdb::PrettyValueMap(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
PrettyValueMap_(GetAttr(val, "data").address, p, from, count);
|
||||
}
|
||||
|
||||
void Pdb::PrettyValue(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
val = GetAttr(val, "data");
|
||||
adr_t a = val.address;
|
||||
p.kind = SINGLE_VALUE;
|
||||
if(PeekWord(a + 12) && !PeekWord(a + 14)) { // this is not String
|
||||
int st = PeekByte(a + 13);
|
||||
if(st == 255) { // REF
|
||||
st = PeekDword(a + 8);
|
||||
if(st == 8) { // WSTRING_V
|
||||
a = PeekPtr(a);
|
||||
Val v = GetAttr(MakeVal("Upp::RawValueRep<Upp::WString>", a), "v");
|
||||
p.data_type << "Upp::WString";
|
||||
p.data_ptr << v.address;
|
||||
}
|
||||
if(st == 9) // VALUEARRAY_V
|
||||
PrettyValueArray_(a, p);
|
||||
if(st == 12)
|
||||
PrettyValueMap_(a, p, from, count);
|
||||
|
||||
static VectorMap<int, String> single {
|
||||
{ 20, "Upp::Complex" }, { 40, "Upp::Font" },
|
||||
{ 48, "Upp::Painting" }, { 49, "Upp::Drawing" }, { 150, "Upp::Image" },
|
||||
{ POINT64_V, "Upp::Point_<__int64>" }, { POINTF_V, "Upp::Point_<double>" },
|
||||
{ SIZE64_V, "Upp::Size_<__int64>" }, { SIZEF_V, "Upp::Size_<double>" },
|
||||
{ RECT_V, "Upp::Rect_<int>" },
|
||||
{ RECT64_V, "Upp::Rect_<__int64>" }, { RECTF_V, "Upp::Rect_<double>" },
|
||||
};
|
||||
|
||||
String t = single.Get(st, Null);
|
||||
if(t.GetCount()) {
|
||||
p.data_type << t;
|
||||
p.data_ptr << PeekPtr(a) + (win64 ? 16 : 8);
|
||||
}
|
||||
return;
|
||||
}
|
||||
p.data_ptr << a;
|
||||
if(st == 3) {
|
||||
p.Text("void", SCyan);
|
||||
return;
|
||||
}
|
||||
static VectorMap<int, String> single {
|
||||
{ 1, "int" }, { 2, "double" }, { 4, "Upp::Date" }, { 5, "Upp::Time" }, { 10, "int64" },
|
||||
{ 11, "bool" }, {39, "Upp::Color" },
|
||||
{ POINT_V, "Upp::Point_<int>" }, { SIZE_V, "Upp::Size_<int>" }
|
||||
};
|
||||
String t = single.Get(st, Null);
|
||||
if(t.GetCount())
|
||||
p.data_type << t;
|
||||
}
|
||||
else {
|
||||
p.data_ptr << a;
|
||||
p.data_type << "Upp::String";
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdString(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
adr_t a;
|
||||
int size;
|
||||
bool w = tparam[0] == "wchar_t";
|
||||
if(HasAttr(val, "__r_")) { // CLANG variant
|
||||
Val r = GetAttr(GetAttr(val, "__r_"), "__value_");
|
||||
Val s = GetAttr(r, "__s");
|
||||
size = GetByteAttr(s, "__size_");
|
||||
if(size & 1) {
|
||||
Val l = GetAttr(r, "__l");
|
||||
size = GetIntAttr(l, "__size_");
|
||||
a = DeRef(GetAttr(l, "__data_")).address;
|
||||
}
|
||||
else {
|
||||
size = size >> 1;
|
||||
a = s.address + 1 + w;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Val q = GetAttr(GetAttr(val, "_Mypair"), "_Myval2");
|
||||
size = GetIntAttr(q, "_Mysize");
|
||||
int res = GetIntAttr(q, "_Myres");
|
||||
a = GetAttr(GetAttr(q, "_Bx"), "_Buf").address;
|
||||
if(res >= (w ? 8 : 16))
|
||||
a = PeekPtr(a);
|
||||
}
|
||||
p.data_count = size;
|
||||
p.data_type << (w ? "short int" : "char");
|
||||
int sz = w + 1;
|
||||
for(int i = 0; i < count; i++)
|
||||
p.data_ptr.Add(a + sz * (from + i));
|
||||
p.kind = TEXT;
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdVector(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
Val begin, end;
|
||||
if(HasAttr(val, "__begin_")) { // CLANG's std::vector
|
||||
begin = DeRef(GetAttr(val, "__begin_"));
|
||||
end = DeRef(GetAttr(val, "__end_"));
|
||||
}
|
||||
else {
|
||||
Val q = GetAttr(GetAttr(val, "_Mypair"), "_Myval2");
|
||||
begin = DeRef(GetAttr(q, "_Myfirst"));
|
||||
end = DeRef(GetAttr(q, "_Mylast"));
|
||||
}
|
||||
int sz = SizeOfType(tparam[0]);
|
||||
p.data_count = (end.address - begin.address) / sz;
|
||||
for(int i = 0; i < count; i++)
|
||||
p.data_ptr.Add(begin.address + (i + from) * sz);
|
||||
}
|
||||
|
||||
void Pdb::TraverseTree(bool set, Pdb::Val head, Val node, int64& from, int& count, Pdb::Pretty& p, int depth)
|
||||
{
|
||||
if(depth > 40) // avoid problems if tree is damaged
|
||||
return;
|
||||
if(depth && node.address == head.address || count <= 0) // we are at the end or have read enough items
|
||||
return;
|
||||
TraverseTree(set, head, DeRef(GetAttr(node, "_Left")), from, count, p, depth + 1);
|
||||
if(node.address != head.address) {
|
||||
if(from == 0) {
|
||||
Val v = GetAttr(node, "_Myval");
|
||||
if(set)
|
||||
p.data_ptr.Add(v.address);
|
||||
else {
|
||||
p.data_ptr.Add(GetAttr(v, "first").address);
|
||||
p.data_ptr.Add(GetAttr(v, "second").address);
|
||||
}
|
||||
count--;
|
||||
}
|
||||
else
|
||||
from--;
|
||||
}
|
||||
TraverseTree(set, head, DeRef(GetAttr(node, "_Right")), from, count, p, depth + 1);
|
||||
}
|
||||
|
||||
void Pdb::TraverseTreeClang(bool set, int nodet, Val node, int64& from, int& count, Pdb::Pretty& p, int depth)
|
||||
{
|
||||
if(depth > 40 || count <= 0) // avoid problems if tree is damaged
|
||||
return;
|
||||
|
||||
Val left = DeRef(GetAttr(node, "__left_"));
|
||||
if(left.address)
|
||||
TraverseTreeClang(set, nodet, left, from, count, p, depth + 1);
|
||||
|
||||
node.type = nodet;
|
||||
Val data = GetAttr(node, "__value_");
|
||||
if(from == 0) {
|
||||
if(set)
|
||||
p.data_ptr.Add(data.address);
|
||||
else {
|
||||
Val cc = GetAttr(data, "__cc");
|
||||
p.data_ptr.Add(GetAttr(cc, "first").address);
|
||||
p.data_ptr.Add(GetAttr(cc, "second").address);
|
||||
}
|
||||
count--;
|
||||
}
|
||||
else
|
||||
from--;
|
||||
|
||||
Val right = DeRef(GetAttr(node, "__right_"));
|
||||
if(right.address)
|
||||
TraverseTreeClang(set, nodet, right, from, count, p, depth + 1);
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdTree(Pdb::Val val, bool set, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
if(HasAttr(val, "__tree_")) {
|
||||
String nodet;
|
||||
if(set)
|
||||
nodet << "std::__1::__tree_node<" << tparam[0] << ",void *>";
|
||||
else {
|
||||
nodet = "std::__1::__tree_node<std::__1::__value_type<" << tparam[0] << "," << tparam[1];
|
||||
if(*nodet.Last() == '>')
|
||||
nodet << ' ';
|
||||
nodet << ">,void *>";
|
||||
}
|
||||
Val tree = GetAttr(val, "__tree_");
|
||||
Val value = GetAttr(GetAttr(tree, "__pair1_"), "__value_");
|
||||
p.data_count = GetIntAttr(GetAttr(tree, "__pair3_"), "__value_");
|
||||
Val node = DeRef(GetAttr(value, "__left_"));
|
||||
TraverseTreeClang(set, GetTypeInfo(nodet).type, node, from, count, p, 0);
|
||||
}
|
||||
else {
|
||||
val = GetAttr(GetAttr(GetAttr(val, "_Mypair"), "_Myval2"), "_Myval2");
|
||||
p.data_count = GetIntAttr(val, "_Mysize");
|
||||
Val head = DeRef(GetAttr(val, "_Myhead")); // points to leftmost element (!)
|
||||
Val top = DeRef(GetAttr(head, "_Left"));
|
||||
for(int i = 0; i < 40; i++) { // find topmost node, i is depth limit
|
||||
Val v = DeRef(GetAttr(top, "_Parent"));
|
||||
if(v.address == head.address)
|
||||
break;
|
||||
top = v;
|
||||
}
|
||||
TraverseTree(set, head, top, from, count, p, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdListM(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p, bool map)
|
||||
{
|
||||
if(HasAttr(val, "__end_")) {
|
||||
p.data_count = GetIntAttr(GetAttr(val, "__size_alloc_"), "__value_");
|
||||
int node_type = GetTypeInfo("std::__1::__list_node<" + tparam[0] + ",void *>").type;
|
||||
Val next = DeRef(GetAttr(GetAttr(val, "__end_"), "__next_"));
|
||||
while(count > 0) {
|
||||
if(from == 0) {
|
||||
Val h = next;
|
||||
h.type = node_type;
|
||||
p.data_ptr.Add(GetAttr(h, "__value_").address);
|
||||
count--;
|
||||
}
|
||||
else
|
||||
from--;
|
||||
next = DeRef(GetAttr(next, "__next_"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
val = GetAttr(GetAttr(val, "_Mypair"), "_Myval2");
|
||||
p.data_count = GetIntAttr(val, "_Mysize");
|
||||
Val next = DeRef(GetAttr(val, "_Myhead"));
|
||||
while(count > 0) {
|
||||
next = DeRef(GetAttr(next, "_Next"));
|
||||
Val v = GetAttr(next, "_Myval");
|
||||
if(from == 0) {
|
||||
if(map) { // support for MS std::unordered_map
|
||||
p.data_ptr.Add(GetAttr(v, "first").address);
|
||||
p.data_ptr.Add(GetAttr(v, "second").address);
|
||||
}
|
||||
else
|
||||
p.data_ptr.Add(GetAttr(next, "_Myval").address);
|
||||
count--;
|
||||
}
|
||||
else
|
||||
from--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdList(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
PrettyStdListM(val, tparam, from, count, p);
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdForwardList(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
String value, next;
|
||||
p.data_count = 0;
|
||||
if(HasAttr(val, "__before_begin_")) {
|
||||
val = DeRef(GetAttr(GetAttr(GetAttr(val, "__before_begin_"), "__value_"), "__next_"));
|
||||
value = "__value_";
|
||||
next = "__next_";
|
||||
}
|
||||
else {
|
||||
val = DeRef(GetAttr(GetAttr(GetAttr(val, "_Mypair"), "_Myval2"), "_Myhead"));
|
||||
value = "_Myval";
|
||||
next = "_Next";
|
||||
}
|
||||
while(val.address) {
|
||||
if(from == 0) {
|
||||
if(count) {
|
||||
p.data_ptr.Add(GetAttr(val, value).address);
|
||||
count--;
|
||||
}
|
||||
}
|
||||
else
|
||||
from--;
|
||||
val = DeRef(GetAttr(val, next));
|
||||
p.data_count++;
|
||||
if(count == 0 && p.data_count > 10000) {
|
||||
p.data_count = INT64_MAX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdDeque(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
int sz = SizeOfType(tparam[0]);
|
||||
int block_size, start;
|
||||
adr_t map;
|
||||
if(HasAttr(val, "__size_")) {
|
||||
p.data_count = GetIntAttr(GetAttr(val, "__size_"), "__value_");
|
||||
block_size = sz < 256 ? 4096 / sz : 16;
|
||||
start = GetIntAttr(val, "__start_");
|
||||
map = DeRef(GetAttr(GetAttr(val, "__map_"), "__begin_")).address;
|
||||
}
|
||||
else {
|
||||
val = GetAttr(GetAttr(val, "_Mypair"), "_Myval2");
|
||||
p.data_count = GetIntAttr(val, "_Mysize");
|
||||
block_size = sz <= 1 ? 16 : sz <= 2 ? 8 : sz <= 4 ? 4 : sz <= 8 ? 2 : 1;
|
||||
start = GetIntAttr(val, "_Myoff");
|
||||
map = DeRef(GetAttr(val, "_Map")).address;
|
||||
}
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
int q = i + from + start;
|
||||
p.data_ptr.Add(PeekPtr(map + (q / block_size) * (win64 ? 8 : 4)) + q % block_size * sz);
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdUnordered(Pdb::Val val, bool set, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
if(HasAttr(val, "__table_")) {
|
||||
val = GetAttr(val, "__table_");
|
||||
p.data_count = GetIntAttr(GetAttr(val, "__p2_"), "__value_");
|
||||
String nodet = set ? "std::__1::__hash_node<" << tparam[0] << ",void *>"
|
||||
: "std::__1::__hash_node<std::__1::__hash_value_type<"
|
||||
<< tparam[0] << "," << tparam[1] << " >,void *>";
|
||||
int ntype = GetTypeInfo(nodet).type;
|
||||
adr_t next = DeRef(GetAttr(GetAttr(GetAttr(val, "__p1_"), "__value_"), "__next_")).address;
|
||||
while(next && count > 0) {
|
||||
Val v = val;
|
||||
v.type = ntype;
|
||||
v.address = next;
|
||||
if(from == 0) {
|
||||
Val vl = GetAttr(v, "__value_");
|
||||
if(set)
|
||||
p.data_ptr.Add(vl.address);
|
||||
else {
|
||||
vl = GetAttr(vl, "__cc");
|
||||
p.data_ptr.Add(GetAttr(vl, "first").address);
|
||||
p.data_ptr.Add(GetAttr(vl, "second").address);
|
||||
}
|
||||
}
|
||||
else
|
||||
from--;
|
||||
next = DeRef(GetAttr(v, "__next_")).address;
|
||||
}
|
||||
}
|
||||
else
|
||||
PrettyStdListM(GetAttr(val, "_List"), tparam, from, count, p, !set);
|
||||
}
|
||||
|
||||
Pdb::Val Pdb::MakeVal(const String& type, adr_t address)
|
||||
{
|
||||
Val item;
|
||||
|
|
|
|||
279
uppsrc/ide/Debuggers/PrettyStd.cpp
Normal file
279
uppsrc/ide/Debuggers/PrettyStd.cpp
Normal file
|
|
@ -0,0 +1,279 @@
|
|||
#include "Debuggers.h"
|
||||
|
||||
#ifdef PLATFORM_WIN32
|
||||
|
||||
void Pdb::PrettyStdString(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
adr_t a;
|
||||
int size;
|
||||
bool w = tparam[0] == "wchar_t";
|
||||
if(HasAttr(val, "__r_")) { // CLANG variant
|
||||
Val r = GetAttr(GetAttr(val, "__r_"), "__value_");
|
||||
Val s = GetAttr(r, "__s");
|
||||
size = GetByteAttr(s, "__size_");
|
||||
if(size & 1) {
|
||||
Val l = GetAttr(r, "__l");
|
||||
size = GetIntAttr(l, "__size_");
|
||||
a = DeRef(GetAttr(l, "__data_")).address;
|
||||
}
|
||||
else {
|
||||
size = size >> 1;
|
||||
a = s.address + 1 + w;
|
||||
}
|
||||
}
|
||||
else {
|
||||
Val q = GetAttr(GetAttr(val, "_Mypair"), "_Myval2");
|
||||
size = GetIntAttr(q, "_Mysize");
|
||||
int res = GetIntAttr(q, "_Myres");
|
||||
a = GetAttr(GetAttr(q, "_Bx"), "_Buf").address;
|
||||
if(res >= (w ? 8 : 16))
|
||||
a = PeekPtr(a);
|
||||
}
|
||||
p.data_count = size;
|
||||
p.data_type << (w ? "short int" : "char");
|
||||
int sz = w + 1;
|
||||
for(int i = 0; i < count; i++)
|
||||
p.data_ptr.Add(a + sz * (from + i));
|
||||
p.kind = TEXT;
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdVector(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
Val begin, end;
|
||||
if(HasAttr(val, "__begin_")) { // CLANG's std::vector
|
||||
begin = DeRef(GetAttr(val, "__begin_"));
|
||||
end = DeRef(GetAttr(val, "__end_"));
|
||||
}
|
||||
else {
|
||||
Val q = GetAttr(GetAttr(val, "_Mypair"), "_Myval2");
|
||||
begin = DeRef(GetAttr(q, "_Myfirst"));
|
||||
end = DeRef(GetAttr(q, "_Mylast"));
|
||||
}
|
||||
int sz = SizeOfType(tparam[0]);
|
||||
p.data_count = (end.address - begin.address) / sz;
|
||||
for(int i = 0; i < count; i++)
|
||||
p.data_ptr.Add(begin.address + (i + from) * sz);
|
||||
}
|
||||
|
||||
void Pdb::TraverseTree(bool set, Pdb::Val head, Val node, int64& from, int& count, Pdb::Pretty& p, int depth)
|
||||
{
|
||||
if(depth > 40) // avoid problems if tree is damaged
|
||||
return;
|
||||
if(depth && node.address == head.address || count <= 0) // we are at the end or have read enough items
|
||||
return;
|
||||
TraverseTree(set, head, DeRef(GetAttr(node, "_Left")), from, count, p, depth + 1);
|
||||
if(node.address != head.address) {
|
||||
if(from == 0) {
|
||||
Val v = GetAttr(node, "_Myval");
|
||||
if(set)
|
||||
p.data_ptr.Add(v.address);
|
||||
else {
|
||||
p.data_ptr.Add(GetAttr(v, "first").address);
|
||||
p.data_ptr.Add(GetAttr(v, "second").address);
|
||||
}
|
||||
count--;
|
||||
}
|
||||
else
|
||||
from--;
|
||||
}
|
||||
TraverseTree(set, head, DeRef(GetAttr(node, "_Right")), from, count, p, depth + 1);
|
||||
}
|
||||
|
||||
void Pdb::TraverseTreeClang(bool set, int nodet, Val node, int64& from, int& count, Pdb::Pretty& p, int depth)
|
||||
{
|
||||
if(depth > 40 || count <= 0) // avoid problems if tree is damaged
|
||||
return;
|
||||
|
||||
Val left = DeRef(GetAttr(node, "__left_"));
|
||||
if(left.address)
|
||||
TraverseTreeClang(set, nodet, left, from, count, p, depth + 1);
|
||||
|
||||
node.type = nodet;
|
||||
Val data = GetAttr(node, "__value_");
|
||||
if(from == 0) {
|
||||
if(set)
|
||||
p.data_ptr.Add(data.address);
|
||||
else {
|
||||
Val cc = GetAttr(data, "__cc");
|
||||
p.data_ptr.Add(GetAttr(cc, "first").address);
|
||||
p.data_ptr.Add(GetAttr(cc, "second").address);
|
||||
}
|
||||
count--;
|
||||
}
|
||||
else
|
||||
from--;
|
||||
|
||||
Val right = DeRef(GetAttr(node, "__right_"));
|
||||
if(right.address)
|
||||
TraverseTreeClang(set, nodet, right, from, count, p, depth + 1);
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdTree(Pdb::Val val, bool set, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
if(HasAttr(val, "__tree_")) {
|
||||
String nodet;
|
||||
if(set)
|
||||
nodet << "std::__1::__tree_node<" << tparam[0] << ",void *>";
|
||||
else {
|
||||
nodet = "std::__1::__tree_node<std::__1::__value_type<" << tparam[0] << "," << tparam[1];
|
||||
if(*nodet.Last() == '>')
|
||||
nodet << ' ';
|
||||
nodet << ">,void *>";
|
||||
}
|
||||
Val tree = GetAttr(val, "__tree_");
|
||||
Val value = GetAttr(GetAttr(tree, "__pair1_"), "__value_");
|
||||
p.data_count = GetIntAttr(GetAttr(tree, "__pair3_"), "__value_");
|
||||
Val node = DeRef(GetAttr(value, "__left_"));
|
||||
TraverseTreeClang(set, GetTypeInfo(nodet).type, node, from, count, p, 0);
|
||||
}
|
||||
else {
|
||||
val = GetAttr(GetAttr(GetAttr(val, "_Mypair"), "_Myval2"), "_Myval2");
|
||||
p.data_count = GetIntAttr(val, "_Mysize");
|
||||
Val head = DeRef(GetAttr(val, "_Myhead")); // points to leftmost element (!)
|
||||
Val top = DeRef(GetAttr(head, "_Left"));
|
||||
for(int i = 0; i < 40; i++) { // find topmost node, i is depth limit
|
||||
Val v = DeRef(GetAttr(top, "_Parent"));
|
||||
if(v.address == head.address)
|
||||
break;
|
||||
top = v;
|
||||
}
|
||||
TraverseTree(set, head, top, from, count, p, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdListM(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p, bool map)
|
||||
{
|
||||
if(HasAttr(val, "__end_")) {
|
||||
p.data_count = GetIntAttr(GetAttr(val, "__size_alloc_"), "__value_");
|
||||
int node_type = GetTypeInfo("std::__1::__list_node<" + tparam[0] + ",void *>").type;
|
||||
Val next = DeRef(GetAttr(GetAttr(val, "__end_"), "__next_"));
|
||||
while(count > 0) {
|
||||
if(from == 0) {
|
||||
Val h = next;
|
||||
h.type = node_type;
|
||||
p.data_ptr.Add(GetAttr(h, "__value_").address);
|
||||
count--;
|
||||
}
|
||||
else
|
||||
from--;
|
||||
next = DeRef(GetAttr(next, "__next_"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
val = GetAttr(GetAttr(val, "_Mypair"), "_Myval2");
|
||||
p.data_count = GetIntAttr(val, "_Mysize");
|
||||
Val next = DeRef(GetAttr(val, "_Myhead"));
|
||||
while(count > 0) {
|
||||
next = DeRef(GetAttr(next, "_Next"));
|
||||
Val v = GetAttr(next, "_Myval");
|
||||
if(from == 0) {
|
||||
if(map) { // support for MS std::unordered_map
|
||||
p.data_ptr.Add(GetAttr(v, "first").address);
|
||||
p.data_ptr.Add(GetAttr(v, "second").address);
|
||||
}
|
||||
else
|
||||
p.data_ptr.Add(GetAttr(next, "_Myval").address);
|
||||
count--;
|
||||
}
|
||||
else
|
||||
from--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdList(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
PrettyStdListM(val, tparam, from, count, p);
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdForwardList(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
String value, next;
|
||||
p.data_count = 0;
|
||||
if(HasAttr(val, "__before_begin_")) {
|
||||
val = DeRef(GetAttr(GetAttr(GetAttr(val, "__before_begin_"), "__value_"), "__next_"));
|
||||
value = "__value_";
|
||||
next = "__next_";
|
||||
}
|
||||
else {
|
||||
val = DeRef(GetAttr(GetAttr(GetAttr(val, "_Mypair"), "_Myval2"), "_Myhead"));
|
||||
value = "_Myval";
|
||||
next = "_Next";
|
||||
}
|
||||
while(val.address) {
|
||||
if(from == 0) {
|
||||
if(count) {
|
||||
p.data_ptr.Add(GetAttr(val, value).address);
|
||||
count--;
|
||||
}
|
||||
}
|
||||
else
|
||||
from--;
|
||||
val = DeRef(GetAttr(val, next));
|
||||
p.data_count++;
|
||||
if(count == 0 && p.data_count > 10000) {
|
||||
p.data_count = INT64_MAX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdDeque(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
int sz = SizeOfType(tparam[0]);
|
||||
int block_size, start;
|
||||
adr_t map;
|
||||
if(HasAttr(val, "__size_")) {
|
||||
p.data_count = GetIntAttr(GetAttr(val, "__size_"), "__value_");
|
||||
block_size = sz < 256 ? 4096 / sz : 16;
|
||||
start = GetIntAttr(val, "__start_");
|
||||
map = DeRef(GetAttr(GetAttr(val, "__map_"), "__begin_")).address;
|
||||
}
|
||||
else {
|
||||
val = GetAttr(GetAttr(val, "_Mypair"), "_Myval2");
|
||||
p.data_count = GetIntAttr(val, "_Mysize");
|
||||
block_size = sz <= 1 ? 16 : sz <= 2 ? 8 : sz <= 4 ? 4 : sz <= 8 ? 2 : 1;
|
||||
start = GetIntAttr(val, "_Myoff");
|
||||
map = DeRef(GetAttr(val, "_Map")).address;
|
||||
}
|
||||
|
||||
for(int i = 0; i < count; i++) {
|
||||
int q = i + from + start;
|
||||
p.data_ptr.Add(PeekPtr(map + (q / block_size) * (win64 ? 8 : 4)) + q % block_size * sz);
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdUnordered(Pdb::Val val, bool set, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
if(HasAttr(val, "__table_")) {
|
||||
val = GetAttr(val, "__table_");
|
||||
p.data_count = GetIntAttr(GetAttr(val, "__p2_"), "__value_");
|
||||
String nodet = set ? "std::__1::__hash_node<" << tparam[0] << ",void *>"
|
||||
: "std::__1::__hash_node<std::__1::__hash_value_type<"
|
||||
<< tparam[0] << "," << tparam[1] << " >,void *>";
|
||||
int ntype = GetTypeInfo(nodet).type;
|
||||
adr_t next = DeRef(GetAttr(GetAttr(GetAttr(val, "__p1_"), "__value_"), "__next_")).address;
|
||||
while(next && count > 0) {
|
||||
Val v = val;
|
||||
v.type = ntype;
|
||||
v.address = next;
|
||||
if(from == 0) {
|
||||
Val vl = GetAttr(v, "__value_");
|
||||
if(set)
|
||||
p.data_ptr.Add(vl.address);
|
||||
else {
|
||||
vl = GetAttr(vl, "__cc");
|
||||
p.data_ptr.Add(GetAttr(vl, "first").address);
|
||||
p.data_ptr.Add(GetAttr(vl, "second").address);
|
||||
}
|
||||
}
|
||||
else
|
||||
from--;
|
||||
next = DeRef(GetAttr(v, "__next_")).address;
|
||||
}
|
||||
}
|
||||
else
|
||||
PrettyStdListM(GetAttr(val, "_List"), tparam, from, count, p, !set);
|
||||
}
|
||||
|
||||
#endif
|
||||
249
uppsrc/ide/Debuggers/PrettyUpp.cpp
Normal file
249
uppsrc/ide/Debuggers/PrettyUpp.cpp
Normal file
|
|
@ -0,0 +1,249 @@
|
|||
#include "Debuggers.h"
|
||||
|
||||
#ifdef PLATFORM_WIN32
|
||||
|
||||
void Pdb::PrettyString(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
bool small = IntAt(val, "chr", 14) == 0;
|
||||
p.data_count = small ? IntAt(val, "chr", 15) : IntAt(val, "w", 2);
|
||||
adr_t a = (small ? GetAttr(val, "chr") : DeRef(GetAttr(val, "ptr"))).address;
|
||||
p.data_type << "char";
|
||||
for(int i = 0; i < count; i++)
|
||||
p.data_ptr.Add(a + from + i);
|
||||
p.kind = TEXT;
|
||||
}
|
||||
|
||||
void Pdb::PrettyWString(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
p.data_count = GetInt64(GetAttr(val, "length"));
|
||||
adr_t a = DeRef(GetAttr(val, "ptr")).address;
|
||||
p.data_type << "short int";
|
||||
for(int i = 0; i < count; i++)
|
||||
p.data_ptr.Add(a + from + 2 * i);
|
||||
p.kind = TEXT;
|
||||
}
|
||||
|
||||
void Pdb::PrettyVector(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
p.data_count = GetInt64(GetAttr(val, "items"));
|
||||
Val item = DeRef(GetAttr(val, "vector"));
|
||||
int sz = SizeOfType(tparam[0]);
|
||||
for(int i = 0; i < count; i++)
|
||||
p.data_ptr.Add(item.address + (i + from) * sz);
|
||||
}
|
||||
|
||||
void Pdb::PrettyBiVector(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
p.data_count = GetInt64(GetAttr(val, "items"));
|
||||
int start = GetInt(GetAttr(val, "start"));
|
||||
int alloc = GetInt(GetAttr(val, "alloc"));
|
||||
Val item = DeRef(GetAttr(val, "vector"));
|
||||
int sz = SizeOfType(tparam[0]);
|
||||
for(int i = 0; i < count; i++) {
|
||||
int ii = i + start < alloc ? i + start : i + start - alloc;
|
||||
p.data_ptr.Add(item.address + (ii + from) * sz);
|
||||
}
|
||||
}
|
||||
|
||||
void Pdb::PrettyIndex(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
return PrettyVector(GetAttr(val, "key"), tparam, from, count, p);
|
||||
}
|
||||
|
||||
void Pdb::PrettyArray(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
PrettyVector(GetAttr(val, "vector"), { "int *" }, from, count, p);
|
||||
for(adr_t& a : p.data_ptr)
|
||||
a = PeekPtr(a);
|
||||
}
|
||||
|
||||
void Pdb::PrettyBiArray(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
PrettyBiVector(GetAttr(val, "bv"), { "int *" }, from, count, p);
|
||||
for(adr_t& a : p.data_ptr)
|
||||
a = PeekPtr(a);
|
||||
}
|
||||
|
||||
void Pdb::PrettyMap(Pdb::Pretty& p, Pdb::Pretty& key, Pdb::Pretty& value)
|
||||
{
|
||||
p.data_count = min(key.data_count, value.data_count);
|
||||
int n = min(key.data_ptr.GetCount(), value.data_ptr.GetCount());
|
||||
for(int i = 0; i < n; i++)
|
||||
p.data_ptr << key.data_ptr[i] << value.data_ptr[i];
|
||||
}
|
||||
|
||||
void Pdb::PrettyVectorMap(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
Pretty key, value;
|
||||
PrettyIndex(GetAttr(val, "key"), { tparam[0] }, from, count, key);
|
||||
PrettyVector(GetAttr(val, "value"), { tparam[1] }, from, count, value);
|
||||
PrettyMap(p, key, value);
|
||||
}
|
||||
|
||||
void Pdb::PrettyArrayMap(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
Pretty key, value;
|
||||
PrettyIndex(GetAttr(val, "key"), { tparam[0] }, from, count, key);
|
||||
PrettyArray(GetAttr(val, "value"), { tparam[1] }, from, count, value);
|
||||
PrettyMap(p, key, value);
|
||||
}
|
||||
|
||||
void Pdb::PrettyDate(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
int day = GetIntAttr(val, "day");
|
||||
int month = GetIntAttr(val, "month");
|
||||
int year = GetIntAttr(val, "year");
|
||||
p.kind = SINGLE_VALUE;
|
||||
if(year < -20000)
|
||||
p.SetNull();
|
||||
else
|
||||
if(day >= 0 && day <= 31 && month >= 1 && month <= 12 && year > 1900 && year < 3000)
|
||||
p.Text(Format("%04d/%02d/%02d", year, month, day));
|
||||
}
|
||||
|
||||
void Pdb::PrettyTime(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
int day = GetIntAttr(val, "day");
|
||||
int month = GetIntAttr(val, "month");
|
||||
int year = GetIntAttr(val, "year");
|
||||
int hour = GetIntAttr(val, "hour");
|
||||
int minute = GetIntAttr(val, "minute");
|
||||
int second = GetIntAttr(val, "second");
|
||||
p.kind = SINGLE_VALUE;
|
||||
if(year < -20000)
|
||||
p.SetNull();
|
||||
else
|
||||
if(day >= 1 && day <= 31 && month >= 1 && month <= 12 && year > 1900 && year < 3000 &&
|
||||
hour >= 0 && hour <= 24 && minute >= 0 && minute < 60 && second >= 0 && second < 60)
|
||||
p.Text(Format("%04d/%02d/%02d %02d:%02d:%02d", year, month, day, hour, minute, second));
|
||||
}
|
||||
|
||||
void Pdb::PrettyColor(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
dword color = GetIntAttr(val, "color");
|
||||
Color c = Color::FromRaw(color);
|
||||
if(IsNull(c))
|
||||
p.SetNull();
|
||||
else {
|
||||
p.Text("\1", c);
|
||||
p.Text(" ");
|
||||
p.Text(ColorToHtml(c));
|
||||
}
|
||||
p.kind = SINGLE_VALUE;
|
||||
}
|
||||
|
||||
void Pdb::PrettyRGBA(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
RGBA rc;
|
||||
rc.r = GetIntAttr(val, "r");
|
||||
rc.g = GetIntAttr(val, "g");
|
||||
rc.b = GetIntAttr(val, "b");
|
||||
rc.a = 255;
|
||||
|
||||
Color c(rc);
|
||||
|
||||
p.Text("\1", c);
|
||||
p.Text(" ");
|
||||
p.Text(ColorToHtml(c));
|
||||
p.Text(", a: " + AsString(GetIntAttr(val, "a")));
|
||||
|
||||
p.kind = SINGLE_VALUE;
|
||||
}
|
||||
|
||||
void Pdb::PrettyFont(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
int64 data = GetInt64Attr(val, "data");
|
||||
Font fnt;
|
||||
memcpy(&fnt, &data, 8);
|
||||
p.Text(AsString(fnt));
|
||||
p.kind = SINGLE_VALUE;
|
||||
}
|
||||
|
||||
void Pdb::PrettyValueArray_(adr_t a, Pdb::Pretty& p)
|
||||
{
|
||||
Val v = GetAttr(MakeVal("Upp::ValueArray::Data", PeekPtr(a)), "data");
|
||||
p.data_type << "Upp::Vector<Upp::Value>";
|
||||
p.data_ptr << v.address;
|
||||
p.kind = SINGLE_VALUE;
|
||||
}
|
||||
|
||||
void Pdb::PrettyValueArray(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
PrettyValueArray_(GetAttr(val, "data").address, p);
|
||||
}
|
||||
|
||||
void Pdb::PrettyValueMap_(adr_t a, Pdb::Pretty& p, int64 from, int count)
|
||||
{
|
||||
p.kind = CONTAINER;
|
||||
p.data_type << "Upp::Value" << "Upp::Value";
|
||||
|
||||
Pretty key, value;
|
||||
Val m = MakeVal("Upp::ValueMap::Data", PeekPtr(a));
|
||||
PrettyIndex(GetAttr(m, "key"), { "Upp::Value" }, from, count, key);
|
||||
PrettyVector(GetAttr(DeRef(GetAttr(GetAttr(m, "value"), "data")), "data"),
|
||||
{ "Upp::Value" }, from, count, value);
|
||||
PrettyMap(p, key, value);
|
||||
}
|
||||
|
||||
void Pdb::PrettyValueMap(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
PrettyValueMap_(GetAttr(val, "data").address, p, from, count);
|
||||
}
|
||||
|
||||
void Pdb::PrettyValue(Pdb::Val val, const Vector<String>&, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
val = GetAttr(val, "data");
|
||||
adr_t a = val.address;
|
||||
p.kind = SINGLE_VALUE;
|
||||
if(PeekWord(a + 12) && !PeekWord(a + 14)) { // this is not String
|
||||
int st = PeekByte(a + 13);
|
||||
if(st == 255) { // REF
|
||||
st = PeekDword(a + 8);
|
||||
if(st == 8) { // WSTRING_V
|
||||
a = PeekPtr(a);
|
||||
Val v = GetAttr(MakeVal("Upp::RawValueRep<Upp::WString>", a), "v");
|
||||
p.data_type << "Upp::WString";
|
||||
p.data_ptr << v.address;
|
||||
}
|
||||
if(st == 9) // VALUEARRAY_V
|
||||
PrettyValueArray_(a, p);
|
||||
if(st == 12)
|
||||
PrettyValueMap_(a, p, from, count);
|
||||
|
||||
static VectorMap<int, String> single {
|
||||
{ 20, "Upp::Complex" }, { 40, "Upp::Font" },
|
||||
{ 48, "Upp::Painting" }, { 49, "Upp::Drawing" }, { 150, "Upp::Image" },
|
||||
{ POINT64_V, "Upp::Point_<__int64>" }, { POINTF_V, "Upp::Point_<double>" },
|
||||
{ SIZE64_V, "Upp::Size_<__int64>" }, { SIZEF_V, "Upp::Size_<double>" },
|
||||
{ RECT_V, "Upp::Rect_<int>" },
|
||||
{ RECT64_V, "Upp::Rect_<__int64>" }, { RECTF_V, "Upp::Rect_<double>" },
|
||||
};
|
||||
|
||||
String t = single.Get(st, Null);
|
||||
if(t.GetCount()) {
|
||||
p.data_type << t;
|
||||
p.data_ptr << PeekPtr(a) + (win64 ? 16 : 8);
|
||||
}
|
||||
return;
|
||||
}
|
||||
p.data_ptr << a;
|
||||
if(st == 3) {
|
||||
p.Text("void", SCyan);
|
||||
return;
|
||||
}
|
||||
static VectorMap<int, String> single {
|
||||
{ 1, "int" }, { 2, "double" }, { 4, "Upp::Date" }, { 5, "Upp::Time" }, { 10, "int64" },
|
||||
{ 11, "bool" }, {39, "Upp::Color" },
|
||||
{ POINT_V, "Upp::Point_<int>" }, { SIZE_V, "Upp::Size_<int>" }
|
||||
};
|
||||
String t = single.Get(st, Null);
|
||||
if(t.GetCount())
|
||||
p.data_type << t;
|
||||
}
|
||||
else {
|
||||
p.data_ptr << a;
|
||||
p.data_type << "Upp::String";
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue