mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-09-01 15:52:41 -06:00
ide: PDB debugger improvements
git-svn-id: svn://ultimatepp.org/upp/trunk@13740 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
0398a5563d
commit
9bf85e1e67
5 changed files with 29 additions and 14 deletions
|
|
@ -86,7 +86,8 @@ struct Pdb : Debugger, ParentCtrl {
|
|||
|
||||
struct TypeInfo : Moveable<TypeInfo> {
|
||||
int type = UNKNOWN;
|
||||
int ref = 0; // this is pointer (or reference)
|
||||
int ref = 0; // this is pointer or reference
|
||||
bool reference = false; // this is reference
|
||||
};
|
||||
|
||||
struct Val : Moveable<Val, TypeInfo> {
|
||||
|
|
@ -343,6 +344,8 @@ struct Pdb : Debugger, ParentCtrl {
|
|||
String TypeInfoAsString(TypeInfo tf);
|
||||
TypeInfo GetTypeInfo(adr_t modbase, const String& name);
|
||||
TypeInfo GetTypeInfo(const String& name) { return GetTypeInfo(current_modbase, name); } // only in Pretty...
|
||||
|
||||
static String FormatString(const String& x) { return AsCString(x, INT_MAX, NULL, CheckUtf8(x) ? 0 : ASCSTRING_OCTALHI); }
|
||||
|
||||
// exp
|
||||
Val MakeVal(const String& type, adr_t address);
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ bool Pdb::VisualisePretty(Visual& result, Pdb::Val val, dword flags)
|
|||
ws.Cat(PeekWord(a));
|
||||
}
|
||||
ResultCount(p.data_count);
|
||||
result.Cat(AsCString(sz == 1 ? s : ws.ToString()), SRed);
|
||||
result.Cat(FormatString(sz == 1 ? s : ws.ToString()), SRed);
|
||||
if(p.data_count > p.data_ptr.GetCount())
|
||||
result.Cat("..", SGray);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -128,6 +128,12 @@ Pdb::FnInfo Pdb::GetFnInfo(adr_t address)
|
|||
void Pdb::TypeVal(Pdb::Val& v, int typeId, adr_t modbase)
|
||||
{
|
||||
adr_t tag;
|
||||
|
||||
BOOL reference;
|
||||
dword dw = 0;
|
||||
SymGetTypeInfo(hProcess, modbase, typeId, TI_GET_IS_REFERENCE, &reference);
|
||||
v.reference = reference;
|
||||
|
||||
for(;;) {
|
||||
tag = GetSymInfo(modbase, typeId, TI_GET_SYMTAG);
|
||||
if(tag == SymTagPointerType)
|
||||
|
|
@ -206,17 +212,16 @@ BOOL CALLBACK Pdb::EnumLocals(PSYMBOL_INFO pSym, ULONG SymbolSize, PVOID UserCon
|
|||
else
|
||||
if(pSym->Flags & IMAGEHLP_SYMBOL_INFO_FRAMERELATIVE)
|
||||
v.address += c.frame;
|
||||
LLOG("LOCAL " << pSym->Name << ": " << Format64Hex(v.address));
|
||||
c.pdb->TypeVal(v, pSym->TypeIndex, (adr_t)pSym->ModBase);
|
||||
v.reported_size = pSym->Size;
|
||||
v.context = c.context;
|
||||
DLOG("LOCAL " << pSym->Name << ": " << Format64Hex(v.address));
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void Pdb::GetLocals(Frame& frame, Context& context, VectorMap<String, Pdb::Val>& param,
|
||||
VectorMap<String, Pdb::Val>& local)
|
||||
{
|
||||
DLOG("============ GetLocals");
|
||||
static IMAGEHLP_STACK_FRAME f;
|
||||
f.InstructionOffset = frame.pc;
|
||||
SymSetContext(hProcess, &f, 0);
|
||||
|
|
@ -227,7 +232,6 @@ void Pdb::GetLocals(Frame& frame, Context& context, VectorMap<String, Pdb::Val>&
|
|||
SymEnumSymbols(hProcess, 0, 0, &EnumLocals, &c);
|
||||
param = pick(c.param);
|
||||
local = pick(c.local);
|
||||
DLOG("...");
|
||||
}
|
||||
|
||||
BOOL CALLBACK Pdb::EnumGlobals(PSYMBOL_INFO pSym, ULONG SymbolSize, PVOID UserContext)
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ void Pdb::ExpandTreeType(int parent, CParser& p)
|
|||
id << AsString(p.ReadInt());
|
||||
else
|
||||
if(p.IsString())
|
||||
id << '\"' << AsCString(p.ReadString()) << '\"';
|
||||
id << '\"' << FormatString(p.ReadString()) << '\"';
|
||||
else
|
||||
if(p.IsId())
|
||||
id << p.ReadId();
|
||||
|
|
|
|||
|
|
@ -106,13 +106,16 @@ void Pdb::Visualise(Visual& result, Pdb::Val val, dword flags)
|
|||
if(val.ref > 0 || val.type < 0) // if pointer or primitive type, fetch it from the memory
|
||||
val = GetRVal(val);
|
||||
if(val.ref > 0) {
|
||||
result.Cat(Hex(val.address), SLtMagenta);
|
||||
if(!val.reference)
|
||||
result.Cat(Hex(val.address), SLtMagenta);
|
||||
while(val.ref > 1) {
|
||||
val = GetRVal(DeRef(val));
|
||||
result.Cat("->");
|
||||
result.Cat(Hex(val.address), SLtMagenta);
|
||||
if(!val.reference) {
|
||||
result.Cat("->");
|
||||
result.Cat(Hex(val.address), SLtMagenta);
|
||||
}
|
||||
}
|
||||
if(val.type == UINT1 || val.type == SINT1) { // show string at [unsigned] char *
|
||||
if((val.type == UINT1 || val.type == SINT1) && !val.reference) { // show string at [unsigned] char *
|
||||
if(Byte(val.address) < 0)
|
||||
result.Cat("??", SColorDisabled);
|
||||
else {
|
||||
|
|
@ -124,16 +127,21 @@ void Pdb::Visualise(Visual& result, Pdb::Val val, dword flags)
|
|||
dt = "..";
|
||||
}
|
||||
result.Cat(" ");
|
||||
result.Cat(AsCString(x), SRed);
|
||||
result.Cat(FormatString(x), SRed);
|
||||
result.Cat(dt, SGray);
|
||||
}
|
||||
return;
|
||||
}
|
||||
if(!(flags & MEMBER) && val.type != UNKNOWN && val.address) {
|
||||
result.Cat("->", SColorMark);
|
||||
if(!val.reference)
|
||||
result.Cat("->", SColorMark);
|
||||
int sz = SizeOfType(val.type);
|
||||
int n = 40;
|
||||
String dt = "..";
|
||||
if(val.reference) {
|
||||
n = 1;
|
||||
dt.Clear();
|
||||
}
|
||||
if(val.reported_size > sz && sz > 0) {
|
||||
n = val.reported_size / sz;
|
||||
if(n <= 40)
|
||||
|
|
@ -143,7 +151,7 @@ void Pdb::Visualise(Visual& result, Pdb::Val val, dword flags)
|
|||
for(int i = 0; i < n; i++) {
|
||||
if(i)
|
||||
result.Cat(", ", SGray);
|
||||
Visualise(result, DeRef(val), flags | MEMBER);
|
||||
Visualise(result, DeRef(val), flags | (val.reference ? 0 : MEMBER));
|
||||
val.address += sz;
|
||||
if(Byte(val.address) < 0) {
|
||||
dt.Clear();
|
||||
|
|
@ -326,7 +334,7 @@ Pdb::Visual Pdb::Visualise(const String& exp, dword flags)
|
|||
|
||||
Size Pdb::VisualPart::GetSize() const
|
||||
{
|
||||
return GetTextSize(*text < 32 ? "MM" : ~text, StdFont());
|
||||
return GetTextSize(*text && *text < 32 ? "MM" : ~text, StdFont());
|
||||
}
|
||||
|
||||
Size Pdb::VisualDisplay::GetStdSize(const Value& q) const
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue