mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-05-15 14:16:07 -06:00
ide: PDB Debugger Fixed std:: types pretty printing in clang
This commit is contained in:
parent
8dd8b7f5f6
commit
1bf5a62ea4
4 changed files with 73 additions and 27 deletions
|
|
@ -451,13 +451,14 @@ struct Pdb : Debugger, ParentCtrl {
|
|||
void PrettyStdVector(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p);
|
||||
void PrettyStdString(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p);
|
||||
void TraverseTree(bool set, Val head, Val node, int64& from, int& count, Pdb::Pretty& p, int depth);
|
||||
void TraverseTreeClang(bool set, int nodet, Val node, int64& from, int& count, Pdb::Pretty& p, int depth);
|
||||
void TraverseTreeClang(bool set, int nodet, Val node, int64& from, int& count, Pdb::Pretty& p, int depth, int key_size);
|
||||
void PrettyStdTree(Pdb::Val val, bool set, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p);
|
||||
void PrettyStdListM(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p, bool map = false);
|
||||
void PrettyStdList(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p);
|
||||
void PrettyStdForwardList(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p);
|
||||
void PrettyStdDeque(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p);
|
||||
void PrettyStdUnordered(Pdb::Val val, bool set, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p);
|
||||
void PrettyStdAtomic(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p);
|
||||
|
||||
void LoadPrettyScripts();
|
||||
void SetVal(EscValue& v, Pdb::Val val);
|
||||
|
|
|
|||
|
|
@ -89,6 +89,7 @@ bool Pdb::PrettyVal(Pdb::Val val, int64 from, int count, Pretty& p)
|
|||
pretty.Add("std::unordered_multiset", { 1, [=](Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p) { PrettyStdUnordered(val, true, tparam, from, count, p); }});
|
||||
pretty.Add("std::unordered_map", { 2, [=](Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p) { PrettyStdUnordered(val, false, tparam, from, count, p); }});
|
||||
pretty.Add("std::unordered_multimap", { 2, [=](Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p) { PrettyStdUnordered(val, false, tparam, from, count, p); }});
|
||||
pretty.Add("std::atomic", { 1, [=](Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p) { PrettyStdAtomic(val, tparam, from, count, p); }});
|
||||
}
|
||||
|
||||
type = Filter(type, [](int c) { return c != ' ' ? c : 0; });
|
||||
|
|
|
|||
|
|
@ -77,25 +77,21 @@ void Pdb::TraverseTree(bool set, Pdb::Val head, Val node, int64& from, int& coun
|
|||
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)
|
||||
void Pdb::TraverseTreeClang(bool set, int nodet, Val node, int64& from, int& count, Pdb::Pretty& p, int depth, int key_size)
|
||||
{
|
||||
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);
|
||||
TraverseTreeClang(set, nodet, left, from, count, p, depth + 1, key_size);
|
||||
|
||||
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);
|
||||
}
|
||||
p.data_ptr.Add(data.address);
|
||||
if(!set)
|
||||
p.data_ptr.Add((data.address + key_size + 7) & ~7);
|
||||
count--;
|
||||
}
|
||||
else
|
||||
|
|
@ -103,7 +99,7 @@ void Pdb::TraverseTreeClang(bool set, int nodet, Val node, int64& from, int& cou
|
|||
|
||||
Val right = DeRef(GetAttr(node, "__right_"));
|
||||
if(right.address)
|
||||
TraverseTreeClang(set, nodet, right, from, count, p, depth + 1);
|
||||
TraverseTreeClang(set, nodet, right, from, count, p, depth + 1, key_size);
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdTree(Pdb::Val val, bool set, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
|
|
@ -122,7 +118,7 @@ void Pdb::PrettyStdTree(Pdb::Val val, bool set, const Vector<String>& tparam, in
|
|||
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);
|
||||
TraverseTreeClang(set, GetTypeInfo(nodet).type, node, from, count, p, 0, SizeOfType(tparam[0]));
|
||||
}
|
||||
else {
|
||||
val = GetAttr(GetAttr(GetAttr(val, "_Mypair"), "_Myval2"), "_Myval2");
|
||||
|
|
@ -251,19 +247,16 @@ void Pdb::PrettyStdUnordered(Pdb::Val val, bool set, const Vector<String>& tpara
|
|||
<< tparam[0] << "," << tparam[1] << " >,void *>";
|
||||
int ntype = GetTypeInfo(nodet).type;
|
||||
adr_t next = DeRef(GetAttr(GetAttr(GetAttr(val, "__p1_"), "__value_"), "__next_")).address;
|
||||
int key_size = SizeOfType(tparam[0]);
|
||||
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);
|
||||
}
|
||||
p.data_ptr.Add(vl.address);
|
||||
if(!set)
|
||||
p.data_ptr.Add((vl.address + key_size + 7) & ~7);
|
||||
}
|
||||
else
|
||||
from--;
|
||||
|
|
@ -274,4 +267,11 @@ void Pdb::PrettyStdUnordered(Pdb::Val val, bool set, const Vector<String>& tpara
|
|||
PrettyStdListM(GetAttr(val, "_List"), tparam, from, count, p, !set);
|
||||
}
|
||||
|
||||
void Pdb::PrettyStdAtomic(Pdb::Val val, const Vector<String>& tparam, int64 from, int count, Pdb::Pretty& p)
|
||||
{
|
||||
p.data_ptr << val.address;
|
||||
p.data_type << tparam[0];
|
||||
p.kind = SINGLE_VALUE;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
using namespace Upp;
|
||||
|
||||
GUI_APP_MAIN
|
||||
void UppTypes()
|
||||
{
|
||||
Date date = GetSysDate();
|
||||
Time time = GetSysTime();
|
||||
|
|
@ -21,9 +21,28 @@ GUI_APP_MAIN
|
|||
Image img = CtrlImg::exclamation();
|
||||
ImageBuffer ib(img);
|
||||
img = CtrlImg::exclamation();
|
||||
Value img_value = img;
|
||||
String string = "Hello world!";
|
||||
WString wstring = "Hello world!";
|
||||
|
||||
DLOG("BREAKPOINT HERE");
|
||||
}
|
||||
|
||||
void UppValue()
|
||||
{
|
||||
ValueArray valuearray { "I", "II", "III", "IV", "V" };
|
||||
ValueMap valuemap { { 1 , "I"}, { 2, "II" }, { 3, "III"}, { 4, "IV"}, { 5, "V" } };
|
||||
|
||||
Value img_value = CtrlImg::exclamation();
|
||||
Value value = valuemap;
|
||||
Value text_value = "Test";
|
||||
Value error_value = ErrorValue("Test");
|
||||
Value void_value;
|
||||
|
||||
DLOG("BREAKPOINT HERE");
|
||||
}
|
||||
|
||||
void UppContainers()
|
||||
{
|
||||
Vector<String> vector { "I", "II", "III", "IV", "V" };
|
||||
BiVector<String> bivector { "I", "II", "III", "IV", "V" };
|
||||
Array<String> array { "I", "II", "III", "IV", "V" };
|
||||
|
|
@ -31,15 +50,27 @@ GUI_APP_MAIN
|
|||
Index<String> index { "I", "II", "III", "IV", "V" };
|
||||
VectorMap<int, String> vectormap { { 1 , "I"}, { 2, "II" }, { 3, "III"}, { 4, "IV"}, { 5, "V" } };
|
||||
ArrayMap<int, String> arraymap { { 1 , "I"}, { 2, "II" }, { 3, "III"}, { 4, "IV"}, { 5, "V" } };
|
||||
ValueArray valuearray { "I", "II", "III", "IV", "V" };
|
||||
ValueMap valuemap { { 1 , "I"}, { 2, "II" }, { 3, "III"}, { 4, "IV"}, { 5, "V" } };
|
||||
Value value = valuemap;
|
||||
Value text_value = "Test";
|
||||
Value error_value = ErrorValue("Test");
|
||||
Value void_value;
|
||||
|
||||
DLOG("BREAKPOINT HERE");
|
||||
}
|
||||
|
||||
void StdTypes()
|
||||
{
|
||||
WString wstring = "Hello world!";
|
||||
std::string std_string = "Hello world!";
|
||||
std::wstring std_wstring = wstring.ToStd();
|
||||
|
||||
std::atomic<int> atomic_int;
|
||||
atomic_int.store(12345);
|
||||
std::atomic<int *> atomic_ptr;
|
||||
int x = 54321;
|
||||
atomic_ptr.store(&x);
|
||||
|
||||
DLOG("BREAKPOINT HERE");
|
||||
}
|
||||
|
||||
void StdContainers()
|
||||
{
|
||||
std::vector<std::string> std_vector { "I", "II", "III", "IV", "V" };
|
||||
std::deque<std::string> std_deqeue { "I", "II", "III", "IV", "V" };
|
||||
std::list<std::string> std_list { "I", "II", "III", "IV", "V" };
|
||||
|
|
@ -48,11 +79,24 @@ GUI_APP_MAIN
|
|||
std::multiset<std::string> std_multiset { "I", "II", "III", "IV", "V" };
|
||||
std::map<int, std::string> std_map { { 1 , "I"}, { 2, "II" }, { 3, "III"}, { 4, "IV"}, { 5, "V" } };
|
||||
std::multimap<int, std::string> std_multimap { { 1 , "I"}, { 2, "II" }, { 3, "III"}, { 4, "IV"}, { 5, "V" } };
|
||||
std::map<std::string, int> std_map2 { { "I", 1 }, { "II", 2 }, { "III", 3 }};
|
||||
std::multimap<std::string, int> std_multimap2 { { "I", 1 }, { "II", 2 }, { "III", 3 }};
|
||||
std::unordered_set<std::string> std_unordered_set { "I", "II", "III", "IV", "V" };
|
||||
std::unordered_multiset<std::string> std_unordered_multiset { "I", "II", "III", "IV", "V" };
|
||||
std::unordered_map<int, std::string> std_unordered_map { { 1 , "I"}, { 2, "II" }, { 3, "III"}, { 4, "IV"}, { 5, "V" } };
|
||||
std::unordered_multimap<int, std::string> std_unordered_multimap { { 1 , "I"}, { 2, "II" }, { 3, "III"}, { 4, "IV"}, { 5, "V" } };
|
||||
|
||||
DLOG("BREAKPOINT HERE");
|
||||
}
|
||||
|
||||
GUI_APP_MAIN
|
||||
{
|
||||
UppTypes();
|
||||
UppValue();
|
||||
UppContainers();
|
||||
|
||||
StdTypes();
|
||||
StdContainers();
|
||||
|
||||
for(String h : { "Hello world!", "Very very very very very very very long hello world!" }) {
|
||||
std::string sh = h.ToStd();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue