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

View file

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

View file

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

View file

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

View file

@ -453,7 +453,7 @@ enum
DW_OP_breg12 = 0x7C,
DW_OP_breg13 = 0x7D,
DW_OP_breg14 = 0x7E,
DW_OP_breg15 = 0x7F,
DW_OP_breg15 = 0x7F,
DW_OP_breg31 = 0x8f,
DW_OP_regx = 0x90,
DW_OP_fbreg = 0x91,
@ -520,7 +520,7 @@ enum
DW_CFA_hi_user = 0x3f,
};
enum SymbolFlags
enum SymbolFlags
{
SF_TypeMask = 0x0000FFFF,
SF_TypeShift = 0,
@ -576,7 +576,7 @@ enum SymbolStorageClass
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_VOID = 1, ///< Used with void pointers and functions.
@ -596,7 +596,7 @@ enum SymbolBaseType
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_POINTER = 1, ///< A pointer to base type.
@ -642,4 +642,3 @@ enum RelocationTypeAMD64
COFF_REL_AMD64_PAIR = 0x000F,
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->mExpressionFlags = expressionFlags;
return NULL;
}

View file

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

View file

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

View file

@ -48,14 +48,14 @@ public:
intptr mLocalIntPtr;
DbgVariable* mVariable;
};
bool mIsLiteral;
bool mIsLiteral;
bool mHasNoValue;
bool mIsReadOnly;
union
union
{
int mRegNum;
int mDataLen;
};
};
addr_target mSrcAddress;
public:
@ -63,13 +63,13 @@ public:
{
mType = NULL;
mUInt64 = 0;
mIsLiteral = false;
mIsLiteral = false;
mSrcAddress = 0;
mHasNoValue = false;
mIsReadOnly = false;
mRegNum = -1;
}
DbgType* ResolveTypeDef() const
{
auto typeDef = mType;
@ -79,7 +79,7 @@ public:
}
int64 GetSExtInt() const
{
{
auto resolvedType = mType->RemoveModifiers();
switch (resolvedType->mTypeCode)
{
@ -139,7 +139,7 @@ public:
case DbgType_u32:
return (int64) mUInt32;
case DbgType_u64:
return (int64) mUInt64;
return (int64) mUInt64;
case DbgType_Ptr:
return (int64) mUInt64;
default:
@ -265,7 +265,7 @@ public:
SizedArray<int, 4> mBestMethodGenericArgumentSrcs;
DwTypeVector mBestMethodGenericArguments;
public:
public:
void CompareMethods(DbgSubprogram* prevMethodInstance, DwTypeVector* prevGenericArgumentsSubstitute,
DbgSubprogram* newMethodInstance, DwTypeVector* genericArgumentsSubstitute,
bool* outNewIsBetter, bool* outNewIsWorse, bool allowSpecializeFail);
@ -332,13 +332,13 @@ public:
};
public:
DebugTarget* mDebugTarget;
DebugTarget* mDebugTarget;
DbgModule* mOrigDbgModule;
DbgModule* mDbgModule;
DbgCompileUnit* mDbgCompileUnit;
DbgCompileUnit* mDbgCompileUnit;
DbgLanguage mLanguage;
BfPassInstance* mPassInstance;
BfPassInstance* mPassInstance;
WinDebugger* mDebugger;
String mExpectingTypeName;
String mSubjectExpr;
@ -348,9 +348,9 @@ public:
DbgTypedValue mResult;
DbgTypedValue* mReceivingValue;
intptr mCountResultOverride;
DbgTypedValue mExplicitThis;
DbgTypedValue mExplicitThis;
BfExpression* mExplicitThisExpr;
Array<DbgCallResult>* mCallResults;
Array<DbgCallResult>* mCallResults;
addr_target mCallStackPreservePos;
int mCallResultIdx;
String mNamespaceSearchStr;
@ -367,12 +367,12 @@ public:
bool mIsEmptyTarget;
DwEvalExpressionFlags mExpressionFlags;
bool mHadSideEffects;
bool mBlockedSideEffects;
bool mBlockedSideEffects;
bool mIgnoreErrors;
bool mCreatedPendingCall;
bool mValidateOnly;
bool mValidateOnly;
int mCallStackIdx;
int mCursorPos;
int mCursorPos;
DwAutoComplete* mAutoComplete;
DbgStackSearch* mStackSearch;
@ -389,17 +389,17 @@ public:
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);
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, SizedArrayImpl<DbgMethodArgument>& argPushQueue, bool bypassVirtual);
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,
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);
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 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);
DbgTypedValue GetResult();
bool HasPropResult();
@ -409,11 +409,11 @@ public:
public:
DbgExprEvaluator(WinDebugger* winDebugger, DbgModule* dbgModule, BfPassInstance* passInstance, int callStackIdx, int cursorPos);
~DbgExprEvaluator();
DbgTypedValue GetInt(int value);
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);
DbgType* GetExpectingType();
void GetNamespaceSearch();
@ -422,11 +422,11 @@ public:
DbgType* ResolveTypeRef(BfTypeReference* typeRef);
DbgType* ResolveTypeRef(BfAstNode* typeRef, BfAstNode** parentChildRef = NULL);
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);
void BeefStringToString(addr_target addr, 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();
CPURegisters* GetRegisters();
DbgTypedValue GetRegister(const StringImpl& regName);
@ -438,9 +438,9 @@ public:
void AutocompleteCheckType(BfTypeReference* typeReference);
void AutocompleteAddTopLevelTypes(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);
DbgTypedValue RemoveRef(DbgTypedValue typedValue);
DbgTypedValue RemoveRef(DbgTypedValue typedValue);
bool StoreValue(DbgTypedValue& ptr, DbgTypedValue& value, BfAstNode* refNode);
bool StoreValue(DbgTypedValue& ptr, BfExpression* expr);
@ -449,16 +449,16 @@ public:
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);
bool HasField(DbgType* type, const StringImpl& fieldName);
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 DoLookupField(BfAstNode* targetSrc, DbgTypedValue target, DbgType* curCheckType, const StringImpl& fieldName, CPUStackFrame* stackFrame, bool allowImplicitThis);
DbgTypedValue LookupField(BfAstNode* targetSrc, DbgTypedValue target, const StringImpl& fieldName);
DbgTypedValue DoLookupIdentifier(BfAstNode* identifierNode, bool ignoreInitialError, bool* hadError);
DbgTypedValue LookupIdentifier(BfAstNode* identifierNode, bool ignoreInitialError = false, bool* hadError = NULL);
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 LookupQualifiedName(BfQualifiedNameNode* nameNode, bool ignoreInitialError = false, bool* hadError = NULL);
DbgType* FindSubtype(DbgType* type, const StringImpl& name);
void LookupQualifiedStaticField(BfQualifiedNameNode* nameNode, bool ignoreIdentifierNotFoundError = false);
bool EnsureRunning(BfAstNode* astNode);
void LookupQualifiedStaticField(BfQualifiedNameNode* nameNode, bool ignoreIdentifierNotFoundError = false);
bool EnsureRunning(BfAstNode* astNode);
virtual void Visit(BfAssignmentExpression* assignExpr) override;
virtual void Visit(BfParenthesizedExpression* parenExpr) override;
@ -477,10 +477,10 @@ public:
virtual void Visit(BfUnaryOperatorExpression* unaryOpExpr) override;
virtual void Visit(BfInvocationExpression* invocationExpr) 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;
DbgTypedValue Resolve(BfExpression* expr, DbgType* wantType = NULL);
DbgTypedValue Resolve(BfExpression* expr, DbgType* wantType = NULL);
BfAstNode* FinalizeExplicitThisReferences(BfAstNode* headNode);
};

View file

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

View file

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

View file

@ -19,13 +19,13 @@
USING_NS_BF_DBG;
DbgSymRequest::DbgSymRequest()
{
{
mFailed = false;
mSearchingSymSrv = false;
mCancelling = false;
mInProcess = false;
mLastUpdateTick = 0;
mDbgSymSrv = NULL;
mDbgSymSrv = NULL;
mWantAge = 0;
mMayBeOld = false;
mIsPreCache = false;
@ -33,18 +33,17 @@ DbgSymRequest::DbgSymRequest()
DbgSymRequest::~DbgSymRequest()
{
}
String DbgSymRequest::GetGuidString()
{
String str;
// 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[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]);
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()));
}
else
else
{
bool hasGuid = false;
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)
{
{
if (mIsPreCache)
{
{
auto netResult = mDbgSymSrv->mDebugger->mDebugManager->mNetManager->QueueGet(url, destPath, true);
if (chainNetResult != NULL)
{
@ -121,7 +120,7 @@ bool DbgSymRequest::Get(const StringImpl& url, const StringImpl& destPath, NetRe
}
return false;
}
return mDbgSymSrv->mDebugger->mDebugManager->mNetManager->Get(url, destPath);
}
@ -144,7 +143,7 @@ void DbgSymRequest::SearchLocal()
return;
}
// Check in same dir as module
// Check in same dir as module
String checkPath = ::GetFileDir(mModulePath);
checkPath += "\\";
checkPath += GetFileName(mPDBRequested);
@ -157,7 +156,7 @@ void DbgSymRequest::SearchLocal()
}
}
}
mMayBeOld = true;
}
@ -206,12 +205,12 @@ void DbgSymRequest::SearchSymSrv()
/*if (mPDBRequested.Contains("IDEHelper"))
Sleep(3000);*/
SetAndRestoreValue<bool> prevSearchingSymSrv(mSearchingSymSrv, true);
SetAndRestoreValue<bool> prevSearchingSymSrv(mSearchingSymSrv, true);
NetResult* chainNetResult = NULL;
uint8 outGuid[16];
int32 outAge;
String cacheDir = mOptions.mCacheDir;
cacheDir += GetPDBStoreDir();
@ -244,7 +243,7 @@ void DbgSymRequest::SearchSymSrv()
checkPath += GetFileName(mPDBRequested);
if (Get(checkPath, cacheFilePath, &chainNetResult))
done = true;
if ((!done) && (!mCancelling))
{
// Compressed version
@ -264,7 +263,7 @@ void DbgSymRequest::SearchSymSrv()
}
done = true;
}
}
}
if ((!done) && (!mCancelling))
{
@ -312,7 +311,7 @@ void DbgSymRequest::SearchSymSrv()
if (mIsPreCache)
continue;
// Re-check cache
// Re-check cache
if (CheckPDBData(cacheFilePath, outGuid, outAge))
{
mFinalPDBPath = cacheFilePath;
@ -329,12 +328,12 @@ bool DbgSymRequest::CheckPEFile(const StringImpl& filePath, uint32 fileTime, int
if (!fs.Open(filePath, "rb"))
return false;
PEHeader hdr;
fs.ReadT(hdr);
PE_NTHeaders64 ntHdr64;
fs.SetPos(hdr.e_lfanew);
PE_NTHeaders64 ntHdr64;
fs.SetPos(hdr.e_lfanew);
fs.Read(&ntHdr64, sizeof(PE_NTHeaders64));
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))
return false;
}
return true;
}
String DbgSymRequest::SearchForImage(const String& filePath, uint32 fileTime, int size)
{
{
if ((gDebugManager->mSymSrvOptions.mFlags & BfSymSrvFlag_Disable) != 0)
return "";
@ -371,15 +370,15 @@ String DbgSymRequest::SearchForImage(const String& filePath, uint32 fileTime, in
{
mFailed = true;
return "";
}
}
NetResult* chainNetResult = NULL;
String fileName = GetFileName(filePath);
String imageStoreDir = "/";
imageStoreDir += fileName;
imageStoreDir += "/";
imageStoreDir += StrFormat("%08X%x/", fileTime, size);
imageStoreDir += "/";
imageStoreDir += StrFormat("%08X%x/", fileTime, size);
SetAndRestoreValue<bool> prevSearchingSymSrv(mSearchingSymSrv, true);
@ -400,7 +399,7 @@ String DbgSymRequest::SearchForImage(const String& filePath, uint32 fileTime, in
if (CheckPEFile(cacheFilePath, fileTime, size))
{
return cacheFilePath;
}
}
for (auto& symServAddr : mOptions.mSymbolServers)
{
@ -466,7 +465,7 @@ String DbgSymRequest::SearchForImage(const String& filePath, uint32 fileTime, in
checkPath += imageStoreDir;
checkPath += fileName;
if (CheckPEFile(checkPath, fileTime, size))
{
{
return checkPath;
}
@ -490,14 +489,14 @@ String DbgSymRequest::SearchForImage(const String& filePath, uint32 fileTime, in
// Re-check cache
if (CheckPEFile(cacheFilePath, fileTime, size))
{
return cacheFilePath;
return cacheFilePath;
}
}
if (!mIsPreCache)
{
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->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",
GetFileName(filePath).c_str(), fileTime, size));
}
@ -526,7 +525,7 @@ bool DbgSymRequest::IsDone()
DbgSymSrv::DbgSymSrv(Debugger* debugger)
{
mDebugger = debugger;
mDebugger = debugger;
}
void DbgSymSrv::PreCacheImage(const String& filePath, uint32 fileTime, int size)
@ -558,7 +557,7 @@ DbgSymRequest* DbgSymSrv::CreateRequest()
DbgSymRequest* symRequest = new DbgSymRequest();
symRequest->mOptions = mDebugger->mDebugManager->mSymSrvOptions;
symRequest->mDbgSymSrv = this;
symRequest->mDbgSymSrv = this;
return symRequest;
}
@ -569,6 +568,4 @@ void DbgSymSrv::ReleaseRequest(DbgSymRequest* dbgSymRequest)
void DbgSymSrv::Update()
{
}
}

View file

@ -81,7 +81,7 @@ USING_NS_BF;
// char cIn;
// do { cIn = *(inPtr++); } while (cIn == ' ');
// char cMap;
// do { cMap = *(mapPtr++); } while (cMap == ' ');
// do { cMap = *(mapPtr++); } while (cMap == ' ');
// if (cIn != cMap)
// {
// if ((cIn == '`') || (cIn == '\''))
@ -136,7 +136,7 @@ USING_NS_BF;
//}
//
//void DbgTypeMap::Insert(DbgType* value)
//{
//{
// if (mHashHeads == NULL)
// 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)
//{
//{
// if (language == DbgLanguage_BeefUnfixed)
// {
// std::string str = name;
@ -184,7 +184,7 @@ USING_NS_BF;
// // Find our way to the end and remove the star
// int chevCount = 0;
// for (char* cTestPtr = cPtr - 1; cTestPtr >= name; cTestPtr--)
// {
// {
// char c = *cTestPtr;
// if (c == 0)
// break;
@ -217,7 +217,7 @@ USING_NS_BF;
// }
// }
// }
//
//
// if (nameStart != NULL)
// {
// 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)
{
{
if (language == DbgLanguage_BeefUnfixed)
{
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
int chevCount = 0;
for (char* cTestPtr = cPtr - 1; cTestPtr >= name; cTestPtr--)
{
{
char c = *cTestPtr;
if (c == 0)
break;
@ -428,7 +428,7 @@ DbgTypeMap::Entry* DbgTypeMap::Find(const char* name, DbgLanguage language)
}
}
}
if (nameStart != NULL)
{
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;
for (int i = mMap.mBuckets[hashCode % mMap.mAllocSize]; i >= 0; i = mMap.mEntries[i].mNext)
{
{
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))
return entry;
}
}
return NULL;
}
@ -490,4 +490,4 @@ Beefy::HashSet<DbgTypeMap::Entry>::iterator DbgTypeMap::begin()
Beefy::HashSet<DbgTypeMap::Entry>::iterator DbgTypeMap::end()
{
return mMap.end();
}
}

View file

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

View file

@ -23,13 +23,13 @@ class DebugTarget
public:
WinDebugger* mDebugger;
DbgRadixMap<DbgSymbol*> mSymbolMap;
DbgRadixMap<DbgSymbol*> mSymbolMap;
DbgAutoStaticEntryBucketMap mAutoStaticEntryBucketMap;
Array<Array<DbgAutoStaticEntry> > mAutoStaticEntryBuckets;
DbgRadixMap<DbgSubprogramMapEntry*> mSubprogramMap;
DbgRadixMap<DbgExceptionDirectoryEntry*> mExceptionDirectoryMap;
DbgRadixMap<DbgCompileUnitContrib*> mContribMap;
Array<String>* mCapturedNamesPtr;
Array<DbgType*>* mCapturedTypesPtr;
@ -37,17 +37,17 @@ public:
int mLastHotHeapCleanIdx;
String mTargetPath;
DbgModule* mLaunchBinary;
DbgModule* mTargetBinary;
DbgModule* mTargetBinary;
Array<DbgModule*> mDbgModules;
Dictionary<int, DbgModule*> mDbgModuleMap;
HashSet<DbgSrcFile*> mPendingSrcFileRehup; // Waiting to remove old/invalid line info
BumpAllocator mAlloc;
BumpAllocator mAlloc;
bool mWasLocallyBuilt;
bool mIsEmpty;
bool mCheckedCompilerSettings;
bool mBfObjectHasFlags;
bool mBfObjectHasVDataExtender;
bool mBfObjectHasVDataExtender;
bool mBfHasLargeStrings;
bool mBfHasLargeCollections;
int mBfObjectVDataIntefaceSlotCount;
@ -57,11 +57,11 @@ public:
Array<DwCommonFrameDescriptor*> mCommonFrameDescriptors;
std::map<addr_target, DwFrameDescriptor> mDwFrameDescriptorMap;
std::map<addr_target, COFFFrameDescriptorEntry> mCOFFFrameDescriptorMap;
Dictionary<String, DbgSrcFile*> mSrcFiles;
Dictionary<String, String> mLocalToOrigSrcMap;
protected:
protected:
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_DwFrameDescriptor(CPURegisters* registers, addr_target* outReturnAddressLoc);
@ -74,7 +74,7 @@ protected:
public:
DebugTarget(WinDebugger* debugger);
~DebugTarget();
void AddDbgModule(DbgModule* dbgModule);
DbgModule* Init(const StringImpl& launchPath, const StringImpl& targetPath, intptr imageBase = 0);
void SetupTargetBinary();
@ -89,8 +89,8 @@ public:
DbgSrcFile* GetSrcFile(const String& srcFilePath);
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);
DbgSubprogram* FindSubProgram(addr_target address, DbgOnDemandKind onDemandKind = DbgOnDemandKind_AllowRemote);
void GetCompilerSettings();
@ -103,7 +103,7 @@ public:
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 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 PropogateRegisterUpCallStack(CPURegisters* callerRegisters, CPURegisters* calleeRegisters, void* regPtr, bool& wasSaved);
int GetFrameBaseRegister(DbgSubprogram* dwSubprogram);

View file

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

View file

@ -149,7 +149,7 @@ void HDCheckHandles(const std::string& traceStr)
handleInfo = (PSYSTEM_HANDLE_INFORMATION)malloc(handleInfoSize);
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. */
while ((status = gNtQuerySystemInformation(
SystemHandleInformation,
@ -181,7 +181,7 @@ void HDCheckHandles(const std::string& traceStr)
/* Check if this handle belongs to the PID the user specified. */
if (handle.ProcessId != GetCurrentProcessId())
continue;
auto itr = oldHandleMap.find(handle.Handle);
if (itr != oldHandleMap.end())
gHDHandleMap.insert(*itr);
@ -261,7 +261,7 @@ void HDDump()
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. */
if (handle.GrantedAccess == 0x0012019f)
{
@ -375,7 +375,7 @@ int ZZwmain(int argc, WCHAR *argv[])
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. */
while ((status = NtQuerySystemInformation(
SystemHandleInformation,
@ -435,7 +435,7 @@ int ZZwmain(int argc, WCHAR *argv[])
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. */
if (handle.GrantedAccess == 0x0012019f)
{
@ -520,4 +520,4 @@ int ZZwmain(int argc, WCHAR *argv[])
CloseHandle(processHandle);
return 0;
}
}

View file

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

View file

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

View file

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

View file

@ -76,7 +76,7 @@ public:
addr_target mRawRootPtr;
addr_target mRawObjectSentinel;
int mSizeClasses[TCFake::kNumClasses];
int mSizeClasses[TCFake::kNumClasses];
};
class DbgHotScanner
@ -88,7 +88,7 @@ public:
Beefy::Dictionary<addr_target, int> mFoundRawAllocDataAddrs;
Beefy::Dictionary<addr_target, int> mFoundTypeAddrs;
Beefy::HashSet<addr_target> mFoundFuncPtrs;
#ifdef BF_DBG_32
TCFake::PageHeap::PageMap::Root mRoot;
TCFake::PageHeap::PageMap::Leaf mNode;
@ -97,7 +97,7 @@ public:
TCFake::PageHeap::PageMap::Node mNode1;
TCFake::PageHeap::PageMap::Leaf mNode2;
#endif
Beefy::Array<uint8> mScanData;
Beefy::Array<uint8> mScanData;
public:
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)
{
auto& threadEx = mMiniDump->GetStreamData<MINIDUMP_THREAD_EX_LIST>(section);
/*WdThreadInfo* threadInfo = new WdThreadInfo();
threadInfo->mThreadId = threadEx.ThreadId;
threadInfo->mThreadId = threadEx.ThreadId;
mThreadList.Add(threadInfo);
if (mActiveThread == NULL)
@ -54,7 +54,7 @@ MiniDumpDebugger::MiniDumpDebugger(DebugManager* debugManager, DbgMiniDump* mini
//TODO: 'get' the actual image
dbgModule->mTimeStamp = module.TimeDateStamp;
//dbgModule->mExpectedFileSize = module.;
const wchar_t* moduleName = &mMiniDump->GetData<wchar_t>(module.ModuleNameRva + 4);
dbgModule->mFilePath = UTF8Encode(moduleName);
dbgModule->mDisplayName = GetFileName(dbgModule->mFilePath);
@ -74,8 +74,8 @@ MiniDumpDebugger::MiniDumpDebugger(DebugManager* debugManager, DbgMiniDump* mini
//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);
//TESTING
@ -124,7 +124,7 @@ MiniDumpDebugger::MiniDumpDebugger(DebugManager* debugManager, DbgMiniDump* mini
auto& memoryInfoList = mMiniDump->GetStreamData<MINIDUMP_MEMORY_INFO_LIST>(section);
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)
@ -143,15 +143,15 @@ MiniDumpDebugger::MiniDumpDebugger(DebugManager* debugManager, DbgMiniDump* mini
else if (section.mStreamType == ExceptionStream)
{
auto& exceptionStream = mMiniDump->GetStreamData<MINIDUMP_EXCEPTION_STREAM>(section);
//mCurException = exceptionStream.ExceptionRecord;
//mCurException = exceptionStream.ExceptionRecord;
mCurException.ExceptionCode = exceptionStream.ExceptionRecord.ExceptionCode;
mCurException.ExceptionFlags = exceptionStream.ExceptionRecord.ExceptionFlags;
mCurException.ExceptionAddress = (PVOID)exceptionStream.ExceptionRecord.ExceptionAddress;
mCurException.NumberParameters = exceptionStream.ExceptionRecord.NumberParameters;
for (int i = 0; i < EXCEPTION_MAXIMUM_PARAMETERS; i++)
mCurException.ExceptionInformation[i] = exceptionStream.ExceptionRecord.ExceptionInformation[i];
WdThreadInfo* threadInfo = NULL;
if (mThreadMap.TryGetValue(exceptionStream.ThreadId, &threadInfo))
{
@ -168,19 +168,19 @@ MiniDumpDebugger::MiniDumpDebugger(DebugManager* debugManager, DbgMiniDump* mini
}
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)
{
auto& miscInfo = mMiniDump->GetStreamData<MINIDUMP_MISC_INFO>(section);
auto& miscInfo = mMiniDump->GetStreamData<MINIDUMP_MISC_INFO>(section);
}
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*/)
{
auto data = ((uint8*)mMiniDump->mMF.mData + section.mDataRVA);
auto data = ((uint8*)mMiniDump->mMF.mData + section.mDataRVA);
}
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);
UTF16String name = UTF16String((wchar_t*)((uint8*)mMiniDump->mMF.mData + threadNameInfo->mNameRVA + 4), nameLen);
WdThreadInfo* threadInfo = NULL;
if (mThreadMap.TryGetValue(threadNameInfo->mThreadId, &threadInfo))
{
@ -216,15 +216,15 @@ MiniDumpDebugger::MiniDumpDebugger(DebugManager* debugManager, DbgMiniDump* mini
GUID mClientID;
};
auto& crashPadInfo = mMiniDump->GetStreamData<_MiniDumpCrashPadInfo>(section);
auto& crashPadInfo = mMiniDump->GetStreamData<_MiniDumpCrashPadInfo>(section);
}
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
{
const char* report = &mMiniDump->GetStreamData<char>(section);
const char* report = &mMiniDump->GetStreamData<char>(section);
}
else if (section.mStreamType == 0xBEEF00) // Error text
{
@ -257,7 +257,7 @@ void MiniDumpDebugger::MapMemory(addr_target addr, void* data, intptr_target siz
break;
MiniDumpMemoryRegion* memRegion = mAlloc.Alloc<MiniDumpMemoryRegion>();
memRegion->mAddress = beginAddress + memOffset;
memRegion->mAddress = beginAddress + memOffset;
memRegion->mAddressLength = curSize;
memRegion->mData = (uint8*)data + memOffset;
memRegion->mNext = NULL;
@ -271,9 +271,9 @@ MappedFile* MiniDumpDebugger::MapModule(COFF* dbgModule, const StringImpl& fileN
if (!mappedFile->Open(fileName))
{
delete mappedFile;
return NULL;
return NULL;
}
mMappedFiles.Add(mappedFile);
mMappedFiles.Add(mappedFile);
return mappedFile;
}
@ -289,7 +289,6 @@ bool MiniDumpDebugger::PopulateRegisters(CPURegisters* registers)
{
if (section.mStreamType == ThreadExListStream)
{
}
else if (section.mStreamType == ThreadListStream)
{
@ -352,21 +351,20 @@ bool MiniDumpDebugger::ReadMemory(intptr address, uint64 length, void* dest, boo
return false;
}
return true;
}
}
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)))
//return false; // Out of bounds
}
return false;
}
bool MiniDumpDebugger::WriteMemory(intptr address, void* src, uint64 length)
{
return false;
}
}

View file

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

View file

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

View file

@ -48,7 +48,7 @@ struct ProfileDataListEquals
class ProfileAddrEntry : public ProfileDataList<addr_target>
{
public:
public:
//int mSampleCount;
int mEntryIdx;
@ -88,7 +88,7 @@ public:
int mEntryIdx;
bool mUsed;
public:
public:
ProfileProcEntry()
{
mEntryIdx = -1;
@ -122,7 +122,7 @@ public:
WinDebugger* mDebugger;
volatile bool mIsRunning;
bool mWantsClear;
SyncEvent mShutdownEvent;
SyncEvent mShutdownEvent;
bool mNeedsProcessing;
uint32 mStartTick;
uint32 mEndTick;
@ -130,37 +130,37 @@ public:
int mTotalVirtualSamples;
int mTotalActualSamples;
int mTotalActiveSamplingMS;
BumpAllocator mAlloc;
Dictionary<uint, ProfileThreadInfo*> mThreadInfo;
Array<uint> mThreadIdList;
ProfileAddrEntrySet mProfileAddrEntrySet;
ProfileAddrEntrySet mProfileAddrEntrySet;
Array<ProfileAddrEntry*> mProfileAddrEntries;
Array<ProfileAddrEntry> mPendingProfileEntries;
ProfileProcEntrySet mProfileProcEntrySet;
Array<ProfileProcEntry*> mProfileProcEntries;
Array<ProfileProcEntry*> mProfileProcEntries;
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)
HashSet<ProfileProdIdEntry> mUniqueProcSet;
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<String> mIdleSymbolNames;
public:
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>
typename T::key_type* AddToSet(T& map, typename T::key_type::data_type* data, int size)
{
typedef T::key_type::data_type DataType;
typename T::key_type entry;
entry.mData = data;
entry.mSize = size;
typename T::key_type* entryPtr;
if (map.TryAdd(entry, &entryPtr))
{
@ -187,7 +187,7 @@ public:
bool IsSampling() override { return mIsRunning; }
String GetOverview() override;
String GetThreadList() override;
String GetThreadList() override;
String GetCallTree(int threadId, bool reverse) override;
};

View file

@ -28,13 +28,12 @@ public:
{
public:
RadixMap32* mRadixMap;
int mRootIdx;
int mRootIdx;
int mLeafIdx;
public:
Iterator()
{
}
Iterator& operator++()
@ -58,7 +57,7 @@ public:
mRootIdx++;
}
}
if (mRadixMap->mRoot[mRootIdx]->mValues[mLeafIdx] != NULL)
return *this;
@ -86,7 +85,7 @@ public:
struct Leaf
{
T mValues[LEAF_LENGTH];
T mValues[LEAF_LENGTH];
T GetFirst(int startLeaf = 0)
{
@ -103,23 +102,23 @@ public:
value = value->mNext;
}
return lowestValue;
}
}
}
return NULL;
}
};
Leaf* mRoot[ROOT_LENGTH]; // Pointers to 32 child nodes
typedef uint32 Number;
typedef uint32 Number;
public:
RadixMap32()
{
memset(mRoot, 0, sizeof(mRoot));
}
~RadixMap32()
{
{
int leafCount = 0;
for (int i = 0; i < ROOT_LENGTH; i++)
{
@ -135,8 +134,8 @@ public:
{
Iterator itr;
itr.mRadixMap = this;
itr.mRootIdx = -1;
itr.mLeafIdx = LEAF_LENGTH - 1;
itr.mRootIdx = -1;
itr.mLeafIdx = LEAF_LENGTH - 1;
return ++itr;
}
@ -144,17 +143,17 @@ public:
{
Iterator itr;
itr.mRadixMap = this;
itr.mRootIdx = ROOT_LENGTH;
itr.mRootIdx = ROOT_LENGTH;
itr.mLeafIdx = 0;
return itr;
}
void Clear()
{
{
for (int i = 0; i < ROOT_LENGTH; i++)
{
if (mRoot[i] != NULL)
{
{
delete mRoot[i];
mRoot[i] = NULL;
}
@ -181,18 +180,18 @@ public:
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 blockAddr = (int)(addr >> BLOCK_SHIFT);
int i1 = (int)(blockAddr >> LEAF_BITS);
int i2 = (int)(blockAddr & (LEAF_LENGTH - 1));
// Find closest entry to requested addr
Leaf* leaf = mRoot[i1];
int bestDist = 0x7FFFFFFF;
T bestValue = NULL;
if (leaf != NULL)
if (leaf != NULL)
{
T curValue = leaf->mValues[i2];
while (curValue != NULL)
@ -222,7 +221,7 @@ public:
i1--;
if (i1 < 0)
break;
i2 = LEAF_LENGTH - 1;
i2 = LEAF_LENGTH - 1;
}
leaf = mRoot[i1];
if (leaf != NULL)
@ -244,7 +243,7 @@ public:
return NULL;
}
T GetNext(T value)
{
const Number blockAddr = value->mAddress >> BLOCK_SHIFT;
@ -305,7 +304,7 @@ public:
}
return NULL;
}
}
T GetUnordered(Number addr, int maxReverseOffset) const
{
@ -331,7 +330,7 @@ public:
blockOffsetsLeft--;
}
else
{
{
i1++;
blockOffsetsLeft -= LEAF_LENGTH;
}
@ -359,7 +358,7 @@ public:
int i2Start;
int i2End;
if (i1 == i1Start)
{
{
i2Start = (int)(blockAddrStart & (LEAF_LENGTH - 1));
i2End = LEAF_LENGTH;
}
@ -394,17 +393,17 @@ public:
}
curValue = curValue->mNext;
}
*nextPtr = NULL;
*nextPtr = NULL;
}
}
}
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 i2 = blockAddr & (LEAF_LENGTH - 1);
Leaf* leaf = mRoot[i1];
if (leaf == NULL)
{
@ -413,7 +412,7 @@ public:
mRoot[i1] = leaf;
}
T prevValue = leaf->mValues[i2];
T prevValue = leaf->mValues[i2];
mRoot[i1]->mValues[i2] = value;
value->mNext = prevValue;
}
@ -432,14 +431,14 @@ public:
{
if (curValue == value)
{
if (prevValue == NULL)
if (prevValue == NULL)
leaf->mValues[i2] = curValue->mNext;
else
prevValue->mNext = curValue->mNext;
prevValue->mNext = curValue->mNext;
curValue->mNext = NULL;
return;
}
prevValue = curValue;
curValue = curValue->mNext;
}
@ -470,19 +469,18 @@ public:
RadixMap64* mRadixMap;
int mRootIdx;
int mMidIdx;
int mLeafIdx;
int mLeafIdx;
public:
Iterator()
{
}
Iterator& operator++()
{
mLeafIdx++;
while (true)
{
{
if (mLeafIdx == LEAF_LENGTH)
{
mLeafIdx = 0;
@ -494,7 +492,7 @@ public:
{
mMidIdx = 0;
mRootIdx++;
mRootIdx++;
while (true)
{
if (mRootIdx == ROOT_LENGTH)
@ -512,7 +510,7 @@ public:
mMidIdx++;
}
}
}
if (mRadixMap->mRoot[mRootIdx]->mLeafs[mMidIdx]->mValues[mLeafIdx] != NULL)
return *this;
@ -563,7 +561,7 @@ public:
return NULL;
}
};
struct Mid
{
Leaf* mLeafs[MID_LENGTH];
@ -722,7 +720,7 @@ public:
}
i3 = LEAF_LENGTH - 1;
}
mid = mRoot[i1];
if (mid != NULL)
{
@ -829,7 +827,7 @@ public:
}
void RemoveRange(Number startAddr, Number length)
{
{
Number endAddr = BF_MIN(startAddr + length, 0x0001000000000000LL);
startAddr = BF_MIN(startAddr, 0x0000FFFFFFFFFFFFLL);
@ -958,7 +956,7 @@ public:
}
}
else
{
{
// MID_LENGTH * LEAF_LENGTH is > 4GB, so a mRoot[i1] being NULL indicates no data
return NULL;
}
@ -992,7 +990,7 @@ public:
sMidSize += sizeof(Mid);
mRoot[i1] = mid;
}
BF_ASSERT((i2 >= 0) && (i2 < MID_LENGTH));
Leaf* leaf = mid->mLeafs[i2];
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_ACTIVE CONTEXT_EXCEPTION_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_BP(ctx) ctx.Ebp
#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_ACTIVE WOW64_CONTEXT_EXCEPTION_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_BP(ctx) ctx.Ebp
#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_ACTIVE CONTEXT_EXCEPTION_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_BP(ctx) ctx.Rbp
#define BF_CONTEXT_IP(ctx) ctx.Rip
@ -123,7 +123,7 @@ public:
class WdBreakpointCondition
{
public:
public:
DbgEvaluationContext* mDbgEvaluationContext;
String mExpr;
~WdBreakpointCondition();
@ -135,7 +135,7 @@ public:
addr_target mMemoryAddress;
int mByteCount;
String mReferenceName;
int8 mMemoryWatchSlotBitmap;
int8 mMemoryWatchSlotBitmap;
WdMemoryBreakpointInfo()
{
@ -147,31 +147,31 @@ public:
class WdBreakpoint : public Breakpoint
{
public:
public:
WdMemoryBreakpointInfo* mMemoryBreakpointInfo;
addr_target mAddr;
DbgSrcFile* mSrcFile;
DbgLineDataEx mLineData;
WdBreakpointCondition* mCondition;
BreakpointType mBreakpointType;
BreakpointType mBreakpointType;
public:
WdBreakpoint()
{
{
mMemoryBreakpointInfo = NULL;
mAddr = 0;
mSrcFile = NULL;
mLineData = DbgLineDataEx();
mCondition = NULL;
mBreakpointType = BreakpointType_User;
mBreakpointType = BreakpointType_User;
}
virtual uintptr GetAddr() override
{
return (uintptr)mAddr;
}
virtual bool IsMemoryBreakpointBound() override
{
return (mMemoryBreakpointInfo != NULL) && (mMemoryBreakpointInfo->mMemoryWatchSlotBitmap != 0);
@ -188,7 +188,7 @@ public:
enum StepType
{
StepType_None,
StepType_StepInto,
StepType_StepInto,
StepType_StepInto_Unfiltered,
StepType_StepInto_UnfilteredSingle,
StepType_StepOver,
@ -201,7 +201,7 @@ enum StepType
class WdStackFrame
{
public:
public:
CPURegisters mRegisters;
bool mIsStart;
bool mIsEnd;
@ -214,7 +214,7 @@ public:
public:
WdStackFrame()
{
{
mSubProgram = NULL;
mHasGottenSubProgram = false;
mIsStart = true;
@ -241,11 +241,11 @@ struct WdThreadInfo
public:
uint mProcessId;
uint mThreadId;
HANDLE mHThread;
HANDLE mHThread;
void* mThreadLocalBase;
void* mStartAddress;
bool mIsBreakRestorePaused;
bool mFrozen;
bool mFrozen;
addr_target mStartSP;
String mName;
addr_target mStoppedAtAddress;
@ -263,7 +263,7 @@ public:
mThreadLocalBase = NULL;
mStartAddress = NULL;
mIsBreakRestorePaused = false;
mFrozen = false;
mFrozen = false;
mIsAtBreakpointAddress = 0;
mStoppedAtAddress = 0;
@ -274,16 +274,16 @@ public:
class DbgPendingExpr
{
public:
public:
int mThreadId;
BfParser* mParser;
DbgType* mExplitType;
DwFormatInfo mFormatInfo;
DbgType* mExplitType;
DwFormatInfo mFormatInfo;
DwEvalExpressionFlags mExpressionFlags;
int mCursorPos;
BfExpression* mExprNode;
String mReferenceId;
int mCallStackIdx;
int mCallStackIdx;
String mResult;
Array<DbgCallResult> mCallResults;
int mIdleTicks;
@ -311,13 +311,13 @@ struct WdMemoryBreakpointBind
addr_target mAddress;
int mOfs;
int mByteCount;
WdMemoryBreakpointBind()
{
mAddress = 0;
mBreakpoint = NULL;
mOfs = 0;
mByteCount = 0;
mByteCount = 0;
}
};
@ -349,12 +349,12 @@ public:
public:
HANDLE mFileMapping;
Stats* mStats;
Stats* mStats;
WinDbgHeapData()
{
mFileMapping = 0;
mStats = NULL;
mStats = NULL;
}
~WinDbgHeapData()
@ -368,8 +368,8 @@ struct DwFormatInfo;
class WinDebugger : public Debugger
{
public:
SyncEvent mContinueEvent;
public:
SyncEvent mContinueEvent;
Array<HotTargetMemory> mHotTargetMemory;
Array<WinHotThreadState> mHotThreadStates;
@ -383,10 +383,10 @@ public:
String mArgs;
String mWorkingDir;
bool mHotSwapEnabled;
Array<uint8> mEnvBlock;
Array<uint8> mEnvBlock;
DebugTarget* mEmptyDebugTarget;
DebugTarget* mDebugTarget;
BfSystem* mBfSystem;
BfSystem* mBfSystem;
CPU* mCPU;
PROCESS_INFORMATION mProcessInfo;
BfDbgAttachFlags mDbgAttachFlags;
@ -396,25 +396,25 @@ public:
HANDLE mDbgThreadHandle;
bool mIsDebuggerWaiting;
bool mWantsDebugContinue;
bool mNeedsRehupBreakpoints;
bool mNeedsRehupBreakpoints;
bool mContinueFromBreakpointFailed;
WdThreadInfo* mDebuggerWaitingThread;
WdThreadInfo* mAtBreakThread;
WdThreadInfo* mActiveThread;
WdBreakpoint* mActiveBreakpoint;
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;
bool mGotStartupEvent;
int mPageSize;
int mPageSize;
DbgSymSrv mDbgSymSrv;
DbgSymRequest* mActiveSymSrvRequest;
DWORD mDebuggerThreadId;
WdMemoryBreakpointBind mMemoryBreakpoints[4];
int mMemoryBreakpointVersion;
Dictionary<addr_target, int> mPhysBreakpointAddrMap; // To make sure we don't create multiple physical breakpoints at the same addr
Array<WdBreakpoint*> mBreakpoints;
Dictionary<addr_target, int> mPhysBreakpointAddrMap; // To make sure we don't create multiple physical breakpoints at the same addr
Array<WdBreakpoint*> mBreakpoints;
Dictionary<addr_target, WdBreakpoint*> mBreakpointAddrMap;
Array<int> mFreeMemoryBreakIndices;
Array<WdStackFrame*> mCallStack;
@ -424,20 +424,20 @@ public:
int mBreakStackFrameIdx;
addr_target mShowPCOverride;
Dictionary<uint32, WdThreadInfo*> mThreadMap;
Array<WdThreadInfo*> mThreadList;
Array<WdThreadInfo*> mThreadList;
StepType mOrigStepType;
StepType mStepType;
StepType mStepType;
int mCurNoInfoStepTries;
DbgLineDataEx mStepLineData;
bool mStepInAssembly;
bool mStepIsRecursing;
bool mStepSwitchedThreads;
bool mStepStopOnNextInstruction;
bool mDbgBreak;
bool mStepStopOnNextInstruction;
bool mDbgBreak;
addr_target mStepStartPC;
addr_target mStepPC;
addr_target mStepSP;
addr_target mStepSP;
addr_target mStoredReturnValueAddr;
addr_target mLastValidStepIntoPC;
bool mIsStepIntoSpecific;
@ -449,27 +449,27 @@ public:
Array<DbgModule*> mPendingDebugInfoRequests;
HashSet<String> mLiteralSet;
EXCEPTION_RECORD mCurException;
EXCEPTION_RECORD mCurException;
bool mIsContinuingFromException;
Array<int64> mTempBreakpoint;
Array<int64> mStepBreakpointAddrs;
Array<int64> mStepBreakpointAddrs;
addr_target mSavedBreakpointAddressContinuing;
addr_target mSavedAtBreakpointAddress;
BF_CONTEXT mSavedContext;
BF_CONTEXT mSavedContext;
Dictionary<int, Profiler*> mPendingProfilerMap;
Array<Profiler*> mNewProfilerList;
HashSet<Profiler*> mProfilerSet;
addr_target mMemCacheAddr;
uint8 mMemCacheData[WD_MEMCACHE_SIZE];
uint8 mMemCacheData[WD_MEMCACHE_SIZE];
public:
void Fail(const StringImpl& error);
void Fail(const StringImpl& error);
void TryGetThreadName(WdThreadInfo* threadInfo);
void ThreadRestorePause(WdThreadInfo* onlyPauseThread, WdThreadInfo* dontPauseThread);
void ThreadRestoreUnpause();
void ThreadRestoreUnpause();
void UpdateThreadDebugRegisters(WdThreadInfo* threadInfo);
void UpdateThreadDebugRegisters();
void ValidateBreakpoints();
@ -477,13 +477,13 @@ public:
void SetBreakpoint(addr_target address, bool fromRehup = false);
void SetTempBreakpoint(addr_target address);
void PhysRemoveBreakpoint(addr_target address);
void RemoveBreakpoint(addr_target address);
void RemoveBreakpoint(addr_target address);
void SingleStepX86();
bool IsInRunState();
bool ContinueFromBreakpoint();
bool ContinueFromBreakpoint();
bool HasLineInfoAt(addr_target address);
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);
void RemoveTempBreakpoints();
void RehupBreakpoints(bool doFlush);
@ -496,7 +496,7 @@ public:
virtual bool PopulateRegisters(CPURegisters* registers);
bool RollBackStackFrame(CPURegisters* registers, bool isStackStart);
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());
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 DbgTypedValueToString(const DbgTypedValue& typedValue, const StringImpl& expr, DwFormatInfo& formatFlags, DbgExprEvaluator* optEvaluator, bool fullPrecision = false);
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);
void ReserveHotTargetMemory(int size);
void ReserveHotTargetMemory(int size);
addr_target AllocHotTargetMemory(int size, bool canExecute, bool canWrite, int* outAllocSize);
void ReleaseHotTargetMemory(addr_target addr, int size);
void CleanupHotHeap();
void CleanupHotHeap();
int EnableWriting(intptr address, int size);
int SetProtection(intptr address, int size, int prot);
void EnableMemCache();
@ -522,14 +522,14 @@ public:
bool WriteInstructions(intptr address, void* src, uint64 length);
template<typename T> bool WriteMemory(intptr addr, T val);
virtual DbgMemoryFlags GetMemoryFlags(intptr address) override;
void SetRunState(RunState runState);
void SetRunState(RunState runState);
bool IsPaused();
void ClearStep();
bool SetupStep(StepType stepType);
bool SetupStep(StepType stepType);
void CheckNonDebuggerBreak();
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, const DbgTypedValue& typedValue);
void SetThisRegister(CPURegisters* registers, addr_target val);
@ -538,7 +538,7 @@ public:
DbgTypedValue ReadReturnValue(CPURegisters* registers, DbgType* type);
bool SetRegisters(CPURegisters* registers);
void SaveAllRegisters();
void RestoreAllRegisters();
void RestoreAllRegisters();
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 GetDictionaryItems(DbgCompileUnit* dbgCompileUnit, DebugVisualizerEntry* debugVis, DbgTypedValue dictValue, int bucketIdx, int nodeIdx, int& count, String* outContinuationData);
@ -548,13 +548,13 @@ public:
bool DoUpdate();
void DebugThreadProc();
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);
void FixupLineData(DbgCompileUnit* compileUnit);
void FixupLineDataForSubprogram(DbgSubprogram* subProgram);
DbgModule* GetCallStackDbgModule(int callStackIdx);
DbgSubprogram* GetCallStackSubprogram(int callStackIdx);
DbgCompileUnit* GetCallStackCompileUnit(int callStackIdx);
DbgSubprogram* GetCallStackSubprogram(int callStackIdx);
DbgCompileUnit* GetCallStackCompileUnit(int callStackIdx);
String Evaluate(const StringImpl& expr, DwFormatInfo formatInfo, int callStackIdx, int cursorPos, int language, DwEvalExpressionFlags expressionFlags);
String EvaluateContinue() override;
void EvaluateContinueKeep() override;
@ -562,15 +562,15 @@ public:
String GetAutocompleteOutput(DwAutoComplete& autoComplete);
bool CheckConditionalBreakpoint(WdBreakpoint* breakpoint, DbgSubprogram* dbgSubprogram, addr_target pcAddress);
void CleanupDebugEval(bool restoreRegisters = true);
bool FixCallStackIdx(int& callStackIdx);
bool FixCallStackIdx(int& callStackIdx);
void DoClearCallStack(bool clearSavedStacks);
int LoadDebugInfoForModule(DbgModule* dbgModule);
int LoadDebugInfoForModule(DbgModule* dbgModule);
public:
WinDebugger(DebugManager* debugManager);
virtual ~WinDebugger();
virtual void OutputMessage(const StringImpl& msg) override;
virtual void OutputRawMessage(const StringImpl& msg) 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 bool Attach(int processId, BfDbgAttachFlags attachFlags) 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 intptr GetDbgAllocHeapSize() override;
virtual String GetDbgAllocInfo() override;
@ -591,13 +591,13 @@ public:
virtual Breakpoint* CreateAddressBreakpoint(intptr address) override;
virtual void CheckBreakpoint(Breakpoint* breakpoint) 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 MoveBreakpoint(Breakpoint* breakpoint, int lineNum, int wantColumn, bool rebindNow) override;
virtual void MoveMemoryBreakpoint(Breakpoint* breakpoint, intptr addr, int byteCount) override;
virtual void DisableBreakpoint(Breakpoint* breakpoint) 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* GetActiveBreakpoint() override;
virtual void BreakAll() override;
@ -611,7 +611,7 @@ public:
virtual String EvaluateToAddress(const StringImpl& expr, int callStackIdx, 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 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 GetAutoLocals(int callStackIdx, bool showRegs) 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 DisassembleAt(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 String GetModulesInfo() override;
virtual void CancelSymSrv() override;
virtual void CancelSymSrv() override;
virtual bool HasPendingDebugLoads() 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) override;
virtual void StopDebugging() override;
virtual void Terminate() override;
virtual void Detach() override;
virtual void Detach() override;
virtual Profiler* StartProfiling() override;
virtual Profiler* PopProfiler() override;
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)
{
{
bool success = true;
T val;
T val;
memset(&val, 0, sizeof(T));
if (local)
{
if (addr != 0)
if (addr != 0)
{
memcpy(&val, (void*)(intptr)addr, sizeof(T));
/*__try
@ -698,7 +698,7 @@ template<typename T> T WinDebugger::ReadMemory(intptr addr, bool local, bool* fa
success = false;
}
else
{
{
//SIZE_T dwReadBytes;
memset(&val, 0, sizeof(T));
//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);
NS_BF_DBG_END