From 13ca5c174d5b9923d9765bac7127c2a5f1be2d6b Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Fri, 20 Mar 2020 09:23:38 -0700 Subject: [PATCH] Trimmed some debug memory --- IDEHelper/DbgModule.cpp | 11 ++++------ IDEHelper/DbgModule.h | 45 +++++++++++++++++---------------------- IDEHelper/DebugTarget.cpp | 11 ++-------- IDEHelper/WinDebugger.cpp | 45 +++++++++++++-------------------------- 4 files changed, 41 insertions(+), 71 deletions(-) diff --git a/IDEHelper/DbgModule.cpp b/IDEHelper/DbgModule.cpp index 658ab78b..5326f4b7 100644 --- a/IDEHelper/DbgModule.cpp +++ b/IDEHelper/DbgModule.cpp @@ -955,16 +955,12 @@ void DbgSrcFile::GetHash(String& outStr) DbgType::DbgType() { - mTypeIdx = -1; - //mHash = 0; + mTypeIdx = -1; mIsDeclaration = false; - mParent = NULL; - //mName = NULL; + mParent = NULL; mTypeName = NULL; mTypeCode = DbgType_Null; - mSize = 0; - //mArraySize = 0; - mDeclLine = 0; + mSize = 0; mPtrType = NULL; mTypeParam = NULL; mBlockParam = NULL; @@ -1833,6 +1829,7 @@ void DbgType::ToString(StringImpl& str, DbgLanguage language, bool allowDirectBf str += " "; mTypeParam->ToString(str, language, allowDirectBfObject, internalName); } + return; } if (mTypeParam == NULL) { diff --git a/IDEHelper/DbgModule.h b/IDEHelper/DbgModule.h index 543a4dfe..526b8d36 100644 --- a/IDEHelper/DbgModule.h +++ b/IDEHelper/DbgModule.h @@ -375,8 +375,7 @@ public: const char* mName; const char* mLinkName; - int mTemplateNameIdx; - int mDeclLine; + int mTemplateNameIdx; int mFrameBaseLen; int mPrologueSize; const uint8* mFrameBaseData; @@ -386,15 +385,15 @@ public: int mStepFilterVersion; LocalBaseRegKind mParamBaseReg; LocalBaseRegKind mLocalBaseReg; - bool mHasQualifiedName; - bool mIsStepFiltered; - bool mIsStepFilteredDefault; - bool mVirtual; - bool mHasThis; - bool mNeedLineDataFixup; - HotReplaceKind mHotReplaceKind; - bool mIsOptimized; - bool mHasLineAddrGaps; // There are gaps of addresses which are not covered by lineinfo + bool mHasQualifiedName:1; + bool mIsStepFiltered:1; + bool mIsStepFilteredDefault:1; + bool mVirtual:1; + bool mHasThis:1; + bool mNeedLineDataFixup:1; + bool mIsOptimized:1; + bool mHasLineAddrGaps:1; // There are gaps of addresses which are not covered by lineinfo + HotReplaceKind mHotReplaceKind; DbgLineInfo* mLineInfo; DbgInlineeInfo* mInlineeInfo; DbgType* mParentType; @@ -416,9 +415,7 @@ public: mHotReplaceKind = HotReplaceKind_None; mHasLineAddrGaps = false; mPrologueSize = -1; - mParentType = NULL; - mDeclLine = 0; - //mInlinerData = NULL; + mParentType = NULL; mInlineeInfo = NULL; mFrameBaseData = NULL; mFrameBaseLen = 0; @@ -560,20 +557,18 @@ public: const char* mTypeName; intptr mSize; // In bytes int mTemplateNameIdx; - int mAlign; - int mDeclFileIdx; - int mDeclLine; + int mAlign; int mTypeIdx; uint16 mDefinedMembersSize; uint16 mMethodsWithParamsCount; - bool mIsIncomplete; // Not fully loaded - bool mIsPacked; - bool mNeedsGlobalsPopulated; - bool mHasGlobalsPopulated; - bool mIsDeclaration; - bool mHasStaticMembers; - bool mHasVTable; - bool mFixedName; + bool mIsIncomplete:1; // Not fully loaded + bool mIsPacked:1; + bool mNeedsGlobalsPopulated:1; + bool mHasGlobalsPopulated:1; + bool mIsDeclaration:1; + bool mHasStaticMembers:1; + bool mHasVTable:1; + bool mFixedName:1; DbgLanguage mLanguage; DbgExtType mExtType; DbgTypePriority mPriority; // Is the one stored in the type map diff --git a/IDEHelper/DebugTarget.cpp b/IDEHelper/DebugTarget.cpp index c734fa5e..875b3eca 100644 --- a/IDEHelper/DebugTarget.cpp +++ b/IDEHelper/DebugTarget.cpp @@ -749,8 +749,7 @@ bool DebugTarget::GetAutoLocalsInBlock(Array& outLocals, DbgSubprogram* continue; } - if (//(dwLineData->mLine >= variable->mDeclLine) && - (variable->mName[0] != '$')) + if ((variable->mName[0] != '$')) _AddLocal(variable->mName); } @@ -2264,12 +2263,9 @@ bool DebugTarget::GetValueByNameInBlock_Helper(DbgSubprogram* dwSubprogram, DbgB } }; - //for (auto variable : dwBlock->mVariables) for (int varIdx = (int)checkVars.size() - 1; varIdx >= 0; varIdx--) { auto variable = checkVars[varIdx]; -// if (variable->mDeclFileIdx == 0) -// continue; if (variable->mRangeStart != 0) { @@ -2339,10 +2335,7 @@ bool DebugTarget::GetValueByNameInBlock_Helper(DbgSubprogram* dwSubprogram, DbgB if (dwBlock == &dwSubprogram->mBlock) { for (auto variable : dwSubprogram->mParams) - { - /*if (variable->mDeclFileIdx == 0) - continue;*/ - + { if (variable->mName == NULL) continue; diff --git a/IDEHelper/WinDebugger.cpp b/IDEHelper/WinDebugger.cpp index ebd0f688..3baabe52 100644 --- a/IDEHelper/WinDebugger.cpp +++ b/IDEHelper/WinDebugger.cpp @@ -10632,11 +10632,8 @@ void WinDebugger::GetCodeAddrInfo(intptr addr, String* outFile, int* outHotIdx, } if (dwEndLineData != NULL) - { - if (subProgram->mDeclLine != 0) - *outDefLineStart = subProgram->mDeclLine - 1; - else - *outDefLineStart = dwStartLineData->mLine; + { + *outDefLineStart = dwStartLineData->mLine; *outDefLineEnd = dwEndLineData->mLine; } } @@ -10754,27 +10751,18 @@ String WinDebugger::GetStackFrameInfo(int stackFrameIdx, intptr* addr, String* o { WdStackFrame* nextStackFrame = mCallStack[actualStackFrameIdx - 1]; auto subProgram = nextStackFrame->mSubProgram; -// int callFileIdx = subProgram->mDeclFileIdx; -// if (callFileIdx > 0) -// { -// DbgSrcFile* srcFile = subProgram->mCompileUnit->mSrcFileRefs[callFileIdx - 1].mSrcFile; -// _CheckHashSrcFile(*outFile, subProgram->mCompileUnit->mDbgModule, srcFile); -// *outFile = srcFile->GetLocalPath(); -// *outLine = subProgram->mDeclLine - 1; -// } -// else - { - FixupLineDataForSubprogram(subProgram->mInlineeInfo->mRootInliner); - DbgSubprogram* parentSubprogram = subProgram->mInlineeInfo->mInlineParent; // Require it be in the inline parent - auto foundLine = parentSubprogram->FindClosestLine(subProgram->mBlock.mLowPC, &parentSubprogram); - if (foundLine != NULL) - { - auto srcFile = parentSubprogram->GetLineSrcFile(*foundLine); - *outFile = srcFile->GetLocalPath(); - _CheckHashSrcFile(*outFile, subProgram->mCompileUnit->mDbgModule, srcFile); - *outLine = foundLine->mLine; - } + + FixupLineDataForSubprogram(subProgram->mInlineeInfo->mRootInliner); + DbgSubprogram* parentSubprogram = subProgram->mInlineeInfo->mInlineParent; // Require it be in the inline parent + auto foundLine = parentSubprogram->FindClosestLine(subProgram->mBlock.mLowPC, &parentSubprogram); + if (foundLine != NULL) + { + auto srcFile = parentSubprogram->GetLineSrcFile(*foundLine); + *outFile = srcFile->GetLocalPath(); + _CheckHashSrcFile(*outFile, subProgram->mCompileUnit->mDbgModule, srcFile); + *outLine = foundLine->mLine; } + *outLanguage = subProgram->GetLanguage(); *outHotIdx = subProgram->mCompileUnit->mDbgModule->mHotIdx; *outColumn = -1; @@ -10879,11 +10867,8 @@ String WinDebugger::GetStackFrameInfo(int stackFrameIdx, intptr* addr, String* o *outLanguage = (int)dwSubprogram->mCompileUnit->mLanguage; if (dwEndLineData != NULL) - { - if (dwSubprogram->mDeclLine != 0) - *outDefLineStart = dwSubprogram->mDeclLine - 1; - else - *outDefLineStart = dwStartLineData->mLine; + { + *outDefLineStart = dwStartLineData->mLine; *outDefLineEnd = dwEndLineData->mLine; }