1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 03:28:20 +02:00

Trimmed trailing whitespace

This commit is contained in:
Brian Fiete 2022-07-30 09:11:38 -04:00
parent 8eda627e2f
commit 14f20f10c8
28 changed files with 1659 additions and 1768 deletions

View file

@ -10,7 +10,7 @@ class BumpList
{ {
public: public:
struct Node struct Node
{ {
T mValue; T mValue;
Node* mNext; Node* mNext;
}; };
@ -18,14 +18,14 @@ public:
struct Iterator struct Iterator
{ {
public: public:
Node* mNode; Node* mNode;
public: public:
Iterator(Node* node) Iterator(Node* node)
{ {
mNode = node; mNode = node;
} }
Iterator& operator++() Iterator& operator++()
{ {
mNode = mNode->mNext; mNode = mNode->mNext;
@ -50,20 +50,20 @@ public:
struct RemovableIterator struct RemovableIterator
{ {
public: public:
Node** mPrevNextPtr; Node** mPrevNextPtr;
public: public:
RemovableIterator(Node** headPtr) RemovableIterator(Node** headPtr)
{ {
mPrevNextPtr = headPtr; mPrevNextPtr = headPtr;
} }
RemovableIterator& operator++() RemovableIterator& operator++()
{ {
Node* newNode = *mPrevNextPtr; Node* newNode = *mPrevNextPtr;
if (newNode != NULL) if (newNode != NULL)
mPrevNextPtr = &newNode->mNext; mPrevNextPtr = &newNode->mNext;
return *this; return *this;
} }
@ -96,7 +96,7 @@ public:
} }
void PushFront(T value, BumpAllocator* bumpAllocator) void PushFront(T value, BumpAllocator* bumpAllocator)
{ {
auto newHead = bumpAllocator->Alloc<Node>(); auto newHead = bumpAllocator->Alloc<Node>();
newHead->mValue = value; newHead->mValue = value;
newHead->mNext = mHead; newHead->mNext = mHead;
@ -152,7 +152,7 @@ public:
mVals[2] = NULL; mVals[2] = NULL;
mNextBlock = NULL; mNextBlock = NULL;
} }
}; };
struct Iterator struct Iterator
{ {
@ -163,7 +163,7 @@ public:
public: public:
Iterator(NodeBlock* nodeBlock) Iterator(NodeBlock* nodeBlock)
{ {
SetNodeBlock(nodeBlock); SetNodeBlock(nodeBlock);
} }
void SetNodeBlock(NodeBlock* nodeBlock) void SetNodeBlock(NodeBlock* nodeBlock)
@ -183,7 +183,7 @@ public:
{ {
mMemberIdx--; mMemberIdx--;
if (mMemberIdx < 0) if (mMemberIdx < 0)
SetNodeBlock(mNodeBlock->mNextBlock); SetNodeBlock(mNodeBlock->mNextBlock);
return *this; return *this;
} }
@ -209,11 +209,11 @@ public:
BlockBumpList() BlockBumpList()
{ {
mHeadBlock = NULL; mHeadBlock = NULL;
} }
void Add(T value, BumpAllocator* bumpAllocator) void Add(T value, BumpAllocator* bumpAllocator)
{ {
if (mHeadBlock == NULL) if (mHeadBlock == NULL)
mHeadBlock = bumpAllocator->Alloc<NodeBlock>(); mHeadBlock = bumpAllocator->Alloc<NodeBlock>();
else if (mHeadBlock->mVals[NodeBlock::NodeCount - 1]) else if (mHeadBlock->mVals[NodeBlock::NodeCount - 1])
{ {

View file

@ -21,7 +21,6 @@
#include "BeefySysLib/util/AllocDebug.h" #include "BeefySysLib/util/AllocDebug.h"
#define LF_CLASS_EX 0x1608 #define LF_CLASS_EX 0x1608
#define LF_STRUCTURE_EX 0x1609 #define LF_STRUCTURE_EX 0x1609
@ -769,14 +768,12 @@ DbgSubprogram* COFF::CvParseMethod(DbgType* parentType, const char* methodName,
else if (trLeafType == LF_MFUNC_ID) else if (trLeafType == LF_MFUNC_ID)
{ {
// //
} }
else else
{ {
SoftFail(StrFormat("Unhandled func type at tagId %d ipi %d", tagIdx, ipi)); SoftFail(StrFormat("Unhandled func type at tagId %d ipi %d", tagIdx, ipi));
} }
if ((parentType != NULL) && (!IsObjectFile())) if ((parentType != NULL) && (!IsObjectFile()))
{ {
subprogram->mCompileUnit = parentType->mCompileUnit; subprogram->mCompileUnit = parentType->mCompileUnit;
@ -1595,8 +1592,6 @@ DbgType* COFF::CvParseType(int tagIdx, bool ipi)
else else
dbgType->mTypeCode = DbgType_Struct; dbgType->mTypeCode = DbgType_Struct;
DbgType* baseType = NULL; DbgType* baseType = NULL;
if (derived != 0) if (derived != 0)
{ {
@ -1734,7 +1729,6 @@ DbgType* COFF::CvParseType(int tagIdx, bool ipi)
break; break;
case LF_DIMARRAY: case LF_DIMARRAY:
{ {
} }
break; break;
case LF_ARRAY: case LF_ARRAY:
@ -3027,7 +3021,6 @@ void COFF::ParseCompileUnit_Symbols(DbgCompileUnit* compileUnit, uint8* sectionD
inlineDebugDump = false; inlineDebugDump = false;
curSubprogram = NULL; curSubprogram = NULL;
curParam = NULL; curParam = NULL;
} }
break; break;
case S_COMPILE2: case S_COMPILE2:
@ -3357,7 +3350,6 @@ void COFF::ParseCompileUnit_Symbols(DbgCompileUnit* compileUnit, uint8* sectionD
} }
return false; return false;
}; };
for (int blockIdx = (int)blockStack.size() - 1; blockIdx >= 0; blockIdx--) for (int blockIdx = (int)blockStack.size() - 1; blockIdx >= 0; blockIdx--)
@ -3415,7 +3407,6 @@ void COFF::ParseCompileUnit_Symbols(DbgCompileUnit* compileUnit, uint8* sectionD
BF_ASSERT(locationDataCount == prevLocalVar->mLocationLen); BF_ASSERT(locationDataCount == prevLocalVar->mLocationLen);
}*/ }*/
data = dataEnd; data = dataEnd;
//PTR_ALIGN(data, sectionData, 4); //PTR_ALIGN(data, sectionData, 4);
} }
@ -3863,7 +3854,6 @@ CvCompileUnit* COFF::ParseCompileUnit(CvModuleInfo* moduleInfo, CvCompileUnit* c
bool flushOnLineOffset = false; bool flushOnLineOffset = false;
addr_target lastLineAddr = 0; addr_target lastLineAddr = 0;
DbgSrcFileReference* srcFileRef = startSrcFileRef; DbgSrcFileReference* srcFileRef = startSrcFileRef;
DbgSubprogram* curSubprogram = inlineData->mSubprogram; DbgSubprogram* curSubprogram = inlineData->mSubprogram;
@ -3907,7 +3897,6 @@ CvCompileUnit* COFF::ParseCompileUnit(CvModuleInfo* moduleInfo, CvCompileUnit* c
BfLogCv(" Adding Line:%d Addr:%@\n", lineData.mLine + 1, lineData.mRelAddress + mImageBase); BfLogCv(" Adding Line:%d Addr:%@\n", lineData.mLine + 1, lineData.mRelAddress + mImageBase);
curLineData = lineBuilder.Add(compileUnit, lineData, srcFileRef->mSrcFile, curSubprogram); curLineData = lineBuilder.Add(compileUnit, lineData, srcFileRef->mSrcFile, curSubprogram);
}; };
int codeIdx = 0; int codeIdx = 0;
@ -4111,7 +4100,6 @@ CvCompileUnit* COFF::ParseCompileUnit(CvModuleInfo* moduleInfo, CvCompileUnit* c
lineBuilder.Commit(); lineBuilder.Commit();
//OutputDebugStrF("Module loaded, AllocSize added: %d\n", (mAlloc.GetAllocSize() - allocSizeStart) / 1024); //OutputDebugStrF("Module loaded, AllocSize added: %d\n", (mAlloc.GetAllocSize() - allocSizeStart) / 1024);
return compileUnit; return compileUnit;
} }
@ -4694,7 +4682,6 @@ void COFF::ScanCompileUnit(int compileUnitId)
PTR_ALIGN(data, sectionData, 4); PTR_ALIGN(data, sectionData, 4);
} }
break; // Stop once we handle the file checksums break; // Stop once we handle the file checksums
} }
@ -5349,7 +5336,6 @@ void COFF::CvParseIPI()
{ {
lfStringId& str = *(lfStringId*)data; lfStringId& str = *(lfStringId*)data;
const char* parentStr = (const char*)str.name; const char* parentStr = (const char*)str.name;
} }
break; break;
case LF_UDT_MOD_SRC_LINE: case LF_UDT_MOD_SRC_LINE:
@ -5367,7 +5353,6 @@ void COFF::CvParseIPI()
{ {
lfMFuncId* funcData = (lfMFuncId*)dataStart; lfMFuncId* funcData = (lfMFuncId*)dataStart;
auto parentType = CvGetType(funcData->parentType); auto parentType = CvGetType(funcData->parentType);
} }
break; break;
} }
@ -5922,7 +5907,6 @@ bool COFF::ParseCv(DataStream& pdbFS, uint8* rootDirData, int pageSize, uint8 wa
for (int i = 0; i < (int)mCvStreamPtrs.size(); i++) for (int i = 0; i < (int)mCvStreamPtrs.size(); i++)
mCvStreamPtrs[i] = GET(int32); mCvStreamPtrs[i] = GET(int32);
////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////
if (!CvParseHeader(wantGuid, wantAge)) if (!CvParseHeader(wantGuid, wantAge))
@ -7089,7 +7073,6 @@ addr_target COFF::LocateSymbol(const StringImpl& name)
// delete data; // delete data;
// #endif // #endif
FileSubStream fileStream; FileSubStream fileStream;
fileStream.mFP = libEntry->mLibFile->mOldFileStream.mFP; fileStream.mFP = libEntry->mLibFile->mOldFileStream.mFP;
fileStream.mOffset = libEntry->mOldDataPos + sizeof(BeLibMemberHeader); fileStream.mOffset = libEntry->mOldDataPos + sizeof(BeLibMemberHeader);
@ -7234,7 +7217,6 @@ void COFF::ParseFrameDescriptors(uint8* data, int size, addr_target baseAddr)
} }
mParsedFrameDescriptors = true; mParsedFrameDescriptors = true;
} }
void COFF::ParseFrameDescriptors() void COFF::ParseFrameDescriptors()
@ -7281,4 +7263,4 @@ void TestPDB(const StringImpl& fileName, WinDebugger* debugger)
coff.ParseCompileUnit(compileUnitId); coff.ParseCompileUnit(compileUnitId);
} }
NS_BF_DBG_END NS_BF_DBG_END

View file

@ -1,6 +1,5 @@
#pragma once #pragma once
#include "DbgModule.h" #include "DbgModule.h"
#include "StrBloomMap.h" #include "StrBloomMap.h"
#include "DbgSymSrv.h" #include "DbgSymSrv.h"
@ -68,11 +67,11 @@ struct CvCrossScopeExportEntry
class CvCompileUnit : public DbgCompileUnit class CvCompileUnit : public DbgCompileUnit
{ {
public: public:
Array<CvCrossScopeExportEntry> mExports; Array<CvCrossScopeExportEntry> mExports;
Array<CvCrossScopeImport> mImports; Array<CvCrossScopeImport> mImports;
Dictionary<uint32, uint32> mExportMap; Dictionary<uint32, uint32> mExportMap;
int mModuleIdx; int mModuleIdx;
CvCompileUnit(DbgModule* dbgModule) : DbgCompileUnit(dbgModule) CvCompileUnit(DbgModule* dbgModule) : DbgCompileUnit(dbgModule)
{ {
@ -80,12 +79,12 @@ public:
}; };
struct CvModuleInfo : public CvModuleInfoBase struct CvModuleInfo : public CvModuleInfoBase
{ {
const char* mModuleName; const char* mModuleName;
const char* mObjectName; const char* mObjectName;
CvCompileUnit* mCompileUnit; CvCompileUnit* mCompileUnit;
int mIdx; int mIdx;
bool mHasMappedMethods; bool mHasMappedMethods;
}; };
struct CvStringTable struct CvStringTable
@ -112,17 +111,17 @@ enum CvSymStreamType
struct CvModuleRef struct CvModuleRef
{ {
CvModuleRef* mNext; CvModuleRef* mNext;
int mModule; int mModule;
}; };
struct CvInlineInfo struct CvInlineInfo
{ {
CvInlineInfo* mNext; CvInlineInfo* mNext;
CvInlineInfo* mTail; CvInlineInfo* mTail;
DbgSubprogram* mSubprogram; DbgSubprogram* mSubprogram;
uint8* mData; uint8* mData;
int mDataLen; int mDataLen;
int mInlinee; int mInlinee;
bool mDebugDump; bool mDebugDump;
}; };
typedef Array<CvInlineInfo> CvInlineInfoVec; typedef Array<CvInlineInfo> CvInlineInfoVec;
@ -172,18 +171,18 @@ class COFF;
class CvStreamReader class CvStreamReader
{ {
public: public:
COFF* mCOFF; COFF* mCOFF;
int mPageBits; int mPageBits;
Array<uint8*> mStreamPtrs; Array<uint8*> mStreamPtrs;
Array<uint8> mTempData; Array<uint8> mTempData;
int mSize; int mSize;
public: public:
CvStreamReader() CvStreamReader()
{ {
mCOFF = NULL; mCOFF = NULL;
mPageBits = 0; mPageBits = 0;
mSize = 0; mSize = 0;
} }
@ -203,7 +202,6 @@ public:
Dictionary<String, BeLibEntry*> mSymDict; Dictionary<String, BeLibEntry*> mSymDict;
}; };
class COFF : public DbgModule class COFF : public DbgModule
{ {
public: public:
@ -214,14 +212,14 @@ public:
ParseKind_Full ParseKind_Full
}; };
public: public:
ZipFile* mEmitSourceFile; ZipFile* mEmitSourceFile;
uint8 mWantPDBGuid[16]; uint8 mWantPDBGuid[16];
int mWantAge; int mWantAge;
uint8 mPDBGuid[16]; uint8 mPDBGuid[16];
int mFileAge; int mFileAge;
int mDebugAge; int mDebugAge;
ParseKind mParseKind; ParseKind mParseKind;
bool mPDBLoaded; bool mPDBLoaded;
bool mIs64Bit; bool mIs64Bit;
@ -229,46 +227,46 @@ public:
int mCvPageSize; int mCvPageSize;
int mCvPageBits; int mCvPageBits;
int mCvMinTag; int mCvMinTag;
int mCvMaxTag; int mCvMaxTag;
int mCvIPIMinTag; int mCvIPIMinTag;
int mCvIPIMaxTag; int mCvIPIMaxTag;
//Array<void*> mCvTagData; // a DbgType* for type info, or a ptr to the data stream for child info //Array<void*> mCvTagData; // a DbgType* for type info, or a ptr to the data stream for child info
Array<DbgType*> mCvTypeMap; Array<DbgType*> mCvTypeMap;
Array<int> mCvTagStartMap; Array<int> mCvTagStartMap;
Array<int> mCvIPITagStartMap; Array<int> mCvIPITagStartMap;
Array<Array<uint8>> mTempBufs;
int mTempBufIdx;
Array<DbgType*> mCvSystemTypes; Array<Array<uint8>> mTempBufs;
int mTempBufIdx;
Array<DbgType*> mCvSystemTypes;
Array<int32> mCvStreamSizes; Array<int32> mCvStreamSizes;
Array<int32> mCvStreamPtrStartIdxs; Array<int32> mCvStreamPtrStartIdxs;
Array<int32> mCvStreamPtrs; Array<int32> mCvStreamPtrs;
CvStreamReader mCvTypeSectionReader; CvStreamReader mCvTypeSectionReader;
CvStreamReader mCvIPIReader; CvStreamReader mCvIPIReader;
CvStreamReader mCvSymbolRecordReader; CvStreamReader mCvSymbolRecordReader;
StringT<128> mPDBPath; StringT<128> mPDBPath;
SafeMemStream* mCvDataStream; SafeMemStream* mCvDataStream;
CvStringTable mStringTable; CvStringTable mStringTable;
uint8* mCvHeaderData; uint8* mCvHeaderData;
//uint8* mCvTypeSectionData //uint8* mCvTypeSectionData
uint8* mCvStrTableData; uint8* mCvStrTableData;
uint8* mCvPublicSymbolData; uint8* mCvPublicSymbolData;
uint8* mCvGlobalSymbolData; uint8* mCvGlobalSymbolData;
uint8* mNewFPOData; uint8* mNewFPOData;
int mCvGlobalSymbolInfoStream; int mCvGlobalSymbolInfoStream;
int mCvPublicSymbolInfoStream; int mCvPublicSymbolInfoStream;
int mCvSymbolRecordStream; int mCvSymbolRecordStream;
int mCvSrcSrvStream; int mCvSrcSrvStream;
int mCvEmitStream; int mCvEmitStream;
int mCvNewFPOStream; int mCvNewFPOStream;
Array<CvModuleInfo*> mCvModuleInfo; Array<CvModuleInfo*> mCvModuleInfo;
Dictionary<int, DbgSrcFile*> mCVSrcFileRefCache; Dictionary<int, DbgSrcFile*> mCVSrcFileRefCache;
Dictionary<CaseInsensitiveString, CvModuleInfo*> mModuleNameMap; Dictionary<CaseInsensitiveString, CvModuleInfo*> mModuleNameMap;
HashSet<CvModuleInfoNameEntry> mModuleNameSet; HashSet<CvModuleInfoNameEntry> mModuleNameSet;
Dictionary<String, CvLibInfo*> mHotLibMap; Dictionary<String, CvLibInfo*> mHotLibMap;
Dictionary<String, BeLibEntry*> mHotLibSymMap; Dictionary<String, BeLibEntry*> mHotLibSymMap;
@ -282,7 +280,7 @@ public:
Array<DbgSectionData> mCvCompileUnitData; Array<DbgSectionData> mCvCompileUnitData;
//int mCvTypeSectionDataSize; //int mCvTypeSectionDataSize;
//uint8* mCvCompileUnitData; //uint8* mCvCompileUnitData;
//int mCvCompileUnitDataSize; //int mCvCompileUnitDataSize;
HANDLE mCvMappedFile; HANDLE mCvMappedFile;
void* mCvMappedViewOfFile; void* mCvMappedViewOfFile;
@ -290,12 +288,12 @@ public:
HANDLE mCvMappedFileMapping; HANDLE mCvMappedFileMapping;
bool mIsFastLink; bool mIsFastLink;
bool mTriedSymSrv; bool mTriedSymSrv;
DbgSymRequest* mDbgSymRequest; DbgSymRequest* mDbgSymRequest;
bool mWantsAutoLoadDebugInfo; bool mWantsAutoLoadDebugInfo;
int mProcSymCount;
public: int mProcSymCount;
public:
virtual void Fail(const StringImpl& error) override; virtual void Fail(const StringImpl& error) override;
virtual void SoftFail(const StringImpl& error); virtual void SoftFail(const StringImpl& error);
virtual void HardFail(const StringImpl& error) override; virtual void HardFail(const StringImpl& error) override;
@ -304,7 +302,7 @@ public:
virtual void ParseSymbolData() override; virtual void ParseSymbolData() override;
virtual void ParseTypeData(CvStreamReader& reader, int dataOffset); virtual void ParseTypeData(CvStreamReader& reader, int dataOffset);
void ParseTypeData(int sectionNum, CvStreamReader& reader, int& sectionSize, int& dataOfs, int& hashStream, int& hashAdjOffset, int& hashAdjSize, int& minVal, int& maxVal); void ParseTypeData(int sectionNum, CvStreamReader& reader, int& sectionSize, int& dataOfs, int& hashStream, int& hashAdjOffset, int& hashAdjSize, int& minVal, int& maxVal);
virtual void ParseTypeData() override; virtual void ParseTypeData() override;
void ParseCompileUnit_Symbols(DbgCompileUnit* compileUnit, uint8* sectionData, uint8* data, uint8* dataEnd, CvInlineInfoVec& inlineDataVec, bool deferInternals, DbgSubprogram* useSubprogram); void ParseCompileUnit_Symbols(DbgCompileUnit* compileUnit, uint8* sectionData, uint8* data, uint8* dataEnd, CvInlineInfoVec& inlineDataVec, bool deferInternals, DbgSubprogram* useSubprogram);
CvCompileUnit* ParseCompileUnit(CvModuleInfo* moduleInfo, CvCompileUnit* compileUnit, uint8* sectionData, int sectionSize); CvCompileUnit* ParseCompileUnit(CvModuleInfo* moduleInfo, CvCompileUnit* compileUnit, uint8* sectionData, int sectionSize);
virtual CvCompileUnit* ParseCompileUnit(int compileUnitId) override; virtual CvCompileUnit* ParseCompileUnit(int compileUnitId) override;
@ -323,7 +321,7 @@ public:
virtual void FinishHotSwap() override; virtual void FinishHotSwap() override;
virtual intptr EvaluateLocation(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, DbgAddrType* outAddrType, DbgEvalLocFlags flags = DbgEvalLocFlag_None) override; virtual intptr EvaluateLocation(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, DbgAddrType* outAddrType, DbgEvalLocFlags flags = DbgEvalLocFlag_None) override;
virtual bool CanGetOldSource() override; virtual bool CanGetOldSource() override;
virtual String GetOldSourceCommand(const StringImpl& path) override; virtual String GetOldSourceCommand(const StringImpl& path) override;
virtual bool GetEmitSource(const StringImpl& filePath, String& outText) override; virtual bool GetEmitSource(const StringImpl& filePath, String& outText) override;
virtual bool HasPendingDebugInfo() override; virtual bool HasPendingDebugInfo() override;
virtual void PreCacheImage() override; virtual void PreCacheImage() override;
@ -346,36 +344,36 @@ public:
void ParseSymbolStream(CvSymStreamType symStreamType); void ParseSymbolStream(CvSymStreamType symStreamType);
void ScanCompileUnit(int compileUnitId); void ScanCompileUnit(int compileUnitId);
void ParseFrameDescriptors(uint8* data, int size, addr_target baseAddr); void ParseFrameDescriptors(uint8* data, int size, addr_target baseAddr);
const char* CvParseSymbol(int offset, CvSymStreamType symStreamType, addr_target& outAddr); const char* CvParseSymbol(int offset, CvSymStreamType symStreamType, addr_target& outAddr);
uint8* HandleSymStreamEntries(CvSymStreamType symStreamType, uint8* data, uint8* addrMap); uint8* HandleSymStreamEntries(CvSymStreamType symStreamType, uint8* data, uint8* addrMap);
const char* CvParseString(uint8*& data); const char* CvParseString(uint8*& data);
const char* CvParseAndDupString(uint8*& data); const char* CvParseAndDupString(uint8*& data);
const char* CvDupString(const char* str, int strLen); const char* CvDupString(const char* str, int strLen);
void CvReadStream(int sectionIdx, CvStreamReader& streamReader); void CvReadStream(int sectionIdx, CvStreamReader& streamReader);
void CvInitStreamRaw(CvStreamReader& streamReader, uint8* data, int size); void CvInitStreamRaw(CvStreamReader& streamReader, uint8* data, int size);
uint8* CvReadStream(int sectionIdx, int* outSize = NULL); uint8* CvReadStream(int sectionIdx, int* outSize = NULL);
uint8* CvReadStreamSegment(int sectionIdx, int offset, int size); uint8* CvReadStreamSegment(int sectionIdx, int offset, int size);
void ReleaseTempBuf(uint8* buf); void ReleaseTempBuf(uint8* buf);
void InitCvTypes(); void InitCvTypes();
DbgType* CvCreateType(); DbgType* CvCreateType();
int CvConvRegNum(int regNum, int* outBits = NULL); int CvConvRegNum(int regNum, int* outBits = NULL);
addr_target GetSectionAddr(uint16 section, uint32 offset); addr_target GetSectionAddr(uint16 section, uint32 offset);
int64 CvParseConstant(uint16 constVal, uint8*& data); int64 CvParseConstant(uint16 constVal, uint8*& data);
int64 CvParseConstant(uint8*& data); int64 CvParseConstant(uint8*& data);
DbgType* CvGetType(int typeId); DbgType* CvGetType(int typeId);
DbgType* CvGetTypeSafe(int typeId); DbgType* CvGetTypeSafe(int typeId);
DbgType* CvGetType(int typeId, CvCompileUnit* compileUnit); DbgType* CvGetType(int typeId, CvCompileUnit* compileUnit);
int CvGetTagStart(int tagIdx, bool ipi); int CvGetTagStart(int tagIdx, bool ipi);
int CvGetTagSize(int tagIdx, bool ipi); int CvGetTagSize(int tagIdx, bool ipi);
uint8* CvGetTagData(int tagIdx, bool ipi, int* outDataSize = NULL); uint8* CvGetTagData(int tagIdx, bool ipi, int* outDataSize = NULL);
void CvParseArgList(DbgSubprogram* subprogram, int tagIdx, bool ipi); void CvParseArgList(DbgSubprogram* subprogram, int tagIdx, bool ipi);
DbgSubprogram* CvParseMethod(DbgType* parentType, const char* methodName, int tagIdx, bool ipi, DbgSubprogram* subprogram = NULL); DbgSubprogram* CvParseMethod(DbgType* parentType, const char* methodName, int tagIdx, bool ipi, DbgSubprogram* subprogram = NULL);
void CvParseMethodList(DbgType* parentType, const char* methodName, int tagIdx, bool ipi); void CvParseMethodList(DbgType* parentType, const char* methodName, int tagIdx, bool ipi);
void CvParseMembers(DbgType* parentType, int tagIdx, bool ipi); void CvParseMembers(DbgType* parentType, int tagIdx, bool ipi);
DbgType* CvParseType(int tagIdx, bool ipi = false); DbgType* CvParseType(int tagIdx, bool ipi = false);
bool CvParseDBI(int wantAge); bool CvParseDBI(int wantAge);
void ParseSectionHeader(int sectionIdx); void ParseSectionHeader(int sectionIdx);
void CvParseIPI(); void CvParseIPI();
@ -384,7 +382,7 @@ public:
bool ParseCv(DataStream& CvFS, uint8* rootDirData, int pageSize, uint8 wantGuid[16], int32 wantAge); bool ParseCv(DataStream& CvFS, uint8* rootDirData, int pageSize, uint8 wantGuid[16], int32 wantAge);
bool TryLoadPDB(const String& CvPath, uint8 wantGuid[16], int32 wantAge); bool TryLoadPDB(const String& CvPath, uint8 wantGuid[16], int32 wantAge);
void ClosePDB(); void ClosePDB();
virtual void ReportMemory(MemReporter* memReporter) override; virtual void ReportMemory(MemReporter* memReporter) override;
public: public:
COFF(DebugTarget* debugTarget); COFF(DebugTarget* debugTarget);
@ -392,7 +390,7 @@ public:
virtual bool LoadPDB(const String& CvPath, uint8 wantGuid[16], int32 wantAge) override; virtual bool LoadPDB(const String& CvPath, uint8 wantGuid[16], int32 wantAge) override;
virtual bool CheckSection(const char* name, uint8* sectionData, virtual bool CheckSection(const char* name, uint8* sectionData,
int sectionSize) override; int sectionSize) override;
}; };
class CvAutoReleaseTempData class CvAutoReleaseTempData
@ -422,10 +420,8 @@ namespace std
struct hash<NS_BF_DBG::CvModuleInfoNameEntry> struct hash<NS_BF_DBG::CvModuleInfoNameEntry>
{ {
size_t operator()(const NS_BF_DBG::CvModuleInfoNameEntry& val) const size_t operator()(const NS_BF_DBG::CvModuleInfoNameEntry& val) const
{ {
return NS_BF_DBG::CvModuleInfoNameEntry::GetHashCode(Beefy::StringImpl::MakeRef(val.mModuleInfo->mModuleName)); return NS_BF_DBG::CvModuleInfoNameEntry::GetHashCode(Beefy::StringImpl::MakeRef(val.mModuleInfo->mModuleName));
} }
}; };
} }

View file

@ -49,4 +49,3 @@ enum RegForm : int8
RegForm_Double2, RegForm_Double2,
RegForm_Double4, RegForm_Double4,
}; };

View file

@ -453,7 +453,7 @@ enum
DW_OP_breg12 = 0x7C, DW_OP_breg12 = 0x7C,
DW_OP_breg13 = 0x7D, DW_OP_breg13 = 0x7D,
DW_OP_breg14 = 0x7E, DW_OP_breg14 = 0x7E,
DW_OP_breg15 = 0x7F, DW_OP_breg15 = 0x7F,
DW_OP_breg31 = 0x8f, DW_OP_breg31 = 0x8f,
DW_OP_regx = 0x90, DW_OP_regx = 0x90,
DW_OP_fbreg = 0x91, DW_OP_fbreg = 0x91,
@ -520,7 +520,7 @@ enum
DW_CFA_hi_user = 0x3f, DW_CFA_hi_user = 0x3f,
}; };
enum SymbolFlags enum SymbolFlags
{ {
SF_TypeMask = 0x0000FFFF, SF_TypeMask = 0x0000FFFF,
SF_TypeShift = 0, SF_TypeShift = 0,
@ -576,7 +576,7 @@ enum SymbolStorageClass
COFF_SYM_CLASS_CLR_TOKEN = 107 COFF_SYM_CLASS_CLR_TOKEN = 107
}; };
enum SymbolBaseType enum SymbolBaseType
{ {
COFF_SYM_TYPE_NULL = 0, ///< No type information or unknown base type. COFF_SYM_TYPE_NULL = 0, ///< No type information or unknown base type.
COFF_SYM_TYPE_VOID = 1, ///< Used with void pointers and functions. COFF_SYM_TYPE_VOID = 1, ///< Used with void pointers and functions.
@ -596,7 +596,7 @@ enum SymbolBaseType
COFF_SYM_TYPE_DWORD = 15 ///< An unsigned 4-byte integer. COFF_SYM_TYPE_DWORD = 15 ///< An unsigned 4-byte integer.
}; };
enum SymbolComplexType enum SymbolComplexType
{ {
COFF_SYM_DTYPE_NULL = 0, ///< No complex type; simple scalar variable. COFF_SYM_DTYPE_NULL = 0, ///< No complex type; simple scalar variable.
COFF_SYM_DTYPE_POINTER = 1, ///< A pointer to base type. COFF_SYM_DTYPE_POINTER = 1, ///< A pointer to base type.
@ -642,4 +642,3 @@ enum RelocationTypeAMD64
COFF_REL_AMD64_PAIR = 0x000F, COFF_REL_AMD64_PAIR = 0x000F,
COFF_REL_AMD64_SSPAN32 = 0x0010 COFF_REL_AMD64_SSPAN32 = 0x0010
}; };

View file

@ -12,7 +12,5 @@ DbgEvalPool::Entry* DbgEvalPool::Add(const std::string& expr, int callStackIdx,
entry->mAllowCall = allowCalls; entry->mAllowCall = allowCalls;
entry->mExpressionFlags = expressionFlags; entry->mExpressionFlags = expressionFlags;
return NULL; return NULL;
} }

View file

@ -16,7 +16,7 @@ public:
int mAllowAssignment; int mAllowAssignment;
int mAllowCall; int mAllowCall;
int mExpressionFlags; int mExpressionFlags;
}; };
public: public:
std::vector<Entry*> mEntryList; std::vector<Entry*> mEntryList;

View file

@ -429,7 +429,6 @@ bool DwMethodMatcher::CheckMethod(DbgType* typeInstance, DbgSubprogram* checkMet
if (!mArguments[argIdx]) if (!mArguments[argIdx])
goto NoMatch; goto NoMatch;
if (!mExprEvaluator->CanCast(mArguments[argIdx], wantType)) if (!mExprEvaluator->CanCast(mArguments[argIdx], wantType))
goto NoMatch; goto NoMatch;
@ -1303,19 +1302,15 @@ void DbgExprEvaluator::BeefTypeToString(const DbgTypedValue& val, String& outStr
struct _String struct _String
{ {
}; };
struct _MethodData struct _MethodData
{ {
}; };
struct _FieldData struct _FieldData
{ {
}; };
struct _ClassVData struct _ClassVData
{ {
}; };
struct _TypeInstance : public _Type struct _TypeInstance : public _Type
@ -2105,7 +2100,6 @@ DbgTypedValue DbgExprEvaluator::Cast(BfAstNode* srcNode, const DbgTypedValue& ty
} }
} }
// IFace -> object|IFace // IFace -> object|IFace
if ((fromType->IsInterface()) || if ((fromType->IsInterface()) ||
((fromType->IsPointer()) && (fromType->mTypeParam->IsInterface()))) ((fromType->IsPointer()) && (fromType->mTypeParam->IsInterface())))
@ -2187,7 +2181,6 @@ DbgTypedValue DbgExprEvaluator::Cast(BfAstNode* srcNode, const DbgTypedValue& ty
} }
} }
if ((fromType->IsPrimitiveType()) && (toType->IsPrimitiveType())) if ((fromType->IsPrimitiveType()) && (toType->IsPrimitiveType()))
{ {
DbgTypeCode fromTypeCode = fromType->mTypeCode; DbgTypeCode fromTypeCode = fromType->mTypeCode;
@ -2619,7 +2612,6 @@ DbgTypedValue DbgExprEvaluator::DoLookupField(BfAstNode* targetSrc, DbgTypedValu
//TODO: //TODO:
/*if (field->mIsConst) /*if (field->mIsConst)
{ {
if (fieldInstance->mStaticValue == NULL) if (fieldInstance->mStaticValue == NULL)
mModule->ResolveConstField(curCheckType, field); mModule->ResolveConstField(curCheckType, field);
return DbgTypedValue(fieldInstance->mStaticValue, fieldInstance->mType); return DbgTypedValue(fieldInstance->mStaticValue, fieldInstance->mType);
@ -2902,7 +2894,6 @@ DbgTypedValue DbgExprEvaluator::DoLookupField(BfAstNode* targetSrc, DbgTypedValu
} }
}*/ }*/
//curCheckType = curCheckType->GetBaseType(); //curCheckType = curCheckType->GetBaseType();
for (auto baseTypeEntry : curCheckType->mBaseTypes) for (auto baseTypeEntry : curCheckType->mBaseTypes)
@ -4134,7 +4125,6 @@ void DbgExprEvaluator::Visit(BfAssignmentExpression* assignExpr)
if (!convVal) if (!convVal)
return; return;
// SizedArray<DbgTypedValue, 4> argPushQueue; // SizedArray<DbgTypedValue, 4> argPushQueue;
// if (propSet->mHasThis) // if (propSet->mHasThis)
// argPushQueue.push_back(propTarget); // argPushQueue.push_back(propTarget);
@ -4685,7 +4675,6 @@ void DbgExprEvaluator::AutocompleteCheckMemberReference(BfAstNode* target, BfAst
//return AutocompleteAddMembersFromNamespace(memberRefExpr->mTarget->ToString(), filter, isCType); //return AutocompleteAddMembersFromNamespace(memberRefExpr->mTarget->ToString(), filter, isCType);
} }
} }
} }
void DbgExprEvaluator::Visit(BfMemberReferenceExpression* memberRefExpr) void DbgExprEvaluator::Visit(BfMemberReferenceExpression* memberRefExpr)
@ -5191,7 +5180,6 @@ void DbgExprEvaluator::LookupSplatMember(BfAstNode* targetNode, BfAstNode* looku
mResult = splatLookupEntry->mResult; mResult = splatLookupEntry->mResult;
return; return;
} }
} }
String findName; String findName;
@ -6257,7 +6245,6 @@ void DbgExprEvaluator::PerformBinaryOperation(ASTREF(BfExpression*)& leftExpress
{ {
if (binaryOp == BfBinaryOp_Subtract) if (binaryOp == BfBinaryOp_Subtract)
{ {
} }
else if (resultType->GetByteCount() < 4) else if (resultType->GetByteCount() < 4)
{ {
@ -6599,7 +6586,6 @@ void DbgExprEvaluator::Visit(BfBinaryOperatorExpression* binOpExpr)
PerformBinaryOperation(binOpExpr->mLeft, binOpExpr->mRight, binOpExpr->mOp, binOpExpr->mOpToken, false); PerformBinaryOperation(binOpExpr->mLeft, binOpExpr->mRight, binOpExpr->mOp, binOpExpr->mOpToken, false);
} }
void DbgExprEvaluator::PerformUnaryExpression(BfAstNode* opToken, BfUnaryOp unaryOp, ASTREF(BfExpression*)& expr) void DbgExprEvaluator::PerformUnaryExpression(BfAstNode* opToken, BfUnaryOp unaryOp, ASTREF(BfExpression*)& expr)
{ {
if (unaryOp != BfUnaryOp_Dereference) if (unaryOp != BfUnaryOp_Dereference)
@ -7283,7 +7269,6 @@ DbgTypedValue DbgExprEvaluator::CreateCall(BfAstNode* targetSrc, DbgTypedValue t
continue; continue;
} }
if (argValue.mType == NULL) if (argValue.mType == NULL)
return DbgTypedValue(); return DbgTypedValue();
@ -7585,7 +7570,6 @@ DbgTypedValue DbgExprEvaluator::MatchMethod(BfAstNode* targetSrc, DbgTypedValue
checkType = checkType->mTypeParam; checkType = checkType->mTypeParam;
if (checkType != NULL) if (checkType != NULL)
{ {
//TODO: Protect //TODO: Protect
String findFieldName = argValues[1].mCharPtr; String findFieldName = argValues[1].mCharPtr;
@ -8162,7 +8146,6 @@ void DbgExprEvaluator::DoInvocation(BfAstNode* target, BfSizedArray<ASTREF(BfExp
allowImplicitThis = true; allowImplicitThis = true;
targetFunctionName = target->ToString(); targetFunctionName = target->ToString();
} }
else if (auto invocationExpr = BfNodeDynCast<BfInvocationExpression>(target)) else if (auto invocationExpr = BfNodeDynCast<BfInvocationExpression>(target))
{ {
@ -8489,4 +8472,4 @@ BfAstNode* DbgExprEvaluator::FinalizeExplicitThisReferences(BfAstNode* headNode)
} }
return headNode; return headNode;
} }

View file

@ -48,14 +48,14 @@ public:
intptr mLocalIntPtr; intptr mLocalIntPtr;
DbgVariable* mVariable; DbgVariable* mVariable;
}; };
bool mIsLiteral; bool mIsLiteral;
bool mHasNoValue; bool mHasNoValue;
bool mIsReadOnly; bool mIsReadOnly;
union union
{ {
int mRegNum; int mRegNum;
int mDataLen; int mDataLen;
}; };
addr_target mSrcAddress; addr_target mSrcAddress;
public: public:
@ -63,13 +63,13 @@ public:
{ {
mType = NULL; mType = NULL;
mUInt64 = 0; mUInt64 = 0;
mIsLiteral = false; mIsLiteral = false;
mSrcAddress = 0; mSrcAddress = 0;
mHasNoValue = false; mHasNoValue = false;
mIsReadOnly = false; mIsReadOnly = false;
mRegNum = -1; mRegNum = -1;
} }
DbgType* ResolveTypeDef() const DbgType* ResolveTypeDef() const
{ {
auto typeDef = mType; auto typeDef = mType;
@ -79,7 +79,7 @@ public:
} }
int64 GetSExtInt() const int64 GetSExtInt() const
{ {
auto resolvedType = mType->RemoveModifiers(); auto resolvedType = mType->RemoveModifiers();
switch (resolvedType->mTypeCode) switch (resolvedType->mTypeCode)
{ {
@ -139,7 +139,7 @@ public:
case DbgType_u32: case DbgType_u32:
return (int64) mUInt32; return (int64) mUInt32;
case DbgType_u64: case DbgType_u64:
return (int64) mUInt64; return (int64) mUInt64;
case DbgType_Ptr: case DbgType_Ptr:
return (int64) mUInt64; return (int64) mUInt64;
default: default:
@ -265,7 +265,7 @@ public:
SizedArray<int, 4> mBestMethodGenericArgumentSrcs; SizedArray<int, 4> mBestMethodGenericArgumentSrcs;
DwTypeVector mBestMethodGenericArguments; DwTypeVector mBestMethodGenericArguments;
public: public:
void CompareMethods(DbgSubprogram* prevMethodInstance, DwTypeVector* prevGenericArgumentsSubstitute, void CompareMethods(DbgSubprogram* prevMethodInstance, DwTypeVector* prevGenericArgumentsSubstitute,
DbgSubprogram* newMethodInstance, DwTypeVector* genericArgumentsSubstitute, DbgSubprogram* newMethodInstance, DwTypeVector* genericArgumentsSubstitute,
bool* outNewIsBetter, bool* outNewIsWorse, bool allowSpecializeFail); bool* outNewIsBetter, bool* outNewIsWorse, bool allowSpecializeFail);
@ -332,13 +332,13 @@ public:
}; };
public: public:
DebugTarget* mDebugTarget; DebugTarget* mDebugTarget;
DbgModule* mOrigDbgModule; DbgModule* mOrigDbgModule;
DbgModule* mDbgModule; DbgModule* mDbgModule;
DbgCompileUnit* mDbgCompileUnit; DbgCompileUnit* mDbgCompileUnit;
DbgLanguage mLanguage; DbgLanguage mLanguage;
BfPassInstance* mPassInstance; BfPassInstance* mPassInstance;
WinDebugger* mDebugger; WinDebugger* mDebugger;
String mExpectingTypeName; String mExpectingTypeName;
String mSubjectExpr; String mSubjectExpr;
@ -348,9 +348,9 @@ public:
DbgTypedValue mResult; DbgTypedValue mResult;
DbgTypedValue* mReceivingValue; DbgTypedValue* mReceivingValue;
intptr mCountResultOverride; intptr mCountResultOverride;
DbgTypedValue mExplicitThis; DbgTypedValue mExplicitThis;
BfExpression* mExplicitThisExpr; BfExpression* mExplicitThisExpr;
Array<DbgCallResult>* mCallResults; Array<DbgCallResult>* mCallResults;
addr_target mCallStackPreservePos; addr_target mCallStackPreservePos;
int mCallResultIdx; int mCallResultIdx;
String mNamespaceSearchStr; String mNamespaceSearchStr;
@ -367,12 +367,12 @@ public:
bool mIsEmptyTarget; bool mIsEmptyTarget;
DwEvalExpressionFlags mExpressionFlags; DwEvalExpressionFlags mExpressionFlags;
bool mHadSideEffects; bool mHadSideEffects;
bool mBlockedSideEffects; bool mBlockedSideEffects;
bool mIgnoreErrors; bool mIgnoreErrors;
bool mCreatedPendingCall; bool mCreatedPendingCall;
bool mValidateOnly; bool mValidateOnly;
int mCallStackIdx; int mCallStackIdx;
int mCursorPos; int mCursorPos;
DwAutoComplete* mAutoComplete; DwAutoComplete* mAutoComplete;
DbgStackSearch* mStackSearch; DbgStackSearch* mStackSearch;
@ -389,17 +389,17 @@ public:
bool CheckTupleCreation(addr_target receiveAddr, BfAstNode* targetSrc, DbgType* tupleType, const BfSizedArray<BfExpression*>& argValues, BfSizedArray<BfTupleNameNode*>* names); bool CheckTupleCreation(addr_target receiveAddr, BfAstNode* targetSrc, DbgType* tupleType, const BfSizedArray<BfExpression*>& argValues, BfSizedArray<BfTupleNameNode*>* names);
DbgTypedValue CheckEnumCreation(BfAstNode* targetSrc, DbgType* enumType, const StringImpl& caseName, const BfSizedArray<BfExpression*>& argValues); DbgTypedValue CheckEnumCreation(BfAstNode* targetSrc, DbgType* enumType, const StringImpl& caseName, const BfSizedArray<BfExpression*>& argValues);
void DoInvocation(BfAstNode* target, BfSizedArray<ASTREF(BfExpression*)>& args, BfSizedArray<ASTREF(BfAstNode*)>* methodGenericArguments); void DoInvocation(BfAstNode* target, BfSizedArray<ASTREF(BfExpression*)>& args, BfSizedArray<ASTREF(BfAstNode*)>* methodGenericArguments);
bool ResolveArgValues(const BfSizedArray<ASTREF(BfExpression*)>& arguments, SizedArrayImpl<DbgTypedValue>& outArgValues); bool ResolveArgValues(const BfSizedArray<ASTREF(BfExpression*)>& arguments, SizedArrayImpl<DbgTypedValue>& outArgValues);
DbgTypedValue CreateCall(DbgSubprogram* method, DbgTypedValue thisVal, DbgTypedValue structRetVal, bool bypassVirtual, CPURegisters* registers); DbgTypedValue CreateCall(DbgSubprogram* method, DbgTypedValue thisVal, DbgTypedValue structRetVal, bool bypassVirtual, CPURegisters* registers);
DbgTypedValue CreateCall(DbgSubprogram* method, SizedArrayImpl<DbgMethodArgument>& argPushQueue, bool bypassVirtual); DbgTypedValue CreateCall(DbgSubprogram* method, SizedArrayImpl<DbgMethodArgument>& argPushQueue, bool bypassVirtual);
DbgTypedValue CreateCall(BfAstNode* targetSrc, DbgTypedValue target, DbgSubprogram* methodDef, bool bypassVirtual, const BfSizedArray<ASTREF(BfExpression*)>& arguments, SizedArrayImpl<DbgTypedValue>& argValues); DbgTypedValue CreateCall(BfAstNode* targetSrc, DbgTypedValue target, DbgSubprogram* methodDef, bool bypassVirtual, const BfSizedArray<ASTREF(BfExpression*)>& arguments, SizedArrayImpl<DbgTypedValue>& argValues);
DbgTypedValue MatchMethod(BfAstNode* targetSrc, DbgTypedValue target, bool allowImplicitThis, bool bypassVirtual, const StringImpl& methodName, DbgTypedValue MatchMethod(BfAstNode* targetSrc, DbgTypedValue target, bool allowImplicitThis, bool bypassVirtual, const StringImpl& methodName,
const BfSizedArray<ASTREF(BfExpression*)>& arguments, BfSizedArray<ASTREF(BfAstNode*)>* methodGenericArguments); const BfSizedArray<ASTREF(BfExpression*)>& arguments, BfSizedArray<ASTREF(BfAstNode*)>* methodGenericArguments);
DbgType* ResolveSubTypeRef(DbgType* checkType, const StringImpl& name); DbgType* ResolveSubTypeRef(DbgType* checkType, const StringImpl& name);
void PerformBinaryOperation(ASTREF(BfExpression*)& leftExpression, ASTREF(BfExpression*)& rightExpression, BfBinaryOp binaryOp, BfTokenNode* opToken, bool forceLeftType); void PerformBinaryOperation(ASTREF(BfExpression*)& leftExpression, ASTREF(BfExpression*)& rightExpression, BfBinaryOp binaryOp, BfTokenNode* opToken, bool forceLeftType);
void PerformBinaryOperation(DbgType* resultType, DbgTypedValue convLeftValue, DbgTypedValue convRightValue, BfBinaryOp binaryOp, BfTokenNode* opToken); void PerformBinaryOperation(DbgType* resultType, DbgTypedValue convLeftValue, DbgTypedValue convRightValue, BfBinaryOp binaryOp, BfTokenNode* opToken);
void PerformUnaryExpression(BfAstNode* opToken, BfUnaryOp unaryOp, ASTREF(BfExpression*)& expr); void PerformUnaryExpression(BfAstNode* opToken, BfUnaryOp unaryOp, ASTREF(BfExpression*)& expr);
DbgTypedValue CreateValueFromExpression(ASTREF(BfExpression*)& expr, DbgType* castToType = NULL, DbgEvalExprFlags flags = DbgEvalExprFlags_None); DbgTypedValue CreateValueFromExpression(ASTREF(BfExpression*)& expr, DbgType* castToType = NULL, DbgEvalExprFlags flags = DbgEvalExprFlags_None);
const char* GetTypeName(DbgType* type); const char* GetTypeName(DbgType* type);
DbgTypedValue GetResult(); DbgTypedValue GetResult();
bool HasPropResult(); bool HasPropResult();
@ -409,11 +409,11 @@ public:
public: public:
DbgExprEvaluator(WinDebugger* winDebugger, DbgModule* dbgModule, BfPassInstance* passInstance, int callStackIdx, int cursorPos); DbgExprEvaluator(WinDebugger* winDebugger, DbgModule* dbgModule, BfPassInstance* passInstance, int callStackIdx, int cursorPos);
~DbgExprEvaluator(); ~DbgExprEvaluator();
DbgTypedValue GetInt(int value); DbgTypedValue GetInt(int value);
DbgTypedValue GetString(const StringImpl& str); DbgTypedValue GetString(const StringImpl& str);
void Fail(const StringImpl& error, BfAstNode* node); void Fail(const StringImpl& error, BfAstNode* node);
void Warn(const StringImpl& error, BfAstNode* node); void Warn(const StringImpl& error, BfAstNode* node);
DbgType* GetExpectingType(); DbgType* GetExpectingType();
void GetNamespaceSearch(); void GetNamespaceSearch();
@ -422,11 +422,11 @@ public:
DbgType* ResolveTypeRef(BfTypeReference* typeRef); DbgType* ResolveTypeRef(BfTypeReference* typeRef);
DbgType* ResolveTypeRef(BfAstNode* typeRef, BfAstNode** parentChildRef = NULL); DbgType* ResolveTypeRef(BfAstNode* typeRef, BfAstNode** parentChildRef = NULL);
DbgType* ResolveTypeRef(const StringImpl& typeRef); DbgType* ResolveTypeRef(const StringImpl& typeRef);
static bool TypeIsSubTypeOf(DbgType* srcType, DbgType* wantType, int* thisOffset = NULL, addr_target* thisAddr = NULL); static bool TypeIsSubTypeOf(DbgType* srcType, DbgType* wantType, int* thisOffset = NULL, addr_target* thisAddr = NULL);
DbgTypedValue GetBeefTypeById(int typeId); DbgTypedValue GetBeefTypeById(int typeId);
void BeefStringToString(addr_target addr, String& outStr); void BeefStringToString(addr_target addr, String& outStr);
void BeefStringToString(const DbgTypedValue& val, String& outStr); void BeefStringToString(const DbgTypedValue& val, String& outStr);
void BeefTypeToString(const DbgTypedValue& val, String& outStr); void BeefTypeToString(const DbgTypedValue& val, String& outStr);
CPUStackFrame* GetStackFrame(); CPUStackFrame* GetStackFrame();
CPURegisters* GetRegisters(); CPURegisters* GetRegisters();
DbgTypedValue GetRegister(const StringImpl& regName); DbgTypedValue GetRegister(const StringImpl& regName);
@ -438,9 +438,9 @@ public:
void AutocompleteCheckType(BfTypeReference* typeReference); void AutocompleteCheckType(BfTypeReference* typeReference);
void AutocompleteAddTopLevelTypes(const StringImpl& filter); void AutocompleteAddTopLevelTypes(const StringImpl& filter);
void AutocompleteAddMethod(const char* methodName, const StringImpl& filter); void AutocompleteAddMethod(const char* methodName, const StringImpl& filter);
void AutocompleteAddMembers(DbgType* dbgType, bool wantsStatic, bool wantsNonStatic, const StringImpl& filter, bool isCapture = false); void AutocompleteAddMembers(DbgType* dbgType, bool wantsStatic, bool wantsNonStatic, const StringImpl& filter, bool isCapture = false);
void AutocompleteCheckMemberReference(BfAstNode* target, BfAstNode* dotToken, BfAstNode* memberName); void AutocompleteCheckMemberReference(BfAstNode* target, BfAstNode* dotToken, BfAstNode* memberName);
DbgTypedValue RemoveRef(DbgTypedValue typedValue); DbgTypedValue RemoveRef(DbgTypedValue typedValue);
bool StoreValue(DbgTypedValue& ptr, DbgTypedValue& value, BfAstNode* refNode); bool StoreValue(DbgTypedValue& ptr, DbgTypedValue& value, BfAstNode* refNode);
bool StoreValue(DbgTypedValue& ptr, BfExpression* expr); bool StoreValue(DbgTypedValue& ptr, BfExpression* expr);
@ -449,16 +449,16 @@ public:
bool CanCast(DbgTypedValue typedVal, DbgType* toType, BfCastFlags castFlags = BfCastFlags_None); bool CanCast(DbgTypedValue typedVal, DbgType* toType, BfCastFlags castFlags = BfCastFlags_None);
DbgTypedValue Cast(BfAstNode* srcNode, const DbgTypedValue& val, DbgType* toType, bool explicitCast = false, bool silentFail = false); DbgTypedValue Cast(BfAstNode* srcNode, const DbgTypedValue& val, DbgType* toType, bool explicitCast = false, bool silentFail = false);
bool HasField(DbgType* type, const StringImpl& fieldName); bool HasField(DbgType* type, const StringImpl& fieldName);
DbgTypedValue DoLookupField(BfAstNode* targetSrc, DbgTypedValue target, DbgType* curCheckType, const StringImpl& fieldName, CPUStackFrame* stackFrame, bool allowImplicitThis); DbgTypedValue DoLookupField(BfAstNode* targetSrc, DbgTypedValue target, DbgType* curCheckType, const StringImpl& fieldName, CPUStackFrame* stackFrame, bool allowImplicitThis);
DbgTypedValue LookupField(BfAstNode* targetSrc, DbgTypedValue target, const StringImpl& fieldName); DbgTypedValue LookupField(BfAstNode* targetSrc, DbgTypedValue target, const StringImpl& fieldName);
DbgTypedValue DoLookupIdentifier(BfAstNode* identifierNode, bool ignoreInitialError, bool* hadError); DbgTypedValue DoLookupIdentifier(BfAstNode* identifierNode, bool ignoreInitialError, bool* hadError);
DbgTypedValue LookupIdentifier(BfAstNode* identifierNode, bool ignoreInitialError = false, bool* hadError = NULL); DbgTypedValue LookupIdentifier(BfAstNode* identifierNode, bool ignoreInitialError = false, bool* hadError = NULL);
void LookupSplatMember(const DbgTypedValue& target, const StringImpl& fieldName); void LookupSplatMember(const DbgTypedValue& target, const StringImpl& fieldName);
void LookupSplatMember(BfAstNode* srcNode, BfAstNode* lookupNode, const DbgTypedValue& target, const StringImpl& fieldName, String* outFindName = NULL, bool* outIsConst = NULL, StringImpl* forceName = NULL); void LookupSplatMember(BfAstNode* srcNode, BfAstNode* lookupNode, const DbgTypedValue& target, const StringImpl& fieldName, String* outFindName = NULL, bool* outIsConst = NULL, StringImpl* forceName = NULL);
void LookupQualifiedName(BfQualifiedNameNode* nameNode, bool ignoreInitialError = false, bool* hadError = NULL); void LookupQualifiedName(BfQualifiedNameNode* nameNode, bool ignoreInitialError = false, bool* hadError = NULL);
DbgType* FindSubtype(DbgType* type, const StringImpl& name); DbgType* FindSubtype(DbgType* type, const StringImpl& name);
void LookupQualifiedStaticField(BfQualifiedNameNode* nameNode, bool ignoreIdentifierNotFoundError = false); void LookupQualifiedStaticField(BfQualifiedNameNode* nameNode, bool ignoreIdentifierNotFoundError = false);
bool EnsureRunning(BfAstNode* astNode); bool EnsureRunning(BfAstNode* astNode);
virtual void Visit(BfAssignmentExpression* assignExpr) override; virtual void Visit(BfAssignmentExpression* assignExpr) override;
virtual void Visit(BfParenthesizedExpression* parenExpr) override; virtual void Visit(BfParenthesizedExpression* parenExpr) override;
@ -477,10 +477,10 @@ public:
virtual void Visit(BfUnaryOperatorExpression* unaryOpExpr) override; virtual void Visit(BfUnaryOperatorExpression* unaryOpExpr) override;
virtual void Visit(BfInvocationExpression* invocationExpr) override; virtual void Visit(BfInvocationExpression* invocationExpr) override;
virtual void Visit(BfConditionalExpression* condExpr) override; virtual void Visit(BfConditionalExpression* condExpr) override;
virtual void Visit(BfTypeAttrExpression* typeAttrExpr) override; virtual void Visit(BfTypeAttrExpression* typeAttrExpr) override;
virtual void Visit(BfTupleExpression* tupleExpr) override; virtual void Visit(BfTupleExpression* tupleExpr) override;
DbgTypedValue Resolve(BfExpression* expr, DbgType* wantType = NULL); DbgTypedValue Resolve(BfExpression* expr, DbgType* wantType = NULL);
BfAstNode* FinalizeExplicitThisReferences(BfAstNode* headNode); BfAstNode* FinalizeExplicitThisReferences(BfAstNode* headNode);
}; };

View file

@ -873,7 +873,6 @@ void DbgSrcFile::RemoveDeferredRefs(DbgModule* debugModule)
} }
} }
void DbgSrcFile::RemoveLines(DbgModule* debugModule) void DbgSrcFile::RemoveLines(DbgModule* debugModule)
{ {
if (!mHasLineDataFromMultipleModules) if (!mHasLineDataFromMultipleModules)
@ -1951,7 +1950,6 @@ String DbgType::ToString(DbgLanguage language, bool allowDirectBfObject)
return str; return str;
} }
intptr DbgType::GetByteCount() intptr DbgType::GetByteCount()
{ {
if (!mSizeCalculated) if (!mSizeCalculated)
@ -2406,17 +2404,14 @@ void DbgModule::MapCompileUnitMethods(DbgCompileUnit * compileUnit)
void DbgModule::MapCompileUnitMethods(int compileUnitId) void DbgModule::MapCompileUnitMethods(int compileUnitId)
{ {
} }
void DbgModule::PopulateType(DbgType* dbgType) void DbgModule::PopulateType(DbgType* dbgType)
{ {
} }
void DbgModule::PopulateTypeGlobals(DbgType* dbgType) void DbgModule::PopulateTypeGlobals(DbgType* dbgType)
{ {
} }
void DbgModule::PopulateStaticVariableMap() void DbgModule::PopulateStaticVariableMap()
@ -2707,7 +2702,6 @@ T DbgModule::GetOrCreate(int idx, DbgDataMap& dataMap)
return val; return val;
} }
template <typename T> template <typename T>
static T GetStackTop(DataStack* dataStack) static T GetStackTop(DataStack* dataStack)
{ {
@ -3609,7 +3603,6 @@ bool DbgModule::ParseDWARF(const uint8*& dataPtr)
if (highPC > (addr_target)atHighPC) if (highPC > (addr_target)atHighPC)
atHighPC = highPC;*/ atHighPC = highPC;*/
} }
} }
switch (entryTag) switch (entryTag)
@ -4002,7 +3995,6 @@ bool DbgModule::ParseDWARF(const uint8*& dataPtr)
if (atAbstractOrigin != 0) if (atAbstractOrigin != 0)
{ {
} }
} }
break; break;
@ -4178,7 +4170,6 @@ bool DbgModule::ParseDWARF(const uint8*& dataPtr)
} }
else else
{ {
int nameSepLen = strlen(nameSep); int nameSepLen = strlen(nameSep);
int parentNameLen = strlen(dbgType->mParent->mName); int parentNameLen = strlen(dbgType->mParent->mName);
int nameLen = strlen(atName); int nameLen = strlen(atName);
@ -4687,7 +4678,6 @@ void DbgModule::ParseEHFrameData()
void DbgModule::FlushLineData(DbgSubprogram* curSubprogram, std::list<DbgLineData>& queuedLineData) void DbgModule::FlushLineData(DbgSubprogram* curSubprogram, std::list<DbgLineData>& queuedLineData)
{ {
} }
DbgSrcFile* DbgModule::AddSrcFile(DbgCompileUnit* compileUnit, const String& srcFilePath) DbgSrcFile* DbgModule::AddSrcFile(DbgCompileUnit* compileUnit, const String& srcFilePath)
@ -4922,8 +4912,6 @@ bool DbgModule::ParseDebugLineInfo(const uint8*& dataPtr, int compileUnitIdx)
} }
queuedPostPrologue = false; queuedPostPrologue = false;
} }
break; break;
} }
@ -4977,7 +4965,6 @@ uint8* DbgModule::GetHotTargetData(addr_target address)
void DbgModule::DoReloc(DbgHotTargetSection* hotTargetSection, COFFRelocation& coffReloc, addr_target resolvedSymbolAddr, PE_SymInfo* symInfo) void DbgModule::DoReloc(DbgHotTargetSection* hotTargetSection, COFFRelocation& coffReloc, addr_target resolvedSymbolAddr, PE_SymInfo* symInfo)
{ {
#ifdef BF_DBG_32 #ifdef BF_DBG_32
if (coffReloc.mType == IMAGE_REL_I386_DIR32) if (coffReloc.mType == IMAGE_REL_I386_DIR32)
{ {
@ -5067,7 +5054,6 @@ void DbgModule::DoReloc(DbgHotTargetSection* hotTargetSection, COFFRelocation& c
} }
*(uint32*)(hotTargetSection->mData + coffReloc.mVirtualAddress) += (uint32)(resolvedSymbolAddr & 0x7FFFFFF); *(uint32*)(hotTargetSection->mData + coffReloc.mVirtualAddress) += (uint32)(resolvedSymbolAddr & 0x7FFFFFF);
} }
else if (coffReloc.mType == IMAGE_REL_AMD64_ADDR64) else if (coffReloc.mType == IMAGE_REL_AMD64_ADDR64)
{ {
@ -5348,7 +5334,6 @@ void DbgModule::HotReplaceType(DbgType* newType)
} }
} }
//DbgType* primaryType = newType->GetPrimaryType(); //DbgType* primaryType = newType->GetPrimaryType();
// We need to keep a persistent list of hot replaced methods so we can set hot jumps // We need to keep a persistent list of hot replaced methods so we can set hot jumps
@ -5883,7 +5868,6 @@ bool DbgModule::ReadCOFF(DataStream* stream, DbgModuleKind moduleKind)
if ((IsObjectFile()) && (sectHdr.mNumberOfRelocations > 0)) if ((IsObjectFile()) && (sectHdr.mNumberOfRelocations > 0))
{ {
//mDebugger->AllocTargetMemory(sectHdr.mSizeOfRawData, true, true); //mDebugger->AllocTargetMemory(sectHdr.mSizeOfRawData, true, true);
} }
@ -7212,7 +7196,6 @@ void DbgModule::RevertWritingEnable()
section->mWritingEnabled = false; section->mWritingEnabled = false;
} }
} }
} }
template <typename TRadixMap> template <typename TRadixMap>
@ -7478,7 +7461,6 @@ DbgType* DbgModule::GetPrimitiveStructType(DbgTypeCode typeCode)
return FindType(name, NULL, DbgLanguage_Beef); return FindType(name, NULL, DbgLanguage_Beef);
} }
DbgType* DbgModule::GetSizedArrayType(DbgType * elementType, int count) DbgType* DbgModule::GetSizedArrayType(DbgType * elementType, int count)
{ {
auto linkedModule = GetLinkedModule(); auto linkedModule = GetLinkedModule();
@ -7507,4 +7489,4 @@ DbgType* DbgModule::GetSizedArrayType(DbgType * elementType, int count)
*sizedArrayTypePtr = sizedArrayType; *sizedArrayTypePtr = sizedArrayType;
} }
return *sizedArrayTypePtr; return *sizedArrayTypePtr;
} }

View file

@ -31,7 +31,7 @@ enum DbgTypeCode : uint8
{ {
DbgType_Void, DbgType_Void,
DbgType_Root, DbgType_Root,
DbgType_Null, DbgType_Null,
DbgType_i8, DbgType_i8,
DbgType_u8, DbgType_u8,
DbgType_i16, DbgType_i16,
@ -80,10 +80,10 @@ enum DbgTypeCode : uint8
DbgType_Ptr, DbgType_Ptr,
DbgType_PtrToMember, DbgType_PtrToMember,
DbgType_SizedArray, DbgType_SizedArray,
DbgType_Ref, DbgType_Ref,
DbgType_RValueReference, DbgType_RValueReference,
DbgType_Const, DbgType_Const,
DbgType_Volatile, DbgType_Volatile,
DbgType_Unaligned, DbgType_Unaligned,
DbgType_Restrict, DbgType_Restrict,
@ -107,9 +107,9 @@ enum DbgClassType : uint8
DbgClassType_CompileUnit, DbgClassType_CompileUnit,
DbgClassType_Subprogram, DbgClassType_Subprogram,
DbgClassType_Type, DbgClassType_Type,
DbgClassType_Member, DbgClassType_Member,
DbgClassType_Block, DbgClassType_Block,
DbgClassType_Variable, DbgClassType_Variable,
}; };
enum DbgFileExistKind : uint8 enum DbgFileExistKind : uint8
@ -117,7 +117,7 @@ enum DbgFileExistKind : uint8
DbgFileExistKind_NotChecked, DbgFileExistKind_NotChecked,
DbgFileExistKind_NotFound, DbgFileExistKind_NotFound,
DbgFileExistKind_HasOldSourceCommand, DbgFileExistKind_HasOldSourceCommand,
DbgFileExistKind_Found DbgFileExistKind_Found
}; };
enum DbgModuleKind : uint8 enum DbgModuleKind : uint8
@ -162,15 +162,15 @@ enum DbgLocationLenKind
class DbgVariable : public DbgDebugData class DbgVariable : public DbgDebugData
{ {
public: public:
static const DbgClassType ClassType = DbgClassType_Variable; static const DbgClassType ClassType = DbgClassType_Variable;
const char* mName; const char* mName;
const char* mLinkName; const char* mLinkName;
addr_target mRangeStart; addr_target mRangeStart;
int64 mConstValue; int64 mConstValue;
DbgType* mType; DbgType* mType;
const uint8* mLocationData; const uint8* mLocationData;
int mRangeLen; int mRangeLen;
int mMemberOffset; int mMemberOffset;
int8 mLocationLen; int8 mLocationLen;
uint8 mBitSize; uint8 mBitSize;
@ -180,9 +180,9 @@ public:
bool mIsMember; bool mIsMember;
bool mIsStatic; bool mIsStatic;
bool mIsConst; bool mIsConst;
bool mInAutoStaticMap; bool mInAutoStaticMap;
bool mSigNoPointer; // Signature was without pointer, mType has pointer bool mSigNoPointer; // Signature was without pointer, mType has pointer
addr_target mStaticCachedAddr; addr_target mStaticCachedAddr;
DbgVariable* mNext; DbgVariable* mNext;
@ -218,14 +218,14 @@ typedef std::map<int, Array<int> > DwAsmDebugLineMap;
class DbgBlock : public DbgDebugData class DbgBlock : public DbgDebugData
{ {
public: public:
static const DbgClassType ClassType = DbgClassType_Block; static const DbgClassType ClassType = DbgClassType_Block;
addr_target mLowPC; // If LowPC is -1 then mHighPC is index into debugRanges addr_target mLowPC; // If LowPC is -1 then mHighPC is index into debugRanges
addr_target mHighPC; addr_target mHighPC;
SLIList<DbgVariable*> mVariables; SLIList<DbgVariable*> mVariables;
SLIList<DbgBlock*> mSubBlocks; SLIList<DbgBlock*> mSubBlocks;
DwAsmDebugLineMap* mAsmDebugLineMap; // empty unless inline asm is used DwAsmDebugLineMap* mAsmDebugLineMap; // empty unless inline asm is used
DbgBlock* mNext; DbgBlock* mNext;
@ -259,17 +259,17 @@ class DbgSubprogram;
class DbgLineData class DbgLineData
{ {
public: public:
uint32 mRelAddress; uint32 mRelAddress;
int32 mLine; int32 mLine;
int16 mColumn; int16 mColumn;
uint16 mContribSize; uint16 mContribSize;
uint16 mCtxIdx; uint16 mCtxIdx;
bool IsStackFrameSetup() bool IsStackFrameSetup()
{ {
return mColumn != -2; return mColumn != -2;
} }
}; };
struct DbgLineDataEx struct DbgLineDataEx
@ -335,7 +335,7 @@ class DbgInlineeInfo
{ {
public: public:
DbgSubprogram* mInlineParent; DbgSubprogram* mInlineParent;
DbgSubprogram* mRootInliner; DbgSubprogram* mRootInliner;
DbgLineData mFirstLineData; DbgLineData mFirstLineData;
DbgLineData mLastLineData; DbgLineData mLastLineData;
uint32 mInlineeId; uint32 mInlineeId;
@ -373,16 +373,16 @@ public:
HotReplaceKind_Invalid = 3 // Mangles matched but arguments were incompatible HotReplaceKind_Invalid = 3 // Mangles matched but arguments were incompatible
}; };
const char* mName; const char* mName;
const char* mLinkName; const char* mLinkName;
int mTemplateNameIdx; int mTemplateNameIdx;
int mFrameBaseLen; int mFrameBaseLen;
int mPrologueSize; int mPrologueSize;
const uint8* mFrameBaseData; const uint8* mFrameBaseData;
DbgBlock mBlock; DbgBlock mBlock;
int mDeferredInternalsSize; int mDeferredInternalsSize;
int mVTableLoc; int mVTableLoc;
int mStepFilterVersion; int mStepFilterVersion;
LocalBaseRegKind mParamBaseReg; LocalBaseRegKind mParamBaseReg;
LocalBaseRegKind mLocalBaseReg; LocalBaseRegKind mLocalBaseReg;
bool mHasQualifiedName:1; bool mHasQualifiedName:1;
@ -390,14 +390,14 @@ public:
bool mIsStepFilteredDefault:1; bool mIsStepFilteredDefault:1;
bool mVirtual:1; bool mVirtual:1;
bool mHasThis:1; bool mHasThis:1;
bool mNeedLineDataFixup:1; bool mNeedLineDataFixup:1;
bool mIsOptimized:1; bool mIsOptimized:1;
bool mHasLineAddrGaps:1; // There are gaps of addresses which are not covered by lineinfo bool mHasLineAddrGaps:1; // There are gaps of addresses which are not covered by lineinfo
HotReplaceKind mHotReplaceKind; HotReplaceKind mHotReplaceKind;
DbgLineInfo* mLineInfo; DbgLineInfo* mLineInfo;
DbgInlineeInfo* mInlineeInfo; DbgInlineeInfo* mInlineeInfo;
DbgType* mParentType; DbgType* mParentType;
DbgType* mReturnType; DbgType* mReturnType;
DbgMethodType mMethodType; DbgMethodType mMethodType;
BfProtection mProtection; BfProtection mProtection;
BfCheckedKind mCheckedKind; BfCheckedKind mCheckedKind;
@ -409,13 +409,13 @@ public:
DbgSubprogram() DbgSubprogram()
{ {
mName = NULL; mName = NULL;
mLinkName = NULL; mLinkName = NULL;
mHasThis = false; mHasThis = false;
mNeedLineDataFixup = true; mNeedLineDataFixup = true;
mHotReplaceKind = HotReplaceKind_None; mHotReplaceKind = HotReplaceKind_None;
mHasLineAddrGaps = false; mHasLineAddrGaps = false;
mPrologueSize = -1; mPrologueSize = -1;
mParentType = NULL; mParentType = NULL;
mInlineeInfo = NULL; mInlineeInfo = NULL;
mFrameBaseData = NULL; mFrameBaseData = NULL;
mFrameBaseLen = 0; mFrameBaseLen = 0;
@ -428,30 +428,30 @@ public:
mStepFilterVersion = -1; mStepFilterVersion = -1;
} }
~DbgSubprogram(); ~DbgSubprogram();
void ToString(StringImpl& str, bool internalName); void ToString(StringImpl& str, bool internalName);
String ToString(); String ToString();
DbgLineData* FindClosestLine(addr_target addr, DbgSubprogram** inlinedSubprogram = NULL, DbgSrcFile** srcFile = NULL, int* outLineIdx = NULL); DbgLineData* FindClosestLine(addr_target addr, DbgSubprogram** inlinedSubprogram = NULL, DbgSrcFile** srcFile = NULL, int* outLineIdx = NULL);
DbgType* GetParent(); DbgType* GetParent();
DbgType* GetTargetType(); // usually mParentType except for closures DbgType* GetTargetType(); // usually mParentType except for closures
DbgLanguage GetLanguage(); DbgLanguage GetLanguage();
bool Equals(DbgSubprogram* checkMethod, bool allowThisMismatch = false); bool Equals(DbgSubprogram* checkMethod, bool allowThisMismatch = false);
int GetParamCount(); int GetParamCount();
String GetParamName(int paramIdx); String GetParamName(int paramIdx);
bool IsGenericMethod(); bool IsGenericMethod();
bool ThisIsSplat(); bool ThisIsSplat();
bool IsLambda(); bool IsLambda();
DbgSubprogram* GetRootInlineParent() DbgSubprogram* GetRootInlineParent()
{ {
if (mInlineeInfo == NULL) if (mInlineeInfo == NULL)
return this; return this;
return mInlineeInfo->mRootInliner; return mInlineeInfo->mRootInliner;
} }
int GetInlineDepth() int GetInlineDepth()
{ {
int inlineDepth = 0; int inlineDepth = 0;
auto checkSubprogram = this; auto checkSubprogram = this;
while (checkSubprogram->mInlineeInfo != NULL) while (checkSubprogram->mInlineeInfo != NULL)
@ -464,7 +464,7 @@ public:
return inlineDepth; return inlineDepth;
} }
addr_target GetLineAddr(const DbgLineData& lineData); addr_target GetLineAddr(const DbgLineData& lineData);
DbgSubprogram* GetLineInlinee(const DbgLineData& lineData); DbgSubprogram* GetLineInlinee(const DbgLineData& lineData);
DbgSrcFile* GetLineSrcFile(const DbgLineData& lineData); DbgSrcFile* GetLineSrcFile(const DbgLineData& lineData);
bool HasValidLines(); bool HasValidLines();
@ -481,7 +481,7 @@ public:
class DbgExceptionDirectoryEntry class DbgExceptionDirectoryEntry
{ {
public: public:
DbgExceptionDirectoryEntry* mNext; DbgExceptionDirectoryEntry* mNext;
DbgModule* mDbgModule; DbgModule* mDbgModule;
addr_target mAddress; addr_target mAddress;
@ -493,7 +493,7 @@ public:
class DbgBaseTypeEntry class DbgBaseTypeEntry
{ {
public: public:
DbgType* mBaseType; DbgType* mBaseType;
DbgBaseTypeEntry* mNext; DbgBaseTypeEntry* mNext;
int mThisOffset; int mThisOffset;
int mVTableOffset; int mVTableOffset;
@ -533,39 +533,39 @@ enum DbgExtType : int8
class DbgType : public DbgDebugData class DbgType : public DbgDebugData
{ {
public: public:
static const DbgClassType ClassType = DbgClassType_Type; static const DbgClassType ClassType = DbgClassType_Type;
DbgType* mParent; DbgType* mParent;
BumpList<DbgType*> mAlternates; // From other compile units BumpList<DbgType*> mAlternates; // From other compile units
DbgType* mPrimaryType; DbgType* mPrimaryType;
DbgTypeCode mTypeCode; DbgTypeCode mTypeCode;
SLIList<DbgBaseTypeEntry*> mBaseTypes; SLIList<DbgBaseTypeEntry*> mBaseTypes;
DbgType* mTypeParam; DbgType* mTypeParam;
SLIList<DbgVariable*> mMemberList; SLIList<DbgVariable*> mMemberList;
DbgType* mPtrType; DbgType* mPtrType;
DbgBlock* mBlockParam; DbgBlock* mBlockParam;
SLIList<DbgMethodNameEntry*> mMethodNameList; SLIList<DbgMethodNameEntry*> mMethodNameList;
SLIList<DbgSubprogram*> mMethodList; SLIList<DbgSubprogram*> mMethodList;
SLIList<DbgType*> mSubTypeList; SLIList<DbgType*> mSubTypeList;
BumpList<DbgType*> mUsingNamespaces; BumpList<DbgType*> mUsingNamespaces;
SLIList<DbgSubprogram*> mHotReplacedMethodList; // Old methods SLIList<DbgSubprogram*> mHotReplacedMethodList; // Old methods
DbgType* mHotNewType; // Only non-null during actual hotloading DbgType* mHotNewType; // Only non-null during actual hotloading
const char* mName; const char* mName;
const char* mTypeName; const char* mTypeName;
intptr mSize; // In bytes intptr mSize; // In bytes
int mTemplateNameIdx; int mTemplateNameIdx;
int mAlign; int mAlign;
int mTypeIdx; int mTypeIdx;
uint16 mDefinedMembersSize; uint16 mDefinedMembersSize;
uint16 mMethodsWithParamsCount; uint16 mMethodsWithParamsCount;
bool mIsIncomplete:1; // Not fully loaded bool mIsIncomplete:1; // Not fully loaded
bool mIsPacked:1; bool mIsPacked:1;
bool mNeedsGlobalsPopulated:1; bool mNeedsGlobalsPopulated:1;
bool mHasGlobalsPopulated:1; bool mHasGlobalsPopulated:1;
bool mIsDeclaration:1; bool mIsDeclaration:1;
bool mHasStaticMembers:1; bool mHasStaticMembers:1;
bool mHasVTable:1; bool mHasVTable:1;
bool mFixedName:1; bool mFixedName:1;
@ -575,20 +575,20 @@ public:
bool mSizeCalculated; bool mSizeCalculated;
DbgType* mNext; DbgType* mNext;
public: public:
DbgType(); DbgType();
~DbgType(); ~DbgType();
//uint64 GetHash(); //uint64 GetHash();
DbgType* ResolveTypeDef(); DbgType* ResolveTypeDef();
bool Equals(DbgType* dbgType); bool Equals(DbgType* dbgType);
bool IsRoot(); bool IsRoot();
bool IsNull(); bool IsNull();
bool IsVoid(); bool IsVoid();
bool IsValuelessType(); bool IsValuelessType();
bool IsPrimitiveType(); bool IsPrimitiveType();
bool IsStruct(); bool IsStruct();
bool IsValueType(); bool IsValueType();
bool IsTypedPrimitive(); bool IsTypedPrimitive();
@ -598,8 +598,8 @@ public:
bool IsChar(); bool IsChar();
bool IsChar(DbgLanguage language); bool IsChar(DbgLanguage language);
bool IsNamespace(); bool IsNamespace();
bool IsFloat(); bool IsFloat();
bool IsCompositeType(); bool IsCompositeType();
bool WantsRefThis(); // Beef valuetypes want 'this' by ref, Objects and C++ want 'this' by pointer bool WantsRefThis(); // Beef valuetypes want 'this' by ref, Objects and C++ want 'this' by pointer
bool IsBfObjectPtr(); bool IsBfObjectPtr();
bool IsBfObject(); bool IsBfObject();
@ -609,34 +609,34 @@ public:
bool IsBfUnion(); bool IsBfUnion();
bool HasCPPVTable(); bool HasCPPVTable();
bool IsBaseBfObject(); bool IsBaseBfObject();
bool IsInterface(); bool IsInterface();
bool IsEnum(); bool IsEnum();
bool IsSigned(); bool IsSigned();
bool IsRef(); bool IsRef();
bool IsConst(); bool IsConst();
bool IsPointer(bool includeBfObjectPointer = true); bool IsPointer(bool includeBfObjectPointer = true);
bool HasPointer(bool includeBfObjectPointer = true); bool HasPointer(bool includeBfObjectPointer = true);
bool IsPointerOrRef(bool includeBfObjectPointer = true); bool IsPointerOrRef(bool includeBfObjectPointer = true);
bool IsSizedArray(); bool IsSizedArray();
bool IsAnonymous(); bool IsAnonymous();
bool IsGlobalsContainer(); bool IsGlobalsContainer();
DbgExtType CalcExtType(); DbgExtType CalcExtType();
DbgLanguage GetLanguage(); DbgLanguage GetLanguage();
void FixName(); void FixName();
void PopulateType(); void PopulateType();
DbgModule* GetDbgModule(); DbgModule* GetDbgModule();
DbgType* GetUnderlyingType(); DbgType* GetUnderlyingType();
DbgType* GetPrimaryType(); DbgType* GetPrimaryType();
DbgType* GetBaseType(); DbgType* GetBaseType();
DbgType* GetRootBaseType(); DbgType* GetRootBaseType();
DbgType* RemoveModifiers(bool* hadRef = NULL); DbgType* RemoveModifiers(bool* hadRef = NULL);
String ToStringRaw(DbgLanguage language = DbgLanguage_Unknown); String ToStringRaw(DbgLanguage language = DbgLanguage_Unknown);
void ToString(StringImpl& str, DbgLanguage language, bool allowDirectBfObject, bool internalName); void ToString(StringImpl& str, DbgLanguage language, bool allowDirectBfObject, bool internalName);
String ToString(DbgLanguage language = DbgLanguage_Unknown, bool allowDirectBfObject = false); String ToString(DbgLanguage language = DbgLanguage_Unknown, bool allowDirectBfObject = false);
intptr GetByteCount(); intptr GetByteCount();
intptr GetStride(); intptr GetStride();
int GetAlign(); int GetAlign();
void EnsureMethodsMapped(); void EnsureMethodsMapped();
}; };
@ -685,11 +685,11 @@ public:
class DbgLineDataState : public DbgLineData class DbgLineDataState : public DbgLineData
{ {
public: public:
int mOpIndex; int mOpIndex;
int mDiscriminator; int mDiscriminator;
int mIsa; int mIsa;
bool mBasicBlock; bool mBasicBlock;
bool mIsStmt; bool mIsStmt;
}; };
@ -724,7 +724,7 @@ enum DbgHashKind
class DbgSrcFile class DbgSrcFile
{ {
public: public:
String mFilePath; String mFilePath;
String mLocalPath; String mLocalPath;
bool mHadLineData; bool mHadLineData;
@ -733,10 +733,10 @@ public:
int mStepFilterVersion; int mStepFilterVersion;
DbgHashKind mHashKind; DbgHashKind mHashKind;
uint8 mHash[32]; uint8 mHash[32];
DbgModule* mFirstLineDataDbgModule; // Just used to detect mHasLineDataFromMultipleModules DbgModule* mFirstLineDataDbgModule; // Just used to detect mHasLineDataFromMultipleModules
Array<DbgDeferredSrcFileReference> mDeferredRefs; Array<DbgDeferredSrcFileReference> mDeferredRefs;
Array<DbgSubprogram*> mLineDataRefs; Array<DbgSubprogram*> mLineDataRefs;
Array<HotReplacedLineInfo*> mHotReplacedDbgLineInfo; // Indexing starts at -1 Array<HotReplacedLineInfo*> mHotReplacedDbgLineInfo; // Indexing starts at -1
public: public:
DbgSrcFile() DbgSrcFile()
@ -747,15 +747,15 @@ public:
mHashKind = DbgHashKind_None; mHashKind = DbgHashKind_None;
mFileExistKind = DbgFileExistKind_NotChecked; mFileExistKind = DbgFileExistKind_NotChecked;
mStepFilterVersion = 0; mStepFilterVersion = 0;
//mLineData.Reserve(64); //mLineData.Reserve(64);
} }
bool IsBeef(); bool IsBeef();
~DbgSrcFile(); ~DbgSrcFile();
void RemoveDeferredRefs(DbgModule* debugModule); void RemoveDeferredRefs(DbgModule* debugModule);
void RemoveLines(DbgModule* debugModule); void RemoveLines(DbgModule* debugModule);
void RemoveLines(DbgModule* debugModule, DbgSubprogram* dbgSubprogram, bool isHotReplaced); void RemoveLines(DbgModule* debugModule, DbgSubprogram* dbgSubprogram, bool isHotReplaced);
void RehupLineData(); void RehupLineData();
@ -765,7 +765,7 @@ public:
class DwCommonFrameDescriptor class DwCommonFrameDescriptor
{ {
public: public:
DbgModule* mDbgModule; DbgModule* mDbgModule;
const char* mAugmentation; const char* mAugmentation;
int mAugmentationLength; int mAugmentationLength;
@ -776,7 +776,7 @@ public:
int mReturnAddressColumn; int mReturnAddressColumn;
const uint8* mInstData; const uint8* mInstData;
int mInstLen; int mInstLen;
int mAddressPointerEncoding; int mAddressPointerEncoding;
addr_target mLSDARoutine; addr_target mLSDARoutine;
int mLSDAPointerEncodingFDE; int mLSDAPointerEncodingFDE;
@ -789,13 +789,13 @@ public:
mAugmentationLength = 0; mAugmentationLength = 0;
mAddressPointerEncoding = 0; mAddressPointerEncoding = 0;
mLSDARoutine = 0; mLSDARoutine = 0;
mLSDAPointerEncodingFDE = 0; mLSDAPointerEncodingFDE = 0;
} }
}; };
class DwFrameDescriptor class DwFrameDescriptor
{ {
public: public:
addr_target mLowPC; addr_target mLowPC;
addr_target mHighPC; addr_target mHighPC;
const uint8* mInstData; const uint8* mInstData;
@ -808,7 +808,7 @@ public:
DwFrameDescriptor() DwFrameDescriptor()
{ {
mAddressPointerEncoding = 0; mAddressPointerEncoding = 0;
mLSDARoutine = 0; mLSDARoutine = 0;
} }
}; };
@ -819,33 +819,33 @@ class DbgCompileUnitContrib
public: public:
DbgCompileUnitContrib* mNext; DbgCompileUnitContrib* mNext;
DbgModule* mDbgModule; DbgModule* mDbgModule;
addr_target mAddress; addr_target mAddress;
int mCompileUnitId; int mCompileUnitId;
int mLength; int mLength;
}; };
class DbgCompileUnit class DbgCompileUnit
{ {
public: public:
static const DbgClassType ClassType = DbgClassType_CompileUnit; static const DbgClassType ClassType = DbgClassType_CompileUnit;
DbgModule* mDbgModule; DbgModule* mDbgModule;
DbgLanguage mLanguage; DbgLanguage mLanguage;
DbgBlock* mGlobalBlock; DbgBlock* mGlobalBlock;
DbgType* mGlobalType; DbgType* mGlobalType;
Array<DbgSrcFileReference> mSrcFileRefs; Array<DbgSrcFileReference> mSrcFileRefs;
String mName; String mName;
String mProducer; String mProducer;
String mCompileDir; String mCompileDir;
addr_target mLowPC; addr_target mLowPC;
addr_target mHighPC; addr_target mHighPC;
bool mNeedsLineDataFixup; bool mNeedsLineDataFixup;
bool mWasHotReplaced; bool mWasHotReplaced;
bool mIsMaster; bool mIsMaster;
SLIList<DbgSubprogram*> mOrphanMethods; SLIList<DbgSubprogram*> mOrphanMethods;
public: public:
DbgCompileUnit(DbgModule* dbgModule); DbgCompileUnit(DbgModule* dbgModule);
virtual ~DbgCompileUnit() virtual ~DbgCompileUnit()
@ -860,14 +860,14 @@ public:
//int mDbgIdx; //int mDbgIdx;
DbgSymbol() DbgSymbol()
{ {
//mDbgIdx = ++gDbgSymbol_Idx; //mDbgIdx = ++gDbgSymbol_Idx;
} }
public: public:
const char* mName; const char* mName;
addr_target mAddress; addr_target mAddress;
DbgModule* mDbgModule; DbgModule* mDbgModule;
DbgSymbol* mNext; DbgSymbol* mNext;
}; };
class DbgSection class DbgSection
@ -969,8 +969,8 @@ struct DbgAutoStaticEntry
class DbgHotTargetSection class DbgHotTargetSection
{ {
public: public:
uint8* mData; uint8* mData;
int mDataSize; int mDataSize;
addr_target mTargetSectionAddr; addr_target mTargetSectionAddr;
int mImageOffset; int mImageOffset;
int mTargetSectionSize; int mTargetSectionSize;
@ -985,18 +985,18 @@ public:
{ {
mData = NULL; mData = NULL;
mDataSize = 0; mDataSize = 0;
mImageOffset = 0; mImageOffset = 0;
mTargetSectionAddr = 0; mTargetSectionAddr = 0;
mTargetSectionSize = 0; mTargetSectionSize = 0;
mPointerToRelocations = 0; mPointerToRelocations = 0;
mNumberOfRelocations = 0; mNumberOfRelocations = 0;
mCanExecute = false; mCanExecute = false;
mCanWrite = false; mCanWrite = false;
mNoTargetAlloc = false; mNoTargetAlloc = false;
} }
~DbgHotTargetSection() ~DbgHotTargetSection()
{ {
} }
}; };
@ -1008,7 +1008,7 @@ struct DbgDeferredHotResolve
{ {
public: public:
DbgHotTargetSection* mHotTargetSection; DbgHotTargetSection* mHotTargetSection;
String mName; String mName;
addr_target mNewAddr; addr_target mNewAddr;
COFFRelocation mReloc; COFFRelocation mReloc;
}; };
@ -1114,7 +1114,7 @@ public:
MappedFile* mMappedImageFile; MappedFile* mMappedImageFile;
MemReporter* mMemReporter; MemReporter* mMemReporter;
const uint8* mDebugLineData; const uint8* mDebugLineData;
const uint8* mDebugInfoData; const uint8* mDebugInfoData;
const uint8* mDebugPubNames; const uint8* mDebugPubNames;
const uint8* mDebugFrameData; const uint8* mDebugFrameData;
@ -1124,26 +1124,26 @@ public:
addr_target mCodeAddress; addr_target mCodeAddress;
const uint8* mDebugAbbrevData; const uint8* mDebugAbbrevData;
const uint8* mDebugStrData; const uint8* mDebugStrData;
const uint8** mDebugAbbrevPtrData; const uint8** mDebugAbbrevPtrData;
Array<DbgSectionData> mExceptionDirectory; Array<DbgSectionData> mExceptionDirectory;
const uint8* mEHFrameData; const uint8* mEHFrameData;
const char* mStringTable; const char* mStringTable;
const uint8* mSymbolData; const uint8* mSymbolData;
addr_target mEHFrameAddress; addr_target mEHFrameAddress;
addr_target mTLSAddr; addr_target mTLSAddr;
addr_target mTLSExtraAddr; addr_target mTLSExtraAddr;
int mTLSSize; int mTLSSize;
int mTLSExtraSize; int mTLSExtraSize;
addr_target mTLSIndexAddr; addr_target mTLSIndexAddr;
DbgFlavor mDbgFlavor; DbgFlavor mDbgFlavor;
bool mParsedGlobalsData; bool mParsedGlobalsData;
bool mParsedSymbolData; bool mParsedSymbolData;
bool mParsedTypeData; bool mParsedTypeData;
bool mPopulatedStaticVariables; bool mPopulatedStaticVariables;
bool mParsedFrameDescriptors; bool mParsedFrameDescriptors;
bool mMayBeOld; // If we had to load debug info from the SymCache or a SymServer then it may be old bool mMayBeOld; // If we had to load debug info from the SymCache or a SymServer then it may be old
bool mDeleting; bool mDeleting;
bool mFailed; bool mFailed;
int mId; int mId;
@ -1155,23 +1155,23 @@ public:
int mStartSubprogramIdx; int mStartSubprogramIdx;
int mEndSubprogramIdx; int mEndSubprogramIdx;
int mStartTypeIdx; int mStartTypeIdx;
int mEndTypeIdx; int mEndTypeIdx;
uintptr mPreferredImageBase; uintptr mPreferredImageBase;
uintptr mImageBase; uintptr mImageBase;
uint32 mImageSize; uint32 mImageSize;
uintptr mEntryPoint; uintptr mEntryPoint;
String mVersion; String mVersion;
String* mFailMsgPtr; String* mFailMsgPtr;
DbgType* mBfTypeType; DbgType* mBfTypeType;
intptr mBfTypesInfoAddr; intptr mBfTypesInfoAddr;
DbgModuleMemoryCache* mOrigImageData; DbgModuleMemoryCache* mOrigImageData;
DbgCompileUnit* mMasterCompileUnit; DbgCompileUnit* mMasterCompileUnit;
StrHashMap<DbgVariable*> mGlobalVarMap; // Dedups entries into mMasterCompileUnit StrHashMap<DbgVariable*> mGlobalVarMap; // Dedups entries into mMasterCompileUnit
BumpAllocator mAlloc; BumpAllocator mAlloc;
std::list<DwAsmDebugLineMap> mAsmDebugLineMaps; std::list<DwAsmDebugLineMap> mAsmDebugLineMaps;
Array<DbgSection> mSections; Array<DbgSection> mSections;
Dictionary<addr_target, int> mSecRelEncodingMap; Dictionary<addr_target, int> mSecRelEncodingMap;
@ -1179,39 +1179,39 @@ public:
bool mCheckedBfObject; bool mCheckedBfObject;
bool mBfObjectHasFlags; bool mBfObjectHasFlags;
DbgModuleKind mModuleKind; DbgModuleKind mModuleKind;
bool mIsDwarf64; bool mIsDwarf64;
HashSet<DbgSrcFile*> mSrcFileDeferredRefs; HashSet<DbgSrcFile*> mSrcFileDeferredRefs;
Array<addr_target> mSectionRVAs; Array<addr_target> mSectionRVAs;
SLIList<DbgSymbol*> mDeferredSymbols; SLIList<DbgSymbol*> mDeferredSymbols;
Beefy::OwnedVector<DbgDeferredHotResolve> mDeferredHotResolveList; Beefy::OwnedVector<DbgDeferredHotResolve> mDeferredHotResolveList;
Array<DbgHotTargetSection*> mHotTargetSections; Array<DbgHotTargetSection*> mHotTargetSections;
HashSet<DbgType*> mHotPrimaryTypes; // List of types where we have entries in mHotReplacedMethodList HashSet<DbgType*> mHotPrimaryTypes; // List of types where we have entries in mHotReplacedMethodList
DbgCompileUnit mDefaultCompileUnit; DbgCompileUnit mDefaultCompileUnit;
Dictionary<DbgType*, DbgType*> mConstTypes; Dictionary<DbgType*, DbgType*> mConstTypes;
Dictionary<String, DbgFileExistKind> mFileExistsCache; Dictionary<String, DbgFileExistKind> mFileExistsCache;
Dictionary<DbgSizedArrayEntry, DbgType*> mSizedArrayTypes; Dictionary<DbgSizedArrayEntry, DbgType*> mSizedArrayTypes;
int mAllocSizeData; int mAllocSizeData;
Array<const uint8*> mOwnedSectionData; Array<const uint8*> mOwnedSectionData;
public: public:
Array<DbgSrcFile*> mEmptySrcFiles; Array<DbgSrcFile*> mEmptySrcFiles;
Array<DbgCompileUnit*> mCompileUnits; Array<DbgCompileUnit*> mCompileUnits;
Array<DbgVariable*> mStaticVariables; Array<DbgVariable*> mStaticVariables;
DbgType* mCPrimitiveTypes[DbgType_COUNT]; DbgType* mCPrimitiveTypes[DbgType_COUNT];
DbgType* mBfPrimitiveTypes[DbgType_COUNT]; DbgType* mBfPrimitiveTypes[DbgType_COUNT];
const char* mPrimitiveStructNames[DbgType_COUNT]; const char* mPrimitiveStructNames[DbgType_COUNT];
DbgTypeMap mTypeMap; DbgTypeMap mTypeMap;
Array<DbgType*> mTypes; Array<DbgType*> mTypes;
Array<DbgSubprogram*> mSubprograms; Array<DbgSubprogram*> mSubprograms;
StrHashMap<DbgSymbol*> mSymbolNameMap; StrHashMap<DbgSymbol*> mSymbolNameMap;
std::unordered_map<const char*, DbgVariable*, DbgCharPtrHash, DbgCharPtrEquals> mStaticVariableMap; std::unordered_map<const char*, DbgVariable*, DbgCharPtrHash, DbgCharPtrEquals> mStaticVariableMap;
public: public:
virtual void ParseGlobalsData(); virtual void ParseGlobalsData();
virtual void ParseSymbolData(); virtual void ParseSymbolData();
virtual void ParseTypeData(); virtual void ParseTypeData();
@ -1219,8 +1219,8 @@ public:
virtual void ParseCompileUnits() {} virtual void ParseCompileUnits() {}
virtual void MapCompileUnitMethods(DbgCompileUnit* compileUnit); virtual void MapCompileUnitMethods(DbgCompileUnit* compileUnit);
virtual void MapCompileUnitMethods(int compileUnitId); virtual void MapCompileUnitMethods(int compileUnitId);
virtual void PopulateType(DbgType* dbgType); virtual void PopulateType(DbgType* dbgType);
virtual void PopulateTypeGlobals(DbgType* dbgType); virtual void PopulateTypeGlobals(DbgType* dbgType);
virtual void PopulateSubprogram(DbgSubprogram* dbgSubprogram) { } virtual void PopulateSubprogram(DbgSubprogram* dbgSubprogram) { }
virtual void FixupInlinee(DbgSubprogram* dbgSubprogram) {} virtual void FixupInlinee(DbgSubprogram* dbgSubprogram) {}
virtual void PopulateStaticVariableMap(); virtual void PopulateStaticVariableMap();
@ -1232,7 +1232,7 @@ public:
virtual addr_target LocateSymbol(const StringImpl& name) { return 0; } virtual addr_target LocateSymbol(const StringImpl& name) { return 0; }
virtual DbgSubprogram* FindSubprogram(DbgType* dbgType, const char* methodName); virtual DbgSubprogram* FindSubprogram(DbgType* dbgType, const char* methodName);
const char* GetStringTable(DataStream* stream, int stringTablePos); const char* GetStringTable(DataStream* stream, int stringTablePos);
virtual void Fail(const StringImpl& error); virtual void Fail(const StringImpl& error);
virtual void SoftFail(const StringImpl& error); virtual void SoftFail(const StringImpl& error);
virtual void HardFail(const StringImpl& error); virtual void HardFail(const StringImpl& error);
@ -1240,7 +1240,7 @@ public:
void TempRemoveTemplateStr(const char*& name, int& templateNameIdx); void TempRemoveTemplateStr(const char*& name, int& templateNameIdx);
void ReplaceTemplateStr(const char*& name, int& templateNameIdx); void ReplaceTemplateStr(const char*& name, int& templateNameIdx);
char* DbgDupString(const char* str, const char* allocName = NULL); char* DbgDupString(const char* str, const char* allocName = NULL);
DbgModule* GetLinkedModule(); DbgModule* GetLinkedModule();
addr_target GetTargetImageBase(); addr_target GetTargetImageBase();
addr_target RemapAddr(addr_target addr); addr_target RemapAddr(addr_target addr);
@ -1255,27 +1255,27 @@ public:
void ParseDebugFrameData(); void ParseDebugFrameData();
void ParseEHFrameData(); void ParseEHFrameData();
void FlushLineData(DbgSubprogram* curSubprogram, std::list<DbgLineData>& queuedLineData); void FlushLineData(DbgSubprogram* curSubprogram, std::list<DbgLineData>& queuedLineData);
DbgSrcFile* AddSrcFile(DbgCompileUnit* compileUnit, const String& srcFilePath); DbgSrcFile* AddSrcFile(DbgCompileUnit* compileUnit, const String& srcFilePath);
void AddLineData(DbgCompileUnit* dwCompileUnit, DbgLineData& lineData, DbgSubprogram*& curSubProgram, std::list<DbgLineData>& queuedLineData); void AddLineData(DbgCompileUnit* dwCompileUnit, DbgLineData& lineData, DbgSubprogram*& curSubProgram, std::list<DbgLineData>& queuedLineData);
bool ParseDebugLineInfo(const uint8*& data, int compileUnitIdx); bool ParseDebugLineInfo(const uint8*& data, int compileUnitIdx);
void FixupInnerTypes(int startingTypeIdx); void FixupInnerTypes(int startingTypeIdx);
void MapTypes(int startingTypeIdx); void MapTypes(int startingTypeIdx);
void CreateNamespaces(); void CreateNamespaces();
bool IsObjectFile() { return mModuleKind != DbgModuleKind_Module; } bool IsObjectFile() { return mModuleKind != DbgModuleKind_Module; }
bool IsHotSwapObjectFile() { return mModuleKind == DbgModuleKind_HotObject; } bool IsHotSwapObjectFile() { return mModuleKind == DbgModuleKind_HotObject; }
bool IsHotSwapPreserve(const String& name); bool IsHotSwapPreserve(const String& name);
addr_target GetHotTargetAddress(DbgHotTargetSection* hotTargetSection); addr_target GetHotTargetAddress(DbgHotTargetSection* hotTargetSection);
uint8* GetHotTargetData(addr_target address); uint8* GetHotTargetData(addr_target address);
void DoReloc(DbgHotTargetSection* hotTargetSection, COFFRelocation& coffReloc, addr_target resolveSymbolAddr, PE_SymInfo* symInfo); void DoReloc(DbgHotTargetSection* hotTargetSection, COFFRelocation& coffReloc, addr_target resolveSymbolAddr, PE_SymInfo* symInfo);
void ParseHotTargetSections(DataStream* stream, addr_target* resovledSymbolAddrs); void ParseHotTargetSections(DataStream* stream, addr_target* resovledSymbolAddrs);
void CommitHotTargetSections(); void CommitHotTargetSections();
void HotReplaceType(DbgType* newType); void HotReplaceType(DbgType* newType);
void ProcessHotSwapVariables(); void ProcessHotSwapVariables();
virtual bool LoadPDB(const String& pdbPath, uint8 wantGuid[16], int32 wantAge) { return false; } virtual bool LoadPDB(const String& pdbPath, uint8 wantGuid[16], int32 wantAge) { return false; }
virtual bool CheckSection(const char* name, uint8* sectionData, int sectionSize) { return false; } virtual bool CheckSection(const char* name, uint8* sectionData, int sectionSize) { return false; }
virtual void PreCacheImage() {} virtual void PreCacheImage() {}
virtual void PreCacheDebugInfo() {} virtual void PreCacheDebugInfo() {}
virtual bool RequestImage() { return false; } virtual bool RequestImage() { return false; }
virtual bool HasPendingDebugInfo() { return false; } virtual bool HasPendingDebugInfo() { return false; }
virtual bool RequestDebugInfo(bool allowRemote = true) { return false; } virtual bool RequestDebugInfo(bool allowRemote = true) { return false; }
virtual bool WantsAutoLoadDebugInfo() { return false; } virtual bool WantsAutoLoadDebugInfo() { return false; }
@ -1286,7 +1286,7 @@ public:
T ReadValue(const uint8*& data, int form, int refOffset = 0, const uint8** extraData = NULL, const uint8* startData = NULL); T ReadValue(const uint8*& data, int form, int refOffset = 0, const uint8** extraData = NULL, const uint8* startData = NULL);
void EnableWriting(addr_target address); void EnableWriting(addr_target address);
void RevertWritingEnable(); void RevertWritingEnable();
public: public:
DbgModule(DebugTarget* debugTarget); DbgModule(DebugTarget* debugTarget);
@ -1297,18 +1297,18 @@ public:
bool ReadCOFF(DataStream* stream, DbgModuleKind dbgModuleKind); bool ReadCOFF(DataStream* stream, DbgModuleKind dbgModuleKind);
void RemoveTargetData(); void RemoveTargetData();
virtual void ReportMemory(MemReporter* memReporter); virtual void ReportMemory(MemReporter* memReporter);
int64 GetImageSize(); int64 GetImageSize();
virtual void FinishHotSwap(); virtual void FinishHotSwap();
addr_target ExecuteOps(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, CPURegisters* registers, DbgAddrType* outAddrType, DbgEvalLocFlags flags, addr_target* pushValue = NULL); addr_target ExecuteOps(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, CPURegisters* registers, DbgAddrType* outAddrType, DbgEvalLocFlags flags, addr_target* pushValue = NULL);
virtual intptr EvaluateLocation(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, DbgAddrType* outAddrType, DbgEvalLocFlags flags = DbgEvalLocFlag_None); virtual intptr EvaluateLocation(DbgSubprogram* dwSubprogram, const uint8* locData, int locDataLen, WdStackFrame* stackFrame, DbgAddrType* outAddrType, DbgEvalLocFlags flags = DbgEvalLocFlag_None);
//const uint8* CopyOrigImageData(addr_target address, int length); //const uint8* CopyOrigImageData(addr_target address, int length);
DbgType* FindTypeHelper(const String& typeName, DbgType* checkType); DbgType* FindTypeHelper(const String& typeName, DbgType* checkType);
DbgType* FindType(const String& typeName, DbgType* contextType = NULL, DbgLanguage language = DbgLanguage_Unknown, bool bfObjectPtr = false); DbgType* FindType(const String& typeName, DbgType* contextType = NULL, DbgLanguage language = DbgLanguage_Unknown, bool bfObjectPtr = false);
DbgTypeMap::Entry* FindType(const char* typeName, DbgLanguage language); DbgTypeMap::Entry* FindType(const char* typeName, DbgLanguage language);
DbgType* GetPointerType(DbgType* innerType); DbgType* GetPointerType(DbgType* innerType);
DbgType* GetConstType(DbgType* innerType); DbgType* GetConstType(DbgType* innerType);
DbgType* GetPrimaryType(DbgType* dbgType); DbgType* GetPrimaryType(DbgType* dbgType);
@ -1326,7 +1326,7 @@ namespace std
struct hash<NS_BF_DBG::DbgSizedArrayEntry> struct hash<NS_BF_DBG::DbgSizedArrayEntry>
{ {
size_t operator()(const NS_BF_DBG::DbgSizedArrayEntry& val) const size_t operator()(const NS_BF_DBG::DbgSizedArrayEntry& val) const
{ {
return (size_t)val.mElementType ^ (val.mCount << 10); return (size_t)val.mElementType ^ (val.mCount << 10);
} }
}; };

View file

@ -19,13 +19,13 @@
USING_NS_BF_DBG; USING_NS_BF_DBG;
DbgSymRequest::DbgSymRequest() DbgSymRequest::DbgSymRequest()
{ {
mFailed = false; mFailed = false;
mSearchingSymSrv = false; mSearchingSymSrv = false;
mCancelling = false; mCancelling = false;
mInProcess = false; mInProcess = false;
mLastUpdateTick = 0; mLastUpdateTick = 0;
mDbgSymSrv = NULL; mDbgSymSrv = NULL;
mWantAge = 0; mWantAge = 0;
mMayBeOld = false; mMayBeOld = false;
mIsPreCache = false; mIsPreCache = false;
@ -33,18 +33,17 @@ DbgSymRequest::DbgSymRequest()
DbgSymRequest::~DbgSymRequest() DbgSymRequest::~DbgSymRequest()
{ {
} }
String DbgSymRequest::GetGuidString() String DbgSymRequest::GetGuidString()
{ {
String str; String str;
// Seems like weird ordering, but the guid is really supposed to be (uint32, uint16, uint16, uint8[8]) // Seems like weird ordering, but the guid is really supposed to be (uint32, uint16, uint16, uint8[8])
str += StrFormat("%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X", str += StrFormat("%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X%02X",
mWantGuid[3], mWantGuid[2], mWantGuid[1], mWantGuid[0], mWantGuid[3], mWantGuid[2], mWantGuid[1], mWantGuid[0],
mWantGuid[5], mWantGuid[4], mWantGuid[5], mWantGuid[4],
mWantGuid[7], mWantGuid[6], mWantGuid[7], mWantGuid[6],
mWantGuid[8], mWantGuid[9], mWantGuid[10], mWantGuid[11], mWantGuid[12], mWantGuid[13], mWantGuid[14], mWantGuid[15]); mWantGuid[8], mWantGuid[9], mWantGuid[10], mWantGuid[11], mWantGuid[12], mWantGuid[13], mWantGuid[14], mWantGuid[15]);
return str; return str;
} }
@ -87,7 +86,7 @@ bool DbgSymRequest::CheckPDBData(const StringImpl& pdbPath, uint8 outGuid[16], i
{ {
mDbgSymSrv->mDebugger->OutputMessage(StrFormat("ERROR: %s cannot be used due to age mismatch\n", pdbPath.c_str())); mDbgSymSrv->mDebugger->OutputMessage(StrFormat("ERROR: %s cannot be used due to age mismatch\n", pdbPath.c_str()));
} }
else else
{ {
bool hasGuid = false; bool hasGuid = false;
for (int i = 0; i < 16; i++) for (int i = 0; i < 16; i++)
@ -108,9 +107,9 @@ bool DbgSymRequest::CheckPDBData(const StringImpl& pdbPath, uint8 outGuid[16], i
} }
bool DbgSymRequest::Get(const StringImpl& url, const StringImpl& destPath, NetResult** chainNetResult, bool ignoreSuccess) bool DbgSymRequest::Get(const StringImpl& url, const StringImpl& destPath, NetResult** chainNetResult, bool ignoreSuccess)
{ {
if (mIsPreCache) if (mIsPreCache)
{ {
auto netResult = mDbgSymSrv->mDebugger->mDebugManager->mNetManager->QueueGet(url, destPath, true); auto netResult = mDbgSymSrv->mDebugger->mDebugManager->mNetManager->QueueGet(url, destPath, true);
if (chainNetResult != NULL) if (chainNetResult != NULL)
{ {
@ -121,7 +120,7 @@ bool DbgSymRequest::Get(const StringImpl& url, const StringImpl& destPath, NetRe
} }
return false; return false;
} }
return mDbgSymSrv->mDebugger->mDebugManager->mNetManager->Get(url, destPath); return mDbgSymSrv->mDebugger->mDebugManager->mNetManager->Get(url, destPath);
} }
@ -144,7 +143,7 @@ void DbgSymRequest::SearchLocal()
return; return;
} }
// Check in same dir as module // Check in same dir as module
String checkPath = ::GetFileDir(mModulePath); String checkPath = ::GetFileDir(mModulePath);
checkPath += "\\"; checkPath += "\\";
checkPath += GetFileName(mPDBRequested); checkPath += GetFileName(mPDBRequested);
@ -157,7 +156,7 @@ void DbgSymRequest::SearchLocal()
} }
} }
} }
mMayBeOld = true; mMayBeOld = true;
} }
@ -206,12 +205,12 @@ void DbgSymRequest::SearchSymSrv()
/*if (mPDBRequested.Contains("IDEHelper")) /*if (mPDBRequested.Contains("IDEHelper"))
Sleep(3000);*/ Sleep(3000);*/
SetAndRestoreValue<bool> prevSearchingSymSrv(mSearchingSymSrv, true); SetAndRestoreValue<bool> prevSearchingSymSrv(mSearchingSymSrv, true);
NetResult* chainNetResult = NULL; NetResult* chainNetResult = NULL;
uint8 outGuid[16]; uint8 outGuid[16];
int32 outAge; int32 outAge;
String cacheDir = mOptions.mCacheDir; String cacheDir = mOptions.mCacheDir;
cacheDir += GetPDBStoreDir(); cacheDir += GetPDBStoreDir();
@ -244,7 +243,7 @@ void DbgSymRequest::SearchSymSrv()
checkPath += GetFileName(mPDBRequested); checkPath += GetFileName(mPDBRequested);
if (Get(checkPath, cacheFilePath, &chainNetResult)) if (Get(checkPath, cacheFilePath, &chainNetResult))
done = true; done = true;
if ((!done) && (!mCancelling)) if ((!done) && (!mCancelling))
{ {
// Compressed version // Compressed version
@ -264,7 +263,7 @@ void DbgSymRequest::SearchSymSrv()
} }
done = true; done = true;
} }
} }
if ((!done) && (!mCancelling)) if ((!done) && (!mCancelling))
{ {
@ -312,7 +311,7 @@ void DbgSymRequest::SearchSymSrv()
if (mIsPreCache) if (mIsPreCache)
continue; continue;
// Re-check cache // Re-check cache
if (CheckPDBData(cacheFilePath, outGuid, outAge)) if (CheckPDBData(cacheFilePath, outGuid, outAge))
{ {
mFinalPDBPath = cacheFilePath; mFinalPDBPath = cacheFilePath;
@ -329,12 +328,12 @@ bool DbgSymRequest::CheckPEFile(const StringImpl& filePath, uint32 fileTime, int
if (!fs.Open(filePath, "rb")) if (!fs.Open(filePath, "rb"))
return false; return false;
PEHeader hdr; PEHeader hdr;
fs.ReadT(hdr); fs.ReadT(hdr);
PE_NTHeaders64 ntHdr64; PE_NTHeaders64 ntHdr64;
fs.SetPos(hdr.e_lfanew); fs.SetPos(hdr.e_lfanew);
fs.Read(&ntHdr64, sizeof(PE_NTHeaders64)); fs.Read(&ntHdr64, sizeof(PE_NTHeaders64));
if (ntHdr64.mFileHeader.mMachine == PE_MACHINE_X64) if (ntHdr64.mFileHeader.mMachine == PE_MACHINE_X64)
{ {
@ -349,12 +348,12 @@ bool DbgSymRequest::CheckPEFile(const StringImpl& filePath, uint32 fileTime, int
if ((ntHdr32.mFileHeader.mTimeDateStamp != fileTime) || (ntHdr32.mOptionalHeader.mSizeOfImage != size)) if ((ntHdr32.mFileHeader.mTimeDateStamp != fileTime) || (ntHdr32.mOptionalHeader.mSizeOfImage != size))
return false; return false;
} }
return true; return true;
} }
String DbgSymRequest::SearchForImage(const String& filePath, uint32 fileTime, int size) String DbgSymRequest::SearchForImage(const String& filePath, uint32 fileTime, int size)
{ {
if ((gDebugManager->mSymSrvOptions.mFlags & BfSymSrvFlag_Disable) != 0) if ((gDebugManager->mSymSrvOptions.mFlags & BfSymSrvFlag_Disable) != 0)
return ""; return "";
@ -371,15 +370,15 @@ String DbgSymRequest::SearchForImage(const String& filePath, uint32 fileTime, in
{ {
mFailed = true; mFailed = true;
return ""; return "";
} }
NetResult* chainNetResult = NULL; NetResult* chainNetResult = NULL;
String fileName = GetFileName(filePath); String fileName = GetFileName(filePath);
String imageStoreDir = "/"; String imageStoreDir = "/";
imageStoreDir += fileName; imageStoreDir += fileName;
imageStoreDir += "/"; imageStoreDir += "/";
imageStoreDir += StrFormat("%08X%x/", fileTime, size); imageStoreDir += StrFormat("%08X%x/", fileTime, size);
SetAndRestoreValue<bool> prevSearchingSymSrv(mSearchingSymSrv, true); SetAndRestoreValue<bool> prevSearchingSymSrv(mSearchingSymSrv, true);
@ -400,7 +399,7 @@ String DbgSymRequest::SearchForImage(const String& filePath, uint32 fileTime, in
if (CheckPEFile(cacheFilePath, fileTime, size)) if (CheckPEFile(cacheFilePath, fileTime, size))
{ {
return cacheFilePath; return cacheFilePath;
} }
for (auto& symServAddr : mOptions.mSymbolServers) for (auto& symServAddr : mOptions.mSymbolServers)
{ {
@ -466,7 +465,7 @@ String DbgSymRequest::SearchForImage(const String& filePath, uint32 fileTime, in
checkPath += imageStoreDir; checkPath += imageStoreDir;
checkPath += fileName; checkPath += fileName;
if (CheckPEFile(checkPath, fileTime, size)) if (CheckPEFile(checkPath, fileTime, size))
{ {
return checkPath; return checkPath;
} }
@ -490,14 +489,14 @@ String DbgSymRequest::SearchForImage(const String& filePath, uint32 fileTime, in
// Re-check cache // Re-check cache
if (CheckPEFile(cacheFilePath, fileTime, size)) if (CheckPEFile(cacheFilePath, fileTime, size))
{ {
return cacheFilePath; return cacheFilePath;
} }
} }
if (!mIsPreCache) if (!mIsPreCache)
{ {
mDbgSymSrv->mDebugger->mHadImageFindError = true; mDbgSymSrv->mDebugger->mHadImageFindError = true;
mDbgSymSrv->mDebugger->OutputMessage(StrFormat("ERROR: Unable to locate image '%s' (%08X%x). If this file is located on a symbol server, configure the symbol server location in File\\Preferences\\Settings under Debugger\\Symbol File Locations.\n", mDbgSymSrv->mDebugger->OutputMessage(StrFormat("ERROR: Unable to locate image '%s' (%08X%x). If this file is located on a symbol server, configure the symbol server location in File\\Preferences\\Settings under Debugger\\Symbol File Locations.\n",
GetFileName(filePath).c_str(), fileTime, size)); GetFileName(filePath).c_str(), fileTime, size));
} }
@ -526,7 +525,7 @@ bool DbgSymRequest::IsDone()
DbgSymSrv::DbgSymSrv(Debugger* debugger) DbgSymSrv::DbgSymSrv(Debugger* debugger)
{ {
mDebugger = debugger; mDebugger = debugger;
} }
void DbgSymSrv::PreCacheImage(const String& filePath, uint32 fileTime, int size) void DbgSymSrv::PreCacheImage(const String& filePath, uint32 fileTime, int size)
@ -558,7 +557,7 @@ DbgSymRequest* DbgSymSrv::CreateRequest()
DbgSymRequest* symRequest = new DbgSymRequest(); DbgSymRequest* symRequest = new DbgSymRequest();
symRequest->mOptions = mDebugger->mDebugManager->mSymSrvOptions; symRequest->mOptions = mDebugger->mDebugManager->mSymSrvOptions;
symRequest->mDbgSymSrv = this; symRequest->mDbgSymSrv = this;
return symRequest; return symRequest;
} }
@ -569,6 +568,4 @@ void DbgSymSrv::ReleaseRequest(DbgSymRequest* dbgSymRequest)
void DbgSymSrv::Update() void DbgSymSrv::Update()
{ {
}
}

View file

@ -81,7 +81,7 @@ USING_NS_BF;
// char cIn; // char cIn;
// do { cIn = *(inPtr++); } while (cIn == ' '); // do { cIn = *(inPtr++); } while (cIn == ' ');
// char cMap; // char cMap;
// do { cMap = *(mapPtr++); } while (cMap == ' '); // do { cMap = *(mapPtr++); } while (cMap == ' ');
// if (cIn != cMap) // if (cIn != cMap)
// { // {
// if ((cIn == '`') || (cIn == '\'')) // if ((cIn == '`') || (cIn == '\''))
@ -136,7 +136,7 @@ USING_NS_BF;
//} //}
// //
//void DbgTypeMap::Insert(DbgType* value) //void DbgTypeMap::Insert(DbgType* value)
//{ //{
// if (mHashHeads == NULL) // if (mHashHeads == NULL)
// mHashHeads = (Entry**)mAlloc.AllocBytes(sizeof(Entry*) * HashSize, alignof(Entry*)); // mHashHeads = (Entry**)mAlloc.AllocBytes(sizeof(Entry*) * HashSize, alignof(Entry*));
// //
@ -157,7 +157,7 @@ USING_NS_BF;
//} //}
// //
//DbgTypeMap::Entry* DbgTypeMap::Find(const char* name, DbgLanguage language) //DbgTypeMap::Entry* DbgTypeMap::Find(const char* name, DbgLanguage language)
//{ //{
// if (language == DbgLanguage_BeefUnfixed) // if (language == DbgLanguage_BeefUnfixed)
// { // {
// std::string str = name; // std::string str = name;
@ -184,7 +184,7 @@ USING_NS_BF;
// // Find our way to the end and remove the star // // Find our way to the end and remove the star
// int chevCount = 0; // int chevCount = 0;
// for (char* cTestPtr = cPtr - 1; cTestPtr >= name; cTestPtr--) // for (char* cTestPtr = cPtr - 1; cTestPtr >= name; cTestPtr--)
// { // {
// char c = *cTestPtr; // char c = *cTestPtr;
// if (c == 0) // if (c == 0)
// break; // break;
@ -217,7 +217,7 @@ USING_NS_BF;
// } // }
// } // }
// } // }
// //
// if (nameStart != NULL) // if (nameStart != NULL)
// { // {
// if (strncmp(nameStart, "System.Array1", 13) == 0) // if (strncmp(nameStart, "System.Array1", 13) == 0)
@ -376,7 +376,7 @@ bool DbgTypeMap::StrEqual(const char* inStr, const char* mapStr)
} }
DbgTypeMap::Entry* DbgTypeMap::Find(const char* name, DbgLanguage language) DbgTypeMap::Entry* DbgTypeMap::Find(const char* name, DbgLanguage language)
{ {
if (language == DbgLanguage_BeefUnfixed) if (language == DbgLanguage_BeefUnfixed)
{ {
std::string str = name; std::string str = name;
@ -395,7 +395,7 @@ DbgTypeMap::Entry* DbgTypeMap::Find(const char* name, DbgLanguage language)
// Find our way to the end and remove the star // Find our way to the end and remove the star
int chevCount = 0; int chevCount = 0;
for (char* cTestPtr = cPtr - 1; cTestPtr >= name; cTestPtr--) for (char* cTestPtr = cPtr - 1; cTestPtr >= name; cTestPtr--)
{ {
char c = *cTestPtr; char c = *cTestPtr;
if (c == 0) if (c == 0)
break; break;
@ -428,7 +428,7 @@ DbgTypeMap::Entry* DbgTypeMap::Find(const char* name, DbgLanguage language)
} }
} }
} }
if (nameStart != NULL) if (nameStart != NULL)
{ {
if (strncmp(nameStart, "System.Array1", 13) == 0) if (strncmp(nameStart, "System.Array1", 13) == 0)
@ -470,15 +470,15 @@ DbgTypeMap::Entry* DbgTypeMap::Find(const char* name, DbgLanguage language)
int hashCode = GetHash(name, language) & 0x7FFFFFFF; int hashCode = GetHash(name, language) & 0x7FFFFFFF;
for (int i = mMap.mBuckets[hashCode % mMap.mAllocSize]; i >= 0; i = mMap.mEntries[i].mNext) for (int i = mMap.mBuckets[hashCode % mMap.mAllocSize]; i >= 0; i = mMap.mEntries[i].mNext)
{ {
if (mMap.mEntries[i].mHashCode == hashCode) if (mMap.mEntries[i].mHashCode == hashCode)
{ {
Entry* entry = (Entry*)&mMap.mEntries[i].mKey; Entry* entry = (Entry*)&mMap.mEntries[i].mKey;
if (StrEqual(name, entry->mValue->mName)) if (StrEqual(name, entry->mValue->mName))
return entry; return entry;
} }
} }
return NULL; return NULL;
} }
@ -490,4 +490,4 @@ Beefy::HashSet<DbgTypeMap::Entry>::iterator DbgTypeMap::begin()
Beefy::HashSet<DbgTypeMap::Entry>::iterator DbgTypeMap::end() Beefy::HashSet<DbgTypeMap::Entry>::iterator DbgTypeMap::end()
{ {
return mMap.end(); return mMap.end();
} }

View file

@ -30,22 +30,22 @@ DebugTarget::DebugTarget(WinDebugger* debugger)
mCapturedNamesPtr = NULL; mCapturedNamesPtr = NULL;
mCapturedTypesPtr = NULL; mCapturedTypesPtr = NULL;
mHotHeap = NULL; mHotHeap = NULL;
mLastHotHeapCleanIdx = 0; mLastHotHeapCleanIdx = 0;
mIsEmpty = false; mIsEmpty = false;
mWasLocallyBuilt = false; mWasLocallyBuilt = false;
mCurModuleId = 0; mCurModuleId = 0;
/*dbgType = new DbgType(); /*dbgType = new DbgType();
dbgType->mName = "int"; dbgType->mName = "int";
dbgType->mTypeCode = DbgType_i32; dbgType->mTypeCode = DbgType_i32;
dbgType->mSize = 4; dbgType->mSize = 4;
mPrimitiveTypes[DbgType_i32] = dbgType;*/ mPrimitiveTypes[DbgType_i32] = dbgType;*/
} }
DebugTarget::~DebugTarget() DebugTarget::~DebugTarget()
{ {
for (auto dwarf : mDbgModules) for (auto dwarf : mDbgModules)
delete dwarf; delete dwarf;
for (auto& dwSrcFilePair : mSrcFiles) for (auto& dwSrcFilePair : mSrcFiles)
delete dwSrcFilePair.mValue; delete dwSrcFilePair.mValue;
@ -63,7 +63,7 @@ static bool PathEquals(const String& pathA, String& pathB)
{ {
char cA = *(ptrA++); char cA = *(ptrA++);
char cB = *(ptrB++); char cB = *(ptrB++);
if ((cA == 0) || (cB == 0)) if ((cA == 0) || (cB == 0))
{ {
return (cA == 0) && (cB == 0); return (cA == 0) && (cB == 0);
@ -91,7 +91,7 @@ void DebugTarget::SetupTargetBinary()
#else #else
if (wantsHotHeap) if (wantsHotHeap)
{ {
// 64-bit hot loaded code needs to be placed close to the original EXE so 32-bit relative // 64-bit hot loaded code needs to be placed close to the original EXE so 32-bit relative
// offsets within the hot code can still reach the old code // offsets within the hot code can still reach the old code
addr_target checkHotReserveAddr = (addr_target)mTargetBinary->mImageBase + mTargetBinary->mImageSize; addr_target checkHotReserveAddr = (addr_target)mTargetBinary->mImageBase + mTargetBinary->mImageSize;
int mb = 1024 * 1024; int mb = 1024 * 1024;
@ -104,7 +104,7 @@ void DebugTarget::SetupTargetBinary()
addr_target reservedPtr = NULL; addr_target reservedPtr = NULL;
while ((addr_target)checkHotReserveAddr < (addr_target)mTargetBinary->mImageBase + 0x30000000) while ((addr_target)checkHotReserveAddr < (addr_target)mTargetBinary->mImageBase + 0x30000000)
{ {
reservedPtr = (addr_target)VirtualAllocEx(mDebugger->mProcessInfo.hProcess, (void*)(intptr)checkHotReserveAddr, reserveSize, MEM_RESERVE, PAGE_EXECUTE_READWRITE); reservedPtr = (addr_target)VirtualAllocEx(mDebugger->mProcessInfo.hProcess, (void*)(intptr)checkHotReserveAddr, reserveSize, MEM_RESERVE, PAGE_EXECUTE_READWRITE);
if (reservedPtr != NULL) if (reservedPtr != NULL)
break; break;
@ -129,7 +129,7 @@ void DebugTarget::CheckTargetBinary(DbgModule* module)
if (mTargetBinary != NULL) if (mTargetBinary != NULL)
return; return;
if (!PathEquals(module->mFilePath, mTargetPath)) if (!PathEquals(module->mFilePath, mTargetPath))
return; return;
mTargetBinary = module; mTargetBinary = module;
if (mTargetBinary != mLaunchBinary) if (mTargetBinary != mLaunchBinary)
SetupTargetBinary(); SetupTargetBinary();
@ -150,7 +150,7 @@ DbgModule* DebugTarget::Init(const StringImpl& launchPath, const StringImpl& tar
return NULL; return NULL;
} }
DbgModule* dwarf = new COFF(this); DbgModule* dwarf = new COFF(this);
mLaunchBinary = dwarf; mLaunchBinary = dwarf;
dwarf->mDisplayName = GetFileName(launchPath); dwarf->mDisplayName = GetFileName(launchPath);
dwarf->mFilePath = launchPath; dwarf->mFilePath = launchPath;
@ -190,15 +190,15 @@ DbgModule* DebugTarget::HotLoad(const StringImpl& fileName, int hotIdx)
} }
DbgModule* dwarf = new COFF(this); DbgModule* dwarf = new COFF(this);
dwarf->mHotIdx = hotIdx; dwarf->mHotIdx = hotIdx;
dwarf->mDisplayName = GetFileName(fileName); dwarf->mDisplayName = GetFileName(fileName);
dwarf->mFilePath = fileName; dwarf->mFilePath = fileName;
if (!dwarf->ReadCOFF(&fileStream, DbgModuleKind_HotObject)) if (!dwarf->ReadCOFF(&fileStream, DbgModuleKind_HotObject))
{ {
mDebugger->OutputMessage(StrFormat("Debugger failed to read binary: %s\n", fileName.c_str())); mDebugger->OutputMessage(StrFormat("Debugger failed to read binary: %s\n", fileName.c_str()));
delete dwarf; delete dwarf;
return NULL; return NULL;
} }
AddDbgModule(dwarf); AddDbgModule(dwarf);
return dwarf; return dwarf;
} }
@ -206,7 +206,7 @@ DbgModule* DebugTarget::HotLoad(const StringImpl& fileName, int hotIdx)
DbgModule* DebugTarget::SetupDyn(const StringImpl& filePath, DataStream* stream, intptr imageBase) DbgModule* DebugTarget::SetupDyn(const StringImpl& filePath, DataStream* stream, intptr imageBase)
{ {
BP_ZONE("DebugTarget::SetupDyn"); BP_ZONE("DebugTarget::SetupDyn");
AutoDbgTime dbgTime("DebugTarget::SetupDyn " + filePath); AutoDbgTime dbgTime("DebugTarget::SetupDyn " + filePath);
DbgModule* dwarf = new COFF(this); DbgModule* dwarf = new COFF(this);
@ -240,12 +240,12 @@ String DebugTarget::UnloadDyn(addr_target imageBase)
String filePath; String filePath;
AutoDbgTime dbgTime("DebugTarget::UnloadDyn"); AutoDbgTime dbgTime("DebugTarget::UnloadDyn");
for (int i = 0; i < (int)mDbgModules.size(); i++) for (int i = 0; i < (int)mDbgModules.size(); i++)
{ {
DbgModule* dwarf = mDbgModules[i]; DbgModule* dwarf = mDbgModules[i];
if (dwarf->mImageBase == imageBase) if (dwarf->mImageBase == imageBase)
{ {
dwarf->mDeleting = true; dwarf->mDeleting = true;
dwarf->RemoveTargetData(); dwarf->RemoveTargetData();
RemoveTargetData(); RemoveTargetData();
@ -253,7 +253,7 @@ String DebugTarget::UnloadDyn(addr_target imageBase)
if (mTargetBinary == dwarf) if (mTargetBinary == dwarf)
mTargetBinary = NULL; mTargetBinary = NULL;
mDbgModules.RemoveAt(i); mDbgModules.RemoveAt(i);
bool success = mDbgModuleMap.Remove(dwarf->mId); bool success = mDbgModuleMap.Remove(dwarf->mId);
BF_ASSERT_REL(success); BF_ASSERT_REL(success);
@ -261,7 +261,7 @@ String DebugTarget::UnloadDyn(addr_target imageBase)
delete dwarf; delete dwarf;
return filePath; return filePath;
} }
} }
return ""; return "";
} }
@ -282,9 +282,9 @@ void DebugTarget::CleanupHotHeap()
Beefy::OutputDebugStrF("Clearing hot module %p data from %@ to %@\n", dbgModule, dbgModule->mImageBase, dbgModule->mImageBase + dbgModule->mImageSize); Beefy::OutputDebugStrF("Clearing hot module %p data from %@ to %@\n", dbgModule, dbgModule->mImageBase, dbgModule->mImageBase + dbgModule->mImageSize);
BfLogDbg("Unloading hot idx: %s@%d\n", dbgModule->mFilePath.c_str(), dbgModule->mHotIdx); BfLogDbg("Unloading hot idx: %s@%d\n", dbgModule->mFilePath.c_str(), dbgModule->mHotIdx);
dbgModule->mDeleting = true; dbgModule->mDeleting = true;
dbgModule->RemoveTargetData(); dbgModule->RemoveTargetData();
hadRemovals = true; hadRemovals = true;
} }
} }
} }
@ -296,15 +296,15 @@ void DebugTarget::CleanupHotHeap()
{ {
DbgModule* dbgModule = mDbgModules[dwarfIdx]; DbgModule* dbgModule = mDbgModules[dwarfIdx];
if (dbgModule->mDeleting) if (dbgModule->mDeleting)
{ {
mDbgModules.RemoveAt(dwarfIdx); mDbgModules.RemoveAt(dwarfIdx);
bool success = mDbgModuleMap.Remove(dbgModule->mId); bool success = mDbgModuleMap.Remove(dbgModule->mId);
BF_ASSERT_REL(success); BF_ASSERT_REL(success);
delete dbgModule; delete dbgModule;
dwarfIdx--; dwarfIdx--;
} }
} }
} }
} }
void DebugTarget::RehupSrcFiles() void DebugTarget::RehupSrcFiles()
@ -349,11 +349,11 @@ DbgSrcFile* DebugTarget::GetSrcFile(const String& srcFilePath)
} }
bool DebugTarget::FindSymbolAt(addr_target addr, String* outSymbol, addr_target* outOffset, DbgModule** outDWARF, bool allowRemote) bool DebugTarget::FindSymbolAt(addr_target addr, String* outSymbol, addr_target* outOffset, DbgModule** outDWARF, bool allowRemote)
{ {
//TODO: First search for symbol, then determine if the addr is within the defining DbgModule //TODO: First search for symbol, then determine if the addr is within the defining DbgModule
DbgModule* insideDWARF = NULL; DbgModule* insideDWARF = NULL;
auto dbgModule = FindDbgModuleForAddress(addr); auto dbgModule = FindDbgModuleForAddress(addr);
if (dbgModule != NULL) if (dbgModule != NULL)
dbgModule->ParseSymbolData(); dbgModule->ParseSymbolData();
@ -363,7 +363,7 @@ bool DebugTarget::FindSymbolAt(addr_target addr, String* outSymbol, addr_target*
{ {
dbgModule = dwSymbol->mDbgModule; dbgModule = dwSymbol->mDbgModule;
} }
if (dbgModule == NULL) if (dbgModule == NULL)
return false; return false;
@ -375,7 +375,7 @@ bool DebugTarget::FindSymbolAt(addr_target addr, String* outSymbol, addr_target*
for (int i = 0; i < (int)dbgModule->mSections.size(); i++) for (int i = 0; i < (int)dbgModule->mSections.size(); i++)
{ {
auto section = &dbgModule->mSections[i]; auto section = &dbgModule->mSections[i];
if ((addr >= section->mAddrStart + dbgModule->mImageBase) && (addr < section->mAddrStart + dbgModule->mImageBase + section->mAddrLength)) if ((addr >= section->mAddrStart + dbgModule->mImageBase) && (addr < section->mAddrStart + dbgModule->mImageBase + section->mAddrLength))
{ {
if (dbgModule->HasPendingDebugInfo()) if (dbgModule->HasPendingDebugInfo())
@ -383,9 +383,9 @@ bool DebugTarget::FindSymbolAt(addr_target addr, String* outSymbol, addr_target*
if (dbgModule->WantsAutoLoadDebugInfo()) if (dbgModule->WantsAutoLoadDebugInfo())
{ {
DbgPendingDebugInfoLoad* dbgPendingDebugInfoLoad = NULL; DbgPendingDebugInfoLoad* dbgPendingDebugInfoLoad = NULL;
mDebugger->mPendingDebugInfoLoad.TryAdd(dbgModule, NULL, &dbgPendingDebugInfoLoad); mDebugger->mPendingDebugInfoLoad.TryAdd(dbgModule, NULL, &dbgPendingDebugInfoLoad);
dbgPendingDebugInfoLoad->mModule = dbgModule; dbgPendingDebugInfoLoad->mModule = dbgModule;
dbgPendingDebugInfoLoad->mAllowRemote |= allowRemote; dbgPendingDebugInfoLoad->mAllowRemote |= allowRemote;
} }
} }
@ -413,7 +413,7 @@ bool DebugTarget::FindSymbolAt(addr_target addr, String* outSymbol, addr_target*
if (outSymbol != NULL) if (outSymbol != NULL)
{ {
*outSymbol = dwSymbol->mName; *outSymbol = dwSymbol->mName;
} }
if (outOffset != NULL) if (outOffset != NULL)
*outOffset = addr - dwSymbol->mAddress; *outOffset = addr - dwSymbol->mAddress;
@ -444,7 +444,7 @@ bool DebugTarget::GetValueByName(DbgSubprogram* subProgram, const StringImpl& na
BP_ZONE("DebugTarget::GetValueByName"); BP_ZONE("DebugTarget::GetValueByName");
//BF_ASSERT(*outAddrType == DbgAddrType_None); //BF_ASSERT(*outAddrType == DbgAddrType_None);
String checkName = name; String checkName = name;
if (subProgram != NULL) if (subProgram != NULL)
@ -477,7 +477,7 @@ void DebugTarget::AddAutoStaticEntry(const DbgAutoStaticEntry& entry)
while (remainingSize > 0) while (remainingSize > 0)
{ {
int bucketIndex = -1; int bucketIndex = -1;
/*auto map_iter = mAutoStaticEntryBucketMap.find((addr_target)curPage); /*auto map_iter = mAutoStaticEntryBucketMap.find((addr_target)curPage);
if (map_iter != mAutoStaticEntryBucketMap.end())*/ if (map_iter != mAutoStaticEntryBucketMap.end())*/
@ -610,14 +610,14 @@ void DebugTarget::GetAutoValueNames(DbgAutoValueMapType& outAutos, WdStackFrame*
auto subProgram = dbgModule->mSubprograms[subProgramIdx]; auto subProgram = dbgModule->mSubprograms[subProgramIdx];
GetAutoValueNamesInBlock(outAutos, subProgram, &subProgram->mBlock, stackFrame, memoryRangeStart, memoryRangeLen); GetAutoValueNamesInBlock(outAutos, subProgram, &subProgram->mBlock, stackFrame, memoryRangeStart, memoryRangeLen);
} }
for (auto compileUnit : dbgModule->mCompileUnits) for (auto compileUnit : dbgModule->mCompileUnits)
{ {
GetAutoValueNamesInBlock(outAutos, NULL, compileUnit->mGlobalBlock, stackFrame, memoryRangeStart, memoryRangeLen); GetAutoValueNamesInBlock(outAutos, NULL, compileUnit->mGlobalBlock, stackFrame, memoryRangeStart, memoryRangeLen);
} }
} }
std::function<void(const DbgAutoStaticEntry&)> iterFunc = [this, &outAutos](const DbgAutoStaticEntry& entry) std::function<void(const DbgAutoStaticEntry&)> iterFunc = [this, &outAutos](const DbgAutoStaticEntry& entry)
{ {
//outAutos.insert(DbgAutoValueMapType::value_type(entry.mFullName, DbgAutoValueMapType::value_type::second_type(entry.mAddrStart, entry.mAddrLen))); //outAutos.insert(DbgAutoValueMapType::value_type(entry.mFullName, DbgAutoValueMapType::value_type::second_type(entry.mAddrStart, entry.mAddrLen)));
outAutos.TryAdd(entry.mFullName, std::make_pair(entry.mAddrStart, entry.mAddrLen)); outAutos.TryAdd(entry.mFullName, std::make_pair(entry.mAddrStart, entry.mAddrLen));
@ -713,7 +713,7 @@ bool DebugTarget::GetAutoLocalsInBlock(Array<String>& outLocals, DbgSubprogram*
{ {
auto dwarf = dwSubprogram->mCompileUnit->mDbgModule; auto dwarf = dwSubprogram->mCompileUnit->mDbgModule;
if (dwBlock->mLowPC == -1) if (dwBlock->mLowPC == -1)
{ {
//Debug ranges //Debug ranges
addr_target* rangeData = (addr_target*)(dwarf->mDebugRangesData + dwBlock->mHighPC); addr_target* rangeData = (addr_target*)(dwarf->mDebugRangesData + dwBlock->mHighPC);
while (true) while (true)
@ -733,7 +733,7 @@ bool DebugTarget::GetAutoLocalsInBlock(Array<String>& outLocals, DbgSubprogram*
for (auto subBlock : dwBlock->mSubBlocks) for (auto subBlock : dwBlock->mSubBlocks)
{ {
GetAutoLocalsInBlock(outLocals, dwSubprogram, subBlock, stackFrame, dwLineData); GetAutoLocalsInBlock(outLocals, dwSubprogram, subBlock, stackFrame, dwLineData);
} }
if (dwBlock == &dwSubprogram->mBlock) if (dwBlock == &dwSubprogram->mBlock)
@ -763,14 +763,13 @@ bool DebugTarget::GetAutoLocalsInBlock(Array<String>& outLocals, DbgSubprogram*
return true; return true;
} }
DbgSubprogram* DebugTarget::FindSubProgram(addr_target pc, DbgOnDemandKind onDemandKind) DbgSubprogram* DebugTarget::FindSubProgram(addr_target pc, DbgOnDemandKind onDemandKind)
{ {
BP_ZONE("WinDebugger::FindSubProgram"); BP_ZONE("WinDebugger::FindSubProgram");
for (int pass = 0; pass < 2; pass++) for (int pass = 0; pass < 2; pass++)
{ {
int mapBlockSize = 1 << DbgRadixMap<DbgSubprogramMapEntry*>::BLOCK_SHIFT; int mapBlockSize = 1 << DbgRadixMap<DbgSubprogramMapEntry*>::BLOCK_SHIFT;
DbgSubprogram* foundSubprogram = NULL; DbgSubprogram* foundSubprogram = NULL;
@ -812,7 +811,6 @@ DbgSubprogram* DebugTarget::FindSubProgram(addr_target pc, DbgOnDemandKind onDem
} }
else else
{ {
}*/ }*/
return dwSubprogram; return dwSubprogram;
@ -827,11 +825,11 @@ DbgSubprogram* DebugTarget::FindSubProgram(addr_target pc, DbgOnDemandKind onDem
if (pass != 0) if (pass != 0)
return NULL; return NULL;
DbgCompileUnitContrib* contrib = mContribMap.Get(pc, DBG_MAX_LOOKBACK); DbgCompileUnitContrib* contrib = mContribMap.Get(pc, DBG_MAX_LOOKBACK);
if ((contrib != NULL) && (pc >= contrib->mAddress) && (pc < contrib->mAddress + contrib->mLength)) if ((contrib != NULL) && (pc >= contrib->mAddress) && (pc < contrib->mAddress + contrib->mLength))
{ {
contrib->mDbgModule->ParseCompileUnit(contrib->mCompileUnitId); contrib->mDbgModule->ParseCompileUnit(contrib->mCompileUnitId);
} }
else if (onDemandKind != DbgOnDemandKind_None) else if (onDemandKind != DbgOnDemandKind_None)
{ {
@ -857,7 +855,7 @@ DbgSubprogram* DebugTarget::FindSubProgram(addr_target pc, DbgOnDemandKind onDem
} }
if (module->RequestDebugInfo(onDemandKind == DbgOnDemandKind_AllowRemote)) if (module->RequestDebugInfo(onDemandKind == DbgOnDemandKind_AllowRemote))
{ {
// Give another chance to ParseCompileUnit and then match again // Give another chance to ParseCompileUnit and then match again
found = true; found = true;
pass = -1; pass = -1;
@ -912,7 +910,7 @@ void DebugTarget::GetCompilerSettings()
} }
void DebugTarget::AddDbgModule(DbgModule* dbgModule) void DebugTarget::AddDbgModule(DbgModule* dbgModule)
{ {
dbgModule->mId = ++mCurModuleId; dbgModule->mId = ++mCurModuleId;
mDbgModules.Add(dbgModule); mDbgModules.Add(dbgModule);
bool success = mDbgModuleMap.TryAdd(dbgModule->mId, dbgModule); bool success = mDbgModuleMap.TryAdd(dbgModule->mId, dbgModule);
@ -944,7 +942,7 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
struct EntryHeader struct EntryHeader
{ {
uint8 mVersion; uint8 mVersion;
uint8 mPrologSize; uint8 mPrologSize;
uint8 mNumUnwindCodes; uint8 mNumUnwindCodes;
uint8 mFrameRegister; uint8 mFrameRegister;
@ -962,7 +960,7 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
//BF_ASSERT(version == 1); //BF_ASSERT(version == 1);
//uint8 prologSize = GET(uint8); //uint8 prologSize = GET(uint8);
//uint8 numUnwindCodes = GET(uint8); //uint8 numUnwindCodes = GET(uint8);
int dataSize = entryHeader.mNumUnwindCodes * 2; int dataSize = entryHeader.mNumUnwindCodes * 2;
@ -976,14 +974,12 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
uint8 dataBuf[512]; uint8 dataBuf[512];
dbgModule->mOrigImageData->Read(dbgModule->mImageBase + exceptionPos + sizeof(EntryHeader), dataBuf, dataSize); dbgModule->mOrigImageData->Read(dbgModule->mImageBase + exceptionPos + sizeof(EntryHeader), dataBuf, dataSize);
const uint8* data = dataBuf; const uint8* data = dataBuf;
if (flags & 1) // UNW_FLAG_EHANDLER if (flags & 1) // UNW_FLAG_EHANDLER
{ {
} }
else if (flags & 4) // UNW_FLAG_CHAININFO else if (flags & 4) // UNW_FLAG_CHAININFO
{ {
} }
/*if (pcAddress < exceptionDirectoryEntry->mAddress + prologSize) /*if (pcAddress < exceptionDirectoryEntry->mAddress + prologSize)
@ -999,16 +995,16 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
uint8 frameRegisterOffset = frameRegister >> 4; uint8 frameRegisterOffset = frameRegister >> 4;
frameRegister &= 15; frameRegister &= 15;
intptr_target newSP = 0; intptr_target newSP = 0;
const uint8* paramAreaStart = data; const uint8* paramAreaStart = data;
const uint8* dataEnd = data + entryHeader.mNumUnwindCodes * 2; const uint8* dataEnd = data + entryHeader.mNumUnwindCodes * 2;
while (data < dataEnd) while (data < dataEnd)
{ {
uint8 offsetInProlog = GET(uint8); uint8 offsetInProlog = GET(uint8);
uint8 unwindOpCode = GET(uint8); uint8 unwindOpCode = GET(uint8);
uint8 opInfo = unwindOpCode >> 4; uint8 opInfo = unwindOpCode >> 4;
unwindOpCode &= 15; unwindOpCode &= 15;
bool executeOp = pcAddress >= exceptionDirectoryEntry->mAddress - exceptionDirectoryEntry->mOrigAddressOffset + offsetInProlog; bool executeOp = pcAddress >= exceptionDirectoryEntry->mAddress - exceptionDirectoryEntry->mOrigAddressOffset + offsetInProlog;
@ -1024,7 +1020,7 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
{ {
// UWOP_ALLOC_LARGE // UWOP_ALLOC_LARGE
int allocSize = 0; int allocSize = 0;
if (opInfo == 0) if (opInfo == 0)
allocSize = (int)GET(uint16) * 8; allocSize = (int)GET(uint16) * 8;
else if (opInfo == 1) else if (opInfo == 1)
allocSize = (int)GET(int32); allocSize = (int)GET(int32);
@ -1034,7 +1030,7 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
else if ((unwindOpCode == 2) && (executeOp)) else if ((unwindOpCode == 2) && (executeOp))
{ {
// UWOP_ALLOC_SMALL // UWOP_ALLOC_SMALL
int allocSize = (int)opInfo * 8 + 8; int allocSize = (int)opInfo * 8 + 8;
*regSP += allocSize; *regSP += allocSize;
} }
else if ((unwindOpCode == 3) && (executeOp)) else if ((unwindOpCode == 3) && (executeOp))
@ -1096,7 +1092,7 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
alreadyRolledBackPC = true; alreadyRolledBackPC = true;
if (opInfo == 0) if (opInfo == 0)
{ {
addr_target regRIP; addr_target regRIP;
gDebugger->ReadMemory(*regSP, sizeof(intptr_target), &regRIP); // RIP (correct back trace) gDebugger->ReadMemory(*regSP, sizeof(intptr_target), &regRIP); // RIP (correct back trace)
*regSP += sizeof(intptr_target); *regSP += sizeof(intptr_target);
@ -1124,11 +1120,9 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
*regSP += 6 * sizeof(intptr_target); *regSP += 6 * sizeof(intptr_target);
} }
} }
} }
// Note: RCX/RDX are reversed // Note: RCX/RDX are reversed
} }
if (flags & 4) // UNW_FLAG_CHAININFO if (flags & 4) // UNW_FLAG_CHAININFO
@ -1146,7 +1140,6 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
return RollBackStackFrame_ExceptionDirectory(dbgModule->mImageBase + chainedRVAStart, registers, outReturnAddressLoc, alreadyRolledBackPC); return RollBackStackFrame_ExceptionDirectory(dbgModule->mImageBase + chainedRVAStart, registers, outReturnAddressLoc, alreadyRolledBackPC);
} }
return true; return true;
} }
@ -1175,7 +1168,7 @@ bool DebugTarget::PropogateRegisterUpCallStack_ExceptionDirectory(addr_target fi
struct EntryHeader struct EntryHeader
{ {
uint8 mVersion; uint8 mVersion;
uint8 mPrologSize; uint8 mPrologSize;
uint8 mNumUnwindCodes; uint8 mNumUnwindCodes;
uint8 mFrameRegister; uint8 mFrameRegister;
@ -1204,11 +1197,9 @@ bool DebugTarget::PropogateRegisterUpCallStack_ExceptionDirectory(addr_target fi
if (flags & 1) // UNW_FLAG_EHANDLER if (flags & 1) // UNW_FLAG_EHANDLER
{ {
} }
else if (flags & 4) // UNW_FLAG_CHAININFO else if (flags & 4) // UNW_FLAG_CHAININFO
{ {
} }
/*if (pcAddress < exceptionDirectoryEntry->mAddress + prologSize) /*if (pcAddress < exceptionDirectoryEntry->mAddress + prologSize)
@ -1224,16 +1215,16 @@ bool DebugTarget::PropogateRegisterUpCallStack_ExceptionDirectory(addr_target fi
uint8 frameRegisterOffset = frameRegister >> 4; uint8 frameRegisterOffset = frameRegister >> 4;
frameRegister &= 15; frameRegister &= 15;
intptr_target newSP = 0; intptr_target newSP = 0;
const uint8* paramAreaStart = data; const uint8* paramAreaStart = data;
const uint8* dataEnd = data + entryHeader.mNumUnwindCodes * 2; const uint8* dataEnd = data + entryHeader.mNumUnwindCodes * 2;
while (data < dataEnd) while (data < dataEnd)
{ {
uint8 offsetInProlog = GET(uint8); uint8 offsetInProlog = GET(uint8);
uint8 unwindOpCode = GET(uint8); uint8 unwindOpCode = GET(uint8);
uint8 opInfo = unwindOpCode >> 4; uint8 opInfo = unwindOpCode >> 4;
unwindOpCode &= 15; unwindOpCode &= 15;
bool executeOp = pcAddress >= exceptionDirectoryEntry->mAddress - exceptionDirectoryEntry->mOrigAddressOffset + offsetInProlog; bool executeOp = pcAddress >= exceptionDirectoryEntry->mAddress - exceptionDirectoryEntry->mOrigAddressOffset + offsetInProlog;
@ -1245,14 +1236,14 @@ bool DebugTarget::PropogateRegisterUpCallStack_ExceptionDirectory(addr_target fi
{ {
mDebugger->WriteMemory(regSP, regRef, sizeof(intptr_target)); mDebugger->WriteMemory(regSP, regRef, sizeof(intptr_target));
wasSaved = true; wasSaved = true;
} }
regSP += sizeof(intptr_target); regSP += sizeof(intptr_target);
} }
else if (unwindOpCode == 1) else if (unwindOpCode == 1)
{ {
// UWOP_ALLOC_LARGE // UWOP_ALLOC_LARGE
int allocSize = 0; int allocSize = 0;
if (opInfo == 0) if (opInfo == 0)
allocSize = (int)GET(uint16) * 8; allocSize = (int)GET(uint16) * 8;
else if (opInfo == 1) else if (opInfo == 1)
allocSize = (int)GET(int32); allocSize = (int)GET(int32);
@ -1262,7 +1253,7 @@ bool DebugTarget::PropogateRegisterUpCallStack_ExceptionDirectory(addr_target fi
else if ((unwindOpCode == 2) && (executeOp)) else if ((unwindOpCode == 2) && (executeOp))
{ {
// UWOP_ALLOC_SMALL // UWOP_ALLOC_SMALL
int allocSize = (int)opInfo * 8 + 8; int allocSize = (int)opInfo * 8 + 8;
regSP += allocSize; regSP += allocSize;
} }
else if ((unwindOpCode == 3) && (executeOp)) else if ((unwindOpCode == 3) && (executeOp))
@ -1336,9 +1327,9 @@ bool DebugTarget::PropogateRegisterUpCallStack_ExceptionDirectory(addr_target fi
// UWOP_PUSH_MACHFRAME // UWOP_PUSH_MACHFRAME
if (executeOp) if (executeOp)
{ {
if (opInfo == 0) if (opInfo == 0)
{ {
//addr_target regRIP; //addr_target regRIP;
//gDebugger->ReadMemory(*regSP, sizeof(intptr_target), &regRIP); // RIP (correct back trace) //gDebugger->ReadMemory(*regSP, sizeof(intptr_target), &regRIP); // RIP (correct back trace)
regSP += sizeof(intptr_target); regSP += sizeof(intptr_target);
@ -1366,11 +1357,9 @@ bool DebugTarget::PropogateRegisterUpCallStack_ExceptionDirectory(addr_target fi
regSP += 6 * sizeof(intptr_target); regSP += 6 * sizeof(intptr_target);
} }
} }
} }
// Note: RCX/RDX are reversed // Note: RCX/RDX are reversed
} }
if (flags & 4) // UNW_FLAG_CHAININFO if (flags & 4) // UNW_FLAG_CHAININFO
@ -1410,22 +1399,19 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
uint8 version = GET(uint8); uint8 version = GET(uint8);
uint8 flags = (version >> 3); uint8 flags = (version >> 3);
version &= 7; version &= 7;
uint8 prologSize = GET(uint8); uint8 prologSize = GET(uint8);
uint8 numUnwindCodes = GET(uint8); uint8 numUnwindCodes = GET(uint8);
if (exceptionDirectoryEntry->mAddress - dbgModule->mImageBase == 0x0000000000048efc) if (exceptionDirectoryEntry->mAddress - dbgModule->mImageBase == 0x0000000000048efc)
{ {
} }
if (flags & 1) // UNW_FLAG_EHANDLER if (flags & 1) // UNW_FLAG_EHANDLER
{ {
} }
else if (flags & 4) // UNW_FLAG_CHAININFO else if (flags & 4) // UNW_FLAG_CHAININFO
{ {
} }
/*if (pcAddress < exceptionDirectoryEntry->mAddress + prologSize) /*if (pcAddress < exceptionDirectoryEntry->mAddress + prologSize)
@ -1434,38 +1420,38 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
return false; return false;
}*/ }*/
addr_target* regSP = registers->GetSPRegisterRef(); addr_target* regSP = registers->GetSPRegisterRef();
int regFPOffset = 0; int regFPOffset = 0;
uint8 frameRegister = GET(uint8); uint8 frameRegister = GET(uint8);
uint8 frameRegisterOffset = frameRegister >> 4; uint8 frameRegisterOffset = frameRegister >> 4;
frameRegister &= 15; frameRegister &= 15;
intptr_target newSP = 0; intptr_target newSP = 0;
const uint8* paramAreaStart = data; const uint8* paramAreaStart = data;
const uint8* dataEnd = data + numUnwindCodes * 2; const uint8* dataEnd = data + numUnwindCodes * 2;
while (data < dataEnd) while (data < dataEnd)
{ {
uint8 offsetInProlog = GET(uint8); uint8 offsetInProlog = GET(uint8);
uint8 unwindOpCode = GET(uint8); uint8 unwindOpCode = GET(uint8);
uint8 opInfo = unwindOpCode >> 4; uint8 opInfo = unwindOpCode >> 4;
unwindOpCode &= 15; unwindOpCode &= 15;
bool executeOp = pcAddress >= exceptionDirectoryEntry->mAddress - exceptionDirectoryEntry->mOrigAddressOffset + offsetInProlog; bool executeOp = pcAddress >= exceptionDirectoryEntry->mAddress - exceptionDirectoryEntry->mOrigAddressOffset + offsetInProlog;
if ((unwindOpCode == 0) && (executeOp)) if ((unwindOpCode == 0) && (executeOp))
{ {
// UWOP_PUSH_NONVOL // UWOP_PUSH_NONVOL
intptr_target* regRef = registers->GetExceptionRegisterRef(opInfo); intptr_target* regRef = registers->GetExceptionRegisterRef(opInfo);
gDebugger->ReadMemory(*regSP, sizeof(intptr_target), regRef); gDebugger->ReadMemory(*regSP, sizeof(intptr_target), regRef);
*regSP += sizeof(intptr_target); *regSP += sizeof(intptr_target);
} }
else if (unwindOpCode == 1) else if (unwindOpCode == 1)
{ {
// UWOP_ALLOC_LARGE // UWOP_ALLOC_LARGE
int allocSize = 0; int allocSize = 0;
if (opInfo == 0) if (opInfo == 0)
allocSize = (int)GET(uint16) * 8; allocSize = (int)GET(uint16) * 8;
else if (opInfo == 1) else if (opInfo == 1)
allocSize = (int)GET(int32); allocSize = (int)GET(int32);
@ -1475,7 +1461,7 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
else if ((unwindOpCode == 2) && (executeOp)) else if ((unwindOpCode == 2) && (executeOp))
{ {
// UWOP_ALLOC_SMALL // UWOP_ALLOC_SMALL
int allocSize = (int)opInfo * 8 + 8; int allocSize = (int)opInfo * 8 + 8;
*regSP += allocSize; *regSP += allocSize;
} }
else if ((unwindOpCode == 3) && (executeOp)) else if ((unwindOpCode == 3) && (executeOp))
@ -1530,7 +1516,7 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
BF_ASSERT(0 == "Not supported"); BF_ASSERT(0 == "Not supported");
} }
// Note: RCX/RDX are reversed // Note: RCX/RDX are reversed
} }
if (flags & 4) // UNW_FLAG_CHAININFO if (flags & 4) // UNW_FLAG_CHAININFO
@ -1548,7 +1534,6 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
return RollBackStackFrame_ExceptionDirectory(dbgModule->mImageBase + chainedRVAStart, registers, outReturnAddressLoc); return RollBackStackFrame_ExceptionDirectory(dbgModule->mImageBase + chainedRVAStart, registers, outReturnAddressLoc);
} }
return true; return true;
} }
@ -1558,7 +1543,7 @@ bool DebugTarget::RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPUR
bool DebugTarget::RollBackStackFrame_ExceptionDirectory(CPURegisters* registers, addr_target* outReturnAddressLoc, bool& alreadyRolledBackPC) bool DebugTarget::RollBackStackFrame_ExceptionDirectory(CPURegisters* registers, addr_target* outReturnAddressLoc, bool& alreadyRolledBackPC)
{ {
addr_target pcAddress = (addr_target)registers->GetPC(); addr_target pcAddress = (addr_target)registers->GetPC();
return RollBackStackFrame_ExceptionDirectory(registers->GetPC(), registers, outReturnAddressLoc, alreadyRolledBackPC); return RollBackStackFrame_ExceptionDirectory(registers->GetPC(), registers, outReturnAddressLoc, alreadyRolledBackPC);
} }
@ -1583,7 +1568,7 @@ bool DebugTarget::RollBackStackFrame_DwFrameDescriptor(CPURegisters* registers,
auto dwFrameDescriptor = &stackFrameItr->second; auto dwFrameDescriptor = &stackFrameItr->second;
if (pcAddress > dwFrameDescriptor->mHighPC) if (pcAddress > dwFrameDescriptor->mHighPC)
return false; return false;
struct RegisterRuleData struct RegisterRuleData
{ {
public: public:
@ -1621,9 +1606,9 @@ bool DebugTarget::RollBackStackFrame_DwFrameDescriptor(CPURegisters* registers,
State rootState; State rootState;
rootState.mRegisterRuleDataIdx = DwarfReg_SP; rootState.mRegisterRuleDataIdx = DwarfReg_SP;
State* state = &rootState; State* state = &rootState;
// Set up default rule to restore stack pointer // Set up default rule to restore stack pointer
state->mRegisterRuleDataArray[state->mRegisterRuleDataIdx].mRegisterRule = DW_CFA_val_offset; state->mRegisterRuleDataArray[state->mRegisterRuleDataIdx].mRegisterRule = DW_CFA_val_offset;
state->mRegisterRuleDataArray[state->mRegisterRuleDataIdx].mParamOffset = 0; state->mRegisterRuleDataArray[state->mRegisterRuleDataIdx].mParamOffset = 0;
@ -1656,7 +1641,7 @@ bool DebugTarget::RollBackStackFrame_DwFrameDescriptor(CPURegisters* registers,
else else
{ {
switch (opCode) switch (opCode)
{ {
case DW_CFA_advance_loc1: case DW_CFA_advance_loc1:
curLoc += GET(uint8) * dwFrameDescriptor->mCommonFrameDescriptor->mCodeAlignmentFactor; curLoc += GET(uint8) * dwFrameDescriptor->mCommonFrameDescriptor->mCodeAlignmentFactor;
break; break;
@ -1719,7 +1704,7 @@ bool DebugTarget::RollBackStackFrame_DwFrameDescriptor(CPURegisters* registers,
{ {
int regNum = (int)DecodeULEB128(data); int regNum = (int)DecodeULEB128(data);
BF_ASSERT(regNum < CPURegisters::kNumIntRegs); BF_ASSERT(regNum < CPURegisters::kNumIntRegs);
int blockLen = (int)DecodeULEB128(data); int blockLen = (int)DecodeULEB128(data);
auto registerRuleData = &state->mRegisterRuleDataArray[regNum]; auto registerRuleData = &state->mRegisterRuleDataArray[regNum];
registerRuleData->mRegisterRule = DW_CFA_expression; registerRuleData->mRegisterRule = DW_CFA_expression;
registerRuleData->mParamOffset = blockLen; registerRuleData->mParamOffset = blockLen;
@ -1826,7 +1811,7 @@ bool DebugTarget::RollBackStackFrame_COFFFrameDescriptor(CPURegisters* registers
int stackPos = 0; int stackPos = 0;
COFFFrameProgram::Command stackCmds[8]; COFFFrameProgram::Command stackCmds[8];
addr_target stackValues[8]; addr_target stackValues[8];
addr_target temps[4]; addr_target temps[4];
auto _GetValue = [&](int stackPos) auto _GetValue = [&](int stackPos)
{ {
@ -1901,7 +1886,7 @@ bool DebugTarget::RollBackStackFrame_COFFFrameDescriptor(CPURegisters* registers
if (cmd == COFFFrameProgram::Command_None) if (cmd == COFFFrameProgram::Command_None)
break; break;
switch (cmd) switch (cmd)
{ {
case COFFFrameProgram::Command_EIP: case COFFFrameProgram::Command_EIP:
case COFFFrameProgram::Command_ESP: case COFFFrameProgram::Command_ESP:
case COFFFrameProgram::Command_EBP: case COFFFrameProgram::Command_EBP:
@ -1916,9 +1901,9 @@ bool DebugTarget::RollBackStackFrame_COFFFrameDescriptor(CPURegisters* registers
case COFFFrameProgram::Command_RASearch: case COFFFrameProgram::Command_RASearch:
if (stackPos >= 8) if (stackPos >= 8)
return false; return false;
stackCmds[stackPos++] = cmd; stackCmds[stackPos++] = cmd;
break; break;
case COFFFrameProgram::Command_Add: case COFFFrameProgram::Command_Add:
{ {
if (stackPos < 2) if (stackPos < 2)
return false; return false;
@ -1938,7 +1923,7 @@ bool DebugTarget::RollBackStackFrame_COFFFrameDescriptor(CPURegisters* registers
stackPos -= 2; stackPos -= 2;
stackValues[stackPos] = lhs - rhs; stackValues[stackPos] = lhs - rhs;
stackCmds[stackPos++] = COFFFrameProgram::Command_Value; stackCmds[stackPos++] = COFFFrameProgram::Command_Value;
} }
break; break;
case COFFFrameProgram::Command_Align: case COFFFrameProgram::Command_Align:
{ {
@ -1949,10 +1934,10 @@ bool DebugTarget::RollBackStackFrame_COFFFrameDescriptor(CPURegisters* registers
stackPos -= 2; stackPos -= 2;
stackValues[stackPos] = BF_ALIGN(lhs, rhs); stackValues[stackPos] = BF_ALIGN(lhs, rhs);
stackCmds[stackPos++] = COFFFrameProgram::Command_Value; stackCmds[stackPos++] = COFFFrameProgram::Command_Value;
} }
break; break;
case COFFFrameProgram::Command_Set: case COFFFrameProgram::Command_Set:
{ {
if (stackPos < 2) if (stackPos < 2)
return false; return false;
addr_target rhs = _GetValue(stackPos - 1); addr_target rhs = _GetValue(stackPos - 1);
@ -2002,15 +1987,15 @@ bool DebugTarget::RollBackStackFrame_COFFFrameDescriptor(CPURegisters* registers
} }
break; break;
case COFFFrameProgram::Command_Deref: case COFFFrameProgram::Command_Deref:
{ {
if (stackPos < 1) if (stackPos < 1)
return false; return false;
addr_target addr = _GetValue(stackPos - 1); addr_target addr = _GetValue(stackPos - 1);
stackPos--; stackPos--;
stackValues[stackPos] = mDebugger->ReadMemory<addr_target>(addr); stackValues[stackPos] = mDebugger->ReadMemory<addr_target>(addr);
stackCmds[stackPos++] = COFFFrameProgram::Command_Value; stackCmds[stackPos++] = COFFFrameProgram::Command_Value;
} }
break; break;
case COFFFrameProgram::Command_Value: case COFFFrameProgram::Command_Value:
{ {
if (stackPos >= 8) if (stackPos >= 8)
@ -2054,9 +2039,9 @@ bool DebugTarget::RollBackStackFrame(CPURegisters* registers, addr_target* outRe
{ {
if (outReturnAddressLoc != NULL) if (outReturnAddressLoc != NULL)
*outReturnAddressLoc = 0; *outReturnAddressLoc = 0;
CPUInst inst; CPUInst inst;
if (DecodeInstruction(registers->GetPC(), &inst)) if (DecodeInstruction(registers->GetPC(), &inst))
{ {
if (inst.IsReturn()) if (inst.IsReturn())
{ {
@ -2066,7 +2051,7 @@ bool DebugTarget::RollBackStackFrame(CPURegisters* registers, addr_target* outRe
} }
} }
#ifdef BF_DBG_32 #ifdef BF_DBG_32
if (RollBackStackFrame_DwFrameDescriptor(registers, outReturnAddressLoc)) if (RollBackStackFrame_DwFrameDescriptor(registers, outReturnAddressLoc))
return true; return true;
if (RollBackStackFrame_COFFFrameDescriptor(registers, outReturnAddressLoc, isStackStart)) if (RollBackStackFrame_COFFFrameDescriptor(registers, outReturnAddressLoc, isStackStart))
@ -2077,7 +2062,7 @@ bool DebugTarget::RollBackStackFrame(CPURegisters* registers, addr_target* outRe
{ {
if (pc == dbgSubprogram->mBlock.mLowPC) if (pc == dbgSubprogram->mBlock.mLowPC)
return RollBackStackFrame_SimpleRet(registers); return RollBackStackFrame_SimpleRet(registers);
auto dbgModule = dbgSubprogram->mCompileUnit->mDbgModule; auto dbgModule = dbgSubprogram->mCompileUnit->mDbgModule;
if ((dbgModule != NULL) && (!dbgModule->mParsedFrameDescriptors)) if ((dbgModule != NULL) && (!dbgModule->mParsedFrameDescriptors))
{ {
@ -2087,7 +2072,7 @@ bool DebugTarget::RollBackStackFrame(CPURegisters* registers, addr_target* outRe
} }
} }
else else
{ {
return RollBackStackFrame_SimpleRet(registers); return RollBackStackFrame_SimpleRet(registers);
} }
#endif #endif
@ -2107,7 +2092,7 @@ bool DebugTarget::RollBackStackFrame(CPURegisters* registers, addr_target* outRe
if (alreadyRolledBackPC) if (alreadyRolledBackPC)
return true; return true;
#ifdef BF_DBG_32 #ifdef BF_DBG_32
// Try rollback assuming a frame pointer // Try rollback assuming a frame pointer
addr_target newPC = 0; addr_target newPC = 0;
addr_target stackFrame = registers->GetBP(); addr_target stackFrame = registers->GetBP();
@ -2174,7 +2159,7 @@ int DebugTarget::GetFrameBaseRegister(DbgSubprogram* dwSubprogram)
} }
} }
#ifdef BF_DBG_32 #ifdef BF_DBG_32
if (dwSubprogram->mLocalBaseReg == DbgSubprogram::LocalBaseRegKind_VFRAME) if (dwSubprogram->mLocalBaseReg == DbgSubprogram::LocalBaseRegKind_VFRAME)
return X86Reg_EBP; return X86Reg_EBP;
else if (dwSubprogram->mLocalBaseReg == DbgSubprogram::LocalBaseRegKind_EBX) else if (dwSubprogram->mLocalBaseReg == DbgSubprogram::LocalBaseRegKind_EBX)
@ -2187,7 +2172,7 @@ int DebugTarget::GetFrameBaseRegister(DbgSubprogram* dwSubprogram)
return X64Reg_R13; return X64Reg_R13;
return X64Reg_RBP; return X64Reg_RBP;
#endif #endif
return -1; return -1;
} }
@ -2217,9 +2202,6 @@ bool DebugTarget::GetVariableIndexRegisterAndOffset(DbgVariable* dwVariable, int
//int64 BfDebuggerReadMemory(int64 addr); //int64 BfDebuggerReadMemory(int64 addr);
addr_target DebugTarget::GetStaticAddress(DbgVariable* dwVariable) addr_target DebugTarget::GetStaticAddress(DbgVariable* dwVariable)
{ {
DbgAddrType addrType; DbgAddrType addrType;
@ -2288,7 +2270,7 @@ bool DebugTarget::GetValueByNameInBlock_Helper(DbgSubprogram* dwSubprogram, DbgB
*outType = dwSubprogram->mCompileUnit->mDbgModule->GetConstType(*outType); *outType = dwSubprogram->mCompileUnit->mDbgModule->GetConstType(*outType);
} }
}; };
for (int varIdx = (int)checkVars.size() - 1; varIdx >= 0; varIdx--) for (int varIdx = (int)checkVars.size() - 1; varIdx >= 0; varIdx--)
{ {
auto variable = checkVars[varIdx]; auto variable = checkVars[varIdx];
@ -2349,7 +2331,7 @@ bool DebugTarget::GetValueByNameInBlock_Helper(DbgSubprogram* dwSubprogram, DbgB
return false; return false;
*outAddr = variable->mCompileUnit->mDbgModule->EvaluateLocation(dwSubprogram, variable->mLocationData, variable->mLocationLen, stackFrame, outAddrType); *outAddr = variable->mCompileUnit->mDbgModule->EvaluateLocation(dwSubprogram, variable->mLocationData, variable->mLocationLen, stackFrame, outAddrType);
_FixParam(variable); _FixParam(variable);
return true; return true;
@ -2361,7 +2343,7 @@ bool DebugTarget::GetValueByNameInBlock_Helper(DbgSubprogram* dwSubprogram, DbgB
if (dwBlock == &dwSubprogram->mBlock) if (dwBlock == &dwSubprogram->mBlock)
{ {
for (auto variable : dwSubprogram->mParams) for (auto variable : dwSubprogram->mParams)
{ {
if (variable->mName == NULL) if (variable->mName == NULL)
continue; continue;
@ -2435,22 +2417,20 @@ bool DebugTarget::GetValueByNameInBlock(DbgSubprogram* dwSubprogram, DbgBlock* d
if (GetValueByNameInBlock(dwSubprogram, subBlock, name, stackFrame, outAddr, outType, outAddrType)) if (GetValueByNameInBlock(dwSubprogram, subBlock, name, stackFrame, outAddr, outType, outAddrType))
return true; return true;
} }
if (GetValueByNameInBlock_Helper(dwSubprogram, dwBlock, name, stackFrame, outAddr, outType, outAddrType)) if (GetValueByNameInBlock_Helper(dwSubprogram, dwBlock, name, stackFrame, outAddr, outType, outAddrType))
return true; return true;
return false; return false;
} }
const DbgMemoryFlags DebugTarget::ReadOrigImageData(addr_target address, uint8* data, int size) const DbgMemoryFlags DebugTarget::ReadOrigImageData(addr_target address, uint8* data, int size)
{ {
for (auto dwarf : mDbgModules) for (auto dwarf : mDbgModules)
{ {
if ((address >= dwarf->mImageBase) && (address < dwarf->mImageBase + dwarf->mImageSize) && (dwarf->mOrigImageData != NULL)) if ((address >= dwarf->mImageBase) && (address < dwarf->mImageBase + dwarf->mImageSize) && (dwarf->mOrigImageData != NULL))
{ {
return dwarf->mOrigImageData->Read(address, data, size); return dwarf->mOrigImageData->Read(address, data, size);
} }
//return dbgModule->mOrigImageData + (address - dbgModule->mImageBase); //return dbgModule->mOrigImageData + (address - dbgModule->mImageBase);
} }
@ -2463,13 +2443,12 @@ bool DebugTarget::DecodeInstruction(addr_target address, CPUInst* inst)
for (auto dwarf : mDbgModules) for (auto dwarf : mDbgModules)
{ {
if ((address >= dwarf->mImageBase) && (address < dwarf->mImageBase + dwarf->mImageSize) && (dwarf->mOrigImageData != NULL)) if ((address >= dwarf->mImageBase) && (address < dwarf->mImageBase + dwarf->mImageSize) && (dwarf->mOrigImageData != NULL))
{ {
return mDebugger->mCPU->Decode(address, dwarf->mOrigImageData, inst); return mDebugger->mCPU->Decode(address, dwarf->mOrigImageData, inst);
} }
} }
return false; return false;
} }
DbgBreakKind DebugTarget::GetDbgBreakKind(addr_target address, CPURegisters* registers, intptr_target* objAddr) DbgBreakKind DebugTarget::GetDbgBreakKind(addr_target address, CPURegisters* registers, intptr_target* objAddr)
@ -2477,14 +2456,13 @@ DbgBreakKind DebugTarget::GetDbgBreakKind(addr_target address, CPURegisters* reg
for (auto dwarf : mDbgModules) for (auto dwarf : mDbgModules)
{ {
if ((address >= dwarf->mImageBase) && (address < dwarf->mImageBase + dwarf->mImageSize) && (dwarf->mOrigImageData != NULL)) if ((address >= dwarf->mImageBase) && (address < dwarf->mImageBase + dwarf->mImageSize) && (dwarf->mOrigImageData != NULL))
{ {
auto result = mDebugger->mCPU->GetDbgBreakKind(address, dwarf->mOrigImageData, registers->mIntRegsArray, objAddr); auto result = mDebugger->mCPU->GetDbgBreakKind(address, dwarf->mOrigImageData, registers->mIntRegsArray, objAddr);
return result; return result;
} }
} }
return DbgBreakKind_None; return DbgBreakKind_None;
} }
DbgModule* DebugTarget::FindDbgModuleForAddress(addr_target address) DbgModule* DebugTarget::FindDbgModuleForAddress(addr_target address)
@ -2499,7 +2477,7 @@ DbgModule* DebugTarget::FindDbgModuleForAddress(addr_target address)
} }
DbgModule* DebugTarget::GetMainDbgModule() DbgModule* DebugTarget::GetMainDbgModule()
{ {
return mTargetBinary; return mTargetBinary;
} }
@ -2527,12 +2505,12 @@ void ReportRadixMap(MemReporter* memReporter, RadixMap64<T>& radixMap)
auto mid = radixMap.mRoot[rootIdx]; auto mid = radixMap.mRoot[rootIdx];
if (mid != NULL) if (mid != NULL)
{ {
memReporter->Add(sizeof(RadixMap64<T>::Mid)); memReporter->Add(sizeof(RadixMap64<T>::Mid));
for (int midIdx = 0; midIdx < RadixMap64<T>::MID_LENGTH; midIdx++) for (int midIdx = 0; midIdx < RadixMap64<T>::MID_LENGTH; midIdx++)
{ {
auto leaf = mid->mLeafs[midIdx]; auto leaf = mid->mLeafs[midIdx];
if (leaf != NULL) if (leaf != NULL)
{ {
memReporter->Add(sizeof(RadixMap64<T>::Leaf)); memReporter->Add(sizeof(RadixMap64<T>::Leaf));
} }
} }
@ -2614,7 +2592,6 @@ struct VectorRemoveCtx
mVec->RemoveRange(mMatchStartIdx, (int)mVec->size() - mMatchStartIdx); mVec->RemoveRange(mMatchStartIdx, (int)mVec->size() - mMatchStartIdx);
mFinished = true; mFinished = true;
} }
}; };
void DebugTarget::RemoveTargetData() void DebugTarget::RemoveTargetData()
@ -2638,11 +2615,11 @@ void DebugTarget::RemoveTargetData()
problemModule = node->mDbgModule; problemModule = node->mDbgModule;
//OutputDebugStrF("Should have been removed by DbgModule::RemoveTargetData %@ %s\n", node->mAddress, node->mName); //OutputDebugStrF("Should have been removed by DbgModule::RemoveTargetData %@ %s\n", node->mAddress, node->mName);
BF_DBG_FATAL("Should have been removed by DbgModule::RemoveTargetData"); BF_DBG_FATAL("Should have been removed by DbgModule::RemoveTargetData");
mSymbolMap.Remove(node); mSymbolMap.Remove(node);
} }
node = next; node = next;
} }
} }
if (problemModule != NULL) if (problemModule != NULL)
{ {
@ -2672,13 +2649,13 @@ void DebugTarget::RemoveTargetData()
{ {
auto next = node->mNext; auto next = node->mNext;
if (node->mDbgModule->mDeleting) if (node->mDbgModule->mDeleting)
{ {
//BF_DBG_FATAL("Should have been removed by DbgModule::RemoveTargetData"); //BF_DBG_FATAL("Should have been removed by DbgModule::RemoveTargetData");
mExceptionDirectoryMap.Remove(node); mExceptionDirectoryMap.Remove(node);
} }
node = next; node = next;
} }
} }
#endif #endif
VectorRemoveCtx<Array<DwCommonFrameDescriptor*>> cieRemoveCtx(mCommonFrameDescriptors); VectorRemoveCtx<Array<DwCommonFrameDescriptor*>> cieRemoveCtx(mCommonFrameDescriptors);
@ -2698,4 +2675,4 @@ void DebugTarget::RemoveTargetData()
else else
++frameDescItr; ++frameDescItr;
} }
} }

View file

@ -23,13 +23,13 @@ class DebugTarget
public: public:
WinDebugger* mDebugger; WinDebugger* mDebugger;
DbgRadixMap<DbgSymbol*> mSymbolMap; DbgRadixMap<DbgSymbol*> mSymbolMap;
DbgAutoStaticEntryBucketMap mAutoStaticEntryBucketMap; DbgAutoStaticEntryBucketMap mAutoStaticEntryBucketMap;
Array<Array<DbgAutoStaticEntry> > mAutoStaticEntryBuckets; Array<Array<DbgAutoStaticEntry> > mAutoStaticEntryBuckets;
DbgRadixMap<DbgSubprogramMapEntry*> mSubprogramMap; DbgRadixMap<DbgSubprogramMapEntry*> mSubprogramMap;
DbgRadixMap<DbgExceptionDirectoryEntry*> mExceptionDirectoryMap; DbgRadixMap<DbgExceptionDirectoryEntry*> mExceptionDirectoryMap;
DbgRadixMap<DbgCompileUnitContrib*> mContribMap; DbgRadixMap<DbgCompileUnitContrib*> mContribMap;
Array<String>* mCapturedNamesPtr; Array<String>* mCapturedNamesPtr;
Array<DbgType*>* mCapturedTypesPtr; Array<DbgType*>* mCapturedTypesPtr;
@ -37,17 +37,17 @@ public:
int mLastHotHeapCleanIdx; int mLastHotHeapCleanIdx;
String mTargetPath; String mTargetPath;
DbgModule* mLaunchBinary; DbgModule* mLaunchBinary;
DbgModule* mTargetBinary; DbgModule* mTargetBinary;
Array<DbgModule*> mDbgModules; Array<DbgModule*> mDbgModules;
Dictionary<int, DbgModule*> mDbgModuleMap; Dictionary<int, DbgModule*> mDbgModuleMap;
HashSet<DbgSrcFile*> mPendingSrcFileRehup; // Waiting to remove old/invalid line info HashSet<DbgSrcFile*> mPendingSrcFileRehup; // Waiting to remove old/invalid line info
BumpAllocator mAlloc; BumpAllocator mAlloc;
bool mWasLocallyBuilt; bool mWasLocallyBuilt;
bool mIsEmpty; bool mIsEmpty;
bool mCheckedCompilerSettings; bool mCheckedCompilerSettings;
bool mBfObjectHasFlags; bool mBfObjectHasFlags;
bool mBfObjectHasVDataExtender; bool mBfObjectHasVDataExtender;
bool mBfHasLargeStrings; bool mBfHasLargeStrings;
bool mBfHasLargeCollections; bool mBfHasLargeCollections;
int mBfObjectVDataIntefaceSlotCount; int mBfObjectVDataIntefaceSlotCount;
@ -57,11 +57,11 @@ public:
Array<DwCommonFrameDescriptor*> mCommonFrameDescriptors; Array<DwCommonFrameDescriptor*> mCommonFrameDescriptors;
std::map<addr_target, DwFrameDescriptor> mDwFrameDescriptorMap; std::map<addr_target, DwFrameDescriptor> mDwFrameDescriptorMap;
std::map<addr_target, COFFFrameDescriptorEntry> mCOFFFrameDescriptorMap; std::map<addr_target, COFFFrameDescriptorEntry> mCOFFFrameDescriptorMap;
Dictionary<String, DbgSrcFile*> mSrcFiles; Dictionary<String, DbgSrcFile*> mSrcFiles;
Dictionary<String, String> mLocalToOrigSrcMap; Dictionary<String, String> mLocalToOrigSrcMap;
protected: protected:
bool RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPURegisters* registers, addr_target* outReturnAddressLoc, bool& alreadyRolledBackPC); bool RollBackStackFrame_ExceptionDirectory(addr_target findPC, CPURegisters* registers, addr_target* outReturnAddressLoc, bool& alreadyRolledBackPC);
bool RollBackStackFrame_ExceptionDirectory(CPURegisters* registers, addr_target* outReturnAddressLoc, bool& alreadyRolledBackPC); bool RollBackStackFrame_ExceptionDirectory(CPURegisters* registers, addr_target* outReturnAddressLoc, bool& alreadyRolledBackPC);
bool RollBackStackFrame_DwFrameDescriptor(CPURegisters* registers, addr_target* outReturnAddressLoc); bool RollBackStackFrame_DwFrameDescriptor(CPURegisters* registers, addr_target* outReturnAddressLoc);
@ -74,7 +74,7 @@ protected:
public: public:
DebugTarget(WinDebugger* debugger); DebugTarget(WinDebugger* debugger);
~DebugTarget(); ~DebugTarget();
void AddDbgModule(DbgModule* dbgModule); void AddDbgModule(DbgModule* dbgModule);
DbgModule* Init(const StringImpl& launchPath, const StringImpl& targetPath, intptr imageBase = 0); DbgModule* Init(const StringImpl& launchPath, const StringImpl& targetPath, intptr imageBase = 0);
void SetupTargetBinary(); void SetupTargetBinary();
@ -89,8 +89,8 @@ public:
DbgSrcFile* GetSrcFile(const String& srcFilePath); DbgSrcFile* GetSrcFile(const String& srcFilePath);
bool FindSymbolAt(addr_target addr, String* outSymbol, addr_target* outOffset = NULL, DbgModule** outDWARF = NULL, bool allowRemote = true); bool FindSymbolAt(addr_target addr, String* outSymbol, addr_target* outOffset = NULL, DbgModule** outDWARF = NULL, bool allowRemote = true);
addr_target FindSymbolAddr(const StringImpl& name); addr_target FindSymbolAddr(const StringImpl& name);
addr_target GetStaticAddress(DbgVariable* dwVariable); addr_target GetStaticAddress(DbgVariable* dwVariable);
DbgSubprogram* FindSubProgram(addr_target address, DbgOnDemandKind onDemandKind = DbgOnDemandKind_AllowRemote); DbgSubprogram* FindSubProgram(addr_target address, DbgOnDemandKind onDemandKind = DbgOnDemandKind_AllowRemote);
void GetCompilerSettings(); void GetCompilerSettings();
@ -103,7 +103,7 @@ public:
bool GetValueByNameInBlock(DbgSubprogram* dwSubprogram, DbgBlock* dwBlock, String& name, WdStackFrame* stackFrame, intptr* outAddr, DbgType** outType, DbgAddrType* outAddrType); bool GetValueByNameInBlock(DbgSubprogram* dwSubprogram, DbgBlock* dwBlock, String& name, WdStackFrame* stackFrame, intptr* outAddr, DbgType** outType, DbgAddrType* outAddrType);
void GetAutoValueNames(DbgAutoValueMapType& outAutos, WdStackFrame* stackFrame, uint64 memoryRangeStart, uint64 memoryRangeLen); void GetAutoValueNames(DbgAutoValueMapType& outAutos, WdStackFrame* stackFrame, uint64 memoryRangeStart, uint64 memoryRangeLen);
void GetAutoValueNamesInBlock(DbgAutoValueMapType& outAutos, DbgSubprogram* dwSubprogram, DbgBlock* dwBlock, WdStackFrame* stackFrame, uint64 memoryRangeStart, uint64 memoryRangeLen); void GetAutoValueNamesInBlock(DbgAutoValueMapType& outAutos, DbgSubprogram* dwSubprogram, DbgBlock* dwBlock, WdStackFrame* stackFrame, uint64 memoryRangeStart, uint64 memoryRangeLen);
bool GetAutoLocalsInBlock(Array<String>& outLocals, DbgSubprogram* dwSubprogram, DbgBlock* dwBlock, WdStackFrame* stackFrame, DbgLineData* dwLineData); bool GetAutoLocalsInBlock(Array<String>& outLocals, DbgSubprogram* dwSubprogram, DbgBlock* dwBlock, WdStackFrame* stackFrame, DbgLineData* dwLineData);
bool RollBackStackFrame(CPURegisters* registers, addr_target* outReturnAddressLoc, bool isStackStart); bool RollBackStackFrame(CPURegisters* registers, addr_target* outReturnAddressLoc, bool isStackStart);
bool PropogateRegisterUpCallStack(CPURegisters* callerRegisters, CPURegisters* calleeRegisters, void* regPtr, bool& wasSaved); bool PropogateRegisterUpCallStack(CPURegisters* callerRegisters, CPURegisters* calleeRegisters, void* regPtr, bool& wasSaved);
int GetFrameBaseRegister(DbgSubprogram* dwSubprogram); int GetFrameBaseRegister(DbgSubprogram* dwSubprogram);

View file

@ -15,7 +15,7 @@ class DwAutoComplete : public Beefy::AutoCompleteBase
public: public:
class MethodMatchEntry class MethodMatchEntry
{ {
public: public:
DwTypeVector mDwGenericArguments; DwTypeVector mDwGenericArguments;
DbgSubprogram* mDwSubprogram; DbgSubprogram* mDwSubprogram;
}; };

View file

@ -149,7 +149,7 @@ void HDCheckHandles(const std::string& traceStr)
handleInfo = (PSYSTEM_HANDLE_INFORMATION)malloc(handleInfoSize); handleInfo = (PSYSTEM_HANDLE_INFORMATION)malloc(handleInfoSize);
NTSTATUS status; NTSTATUS status;
/* NtQuerySystemInformation won't give us the correct buffer size, /* NtQuerySystemInformation won't give us the correct buffer size,
so we guess by doubling the buffer size. */ so we guess by doubling the buffer size. */
while ((status = gNtQuerySystemInformation( while ((status = gNtQuerySystemInformation(
SystemHandleInformation, SystemHandleInformation,
@ -181,7 +181,7 @@ void HDCheckHandles(const std::string& traceStr)
/* Check if this handle belongs to the PID the user specified. */ /* Check if this handle belongs to the PID the user specified. */
if (handle.ProcessId != GetCurrentProcessId()) if (handle.ProcessId != GetCurrentProcessId())
continue; continue;
auto itr = oldHandleMap.find(handle.Handle); auto itr = oldHandleMap.find(handle.Handle);
if (itr != oldHandleMap.end()) if (itr != oldHandleMap.end())
gHDHandleMap.insert(*itr); gHDHandleMap.insert(*itr);
@ -261,7 +261,7 @@ void HDDump()
continue; continue;
} }
/* Query the object name (unless it has an access of /* Query the object name (unless it has an access of
0x0012019f, on which NtQueryObject could hang. */ 0x0012019f, on which NtQueryObject could hang. */
if (handle.GrantedAccess == 0x0012019f) if (handle.GrantedAccess == 0x0012019f)
{ {
@ -375,7 +375,7 @@ int ZZwmain(int argc, WCHAR *argv[])
handleInfo = (PSYSTEM_HANDLE_INFORMATION)malloc(handleInfoSize); handleInfo = (PSYSTEM_HANDLE_INFORMATION)malloc(handleInfoSize);
/* NtQuerySystemInformation won't give us the correct buffer size, /* NtQuerySystemInformation won't give us the correct buffer size,
so we guess by doubling the buffer size. */ so we guess by doubling the buffer size. */
while ((status = NtQuerySystemInformation( while ((status = NtQuerySystemInformation(
SystemHandleInformation, SystemHandleInformation,
@ -435,7 +435,7 @@ int ZZwmain(int argc, WCHAR *argv[])
continue; continue;
} }
/* Query the object name (unless it has an access of /* Query the object name (unless it has an access of
0x0012019f, on which NtQueryObject could hang. */ 0x0012019f, on which NtQueryObject could hang. */
if (handle.GrantedAccess == 0x0012019f) if (handle.GrantedAccess == 0x0012019f)
{ {
@ -520,4 +520,4 @@ int ZZwmain(int argc, WCHAR *argv[])
CloseHandle(processHandle); CloseHandle(processHandle);
return 0; return 0;
} }

View file

@ -14,7 +14,7 @@ HotHeap::HotHeap(addr_target hotStart, int size)
} }
HotHeap::HotHeap() HotHeap::HotHeap()
{ {
mHotAreaStart = 0xFFFFFFFF; mHotAreaStart = 0xFFFFFFFF;
mHotAreaSize = 0; mHotAreaSize = 0;
mCurBlockIdx = 0; mCurBlockIdx = 0;
@ -59,17 +59,17 @@ addr_target HotHeap::Alloc(int size)
} }
if (!isOccupied) if (!isOccupied)
{ {
mBlockAllocIdx += blockCount; mBlockAllocIdx += blockCount;
addr_target addr = mHotAreaStart + mCurBlockIdx * BLOCK_SIZE; addr_target addr = mHotAreaStart + mCurBlockIdx * BLOCK_SIZE;
OutputDebugStrF("HotHeap Alloc %d length %d %@\n", mCurBlockIdx, blockCount, addr); OutputDebugStrF("HotHeap Alloc %d length %d %@\n", mCurBlockIdx, blockCount, addr);
for (int checkIdx = 0; checkIdx < blockCount; checkIdx++) for (int checkIdx = 0; checkIdx < blockCount; checkIdx++)
{ {
mHotAreaUsed[mCurBlockIdx] = (HotUseFlags)(mHotAreaUsed[mCurBlockIdx] | HotUseFlags_Allocated); mHotAreaUsed[mCurBlockIdx] = (HotUseFlags)(mHotAreaUsed[mCurBlockIdx] | HotUseFlags_Allocated);
mCurBlockIdx++; mCurBlockIdx++;
} }
return addr; return addr;
} }
} }
@ -100,7 +100,7 @@ void HotHeap::Release(addr_target addr, int size)
} }
bool HotHeap::IsReferenced(addr_target addr, int size) bool HotHeap::IsReferenced(addr_target addr, int size)
{ {
int blockStart = (int)(addr - mHotAreaStart) / BLOCK_SIZE; int blockStart = (int)(addr - mHotAreaStart) / BLOCK_SIZE;
int blockCount = (size + BLOCK_SIZE - 1) / BLOCK_SIZE; int blockCount = (size + BLOCK_SIZE - 1) / BLOCK_SIZE;
for (int blockNum = blockStart; blockNum < blockStart + blockCount; blockNum++) for (int blockNum = blockStart; blockNum < blockStart + blockCount; blockNum++)
@ -111,7 +111,7 @@ bool HotHeap::IsReferenced(addr_target addr, int size)
void HotHeap::MarkBlockReferenced(addr_target addr) void HotHeap::MarkBlockReferenced(addr_target addr)
{ {
int blockNum = (int)(addr - mHotAreaStart) / BLOCK_SIZE; int blockNum = (int)(addr - mHotAreaStart) / BLOCK_SIZE;
mHotAreaUsed[blockNum] = (HotUseFlags)(mHotAreaUsed[blockNum] | HotUseFlags_Referenced); mHotAreaUsed[blockNum] = (HotUseFlags)(mHotAreaUsed[blockNum] | HotUseFlags_Referenced);
} }
@ -124,7 +124,7 @@ void HotHeap::ClearReferencedFlags()
} }
intptr_target HotHeap::GetUsedSize() intptr_target HotHeap::GetUsedSize()
{ {
if (mTrackedMap.size() != 0) if (mTrackedMap.size() != 0)
{ {
int usedBytes = 0; int usedBytes = 0;
@ -133,7 +133,7 @@ intptr_target HotHeap::GetUsedSize()
return usedBytes; return usedBytes;
} }
int usedCount = 0; int usedCount = 0;
for (auto flag : mHotAreaUsed) for (auto flag : mHotAreaUsed)
if ((flag & HotUseFlags_Allocated) != 0) if ((flag & HotUseFlags_Allocated) != 0)
usedCount++; usedCount++;

View file

@ -18,10 +18,10 @@ public:
public: public:
static const int BLOCK_SIZE = 4096; static const int BLOCK_SIZE = 4096;
addr_target mHotAreaStart; addr_target mHotAreaStart;
int mHotAreaSize; int mHotAreaSize;
Beefy::Array<HotUseFlags> mHotAreaUsed; Beefy::Array<HotUseFlags> mHotAreaUsed;
int mCurBlockIdx; int mCurBlockIdx;
int mBlockAllocIdx; // Total blocks allocated, doesn't decrease with frees int mBlockAllocIdx; // Total blocks allocated, doesn't decrease with frees
@ -31,9 +31,9 @@ public:
public: public:
HotHeap(addr_target hotStart, int size); HotHeap(addr_target hotStart, int size);
HotHeap(); HotHeap();
void AddTrackedRegion(addr_target hotStart, int size); void AddTrackedRegion(addr_target hotStart, int size);
addr_target Alloc(int size); addr_target Alloc(int size);
void Release(addr_target addr, int size); void Release(addr_target addr, int size);
void MarkBlockReferenced(addr_target addr); void MarkBlockReferenced(addr_target addr);

View file

@ -12,7 +12,7 @@ DbgHotScanner::DbgHotScanner(WinDebugger* debugger)
NS_BF_DBG_BEGIN NS_BF_DBG_BEGIN
namespace TCFake namespace TCFake
{ {
struct Span struct Span
{ {
addr_target start; // Starting page number addr_target start; // Starting page number
@ -45,7 +45,7 @@ struct Fake_BfObject_WithFlags
{ {
union union
{ {
addr_target mClassVData; addr_target mClassVData;
struct struct
{ {
BfObjectFlags mObjectFlags; BfObjectFlags mObjectFlags;
@ -154,15 +154,15 @@ void DbgHotScanner::ScanSpan(TCFake::Span* span, int expectedStartPage, int memK
intptr pageSize = (intptr)1 << kPageShift; intptr pageSize = (intptr)1 << kPageShift;
int spanSize = pageSize * span->length; int spanSize = pageSize * span->length;
addr_target spanStart = ((addr_target)span->start << kPageShift); addr_target spanStart = ((addr_target)span->start << kPageShift);
if (spanSize > mScanData.size()) if (spanSize > mScanData.size())
{ {
mScanData.Resize(spanSize); mScanData.Resize(spanSize);
} }
void* spanPtr = &mScanData[0]; void* spanPtr = &mScanData[0];
mDebugger->ReadMemory(spanStart, spanSize, spanPtr); mDebugger->ReadMemory(spanStart, spanSize, spanPtr);
void* spanEnd = (void*)((intptr)spanPtr + spanSize); void* spanEnd = (void*)((intptr)spanPtr + spanSize);
//BF_LOGASSERT((spanStart >= TCFake::PageHeap::sAddressStart) && (spanEnd <= TCFake::PageHeap::sAddressEnd)); //BF_LOGASSERT((spanStart >= TCFake::PageHeap::sAddressStart) && (spanEnd <= TCFake::PageHeap::sAddressEnd));
int elementSize = mDbgGCData.mSizeClasses[span->sizeclass]; int elementSize = mDbgGCData.mSizeClasses[span->sizeclass];
@ -211,9 +211,8 @@ void DbgHotScanner::ScanSpan(TCFake::Span* span, int expectedStartPage, int memK
if ((mDbgGCData.mDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0) if ((mDbgGCData.mDbgFlags & BfRtFlags_ObjectHasDebugFlags) != 0)
classVDataAddr = classVDataAddr & ~0xFF; classVDataAddr = classVDataAddr & ~0xFF;
} }
else else
{ {
int* rawTypeIdPtr = NULL; int* rawTypeIdPtr = NULL;
if (mFoundRawAllocDataAddrs.TryAdd(rawAllocDataAddr, NULL, &rawTypeIdPtr)) if (mFoundRawAllocDataAddrs.TryAdd(rawAllocDataAddr, NULL, &rawTypeIdPtr))
{ {
@ -231,8 +230,8 @@ void DbgHotScanner::ScanSpan(TCFake::Span* span, int expectedStartPage, int memK
*typeAddrIdPtr = typeData.mTypeId; *typeAddrIdPtr = typeData.mTypeId;
*rawTypeIdPtr = typeData.mTypeId; *rawTypeIdPtr = typeData.mTypeId;
_MarkTypeUsed(typeData.mTypeId, elementSize); _MarkTypeUsed(typeData.mTypeId, elementSize);
} }
} }
else else
{ {
_MarkTypeUsed(*typeAddrIdPtr, elementSize); _MarkTypeUsed(*typeAddrIdPtr, elementSize);
@ -249,7 +248,7 @@ void DbgHotScanner::ScanSpan(TCFake::Span* span, int expectedStartPage, int memK
if (classVDataAddr != 0) if (classVDataAddr != 0)
{ {
int* typeIdPtr = NULL; int* typeIdPtr = NULL;
if (mFoundClassVDataAddrs.TryAdd(classVDataAddr, NULL, &typeIdPtr)) if (mFoundClassVDataAddrs.TryAdd(classVDataAddr, NULL, &typeIdPtr))
{ {
addr_target typeAddr = mDebugger->ReadMemory<addr_target>(classVDataAddr); addr_target typeAddr = mDebugger->ReadMemory<addr_target>(classVDataAddr);
@ -271,7 +270,7 @@ void DbgHotScanner::ScanSpan(TCFake::Span* span, int expectedStartPage, int memK
} }
else else
{ {
_MarkTypeUsed(*typeIdPtr, elementSize); _MarkTypeUsed(*typeIdPtr, elementSize);
} }
} }
@ -296,7 +295,7 @@ void DbgHotScanner::ScanRoot(addr_target rootPtr, int memKind)
if (spanAddr == 0) if (spanAddr == 0)
continue; continue;
int expectedStartPage = (rootIdx * PageHeap::PageMap::LEAF_LENGTH) + leafIdx; int expectedStartPage = (rootIdx * PageHeap::PageMap::LEAF_LENGTH) + leafIdx;
TCFake::Span span; TCFake::Span span;
mDebugger->ReadMemory(spanAddr, sizeof(span), &span); mDebugger->ReadMemory(spanAddr, sizeof(span), &span);
ScanSpan(&span, expectedStartPage, memKind); ScanSpan(&span, expectedStartPage, memKind);
@ -367,7 +366,7 @@ void DbgHotScanner::Scan(DbgHotResolveFlags flags)
bool success = mDebugger->ReadMemory(gcDbgDataAddr, sizeof(DbgGCData), &mDbgGCData); bool success = mDebugger->ReadMemory(gcDbgDataAddr, sizeof(DbgGCData), &mDbgGCData);
if (!success) if (!success)
{ {
BF_ASSERT("Failed to read DbgGCData"); BF_ASSERT("Failed to read DbgGCData");
success = mDebugger->ReadMemory(gcDbgDataAddr, sizeof(DbgGCData), &mDbgGCData); success = mDebugger->ReadMemory(gcDbgDataAddr, sizeof(DbgGCData), &mDbgGCData);
} }
@ -376,7 +375,7 @@ void DbgHotScanner::Scan(DbgHotResolveFlags flags)
if (mDbgGCData.mObjRootPtr != NULL) if (mDbgGCData.mObjRootPtr != NULL)
ScanRoot(mDbgGCData.mObjRootPtr, 0); ScanRoot(mDbgGCData.mObjRootPtr, 0);
if (mDbgGCData.mRawRootPtr != NULL) if (mDbgGCData.mRawRootPtr != NULL)
ScanRoot(mDbgGCData.mRawRootPtr, 1); ScanRoot(mDbgGCData.mRawRootPtr, 1);
} }
if ((prevRunState == RunState_Running) && ((flags & DbgHotResolveFlag_KeepThreadState) == 0)) if ((prevRunState == RunState_Running) && ((flags & DbgHotResolveFlag_KeepThreadState) == 0))
@ -384,4 +383,4 @@ void DbgHotScanner::Scan(DbgHotResolveFlags flags)
mDebugger->ThreadRestoreUnpause(); mDebugger->ThreadRestoreUnpause();
mDebugger->mRunState = prevRunState; mDebugger->mRunState = prevRunState;
} }
} }

View file

@ -76,7 +76,7 @@ public:
addr_target mRawRootPtr; addr_target mRawRootPtr;
addr_target mRawObjectSentinel; addr_target mRawObjectSentinel;
int mSizeClasses[TCFake::kNumClasses]; int mSizeClasses[TCFake::kNumClasses];
}; };
class DbgHotScanner class DbgHotScanner
@ -88,7 +88,7 @@ public:
Beefy::Dictionary<addr_target, int> mFoundRawAllocDataAddrs; Beefy::Dictionary<addr_target, int> mFoundRawAllocDataAddrs;
Beefy::Dictionary<addr_target, int> mFoundTypeAddrs; Beefy::Dictionary<addr_target, int> mFoundTypeAddrs;
Beefy::HashSet<addr_target> mFoundFuncPtrs; Beefy::HashSet<addr_target> mFoundFuncPtrs;
#ifdef BF_DBG_32 #ifdef BF_DBG_32
TCFake::PageHeap::PageMap::Root mRoot; TCFake::PageHeap::PageMap::Root mRoot;
TCFake::PageHeap::PageMap::Leaf mNode; TCFake::PageHeap::PageMap::Leaf mNode;
@ -97,7 +97,7 @@ public:
TCFake::PageHeap::PageMap::Node mNode1; TCFake::PageHeap::PageMap::Node mNode1;
TCFake::PageHeap::PageMap::Leaf mNode2; TCFake::PageHeap::PageMap::Leaf mNode2;
#endif #endif
Beefy::Array<uint8> mScanData; Beefy::Array<uint8> mScanData;
public: public:
void AddSubProgram(DbgSubprogram* subProgram, bool followInlineParent, const Beefy::StringImpl& prefix); void AddSubProgram(DbgSubprogram* subProgram, bool followInlineParent, const Beefy::StringImpl& prefix);

View file

@ -23,9 +23,9 @@ MiniDumpDebugger::MiniDumpDebugger(DebugManager* debugManager, DbgMiniDump* mini
if (section.mStreamType == ThreadExListStream) if (section.mStreamType == ThreadExListStream)
{ {
auto& threadEx = mMiniDump->GetStreamData<MINIDUMP_THREAD_EX_LIST>(section); auto& threadEx = mMiniDump->GetStreamData<MINIDUMP_THREAD_EX_LIST>(section);
/*WdThreadInfo* threadInfo = new WdThreadInfo(); /*WdThreadInfo* threadInfo = new WdThreadInfo();
threadInfo->mThreadId = threadEx.ThreadId; threadInfo->mThreadId = threadEx.ThreadId;
mThreadList.Add(threadInfo); mThreadList.Add(threadInfo);
if (mActiveThread == NULL) if (mActiveThread == NULL)
@ -54,7 +54,7 @@ MiniDumpDebugger::MiniDumpDebugger(DebugManager* debugManager, DbgMiniDump* mini
//TODO: 'get' the actual image //TODO: 'get' the actual image
dbgModule->mTimeStamp = module.TimeDateStamp; dbgModule->mTimeStamp = module.TimeDateStamp;
//dbgModule->mExpectedFileSize = module.; //dbgModule->mExpectedFileSize = module.;
const wchar_t* moduleName = &mMiniDump->GetData<wchar_t>(module.ModuleNameRva + 4); const wchar_t* moduleName = &mMiniDump->GetData<wchar_t>(module.ModuleNameRva + 4);
dbgModule->mFilePath = UTF8Encode(moduleName); dbgModule->mFilePath = UTF8Encode(moduleName);
dbgModule->mDisplayName = GetFileName(dbgModule->mFilePath); dbgModule->mDisplayName = GetFileName(dbgModule->mFilePath);
@ -74,8 +74,8 @@ MiniDumpDebugger::MiniDumpDebugger(DebugManager* debugManager, DbgMiniDump* mini
//dbgModule->LoadPDB(codeViewEntry.mPDBPath, codeViewEntry.mGUID, codeViewEntry.mAge); //dbgModule->LoadPDB(codeViewEntry.mPDBPath, codeViewEntry.mGUID, codeViewEntry.mAge);
} }
auto miscEntry = &mMiniDump->GetData<char>(module.MiscRecord.Rva); auto miscEntry = &mMiniDump->GetData<char>(module.MiscRecord.Rva);
mDebugTarget->AddDbgModule(dbgModule); mDebugTarget->AddDbgModule(dbgModule);
//TESTING //TESTING
@ -124,7 +124,7 @@ MiniDumpDebugger::MiniDumpDebugger(DebugManager* debugManager, DbgMiniDump* mini
auto& memoryInfoList = mMiniDump->GetStreamData<MINIDUMP_MEMORY_INFO_LIST>(section); auto& memoryInfoList = mMiniDump->GetStreamData<MINIDUMP_MEMORY_INFO_LIST>(section);
for (int memoryInfoIdx = 0; memoryInfoIdx < (int)memoryInfoList.NumberOfEntries; memoryInfoIdx++) for (int memoryInfoIdx = 0; memoryInfoIdx < (int)memoryInfoList.NumberOfEntries; memoryInfoIdx++)
{ {
auto& memoryInfo = mMiniDump->GetData<MINIDUMP_MEMORY_INFO>(section.mDataRVA + memoryInfoList.SizeOfHeader + memoryInfoIdx*memoryInfoList.SizeOfEntry); auto& memoryInfo = mMiniDump->GetData<MINIDUMP_MEMORY_INFO>(section.mDataRVA + memoryInfoList.SizeOfHeader + memoryInfoIdx*memoryInfoList.SizeOfEntry);
} }
} }
else if (section.mStreamType == MemoryListStream) else if (section.mStreamType == MemoryListStream)
@ -143,15 +143,15 @@ MiniDumpDebugger::MiniDumpDebugger(DebugManager* debugManager, DbgMiniDump* mini
else if (section.mStreamType == ExceptionStream) else if (section.mStreamType == ExceptionStream)
{ {
auto& exceptionStream = mMiniDump->GetStreamData<MINIDUMP_EXCEPTION_STREAM>(section); auto& exceptionStream = mMiniDump->GetStreamData<MINIDUMP_EXCEPTION_STREAM>(section);
//mCurException = exceptionStream.ExceptionRecord; //mCurException = exceptionStream.ExceptionRecord;
mCurException.ExceptionCode = exceptionStream.ExceptionRecord.ExceptionCode; mCurException.ExceptionCode = exceptionStream.ExceptionRecord.ExceptionCode;
mCurException.ExceptionFlags = exceptionStream.ExceptionRecord.ExceptionFlags; mCurException.ExceptionFlags = exceptionStream.ExceptionRecord.ExceptionFlags;
mCurException.ExceptionAddress = (PVOID)exceptionStream.ExceptionRecord.ExceptionAddress; mCurException.ExceptionAddress = (PVOID)exceptionStream.ExceptionRecord.ExceptionAddress;
mCurException.NumberParameters = exceptionStream.ExceptionRecord.NumberParameters; mCurException.NumberParameters = exceptionStream.ExceptionRecord.NumberParameters;
for (int i = 0; i < EXCEPTION_MAXIMUM_PARAMETERS; i++) for (int i = 0; i < EXCEPTION_MAXIMUM_PARAMETERS; i++)
mCurException.ExceptionInformation[i] = exceptionStream.ExceptionRecord.ExceptionInformation[i]; mCurException.ExceptionInformation[i] = exceptionStream.ExceptionRecord.ExceptionInformation[i];
WdThreadInfo* threadInfo = NULL; WdThreadInfo* threadInfo = NULL;
if (mThreadMap.TryGetValue(exceptionStream.ThreadId, &threadInfo)) if (mThreadMap.TryGetValue(exceptionStream.ThreadId, &threadInfo))
{ {
@ -168,19 +168,19 @@ MiniDumpDebugger::MiniDumpDebugger(DebugManager* debugManager, DbgMiniDump* mini
} }
else if (section.mStreamType == SystemInfoStream) else if (section.mStreamType == SystemInfoStream)
{ {
auto& systemInfo = mMiniDump->GetStreamData<MINIDUMP_SYSTEM_INFO>(section); auto& systemInfo = mMiniDump->GetStreamData<MINIDUMP_SYSTEM_INFO>(section);
} }
else if (section.mStreamType == MiscInfoStream) else if (section.mStreamType == MiscInfoStream)
{ {
auto& miscInfo = mMiniDump->GetStreamData<MINIDUMP_MISC_INFO>(section); auto& miscInfo = mMiniDump->GetStreamData<MINIDUMP_MISC_INFO>(section);
} }
else if (section.mStreamType == 21/*SystemMemoryInfoStream*/) else if (section.mStreamType == 21/*SystemMemoryInfoStream*/)
{ {
auto data = ((uint8*)mMiniDump->mMF.mData + section.mDataRVA); auto data = ((uint8*)mMiniDump->mMF.mData + section.mDataRVA);
} }
else if (section.mStreamType == 22/*ProcessVmCountersStream*/) else if (section.mStreamType == 22/*ProcessVmCountersStream*/)
{ {
auto data = ((uint8*)mMiniDump->mMF.mData + section.mDataRVA); auto data = ((uint8*)mMiniDump->mMF.mData + section.mDataRVA);
} }
else if (section.mStreamType == 24) // Thread names else if (section.mStreamType == 24) // Thread names
{ {
@ -199,7 +199,7 @@ MiniDumpDebugger::MiniDumpDebugger(DebugManager* debugManager, DbgMiniDump* mini
int nameLen = *(int32*)((uint8*)mMiniDump->mMF.mData + threadNameInfo->mNameRVA); int nameLen = *(int32*)((uint8*)mMiniDump->mMF.mData + threadNameInfo->mNameRVA);
UTF16String name = UTF16String((wchar_t*)((uint8*)mMiniDump->mMF.mData + threadNameInfo->mNameRVA + 4), nameLen); UTF16String name = UTF16String((wchar_t*)((uint8*)mMiniDump->mMF.mData + threadNameInfo->mNameRVA + 4), nameLen);
WdThreadInfo* threadInfo = NULL; WdThreadInfo* threadInfo = NULL;
if (mThreadMap.TryGetValue(threadNameInfo->mThreadId, &threadInfo)) if (mThreadMap.TryGetValue(threadNameInfo->mThreadId, &threadInfo))
{ {
@ -216,15 +216,15 @@ MiniDumpDebugger::MiniDumpDebugger(DebugManager* debugManager, DbgMiniDump* mini
GUID mClientID; GUID mClientID;
}; };
auto& crashPadInfo = mMiniDump->GetStreamData<_MiniDumpCrashPadInfo>(section); auto& crashPadInfo = mMiniDump->GetStreamData<_MiniDumpCrashPadInfo>(section);
} }
else if (section.mStreamType == 0x4b6b0002) // Stability report else if (section.mStreamType == 0x4b6b0002) // Stability report
{ {
const char* report = &mMiniDump->GetStreamData<char>(section); const char* report = &mMiniDump->GetStreamData<char>(section);
} }
else if (section.mStreamType == 0x4b6b0002) // Stability report else if (section.mStreamType == 0x4b6b0002) // Stability report
{ {
const char* report = &mMiniDump->GetStreamData<char>(section); const char* report = &mMiniDump->GetStreamData<char>(section);
} }
else if (section.mStreamType == 0xBEEF00) // Error text else if (section.mStreamType == 0xBEEF00) // Error text
{ {
@ -257,7 +257,7 @@ void MiniDumpDebugger::MapMemory(addr_target addr, void* data, intptr_target siz
break; break;
MiniDumpMemoryRegion* memRegion = mAlloc.Alloc<MiniDumpMemoryRegion>(); MiniDumpMemoryRegion* memRegion = mAlloc.Alloc<MiniDumpMemoryRegion>();
memRegion->mAddress = beginAddress + memOffset; memRegion->mAddress = beginAddress + memOffset;
memRegion->mAddressLength = curSize; memRegion->mAddressLength = curSize;
memRegion->mData = (uint8*)data + memOffset; memRegion->mData = (uint8*)data + memOffset;
memRegion->mNext = NULL; memRegion->mNext = NULL;
@ -271,9 +271,9 @@ MappedFile* MiniDumpDebugger::MapModule(COFF* dbgModule, const StringImpl& fileN
if (!mappedFile->Open(fileName)) if (!mappedFile->Open(fileName))
{ {
delete mappedFile; delete mappedFile;
return NULL; return NULL;
} }
mMappedFiles.Add(mappedFile); mMappedFiles.Add(mappedFile);
return mappedFile; return mappedFile;
} }
@ -289,7 +289,6 @@ bool MiniDumpDebugger::PopulateRegisters(CPURegisters* registers)
{ {
if (section.mStreamType == ThreadExListStream) if (section.mStreamType == ThreadExListStream)
{ {
} }
else if (section.mStreamType == ThreadListStream) else if (section.mStreamType == ThreadListStream)
{ {
@ -352,21 +351,20 @@ bool MiniDumpDebugger::ReadMemory(intptr address, uint64 length, void* dest, boo
return false; return false;
} }
return true; return true;
} }
useAddr = BF_MIN(useAddr, memRegion->mAddress - 1); useAddr = BF_MIN(useAddr, memRegion->mAddress - 1);
memRegion = memRegion->mNext; memRegion = memRegion->mNext;
} }
//if (((uintptr)address < (uintptr)memRegion->mAddress) || ((uintptr)(address + length) > uintptr(memRegion->mAddress + memRegion->mAddressLength))) //if (((uintptr)address < (uintptr)memRegion->mAddress) || ((uintptr)(address + length) > uintptr(memRegion->mAddress + memRegion->mAddressLength)))
//return false; // Out of bounds //return false; // Out of bounds
} }
return false; return false;
} }
bool MiniDumpDebugger::WriteMemory(intptr address, void* src, uint64 length) bool MiniDumpDebugger::WriteMemory(intptr address, void* src, uint64 length)
{ {
return false; return false;
} }

View file

@ -32,7 +32,7 @@ public:
void MapMemory(addr_target addr, void* data, intptr_target size); void MapMemory(addr_target addr, void* data, intptr_target size);
MappedFile* MapModule(COFF* dbgModule, const StringImpl& fileName); MappedFile* MapModule(COFF* dbgModule, const StringImpl& fileName);
virtual bool PopulateRegisters(CPURegisters* registers) override; virtual bool PopulateRegisters(CPURegisters* registers) override;
using WinDebugger::PopulateRegisters; using WinDebugger::PopulateRegisters;
@ -40,7 +40,7 @@ public:
virtual bool WriteMemory(intptr address, void* src, uint64 length) override; virtual bool WriteMemory(intptr address, void* src, uint64 length) override;
virtual bool IsOnDemandDebugger() override { return true; } virtual bool IsOnDemandDebugger() override { return true; }
virtual bool IsMiniDumpDebugger() override { return true; } virtual bool IsMiniDumpDebugger() override { return true; }
virtual void ContinueDebugEvent() { } virtual void ContinueDebugEvent() { }
virtual Breakpoint* CreateBreakpoint(const StringImpl& fileName, int lineNum, int wantColumn, int instrOffset) { return NULL; } virtual Breakpoint* CreateBreakpoint(const StringImpl& fileName, int lineNum, int wantColumn, int instrOffset) { return NULL; }
@ -60,5 +60,3 @@ public:
}; };
NS_BF_DBG_END NS_BF_DBG_END

View file

@ -101,7 +101,7 @@ DbgProfiler::DbgProfiler(WinDebugger* debugger) : mShutdownEvent(true)
mEndTick = 0; mEndTick = 0;
mDebugger->AddProfiler(this); mDebugger->AddProfiler(this);
mIdleSymbolNames.Add("NtUserGetMessage"); mIdleSymbolNames.Add("NtUserGetMessage");
mIdleSymbolNames.Add("NtWaitForAlertByThreadId"); mIdleSymbolNames.Add("NtWaitForAlertByThreadId");
mIdleSymbolNames.Add("NtWaitForMultipleObjects"); mIdleSymbolNames.Add("NtWaitForMultipleObjects");
@ -167,7 +167,7 @@ ProfileProcId* DbgProfiler::Get(const StringImpl& str, bool* outIsNew)
auto procId = new ProfileProcId(); auto procId = new ProfileProcId();
procId->mProcName = str; procId->mProcName = str;
procId->mIsIdle = false; procId->mIsIdle = false;
entryPtr->mProcId = procId; entryPtr->mProcId = procId;
if (outIsNew != NULL) if (outIsNew != NULL)
*outIsNew = true; *outIsNew = true;
return procId; return procId;
@ -372,7 +372,7 @@ void DbgProfiler::ThreadProc()
ProfileAddrEntry* insertedProfileEntry = AddToSet(mProfileAddrEntrySet, stackTrace, stackSize); ProfileAddrEntry* insertedProfileEntry = AddToSet(mProfileAddrEntrySet, stackTrace, stackSize);
if (insertedProfileEntry->mEntryIdx == -1) if (insertedProfileEntry->mEntryIdx == -1)
{ {
insertedProfileEntry->mEntryIdx = (int)mProfileAddrEntrySet.size(); // Starts at '1' insertedProfileEntry->mEntryIdx = (int)mProfileAddrEntrySet.size(); // Starts at '1'
mPendingProfileEntries.Add(*insertedProfileEntry); mPendingProfileEntries.Add(*insertedProfileEntry);
} }
@ -652,7 +652,7 @@ void DbgProfiler::HandlePendingEntries()
auto procEntry = AddToSet(mProfileProcEntrySet, procStackTraceHead, stackTraceProcIdx); auto procEntry = AddToSet(mProfileProcEntrySet, procStackTraceHead, stackTraceProcIdx);
if (procEntry->mEntryIdx == -1) if (procEntry->mEntryIdx == -1)
{ {
procEntry->mEntryIdx = (int)mProfileProcEntrySet.size() - 1; // Start at '0' procEntry->mEntryIdx = (int)mProfileProcEntrySet.size() - 1; // Start at '0'
} }
mProfileAddrToProcMap[addrEntry->mEntryIdx] = procEntry->mEntryIdx; mProfileAddrToProcMap[addrEntry->mEntryIdx] = procEntry->mEntryIdx;
} }
@ -681,7 +681,7 @@ void DbgProfiler::Process()
for (auto threadKV : mThreadInfo) for (auto threadKV : mThreadInfo)
{ {
auto threadInfo = threadKV.mValue; auto threadInfo = threadKV.mValue;
for (auto addrEntryIdx : threadInfo->mProfileAddrEntries) for (auto addrEntryIdx : threadInfo->mProfileAddrEntries)
{ {
if (addrEntryIdx < 0) if (addrEntryIdx < 0)
@ -691,10 +691,10 @@ void DbgProfiler::Process()
int procEntryIdx = mProfileAddrToProcMap[addrEntryIdx]; int procEntryIdx = mProfileAddrToProcMap[addrEntryIdx];
auto procEntry = mProfileProcEntries[procEntryIdx]; auto procEntry = mProfileProcEntries[procEntryIdx];
auto curProc = procEntry->mData[0]; auto curProc = procEntry->mData[0];
if (curProc->mIsIdle) if (curProc->mIsIdle)
threadInfo->mTotalIdleSamples++; threadInfo->mTotalIdleSamples++;
} }
} }
} }
@ -765,5 +765,4 @@ String DbgProfiler::GetCallTree(int threadId, bool reverse)
//BF_ASSERT(childSampleCount == totalSampleCount); //BF_ASSERT(childSampleCount == totalSampleCount);
return str; return str;
} }

View file

@ -48,7 +48,7 @@ struct ProfileDataListEquals
class ProfileAddrEntry : public ProfileDataList<addr_target> class ProfileAddrEntry : public ProfileDataList<addr_target>
{ {
public: public:
//int mSampleCount; //int mSampleCount;
int mEntryIdx; int mEntryIdx;
@ -88,7 +88,7 @@ public:
int mEntryIdx; int mEntryIdx;
bool mUsed; bool mUsed;
public: public:
ProfileProcEntry() ProfileProcEntry()
{ {
mEntryIdx = -1; mEntryIdx = -1;
@ -122,7 +122,7 @@ public:
WinDebugger* mDebugger; WinDebugger* mDebugger;
volatile bool mIsRunning; volatile bool mIsRunning;
bool mWantsClear; bool mWantsClear;
SyncEvent mShutdownEvent; SyncEvent mShutdownEvent;
bool mNeedsProcessing; bool mNeedsProcessing;
uint32 mStartTick; uint32 mStartTick;
uint32 mEndTick; uint32 mEndTick;
@ -130,37 +130,37 @@ public:
int mTotalVirtualSamples; int mTotalVirtualSamples;
int mTotalActualSamples; int mTotalActualSamples;
int mTotalActiveSamplingMS; int mTotalActiveSamplingMS;
BumpAllocator mAlloc; BumpAllocator mAlloc;
Dictionary<uint, ProfileThreadInfo*> mThreadInfo; Dictionary<uint, ProfileThreadInfo*> mThreadInfo;
Array<uint> mThreadIdList; Array<uint> mThreadIdList;
ProfileAddrEntrySet mProfileAddrEntrySet; ProfileAddrEntrySet mProfileAddrEntrySet;
Array<ProfileAddrEntry*> mProfileAddrEntries; Array<ProfileAddrEntry*> mProfileAddrEntries;
Array<ProfileAddrEntry> mPendingProfileEntries; Array<ProfileAddrEntry> mPendingProfileEntries;
ProfileProcEntrySet mProfileProcEntrySet; ProfileProcEntrySet mProfileProcEntrySet;
Array<ProfileProcEntry*> mProfileProcEntries; Array<ProfileProcEntry*> mProfileProcEntries;
Array<int> mProfileAddrToProcMap; Array<int> mProfileAddrToProcMap;
Dictionary<void*, ProfileProcId*> mProcMap; // Keyed on either DwSubprogram or DwSymbol. Multiple pointers can reference the same ProfileProcId (in the case of inlined functions, for example) Dictionary<void*, ProfileProcId*> mProcMap; // Keyed on either DwSubprogram or DwSymbol. Multiple pointers can reference the same ProfileProcId (in the case of inlined functions, for example)
HashSet<ProfileProdIdEntry> mUniqueProcSet; HashSet<ProfileProdIdEntry> mUniqueProcSet;
HashSet<String> mIdleSymbolNames; HashSet<String> mIdleSymbolNames;
public: public:
void ThreadProc(); void ThreadProc();
void AddEntries(String& str, Array<ProfileProcEntry*>& procEntries, int rangeStart, int rangeEnd, int stackIdx, ProfileProcId* findProc); void AddEntries(String& str, Array<ProfileProcEntry*>& procEntries, int rangeStart, int rangeEnd, int stackIdx, ProfileProcId* findProc);
template <typename T> template <typename T>
typename T::key_type* AddToSet(T& map, typename T::key_type::data_type* data, int size) typename T::key_type* AddToSet(T& map, typename T::key_type::data_type* data, int size)
{ {
typedef T::key_type::data_type DataType; typedef T::key_type::data_type DataType;
typename T::key_type entry; typename T::key_type entry;
entry.mData = data; entry.mData = data;
entry.mSize = size; entry.mSize = size;
typename T::key_type* entryPtr; typename T::key_type* entryPtr;
if (map.TryAdd(entry, &entryPtr)) if (map.TryAdd(entry, &entryPtr))
{ {
@ -187,7 +187,7 @@ public:
bool IsSampling() override { return mIsRunning; } bool IsSampling() override { return mIsRunning; }
String GetOverview() override; String GetOverview() override;
String GetThreadList() override; String GetThreadList() override;
String GetCallTree(int threadId, bool reverse) override; String GetCallTree(int threadId, bool reverse) override;
}; };

View file

@ -28,13 +28,12 @@ public:
{ {
public: public:
RadixMap32* mRadixMap; RadixMap32* mRadixMap;
int mRootIdx; int mRootIdx;
int mLeafIdx; int mLeafIdx;
public: public:
Iterator() Iterator()
{ {
} }
Iterator& operator++() Iterator& operator++()
@ -58,7 +57,7 @@ public:
mRootIdx++; mRootIdx++;
} }
} }
if (mRadixMap->mRoot[mRootIdx]->mValues[mLeafIdx] != NULL) if (mRadixMap->mRoot[mRootIdx]->mValues[mLeafIdx] != NULL)
return *this; return *this;
@ -86,7 +85,7 @@ public:
struct Leaf struct Leaf
{ {
T mValues[LEAF_LENGTH]; T mValues[LEAF_LENGTH];
T GetFirst(int startLeaf = 0) T GetFirst(int startLeaf = 0)
{ {
@ -103,23 +102,23 @@ public:
value = value->mNext; value = value->mNext;
} }
return lowestValue; return lowestValue;
} }
} }
return NULL; return NULL;
} }
}; };
Leaf* mRoot[ROOT_LENGTH]; // Pointers to 32 child nodes Leaf* mRoot[ROOT_LENGTH]; // Pointers to 32 child nodes
typedef uint32 Number; typedef uint32 Number;
public: public:
RadixMap32() RadixMap32()
{ {
memset(mRoot, 0, sizeof(mRoot)); memset(mRoot, 0, sizeof(mRoot));
} }
~RadixMap32() ~RadixMap32()
{ {
int leafCount = 0; int leafCount = 0;
for (int i = 0; i < ROOT_LENGTH; i++) for (int i = 0; i < ROOT_LENGTH; i++)
{ {
@ -135,8 +134,8 @@ public:
{ {
Iterator itr; Iterator itr;
itr.mRadixMap = this; itr.mRadixMap = this;
itr.mRootIdx = -1; itr.mRootIdx = -1;
itr.mLeafIdx = LEAF_LENGTH - 1; itr.mLeafIdx = LEAF_LENGTH - 1;
return ++itr; return ++itr;
} }
@ -144,17 +143,17 @@ public:
{ {
Iterator itr; Iterator itr;
itr.mRadixMap = this; itr.mRadixMap = this;
itr.mRootIdx = ROOT_LENGTH; itr.mRootIdx = ROOT_LENGTH;
itr.mLeafIdx = 0; itr.mLeafIdx = 0;
return itr; return itr;
} }
void Clear() void Clear()
{ {
for (int i = 0; i < ROOT_LENGTH; i++) for (int i = 0; i < ROOT_LENGTH; i++)
{ {
if (mRoot[i] != NULL) if (mRoot[i] != NULL)
{ {
delete mRoot[i]; delete mRoot[i];
mRoot[i] = NULL; mRoot[i] = NULL;
} }
@ -181,18 +180,18 @@ public:
return leaf->mValues[i2]; return leaf->mValues[i2];
} }
T Get(Number addr, int maxOffset = 0) const T Get(Number addr, int maxOffset = 0) const
{ {
int blockOffsetsLeft = (maxOffset + (1 << BLOCK_SHIFT) - 1) >> BLOCK_SHIFT; int blockOffsetsLeft = (maxOffset + (1 << BLOCK_SHIFT) - 1) >> BLOCK_SHIFT;
int blockAddr = (int)(addr >> BLOCK_SHIFT); int blockAddr = (int)(addr >> BLOCK_SHIFT);
int i1 = (int)(blockAddr >> LEAF_BITS); int i1 = (int)(blockAddr >> LEAF_BITS);
int i2 = (int)(blockAddr & (LEAF_LENGTH - 1)); int i2 = (int)(blockAddr & (LEAF_LENGTH - 1));
// Find closest entry to requested addr // Find closest entry to requested addr
Leaf* leaf = mRoot[i1]; Leaf* leaf = mRoot[i1];
int bestDist = 0x7FFFFFFF; int bestDist = 0x7FFFFFFF;
T bestValue = NULL; T bestValue = NULL;
if (leaf != NULL) if (leaf != NULL)
{ {
T curValue = leaf->mValues[i2]; T curValue = leaf->mValues[i2];
while (curValue != NULL) while (curValue != NULL)
@ -222,7 +221,7 @@ public:
i1--; i1--;
if (i1 < 0) if (i1 < 0)
break; break;
i2 = LEAF_LENGTH - 1; i2 = LEAF_LENGTH - 1;
} }
leaf = mRoot[i1]; leaf = mRoot[i1];
if (leaf != NULL) if (leaf != NULL)
@ -244,7 +243,7 @@ public:
return NULL; return NULL;
} }
T GetNext(T value) T GetNext(T value)
{ {
const Number blockAddr = value->mAddress >> BLOCK_SHIFT; const Number blockAddr = value->mAddress >> BLOCK_SHIFT;
@ -305,7 +304,7 @@ public:
} }
return NULL; return NULL;
} }
T GetUnordered(Number addr, int maxReverseOffset) const T GetUnordered(Number addr, int maxReverseOffset) const
{ {
@ -331,7 +330,7 @@ public:
blockOffsetsLeft--; blockOffsetsLeft--;
} }
else else
{ {
i1++; i1++;
blockOffsetsLeft -= LEAF_LENGTH; blockOffsetsLeft -= LEAF_LENGTH;
} }
@ -359,7 +358,7 @@ public:
int i2Start; int i2Start;
int i2End; int i2End;
if (i1 == i1Start) if (i1 == i1Start)
{ {
i2Start = (int)(blockAddrStart & (LEAF_LENGTH - 1)); i2Start = (int)(blockAddrStart & (LEAF_LENGTH - 1));
i2End = LEAF_LENGTH; i2End = LEAF_LENGTH;
} }
@ -394,17 +393,17 @@ public:
} }
curValue = curValue->mNext; curValue = curValue->mNext;
} }
*nextPtr = NULL; *nextPtr = NULL;
} }
} }
} }
void Insert(T value) void Insert(T value)
{ {
const Number blockAddr = value->mAddress >> BLOCK_SHIFT; const Number blockAddr = value->mAddress >> BLOCK_SHIFT;
const Number i1 = blockAddr >> LEAF_BITS; const Number i1 = blockAddr >> LEAF_BITS;
const Number i2 = blockAddr & (LEAF_LENGTH - 1); const Number i2 = blockAddr & (LEAF_LENGTH - 1);
Leaf* leaf = mRoot[i1]; Leaf* leaf = mRoot[i1];
if (leaf == NULL) if (leaf == NULL)
{ {
@ -413,7 +412,7 @@ public:
mRoot[i1] = leaf; mRoot[i1] = leaf;
} }
T prevValue = leaf->mValues[i2]; T prevValue = leaf->mValues[i2];
mRoot[i1]->mValues[i2] = value; mRoot[i1]->mValues[i2] = value;
value->mNext = prevValue; value->mNext = prevValue;
} }
@ -432,14 +431,14 @@ public:
{ {
if (curValue == value) if (curValue == value)
{ {
if (prevValue == NULL) if (prevValue == NULL)
leaf->mValues[i2] = curValue->mNext; leaf->mValues[i2] = curValue->mNext;
else else
prevValue->mNext = curValue->mNext; prevValue->mNext = curValue->mNext;
curValue->mNext = NULL; curValue->mNext = NULL;
return; return;
} }
prevValue = curValue; prevValue = curValue;
curValue = curValue->mNext; curValue = curValue->mNext;
} }
@ -470,19 +469,18 @@ public:
RadixMap64* mRadixMap; RadixMap64* mRadixMap;
int mRootIdx; int mRootIdx;
int mMidIdx; int mMidIdx;
int mLeafIdx; int mLeafIdx;
public: public:
Iterator() Iterator()
{ {
} }
Iterator& operator++() Iterator& operator++()
{ {
mLeafIdx++; mLeafIdx++;
while (true) while (true)
{ {
if (mLeafIdx == LEAF_LENGTH) if (mLeafIdx == LEAF_LENGTH)
{ {
mLeafIdx = 0; mLeafIdx = 0;
@ -494,7 +492,7 @@ public:
{ {
mMidIdx = 0; mMidIdx = 0;
mRootIdx++; mRootIdx++;
while (true) while (true)
{ {
if (mRootIdx == ROOT_LENGTH) if (mRootIdx == ROOT_LENGTH)
@ -512,7 +510,7 @@ public:
mMidIdx++; mMidIdx++;
} }
} }
if (mRadixMap->mRoot[mRootIdx]->mLeafs[mMidIdx]->mValues[mLeafIdx] != NULL) if (mRadixMap->mRoot[mRootIdx]->mLeafs[mMidIdx]->mValues[mLeafIdx] != NULL)
return *this; return *this;
@ -563,7 +561,7 @@ public:
return NULL; return NULL;
} }
}; };
struct Mid struct Mid
{ {
Leaf* mLeafs[MID_LENGTH]; Leaf* mLeafs[MID_LENGTH];
@ -722,7 +720,7 @@ public:
} }
i3 = LEAF_LENGTH - 1; i3 = LEAF_LENGTH - 1;
} }
mid = mRoot[i1]; mid = mRoot[i1];
if (mid != NULL) if (mid != NULL)
{ {
@ -829,7 +827,7 @@ public:
} }
void RemoveRange(Number startAddr, Number length) void RemoveRange(Number startAddr, Number length)
{ {
Number endAddr = BF_MIN(startAddr + length, 0x0001000000000000LL); Number endAddr = BF_MIN(startAddr + length, 0x0001000000000000LL);
startAddr = BF_MIN(startAddr, 0x0000FFFFFFFFFFFFLL); startAddr = BF_MIN(startAddr, 0x0000FFFFFFFFFFFFLL);
@ -958,7 +956,7 @@ public:
} }
} }
else else
{ {
// MID_LENGTH * LEAF_LENGTH is > 4GB, so a mRoot[i1] being NULL indicates no data // MID_LENGTH * LEAF_LENGTH is > 4GB, so a mRoot[i1] being NULL indicates no data
return NULL; return NULL;
} }
@ -992,7 +990,7 @@ public:
sMidSize += sizeof(Mid); sMidSize += sizeof(Mid);
mRoot[i1] = mid; mRoot[i1] = mid;
} }
BF_ASSERT((i2 >= 0) && (i2 < MID_LENGTH)); BF_ASSERT((i2 >= 0) && (i2 < MID_LENGTH));
Leaf* leaf = mid->mLeafs[i2]; Leaf* leaf = mid->mLeafs[i2];
if (leaf == NULL) if (leaf == NULL)

File diff suppressed because it is too large Load diff

View file

@ -43,7 +43,7 @@ class HotHeap;
#define BF_CONTEXT_EXCEPTION_REQUEST CONTEXT_EXCEPTION_REQUEST #define BF_CONTEXT_EXCEPTION_REQUEST CONTEXT_EXCEPTION_REQUEST
#define BF_CONTEXT_EXCEPTION_ACTIVE CONTEXT_EXCEPTION_ACTIVE #define BF_CONTEXT_EXCEPTION_ACTIVE CONTEXT_EXCEPTION_ACTIVE
#define BF_CONTEXT_SERVICE_ACTIVE CONTEXT_SERVICE_ACTIVE #define BF_CONTEXT_SERVICE_ACTIVE CONTEXT_SERVICE_ACTIVE
#define BF_CONTEXT_ALL CONTEXT_ALL #define BF_CONTEXT_ALL CONTEXT_ALL
#define BF_CONTEXT_SP(ctx) ctx.Esp #define BF_CONTEXT_SP(ctx) ctx.Esp
#define BF_CONTEXT_BP(ctx) ctx.Ebp #define BF_CONTEXT_BP(ctx) ctx.Ebp
#define BF_CONTEXT_IP(ctx) ctx.Eip #define BF_CONTEXT_IP(ctx) ctx.Eip
@ -62,7 +62,7 @@ class HotHeap;
#define BF_CONTEXT_EXCEPTION_REQUEST WOW64_CONTEXT_EXCEPTION_REQUEST #define BF_CONTEXT_EXCEPTION_REQUEST WOW64_CONTEXT_EXCEPTION_REQUEST
#define BF_CONTEXT_EXCEPTION_ACTIVE WOW64_CONTEXT_EXCEPTION_ACTIVE #define BF_CONTEXT_EXCEPTION_ACTIVE WOW64_CONTEXT_EXCEPTION_ACTIVE
#define BF_CONTEXT_SERVICE_ACTIVE WOW64_CONTEXT_SERVICE_ACTIVE #define BF_CONTEXT_SERVICE_ACTIVE WOW64_CONTEXT_SERVICE_ACTIVE
#define BF_CONTEXT_ALL WOW64_CONTEXT_ALL #define BF_CONTEXT_ALL WOW64_CONTEXT_ALL
#define BF_CONTEXT_SP(ctx) ctx.Esp #define BF_CONTEXT_SP(ctx) ctx.Esp
#define BF_CONTEXT_BP(ctx) ctx.Ebp #define BF_CONTEXT_BP(ctx) ctx.Ebp
#define BF_CONTEXT_IP(ctx) ctx.Eip #define BF_CONTEXT_IP(ctx) ctx.Eip
@ -84,7 +84,7 @@ class HotHeap;
#define BF_CONTEXT_EXCEPTION_REQUEST CONTEXT_EXCEPTION_REQUEST #define BF_CONTEXT_EXCEPTION_REQUEST CONTEXT_EXCEPTION_REQUEST
#define BF_CONTEXT_EXCEPTION_ACTIVE CONTEXT_EXCEPTION_ACTIVE #define BF_CONTEXT_EXCEPTION_ACTIVE CONTEXT_EXCEPTION_ACTIVE
#define BF_CONTEXT_SERVICE_ACTIVE CONTEXT_SERVICE_ACTIVE #define BF_CONTEXT_SERVICE_ACTIVE CONTEXT_SERVICE_ACTIVE
#define BF_CONTEXT_ALL CONTEXT_ALL #define BF_CONTEXT_ALL CONTEXT_ALL
#define BF_CONTEXT_SP(ctx) ctx.Rsp #define BF_CONTEXT_SP(ctx) ctx.Rsp
#define BF_CONTEXT_BP(ctx) ctx.Rbp #define BF_CONTEXT_BP(ctx) ctx.Rbp
#define BF_CONTEXT_IP(ctx) ctx.Rip #define BF_CONTEXT_IP(ctx) ctx.Rip
@ -123,7 +123,7 @@ public:
class WdBreakpointCondition class WdBreakpointCondition
{ {
public: public:
DbgEvaluationContext* mDbgEvaluationContext; DbgEvaluationContext* mDbgEvaluationContext;
String mExpr; String mExpr;
~WdBreakpointCondition(); ~WdBreakpointCondition();
@ -135,7 +135,7 @@ public:
addr_target mMemoryAddress; addr_target mMemoryAddress;
int mByteCount; int mByteCount;
String mReferenceName; String mReferenceName;
int8 mMemoryWatchSlotBitmap; int8 mMemoryWatchSlotBitmap;
WdMemoryBreakpointInfo() WdMemoryBreakpointInfo()
{ {
@ -147,31 +147,31 @@ public:
class WdBreakpoint : public Breakpoint class WdBreakpoint : public Breakpoint
{ {
public: public:
WdMemoryBreakpointInfo* mMemoryBreakpointInfo; WdMemoryBreakpointInfo* mMemoryBreakpointInfo;
addr_target mAddr; addr_target mAddr;
DbgSrcFile* mSrcFile; DbgSrcFile* mSrcFile;
DbgLineDataEx mLineData; DbgLineDataEx mLineData;
WdBreakpointCondition* mCondition; WdBreakpointCondition* mCondition;
BreakpointType mBreakpointType; BreakpointType mBreakpointType;
public: public:
WdBreakpoint() WdBreakpoint()
{ {
mMemoryBreakpointInfo = NULL; mMemoryBreakpointInfo = NULL;
mAddr = 0; mAddr = 0;
mSrcFile = NULL; mSrcFile = NULL;
mLineData = DbgLineDataEx(); mLineData = DbgLineDataEx();
mCondition = NULL; mCondition = NULL;
mBreakpointType = BreakpointType_User; mBreakpointType = BreakpointType_User;
} }
virtual uintptr GetAddr() override virtual uintptr GetAddr() override
{ {
return (uintptr)mAddr; return (uintptr)mAddr;
} }
virtual bool IsMemoryBreakpointBound() override virtual bool IsMemoryBreakpointBound() override
{ {
return (mMemoryBreakpointInfo != NULL) && (mMemoryBreakpointInfo->mMemoryWatchSlotBitmap != 0); return (mMemoryBreakpointInfo != NULL) && (mMemoryBreakpointInfo->mMemoryWatchSlotBitmap != 0);
@ -188,7 +188,7 @@ public:
enum StepType enum StepType
{ {
StepType_None, StepType_None,
StepType_StepInto, StepType_StepInto,
StepType_StepInto_Unfiltered, StepType_StepInto_Unfiltered,
StepType_StepInto_UnfilteredSingle, StepType_StepInto_UnfilteredSingle,
StepType_StepOver, StepType_StepOver,
@ -201,7 +201,7 @@ enum StepType
class WdStackFrame class WdStackFrame
{ {
public: public:
CPURegisters mRegisters; CPURegisters mRegisters;
bool mIsStart; bool mIsStart;
bool mIsEnd; bool mIsEnd;
@ -214,7 +214,7 @@ public:
public: public:
WdStackFrame() WdStackFrame()
{ {
mSubProgram = NULL; mSubProgram = NULL;
mHasGottenSubProgram = false; mHasGottenSubProgram = false;
mIsStart = true; mIsStart = true;
@ -241,11 +241,11 @@ struct WdThreadInfo
public: public:
uint mProcessId; uint mProcessId;
uint mThreadId; uint mThreadId;
HANDLE mHThread; HANDLE mHThread;
void* mThreadLocalBase; void* mThreadLocalBase;
void* mStartAddress; void* mStartAddress;
bool mIsBreakRestorePaused; bool mIsBreakRestorePaused;
bool mFrozen; bool mFrozen;
addr_target mStartSP; addr_target mStartSP;
String mName; String mName;
addr_target mStoppedAtAddress; addr_target mStoppedAtAddress;
@ -263,7 +263,7 @@ public:
mThreadLocalBase = NULL; mThreadLocalBase = NULL;
mStartAddress = NULL; mStartAddress = NULL;
mIsBreakRestorePaused = false; mIsBreakRestorePaused = false;
mFrozen = false; mFrozen = false;
mIsAtBreakpointAddress = 0; mIsAtBreakpointAddress = 0;
mStoppedAtAddress = 0; mStoppedAtAddress = 0;
@ -274,16 +274,16 @@ public:
class DbgPendingExpr class DbgPendingExpr
{ {
public: public:
int mThreadId; int mThreadId;
BfParser* mParser; BfParser* mParser;
DbgType* mExplitType; DbgType* mExplitType;
DwFormatInfo mFormatInfo; DwFormatInfo mFormatInfo;
DwEvalExpressionFlags mExpressionFlags; DwEvalExpressionFlags mExpressionFlags;
int mCursorPos; int mCursorPos;
BfExpression* mExprNode; BfExpression* mExprNode;
String mReferenceId; String mReferenceId;
int mCallStackIdx; int mCallStackIdx;
String mResult; String mResult;
Array<DbgCallResult> mCallResults; Array<DbgCallResult> mCallResults;
int mIdleTicks; int mIdleTicks;
@ -311,13 +311,13 @@ struct WdMemoryBreakpointBind
addr_target mAddress; addr_target mAddress;
int mOfs; int mOfs;
int mByteCount; int mByteCount;
WdMemoryBreakpointBind() WdMemoryBreakpointBind()
{ {
mAddress = 0; mAddress = 0;
mBreakpoint = NULL; mBreakpoint = NULL;
mOfs = 0; mOfs = 0;
mByteCount = 0; mByteCount = 0;
} }
}; };
@ -349,12 +349,12 @@ public:
public: public:
HANDLE mFileMapping; HANDLE mFileMapping;
Stats* mStats; Stats* mStats;
WinDbgHeapData() WinDbgHeapData()
{ {
mFileMapping = 0; mFileMapping = 0;
mStats = NULL; mStats = NULL;
} }
~WinDbgHeapData() ~WinDbgHeapData()
@ -368,8 +368,8 @@ struct DwFormatInfo;
class WinDebugger : public Debugger class WinDebugger : public Debugger
{ {
public: public:
SyncEvent mContinueEvent; SyncEvent mContinueEvent;
Array<HotTargetMemory> mHotTargetMemory; Array<HotTargetMemory> mHotTargetMemory;
Array<WinHotThreadState> mHotThreadStates; Array<WinHotThreadState> mHotThreadStates;
@ -383,10 +383,10 @@ public:
String mArgs; String mArgs;
String mWorkingDir; String mWorkingDir;
bool mHotSwapEnabled; bool mHotSwapEnabled;
Array<uint8> mEnvBlock; Array<uint8> mEnvBlock;
DebugTarget* mEmptyDebugTarget; DebugTarget* mEmptyDebugTarget;
DebugTarget* mDebugTarget; DebugTarget* mDebugTarget;
BfSystem* mBfSystem; BfSystem* mBfSystem;
CPU* mCPU; CPU* mCPU;
PROCESS_INFORMATION mProcessInfo; PROCESS_INFORMATION mProcessInfo;
BfDbgAttachFlags mDbgAttachFlags; BfDbgAttachFlags mDbgAttachFlags;
@ -396,25 +396,25 @@ public:
HANDLE mDbgThreadHandle; HANDLE mDbgThreadHandle;
bool mIsDebuggerWaiting; bool mIsDebuggerWaiting;
bool mWantsDebugContinue; bool mWantsDebugContinue;
bool mNeedsRehupBreakpoints; bool mNeedsRehupBreakpoints;
bool mContinueFromBreakpointFailed; bool mContinueFromBreakpointFailed;
WdThreadInfo* mDebuggerWaitingThread; WdThreadInfo* mDebuggerWaitingThread;
WdThreadInfo* mAtBreakThread; WdThreadInfo* mAtBreakThread;
WdThreadInfo* mActiveThread; WdThreadInfo* mActiveThread;
WdBreakpoint* mActiveBreakpoint; WdBreakpoint* mActiveBreakpoint;
WdThreadInfo* mSteppingThread; WdThreadInfo* mSteppingThread;
WdThreadInfo* mExplicitStopThread; // Don't try to show first frame-with-source for this thread (when we hit breakpoint in asm, encounter exception, etc) WdThreadInfo* mExplicitStopThread; // Don't try to show first frame-with-source for this thread (when we hit breakpoint in asm, encounter exception, etc)
DEBUG_EVENT mDebugEvent; DEBUG_EVENT mDebugEvent;
bool mGotStartupEvent; bool mGotStartupEvent;
int mPageSize; int mPageSize;
DbgSymSrv mDbgSymSrv; DbgSymSrv mDbgSymSrv;
DbgSymRequest* mActiveSymSrvRequest; DbgSymRequest* mActiveSymSrvRequest;
DWORD mDebuggerThreadId; DWORD mDebuggerThreadId;
WdMemoryBreakpointBind mMemoryBreakpoints[4]; WdMemoryBreakpointBind mMemoryBreakpoints[4];
int mMemoryBreakpointVersion; int mMemoryBreakpointVersion;
Dictionary<addr_target, int> mPhysBreakpointAddrMap; // To make sure we don't create multiple physical breakpoints at the same addr Dictionary<addr_target, int> mPhysBreakpointAddrMap; // To make sure we don't create multiple physical breakpoints at the same addr
Array<WdBreakpoint*> mBreakpoints; Array<WdBreakpoint*> mBreakpoints;
Dictionary<addr_target, WdBreakpoint*> mBreakpointAddrMap; Dictionary<addr_target, WdBreakpoint*> mBreakpointAddrMap;
Array<int> mFreeMemoryBreakIndices; Array<int> mFreeMemoryBreakIndices;
Array<WdStackFrame*> mCallStack; Array<WdStackFrame*> mCallStack;
@ -424,20 +424,20 @@ public:
int mBreakStackFrameIdx; int mBreakStackFrameIdx;
addr_target mShowPCOverride; addr_target mShowPCOverride;
Dictionary<uint32, WdThreadInfo*> mThreadMap; Dictionary<uint32, WdThreadInfo*> mThreadMap;
Array<WdThreadInfo*> mThreadList; Array<WdThreadInfo*> mThreadList;
StepType mOrigStepType; StepType mOrigStepType;
StepType mStepType; StepType mStepType;
int mCurNoInfoStepTries; int mCurNoInfoStepTries;
DbgLineDataEx mStepLineData; DbgLineDataEx mStepLineData;
bool mStepInAssembly; bool mStepInAssembly;
bool mStepIsRecursing; bool mStepIsRecursing;
bool mStepSwitchedThreads; bool mStepSwitchedThreads;
bool mStepStopOnNextInstruction; bool mStepStopOnNextInstruction;
bool mDbgBreak; bool mDbgBreak;
addr_target mStepStartPC; addr_target mStepStartPC;
addr_target mStepPC; addr_target mStepPC;
addr_target mStepSP; addr_target mStepSP;
addr_target mStoredReturnValueAddr; addr_target mStoredReturnValueAddr;
addr_target mLastValidStepIntoPC; addr_target mLastValidStepIntoPC;
bool mIsStepIntoSpecific; bool mIsStepIntoSpecific;
@ -449,27 +449,27 @@ public:
Array<DbgModule*> mPendingDebugInfoRequests; Array<DbgModule*> mPendingDebugInfoRequests;
HashSet<String> mLiteralSet; HashSet<String> mLiteralSet;
EXCEPTION_RECORD mCurException; EXCEPTION_RECORD mCurException;
bool mIsContinuingFromException; bool mIsContinuingFromException;
Array<int64> mTempBreakpoint; Array<int64> mTempBreakpoint;
Array<int64> mStepBreakpointAddrs; Array<int64> mStepBreakpointAddrs;
addr_target mSavedBreakpointAddressContinuing; addr_target mSavedBreakpointAddressContinuing;
addr_target mSavedAtBreakpointAddress; addr_target mSavedAtBreakpointAddress;
BF_CONTEXT mSavedContext; BF_CONTEXT mSavedContext;
Dictionary<int, Profiler*> mPendingProfilerMap; Dictionary<int, Profiler*> mPendingProfilerMap;
Array<Profiler*> mNewProfilerList; Array<Profiler*> mNewProfilerList;
HashSet<Profiler*> mProfilerSet; HashSet<Profiler*> mProfilerSet;
addr_target mMemCacheAddr; addr_target mMemCacheAddr;
uint8 mMemCacheData[WD_MEMCACHE_SIZE]; uint8 mMemCacheData[WD_MEMCACHE_SIZE];
public: public:
void Fail(const StringImpl& error); void Fail(const StringImpl& error);
void TryGetThreadName(WdThreadInfo* threadInfo); void TryGetThreadName(WdThreadInfo* threadInfo);
void ThreadRestorePause(WdThreadInfo* onlyPauseThread, WdThreadInfo* dontPauseThread); void ThreadRestorePause(WdThreadInfo* onlyPauseThread, WdThreadInfo* dontPauseThread);
void ThreadRestoreUnpause(); void ThreadRestoreUnpause();
void UpdateThreadDebugRegisters(WdThreadInfo* threadInfo); void UpdateThreadDebugRegisters(WdThreadInfo* threadInfo);
void UpdateThreadDebugRegisters(); void UpdateThreadDebugRegisters();
void ValidateBreakpoints(); void ValidateBreakpoints();
@ -477,13 +477,13 @@ public:
void SetBreakpoint(addr_target address, bool fromRehup = false); void SetBreakpoint(addr_target address, bool fromRehup = false);
void SetTempBreakpoint(addr_target address); void SetTempBreakpoint(addr_target address);
void PhysRemoveBreakpoint(addr_target address); void PhysRemoveBreakpoint(addr_target address);
void RemoveBreakpoint(addr_target address); void RemoveBreakpoint(addr_target address);
void SingleStepX86(); void SingleStepX86();
bool IsInRunState(); bool IsInRunState();
bool ContinueFromBreakpoint(); bool ContinueFromBreakpoint();
bool HasLineInfoAt(addr_target address); bool HasLineInfoAt(addr_target address);
DbgLineData* FindLineDataAtAddress(addr_target address, DbgSubprogram** outSubProgram = NULL, DbgSrcFile** outSrcFile = NULL, int* outLineIdx = NULL, DbgOnDemandKind onDemandKind = DbgOnDemandKind_AllowRemote); DbgLineData* FindLineDataAtAddress(addr_target address, DbgSubprogram** outSubProgram = NULL, DbgSrcFile** outSrcFile = NULL, int* outLineIdx = NULL, DbgOnDemandKind onDemandKind = DbgOnDemandKind_AllowRemote);
DbgLineData* FindLineDataInSubprogram(addr_target address, DbgSubprogram* dwSubprogram); DbgLineData* FindLineDataInSubprogram(addr_target address, DbgSubprogram* dwSubprogram);
bool IsStepFiltered(DbgSubprogram* dbgSubprogram, DbgLineData* dbgLineData); bool IsStepFiltered(DbgSubprogram* dbgSubprogram, DbgLineData* dbgLineData);
void RemoveTempBreakpoints(); void RemoveTempBreakpoints();
void RehupBreakpoints(bool doFlush); void RehupBreakpoints(bool doFlush);
@ -496,7 +496,7 @@ public:
virtual bool PopulateRegisters(CPURegisters* registers); virtual bool PopulateRegisters(CPURegisters* registers);
bool RollBackStackFrame(CPURegisters* registers, bool isStackStart); bool RollBackStackFrame(CPURegisters* registers, bool isStackStart);
bool SetHotJump(DbgSubprogram* oldSubprogram, addr_target newTarget, int newTargetSize); bool SetHotJump(DbgSubprogram* oldSubprogram, addr_target newTarget, int newTargetSize);
DbgSubprogram* TryFollowHotJump(DbgSubprogram* subprogram, addr_target addr); DbgSubprogram* TryFollowHotJump(DbgSubprogram* subprogram, addr_target addr);
bool ParseFormatInfo(DbgModule* dbgModule, const StringImpl& formatInfoStr, DwFormatInfo* formatInfo, BfPassInstance* bfPassInstance, int* assignExprOffset, String* assignExpr = NULL, String* errorString = NULL, DbgTypedValue contextTypedValue = DbgTypedValue()); bool ParseFormatInfo(DbgModule* dbgModule, const StringImpl& formatInfoStr, DwFormatInfo* formatInfo, BfPassInstance* bfPassInstance, int* assignExprOffset, String* assignExpr = NULL, String* errorString = NULL, DbgTypedValue contextTypedValue = DbgTypedValue());
String MaybeQuoteFormatInfoParam(const StringImpl& str); String MaybeQuoteFormatInfoParam(const StringImpl& str);
@ -508,12 +508,12 @@ public:
String ReadString(DbgTypeCode charType, intptr addr, bool isLocalAddr, intptr maxLength, DwFormatInfo& formatInfo, bool wantStringView); String ReadString(DbgTypeCode charType, intptr addr, bool isLocalAddr, intptr maxLength, DwFormatInfo& formatInfo, bool wantStringView);
String DbgTypedValueToString(const DbgTypedValue& typedValue, const StringImpl& expr, DwFormatInfo& formatFlags, DbgExprEvaluator* optEvaluator, bool fullPrecision = false); String DbgTypedValueToString(const DbgTypedValue& typedValue, const StringImpl& expr, DwFormatInfo& formatFlags, DbgExprEvaluator* optEvaluator, bool fullPrecision = false);
bool ShouldShowStaticMember(DbgType* dbgType, DbgVariable* member); bool ShouldShowStaticMember(DbgType* dbgType, DbgVariable* member);
String GetMemberList(DbgType* dbgType, const StringImpl& expr, bool isPtr, bool isStatic, bool forceCast = false, bool isSplat = false, bool isReadOnly = false); String GetMemberList(DbgType* dbgType, const StringImpl& expr, bool isPtr, bool isStatic, bool forceCast = false, bool isSplat = false, bool isReadOnly = false);
DebugVisualizerEntry* FindVisualizerForType(DbgType* dbgType, Array<String>* wildcardCaptures); DebugVisualizerEntry* FindVisualizerForType(DbgType* dbgType, Array<String>* wildcardCaptures);
void ReserveHotTargetMemory(int size); void ReserveHotTargetMemory(int size);
addr_target AllocHotTargetMemory(int size, bool canExecute, bool canWrite, int* outAllocSize); addr_target AllocHotTargetMemory(int size, bool canExecute, bool canWrite, int* outAllocSize);
void ReleaseHotTargetMemory(addr_target addr, int size); void ReleaseHotTargetMemory(addr_target addr, int size);
void CleanupHotHeap(); void CleanupHotHeap();
int EnableWriting(intptr address, int size); int EnableWriting(intptr address, int size);
int SetProtection(intptr address, int size, int prot); int SetProtection(intptr address, int size, int prot);
void EnableMemCache(); void EnableMemCache();
@ -522,14 +522,14 @@ public:
bool WriteInstructions(intptr address, void* src, uint64 length); bool WriteInstructions(intptr address, void* src, uint64 length);
template<typename T> bool WriteMemory(intptr addr, T val); template<typename T> bool WriteMemory(intptr addr, T val);
virtual DbgMemoryFlags GetMemoryFlags(intptr address) override; virtual DbgMemoryFlags GetMemoryFlags(intptr address) override;
void SetRunState(RunState runState); void SetRunState(RunState runState);
bool IsPaused(); bool IsPaused();
void ClearStep(); void ClearStep();
bool SetupStep(StepType stepType); bool SetupStep(StepType stepType);
void CheckNonDebuggerBreak(); void CheckNonDebuggerBreak();
bool HasSteppedIntoCall(); bool HasSteppedIntoCall();
void StepLineTryPause(addr_target address, bool requireExactMatch); void StepLineTryPause(addr_target address, bool requireExactMatch);
void PushValue(CPURegisters* registers, int64 val); void PushValue(CPURegisters* registers, int64 val);
void PushValue(CPURegisters* registers, const DbgTypedValue& typedValue); void PushValue(CPURegisters* registers, const DbgTypedValue& typedValue);
void SetThisRegister(CPURegisters* registers, addr_target val); void SetThisRegister(CPURegisters* registers, addr_target val);
@ -538,7 +538,7 @@ public:
DbgTypedValue ReadReturnValue(CPURegisters* registers, DbgType* type); DbgTypedValue ReadReturnValue(CPURegisters* registers, DbgType* type);
bool SetRegisters(CPURegisters* registers); bool SetRegisters(CPURegisters* registers);
void SaveAllRegisters(); void SaveAllRegisters();
void RestoreAllRegisters(); void RestoreAllRegisters();
String GetArrayItems(DbgCompileUnit* dbgCompileUnit, DebugVisualizerEntry* debugVis, DbgType* valueType, DbgTypedValue& curNode, int& count, String* outContinuationData); String GetArrayItems(DbgCompileUnit* dbgCompileUnit, DebugVisualizerEntry* debugVis, DbgType* valueType, DbgTypedValue& curNode, int& count, String* outContinuationData);
String GetLinkedListItems(DbgCompileUnit* dbgCompileUnit, DebugVisualizerEntry* debugVis, addr_target endNodePtr, DbgType* valueType, DbgTypedValue& curNode, int& count, String* outContinuationData); String GetLinkedListItems(DbgCompileUnit* dbgCompileUnit, DebugVisualizerEntry* debugVis, addr_target endNodePtr, DbgType* valueType, DbgTypedValue& curNode, int& count, String* outContinuationData);
String GetDictionaryItems(DbgCompileUnit* dbgCompileUnit, DebugVisualizerEntry* debugVis, DbgTypedValue dictValue, int bucketIdx, int nodeIdx, int& count, String* outContinuationData); String GetDictionaryItems(DbgCompileUnit* dbgCompileUnit, DebugVisualizerEntry* debugVis, DbgTypedValue dictValue, int bucketIdx, int nodeIdx, int& count, String* outContinuationData);
@ -548,13 +548,13 @@ public:
bool DoUpdate(); bool DoUpdate();
void DebugThreadProc(); void DebugThreadProc();
bool DoOpenFile(const StringImpl& fileName, const StringImpl& args, const StringImpl& workingDir, const Array<uint8>& envBlock); bool DoOpenFile(const StringImpl& fileName, const StringImpl& args, const StringImpl& workingDir, const Array<uint8>& envBlock);
DbgTypedValue GetRegister(const StringImpl& regName, DbgLanguage language, CPURegisters* registers, Array<RegForm>* regForms = NULL); DbgTypedValue GetRegister(const StringImpl& regName, DbgLanguage language, CPURegisters* registers, Array<RegForm>* regForms = NULL);
void FixupLineData(DbgCompileUnit* compileUnit); void FixupLineData(DbgCompileUnit* compileUnit);
void FixupLineDataForSubprogram(DbgSubprogram* subProgram); void FixupLineDataForSubprogram(DbgSubprogram* subProgram);
DbgModule* GetCallStackDbgModule(int callStackIdx); DbgModule* GetCallStackDbgModule(int callStackIdx);
DbgSubprogram* GetCallStackSubprogram(int callStackIdx); DbgSubprogram* GetCallStackSubprogram(int callStackIdx);
DbgCompileUnit* GetCallStackCompileUnit(int callStackIdx); DbgCompileUnit* GetCallStackCompileUnit(int callStackIdx);
String Evaluate(const StringImpl& expr, DwFormatInfo formatInfo, int callStackIdx, int cursorPos, int language, DwEvalExpressionFlags expressionFlags); String Evaluate(const StringImpl& expr, DwFormatInfo formatInfo, int callStackIdx, int cursorPos, int language, DwEvalExpressionFlags expressionFlags);
String EvaluateContinue() override; String EvaluateContinue() override;
void EvaluateContinueKeep() override; void EvaluateContinueKeep() override;
@ -562,15 +562,15 @@ public:
String GetAutocompleteOutput(DwAutoComplete& autoComplete); String GetAutocompleteOutput(DwAutoComplete& autoComplete);
bool CheckConditionalBreakpoint(WdBreakpoint* breakpoint, DbgSubprogram* dbgSubprogram, addr_target pcAddress); bool CheckConditionalBreakpoint(WdBreakpoint* breakpoint, DbgSubprogram* dbgSubprogram, addr_target pcAddress);
void CleanupDebugEval(bool restoreRegisters = true); void CleanupDebugEval(bool restoreRegisters = true);
bool FixCallStackIdx(int& callStackIdx); bool FixCallStackIdx(int& callStackIdx);
void DoClearCallStack(bool clearSavedStacks); void DoClearCallStack(bool clearSavedStacks);
int LoadDebugInfoForModule(DbgModule* dbgModule); int LoadDebugInfoForModule(DbgModule* dbgModule);
public: public:
WinDebugger(DebugManager* debugManager); WinDebugger(DebugManager* debugManager);
virtual ~WinDebugger(); virtual ~WinDebugger();
virtual void OutputMessage(const StringImpl& msg) override; virtual void OutputMessage(const StringImpl& msg) override;
virtual void OutputRawMessage(const StringImpl& msg) override; virtual void OutputRawMessage(const StringImpl& msg) override;
virtual int GetAddrSize() override; virtual int GetAddrSize() override;
@ -578,7 +578,7 @@ public:
virtual void OpenFile(const StringImpl& launchPath, const StringImpl& targetPath, const StringImpl& args, const StringImpl& workingDir, const Array<uint8>& envBlock, bool hotSwapEnabled) override; virtual void OpenFile(const StringImpl& launchPath, const StringImpl& targetPath, const StringImpl& args, const StringImpl& workingDir, const Array<uint8>& envBlock, bool hotSwapEnabled) override;
virtual bool Attach(int processId, BfDbgAttachFlags attachFlags) override; virtual bool Attach(int processId, BfDbgAttachFlags attachFlags) override;
virtual void Run() override; virtual void Run() override;
virtual void HotLoad(const Array<String>& objectFiles, int hotIdx) override; virtual void HotLoad(const Array<String>& objectFiles, int hotIdx) override;
virtual void InitiateHotResolve(DbgHotResolveFlags flags) override; virtual void InitiateHotResolve(DbgHotResolveFlags flags) override;
virtual intptr GetDbgAllocHeapSize() override; virtual intptr GetDbgAllocHeapSize() override;
virtual String GetDbgAllocInfo() override; virtual String GetDbgAllocInfo() override;
@ -591,13 +591,13 @@ public:
virtual Breakpoint* CreateAddressBreakpoint(intptr address) override; virtual Breakpoint* CreateAddressBreakpoint(intptr address) override;
virtual void CheckBreakpoint(Breakpoint* breakpoint) override; virtual void CheckBreakpoint(Breakpoint* breakpoint) override;
virtual void HotBindBreakpoint(Breakpoint* breakpoint, int lineNum, int hotIdx) override; virtual void HotBindBreakpoint(Breakpoint* breakpoint, int lineNum, int hotIdx) override;
virtual void DeleteBreakpoint(Breakpoint* breakpoint) override; virtual void DeleteBreakpoint(Breakpoint* breakpoint) override;
virtual void DetachBreakpoint(Breakpoint* breakpoint) override; virtual void DetachBreakpoint(Breakpoint* breakpoint) override;
virtual void MoveBreakpoint(Breakpoint* breakpoint, int lineNum, int wantColumn, bool rebindNow) override; virtual void MoveBreakpoint(Breakpoint* breakpoint, int lineNum, int wantColumn, bool rebindNow) override;
virtual void MoveMemoryBreakpoint(Breakpoint* breakpoint, intptr addr, int byteCount) override; virtual void MoveMemoryBreakpoint(Breakpoint* breakpoint, intptr addr, int byteCount) override;
virtual void DisableBreakpoint(Breakpoint* breakpoint) override; virtual void DisableBreakpoint(Breakpoint* breakpoint) override;
virtual void SetBreakpointCondition(Breakpoint* breakpoint, const StringImpl& condition) override; virtual void SetBreakpointCondition(Breakpoint* breakpoint, const StringImpl& condition) override;
virtual void SetBreakpointLogging(Breakpoint* wdBreakpoint, const StringImpl& logging, bool breakAfterLogging) override; virtual void SetBreakpointLogging(Breakpoint* wdBreakpoint, const StringImpl& logging, bool breakAfterLogging) override;
virtual Breakpoint* FindBreakpointAt(intptr address) override; virtual Breakpoint* FindBreakpointAt(intptr address) override;
virtual Breakpoint* GetActiveBreakpoint() override; virtual Breakpoint* GetActiveBreakpoint() override;
virtual void BreakAll() override; virtual void BreakAll() override;
@ -611,7 +611,7 @@ public:
virtual String EvaluateToAddress(const StringImpl& expr, int callStackIdx, int cursorPos) override; virtual String EvaluateToAddress(const StringImpl& expr, int callStackIdx, int cursorPos) override;
virtual String EvaluateAtAddress(const StringImpl& expr, intptr atAddr, int cursorPos) override; virtual String EvaluateAtAddress(const StringImpl& expr, intptr atAddr, int cursorPos) override;
virtual bool AssignToReg(int callStackIdx, DbgTypedValue reg, DbgTypedValue value, String& outError); virtual bool AssignToReg(int callStackIdx, DbgTypedValue reg, DbgTypedValue value, String& outError);
virtual String GetCollectionContinuation(const StringImpl& continuationData, int callStackIdx, int count) override; virtual String GetCollectionContinuation(const StringImpl& continuationData, int callStackIdx, int count) override;
virtual String GetAutoExpressions(int callStackIdx, uint64 memoryRangeStart, uint64 memoryRangeLen) override; virtual String GetAutoExpressions(int callStackIdx, uint64 memoryRangeStart, uint64 memoryRangeLen) override;
virtual String GetAutoLocals(int callStackIdx, bool showRegs) override; virtual String GetAutoLocals(int callStackIdx, bool showRegs) override;
virtual String CompactChildExpression(const StringImpl& expr, const StringImpl& parentExpr, int callStackIdx) override; virtual String CompactChildExpression(const StringImpl& expr, const StringImpl& parentExpr, int callStackIdx) override;
@ -646,17 +646,17 @@ public:
virtual String DisassembleAtRaw(intptr address) override; virtual String DisassembleAtRaw(intptr address) override;
virtual String DisassembleAt(intptr address) override; virtual String DisassembleAt(intptr address) override;
virtual String FindLineCallAddresses(intptr address) override; virtual String FindLineCallAddresses(intptr address) override;
virtual String GetCurrentException() override; virtual String GetCurrentException() override;
virtual void SetAliasPath(const StringImpl& origPath, const StringImpl& localPath) override; virtual void SetAliasPath(const StringImpl& origPath, const StringImpl& localPath) override;
virtual String GetModulesInfo() override; virtual String GetModulesInfo() override;
virtual void CancelSymSrv() override; virtual void CancelSymSrv() override;
virtual bool HasPendingDebugLoads() override; virtual bool HasPendingDebugLoads() override;
virtual int LoadImageForModule(const StringImpl& moduleName, const StringImpl& debugFileName) override; virtual int LoadImageForModule(const StringImpl& moduleName, const StringImpl& debugFileName) override;
virtual int LoadDebugInfoForModule(const StringImpl& moduleName, const StringImpl& debugFileName) override; virtual int LoadDebugInfoForModule(const StringImpl& moduleName, const StringImpl& debugFileName) override;
virtual int LoadDebugInfoForModule(const StringImpl& moduleName) override; virtual int LoadDebugInfoForModule(const StringImpl& moduleName) override;
virtual void StopDebugging() override; virtual void StopDebugging() override;
virtual void Terminate() override; virtual void Terminate() override;
virtual void Detach() override; virtual void Detach() override;
virtual Profiler* StartProfiling() override; virtual Profiler* StartProfiling() override;
virtual Profiler* PopProfiler() override; virtual Profiler* PopProfiler() override;
void AddProfiler(DbgProfiler* profiler); void AddProfiler(DbgProfiler* profiler);
@ -676,13 +676,13 @@ template<typename T> bool WinDebugger::WriteMemory(intptr addr, T val)
} }
template<typename T> T WinDebugger::ReadMemory(intptr addr, bool local, bool* failed) template<typename T> T WinDebugger::ReadMemory(intptr addr, bool local, bool* failed)
{ {
bool success = true; bool success = true;
T val; T val;
memset(&val, 0, sizeof(T)); memset(&val, 0, sizeof(T));
if (local) if (local)
{ {
if (addr != 0) if (addr != 0)
{ {
memcpy(&val, (void*)(intptr)addr, sizeof(T)); memcpy(&val, (void*)(intptr)addr, sizeof(T));
/*__try /*__try
@ -698,7 +698,7 @@ template<typename T> T WinDebugger::ReadMemory(intptr addr, bool local, bool* fa
success = false; success = false;
} }
else else
{ {
//SIZE_T dwReadBytes; //SIZE_T dwReadBytes;
memset(&val, 0, sizeof(T)); memset(&val, 0, sizeof(T));
//success = ReadProcessMemory(mProcessInfo.hProcess, (void*)(intptr)addr, &val, (SIZE_T)sizeof(T), &dwReadBytes) != 0; //success = ReadProcessMemory(mProcessInfo.hProcess, (void*)(intptr)addr, &val, (SIZE_T)sizeof(T), &dwReadBytes) != 0;
@ -713,4 +713,3 @@ template<typename T> T WinDebugger::ReadMemory(intptr addr, bool local, bool* fa
addr_target DecodeTargetDataPtr(const char*& strRef); addr_target DecodeTargetDataPtr(const char*& strRef);
NS_BF_DBG_END NS_BF_DBG_END