From 1059f35af374ff7592bd04ec684e11cb2b2d015f Mon Sep 17 00:00:00 2001 From: cxl Date: Fri, 15 Aug 2014 18:56:28 +0000 Subject: [PATCH] ide: PDB developing globals support git-svn-id: svn://ultimatepp.org/upp/trunk@7591 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/ide/Debuggers/Debug.cpp | 15 +----------- uppsrc/ide/Debuggers/Pdb.h | 3 +++ uppsrc/ide/Debuggers/Sym.cpp | 35 +++++++++++++++++++++++++++ uppsrc/ide/app.tpp/special$en-us.tpp | 2 +- uppsrc/ide/app.tpp/special$en-us.tppi | 6 ++--- 5 files changed, 43 insertions(+), 18 deletions(-) diff --git a/uppsrc/ide/Debuggers/Debug.cpp b/uppsrc/ide/Debuggers/Debug.cpp index 7e5f89103..ea0e6b612 100644 --- a/uppsrc/ide/Debuggers/Debug.cpp +++ b/uppsrc/ide/Debuggers/Debug.cpp @@ -46,16 +46,6 @@ int Pdb::FindModuleIndex(adr_t base) return -1; } -static Vector test; - -BOOL CALLBACK Pdb::EnumGlobals(PSYMBOL_INFO pSym, ULONG SymbolSize, PVOID UserContext) -{ -// LocalsCtx& c = *(GlobalsCtx *)UserContext; - if(pSym->Tag == SymTagData) - test.Add(pSym->Name); - return TRUE; -} - void Pdb::LoadModuleInfo() { ModuleInfo f; @@ -95,10 +85,7 @@ void Pdb::LoadModuleInfo() if(w) { LLOG("Loading symbols " << Hex(f.base) << '/' << hProcess << " returned base " << Hex(w)); f.symbols = true; - #if 0 - TimeStop t; - SymEnumSymbols(hProcess, w, 0, &EnumGlobals, 0); - #endif + LoadGlobals(w); } } } diff --git a/uppsrc/ide/Debuggers/Pdb.h b/uppsrc/ide/Debuggers/Pdb.h index 1b12fe7d9..2fe197445 100644 --- a/uppsrc/ide/Debuggers/Pdb.h +++ b/uppsrc/ide/Debuggers/Pdb.h @@ -402,4 +402,7 @@ struct Pdb : Debugger, ParentCtrl { Pdb(); virtual ~Pdb(); + + + void LoadGlobals(DWORD64 base); }; diff --git a/uppsrc/ide/Debuggers/Sym.cpp b/uppsrc/ide/Debuggers/Sym.cpp index ed4abe3d5..e9dda93ce 100644 --- a/uppsrc/ide/Debuggers/Sym.cpp +++ b/uppsrc/ide/Debuggers/Sym.cpp @@ -240,6 +240,41 @@ void Pdb::GetLocals(Frame& frame, Context& context, VectorMap& local = c.local; } +#ifdef _DEBUG + +BOOL CALLBACK Pdb::EnumGlobals(PSYMBOL_INFO pSym, ULONG SymbolSize, PVOID UserContext) +{ + LocalsCtx& c = *(LocalsCtx *)UserContext; + + if(pSym->Tag != SymTagData) + return TRUE; + DLOG(pSym->Name << " " << Format64Hex(pSym->Address)); + DDUMP(pSym->Scope); + +// FilePos pos = c.pdb->GetFilePos(pSym->Address); +// DDUMP(pos.line); +// DDUMP(pos.path); +// LLOG("LOCAL " << pSym->Name << ": " << Format64Hex(v.address));*/ + return TRUE; +} + +#endif + +void Pdb::LoadGlobals(DWORD64 base) +{ +#ifdef _DEBUG + TimeStop tm; + static IMAGEHLP_STACK_FRAME f; + LocalsCtx c; + c.pdb = this; + c.context = &context; +// SymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_UNDNAME|SYMOPT_NO_UNQUALIFIED_LOADS|SYMOPT_NO_PUBLICS); + SymEnumSymbols(hProcess, base, NULL, &EnumGlobals, &c); +// SymSetOptions(SYMOPT_LOAD_LINES|SYMOPT_UNDNAME|SYMOPT_NO_UNQUALIFIED_LOADS); + DUMP(tm); +#endif +} + Pdb::Val Pdb::GetGlobal(const char *fn, const String& name) { return Val(); diff --git a/uppsrc/ide/app.tpp/special$en-us.tpp b/uppsrc/ide/app.tpp/special$en-us.tpp index 80c274260..66384938a 100644 --- a/uppsrc/ide/app.tpp/special$en-us.tpp +++ b/uppsrc/ide/app.tpp/special$en-us.tpp @@ -1,7 +1,7 @@ topic "Rectangular blocks are activated by pressing ALT key."; [ $$0,0#00000000000000000000000000000000:Default] [{_}%EN-US -[s0;i150;O2; Use Ctrl`+Tab to cycle throught files. This is perhaps +[s0;=i150;O2; Use Ctrl`+Tab to cycle throught files. This is perhaps the most used key in theide!&] [s0;i150;O2; Use Alt`+Left to `"return`" to important places (e.g. where you have written something). Use Alt`+Right to cycle this diff --git a/uppsrc/ide/app.tpp/special$en-us.tppi b/uppsrc/ide/app.tpp/special$en-us.tppi index ffb8c94bf..04dcdcb2a 100644 --- a/uppsrc/ide/app.tpp/special$en-us.tppi +++ b/uppsrc/ide/app.tpp/special$en-us.tppi @@ -1,6 +1,6 @@ TITLE("Rectangular blocks are activated by pressing ALT key.") COMPRESSED -120,156,165,83,93,79,219,64,16,252,43,91,74,75,34,192,132,74,237,3,121,66,9,170,34,33,42,133,80,169,138,162,250,114,222,216,87,206,119,238,221,58,193,253,248,239,221,181,27,129,2,85,91,97,249,193,231,245,206,204,206,142,231,176,191,63,56,26,188,28,252,229,58,27,227,74,213,150,22,243,239,159,127,190,186,184,58,190,185,134,121,28,12,205,233,219,193,240,195,155,33,220,68,132,17,5,155,30,206,212,18,200,131,110,180,69,160,34,248,58,47,8,86,198,98,76,96,86,152,8,124,87,24,10,85,69,174,35,148,62,18,212,17,51,184,197,6,140,147,151,38,195,23,175,23,143,24,206,45,165,135,151,184,34,97,72,247,2,82,29,92,186,39,39,83,86,62,144,114,4,149,85,26,35,244,48,201,19,216,20,24,16,26,95,67,161,214,8,155,96,136,208,65,244,37,82,97,92,222,79,238,129,167,70,148,62,208,46,66,59,176,149,15,27,21,178,100,71,211,69,212,173,104,109,125,20,74,229,50,8,232,43,116,177,223,206,182,244,68,190,132,74,57,132,222,198, -80,1,218,151,149,177,138,140,119,252,105,100,79,35,32,233,36,73,250,59,224,83,212,60,79,94,91,21,96,105,189,190,141,160,120,22,165,201,172,21,177,93,203,6,42,134,136,60,6,156,95,206,68,201,174,192,79,60,184,86,142,89,171,166,219,1,244,186,53,141,196,233,216,68,194,178,45,64,169,156,202,49,28,253,94,227,71,169,207,10,156,140,47,250,252,200,174,16,222,17,100,38,176,44,219,36,48,89,241,230,130,216,196,248,162,129,49,90,32,118,141,103,211,214,84,75,207,158,29,129,178,182,107,230,10,11,49,248,200,199,113,80,121,46,99,180,0,94,216,58,106,104,189,4,67,236,109,228,141,179,218,138,247,45,159,245,119,65,238,35,120,34,75,44,56,67,236,143,255,194,122,193,175,49,172,13,110,32,61,150,168,173,106,11,219,120,56,192,204,144,144,111,164,195,42,14,11,197,63,131,167,199,91,139,210,31,194,19,43,203,242,4,195,7,96,26,50,154,7,110,78,10,31,204,55,30,69,14,187,104,19,7,78,173,77,174,164,39,162,10,186,224,153,208,102,109, -82,101,97,18,84,236,186,236,233,187,109,235,233,176,43,128,53,28,40,87,151,75,12,162,33,160,98,4,9,156,20,158,106,75,15,70,231,179,244,128,235,145,3,39,27,65,139,37,58,62,116,191,136,182,42,70,86,85,178,255,1,74,108,161,219,163,150,33,12,111,97,139,209,211,138,221,48,185,227,245,103,253,167,217,174,103,211,201,213,251,179,127,39,125,192,210,245,114,159,252,78,207,86,114,246,223,82,230,39,146,84,252,90,43,187,120,134,156,197,226,23,141,18,198,169, +120,156,165,83,93,111,211,64,16,252,43,75,41,52,81,91,55,69,130,135,70,60,68,105,133,34,85,69,74,83,36,20,69,248,114,222,216,71,207,119,230,110,157,96,62,254,59,187,54,81,75,40,2,84,203,15,62,175,119,102,118,118,60,135,253,253,193,209,224,233,224,47,215,217,57,174,84,109,105,49,255,250,225,251,179,139,171,227,155,107,152,199,193,240,181,57,125,57,24,190,125,49,132,155,136,48,166,96,211,195,153,90,2,121,208,141,182,8,84,4,95,231,5,193,202,88,140,9,204,10,19,129,239,10,67,161,170,200,117,132,210,71,130,58,98,6,183,216,128,113,242,210,100,248,228,249,66,40,126,97,24,89,74,15,47,113,69,194,144,238,5,164,58,184,116,79,78,166,172,124,32,229,8,42,171,52,70,232,97,146,39,176,41,48,32,52,190,134,66,173,17,54,193,16,161,131,232,75,164,194,184,188,159,220,1,79,141,40,189,167,93,132,118,96,43,31,54,42,100,201,142,166,139,168,91,209,218,250,40,148,202,101,16,208,87,232,98,191,157,109,233,137,124,9,149,114, +8,189,141,161,2,180,47,43,99,21,25,239,248,211,200,166,70,64,210,73,146,244,119,192,167,168,121,158,188,182,42,192,210,122,125,27,65,241,44,74,147,89,43,98,187,150,13,84,12,17,121,12,24,93,206,68,201,174,192,247,60,184,86,142,89,171,166,219,1,244,186,53,141,197,233,216,68,194,178,45,64,169,156,202,49,28,253,92,227,59,169,207,10,156,156,95,244,249,145,93,33,252,76,144,153,192,178,108,147,192,100,197,155,11,98,19,227,139,6,198,104,129,216,53,158,77,91,83,45,61,123,118,4,202,218,174,153,43,44,196,224,111,62,158,7,149,231,50,70,11,224,133,173,163,134,214,75,48,196,222,70,222,56,171,173,120,223,242,89,127,23,228,46,130,39,178,196,130,51,196,254,248,143,172,23,252,26,195,218,224,6,210,99,137,218,170,182,176,141,135,3,204,12,9,249,70,58,172,226,176,80,252,51,120,122,188,181,40,253,38,60,177,178,44,79,48,124,0,166,33,163,121,224,230,164,240,193,124,225,81,228,176,139,54,113,224,212,218,228,74,122,34,170,160,11,158, +9,109,214,38,85,22,38,65,197,174,203,158,190,218,182,158,14,187,2,88,195,129,114,117,185,196,32,26,2,42,70,144,192,73,225,161,182,244,96,60,154,165,7,92,143,28,56,217,8,90,44,209,241,161,251,69,180,85,49,178,170,146,253,15,80,98,11,221,30,181,12,97,120,11,91,140,158,86,236,134,201,29,175,63,235,63,204,118,61,155,78,174,222,156,253,59,233,61,150,174,151,251,228,119,122,180,146,179,255,150,50,63,145,164,226,167,90,217,197,35,228,44,22,63,0,212,235,198,230,