mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Watch lock fixes, add watch pointee/pointer address
This commit is contained in:
parent
d990e3afea
commit
eccfabbad2
9 changed files with 214 additions and 55 deletions
|
@ -4137,7 +4137,7 @@ void CeDebugger::HandleCustomExpandedItems(String& retVal, DebugVisualizerEntry*
|
|||
if (!valueType->IsPointer())
|
||||
ptrType = ceModule->CreatePointerType(valueType);
|
||||
evalStr = StrFormat("(comptype(%d)", ptrType->mTypeId);
|
||||
evalStr += ")0x{1}";;
|
||||
evalStr += ")0x{1}";
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -970,10 +970,20 @@ DbgType* DbgExprEvaluator::ResolveTypeRef(BfTypeReference* typeRef)
|
|||
|
||||
String name = typeRef->ToString();
|
||||
if (name.StartsWith("_T_"))
|
||||
{
|
||||
int idx = atoi(name.c_str() + 3);
|
||||
if ((idx >= 0) && (idx < (int)mDbgModule->mTypes.size()))
|
||||
return mDbgModule->mTypes[idx];
|
||||
{
|
||||
auto dbgModule = mDbgModule;
|
||||
|
||||
char* endPtr = NULL;
|
||||
int typeIdx = strtol(name.c_str() + 3, &endPtr, 10);
|
||||
if ((endPtr != NULL) && (*endPtr == '_'))
|
||||
{
|
||||
int moduleIdx = typeIdx;
|
||||
typeIdx = atoi(endPtr + 1);
|
||||
mDebugTarget->mDbgModuleMap.TryGetValue(moduleIdx, &dbgModule);
|
||||
}
|
||||
|
||||
if ((dbgModule != NULL) && (typeIdx >= 0) && (typeIdx < (int)dbgModule->mTypes.size()))
|
||||
return dbgModule->mTypes[typeIdx];
|
||||
}
|
||||
|
||||
auto entry = mDbgModule->mTypeMap.Find(name.c_str(), GetLanguage());
|
||||
|
@ -1023,23 +1033,33 @@ DbgType* DbgExprEvaluator::ResolveTypeRef(BfAstNode* typeRef, BfAstNode** parent
|
|||
for (int i = 3; i < (int)name.length(); i++)
|
||||
{
|
||||
char c = name[i];
|
||||
if ((c < '0') || (c > '9'))
|
||||
if (((c < '0') || (c > '9')) && (c != '_'))
|
||||
{
|
||||
endIdx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int idx = atoi(name.c_str() + 3);
|
||||
if ((idx >= 0) && (idx < (int)mDbgModule->mTypes.size()))
|
||||
auto dbgModule = mDbgModule;
|
||||
|
||||
char* endPtr = NULL;
|
||||
int typeIdx = strtol(name.c_str() + 3, &endPtr, 10);
|
||||
if ((endPtr != NULL) && (*endPtr == '_'))
|
||||
{
|
||||
int moduleIdx = typeIdx;
|
||||
typeIdx = atoi(endPtr + 1);
|
||||
mDebugTarget->mDbgModuleMap.TryGetValue(moduleIdx, &dbgModule);
|
||||
}
|
||||
|
||||
if ((dbgModule != NULL) && (typeIdx >= 0) && (typeIdx < (int)dbgModule->mTypes.size()))
|
||||
{
|
||||
if ((mExplicitThisExpr != NULL) && (parentChildRef != NULL))
|
||||
mDeferredInsertExplicitThisVector.push_back(NodeReplaceRecord(typeRef, parentChildRef, true));
|
||||
DbgType* dbgType = mDbgModule->mTypes[idx];
|
||||
DbgType* dbgType = dbgModule->mTypes[typeIdx];
|
||||
for (int i = endIdx; i < (int)name.length(); i++)
|
||||
{
|
||||
if (name[i] == '*')
|
||||
dbgType = mDbgModule->GetPointerType(dbgType);
|
||||
dbgType = dbgModule->GetPointerType(dbgType);
|
||||
}
|
||||
return dbgType;
|
||||
}
|
||||
|
|
|
@ -1547,7 +1547,7 @@ DbgType* DbgType::RemoveModifiers(bool* hadRef)
|
|||
String DbgType::ToStringRaw(DbgLanguage language)
|
||||
{
|
||||
if (mTypeIdx != -1)
|
||||
return StrFormat("_T_%d", mTypeIdx);
|
||||
return StrFormat("_T_%d_%d", mCompileUnit->mDbgModule->mId, mTypeIdx);
|
||||
return ToString(language);
|
||||
}
|
||||
|
||||
|
|
|
@ -33,6 +33,7 @@ DebugTarget::DebugTarget(WinDebugger* debugger)
|
|||
mLastHotHeapCleanIdx = 0;
|
||||
mIsEmpty = false;
|
||||
mWasLocallyBuilt = false;
|
||||
mCurModuleId = 0;
|
||||
|
||||
/*dbgType = new DbgType();
|
||||
dbgType->mName = "int";
|
||||
|
@ -252,9 +253,12 @@ String DebugTarget::UnloadDyn(addr_target imageBase)
|
|||
|
||||
if (mTargetBinary == dwarf)
|
||||
mTargetBinary = NULL;
|
||||
|
||||
mDbgModules.RemoveAt(i);
|
||||
bool success = mDbgModuleMap.Remove(dwarf->mId);
|
||||
BF_ASSERT_REL(success);
|
||||
|
||||
delete dwarf;
|
||||
mDbgModules.erase(mDbgModules.begin() + i);
|
||||
return filePath;
|
||||
}
|
||||
}
|
||||
|
@ -292,9 +296,11 @@ 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;
|
||||
mDbgModules.erase(mDbgModules.begin() + dwarfIdx);
|
||||
dwarfIdx--;
|
||||
}
|
||||
}
|
||||
|
@ -906,10 +912,11 @@ void DebugTarget::GetCompilerSettings()
|
|||
}
|
||||
|
||||
void DebugTarget::AddDbgModule(DbgModule* dbgModule)
|
||||
{
|
||||
static int id = 0;
|
||||
dbgModule->mId = ++id;
|
||||
{
|
||||
dbgModule->mId = ++mCurModuleId;
|
||||
mDbgModules.Add(dbgModule);
|
||||
bool success = mDbgModuleMap.TryAdd(dbgModule->mId, dbgModule);
|
||||
BF_ASSERT_REL(success);
|
||||
}
|
||||
|
||||
#if 1
|
||||
|
|
|
@ -38,7 +38,8 @@ public:
|
|||
String mTargetPath;
|
||||
DbgModule* mLaunchBinary;
|
||||
DbgModule* mTargetBinary;
|
||||
Array<DbgModule*> mDbgModules;
|
||||
Array<DbgModule*> mDbgModules;
|
||||
Dictionary<int, DbgModule*> mDbgModuleMap;
|
||||
HashSet<DbgSrcFile*> mPendingSrcFileRehup; // Waiting to remove old/invalid line info
|
||||
|
||||
BumpAllocator mAlloc;
|
||||
|
@ -51,6 +52,7 @@ public:
|
|||
bool mBfHasLargeCollections;
|
||||
int mBfObjectVDataIntefaceSlotCount;
|
||||
int mBfObjectSize;
|
||||
int mCurModuleId;
|
||||
|
||||
Array<DwCommonFrameDescriptor*> mCommonFrameDescriptors;
|
||||
std::map<addr_target, DwFrameDescriptor> mDwFrameDescriptorMap;
|
||||
|
|
|
@ -389,6 +389,8 @@ DbgPendingExpr::DbgPendingExpr()
|
|||
mIdleTicks = 0;
|
||||
mExplitType = NULL;
|
||||
mExpressionFlags = DwEvalExpressionFlag_None;
|
||||
mUsedSpecifiedLock = false;
|
||||
mStackIdxOverride = -1;
|
||||
}
|
||||
|
||||
DbgPendingExpr::~DbgPendingExpr()
|
||||
|
@ -8727,7 +8729,7 @@ void WinDebugger::HandleCustomExpandedItems(String& retVal, DbgCompileUnit* dbgC
|
|||
}
|
||||
}
|
||||
else if (debugVis->mCollectionType == DebugVisualizerEntry::CollectionType_Dictionary)
|
||||
{
|
||||
{
|
||||
DbgTypedValue sizeValue = EvaluateInContext(dbgCompileUnit, useTypedValue, debugVisualizers->DoStringReplace(debugVis->mSize, dbgVisWildcardCaptures), &formatInfo);
|
||||
DbgTypedValue entriesPtrValue = EvaluateInContext(dbgCompileUnit, useTypedValue, debugVisualizers->DoStringReplace(debugVis->mEntries, dbgVisWildcardCaptures), &formatInfo);
|
||||
|
||||
|
@ -9461,6 +9463,25 @@ String WinDebugger::EvaluateContinue(DbgPendingExpr* pendingExpr, BfPassInstance
|
|||
if (exprResult.mIsReadOnly)
|
||||
canEdit = false;
|
||||
|
||||
const char* langStr = (pendingExpr->mFormatInfo.mLanguage == DbgLanguage_Beef) ? "@Beef:" : "@C:";
|
||||
|
||||
if (exprResult.mSrcAddress != 0)
|
||||
{
|
||||
val += StrFormat("\n:addrValueExpr\t%s(%s*)", langStr, exprResult.mType->ToString(pendingExpr->mFormatInfo.mLanguage).c_str());
|
||||
val += EncodeDataPtr(exprResult.mSrcAddress, true);
|
||||
}
|
||||
|
||||
if (exprResult.mType->IsPointerOrRef())
|
||||
{
|
||||
auto underlyingType = exprResult.mType->mTypeParam;
|
||||
if (underlyingType != NULL)
|
||||
{
|
||||
val += StrFormat("\n:pointeeExpr\t%s(%s%s)", langStr, underlyingType->ToString(pendingExpr->mFormatInfo.mLanguage).c_str(),
|
||||
underlyingType->IsBfObject() ? "" : "*");
|
||||
val += EncodeDataPtr(exprResult.mPtr, true);
|
||||
}
|
||||
}
|
||||
|
||||
if (val[0] == '!')
|
||||
{
|
||||
// Already has an error embedded, can't edit
|
||||
|
@ -9504,6 +9525,15 @@ String WinDebugger::EvaluateContinue(DbgPendingExpr* pendingExpr, BfPassInstance
|
|||
if (pendingExpr->mFormatInfo.mRawString)
|
||||
return "";
|
||||
|
||||
if (val[0] != '!')
|
||||
{
|
||||
if (pendingExpr->mUsedSpecifiedLock)
|
||||
val += "\n:usedLock";
|
||||
|
||||
if (pendingExpr->mStackIdxOverride != -1)
|
||||
val += StrFormat("\n:stackIdx\t%d", pendingExpr->mStackIdxOverride);
|
||||
}
|
||||
|
||||
if (pendingExpr->mCursorPos != -1)
|
||||
val += GetAutocompleteOutput(autoComplete);
|
||||
|
||||
|
@ -9642,8 +9672,10 @@ String WinDebugger::Evaluate(const StringImpl& expr, DwFormatInfo formatInfo, in
|
|||
|
||||
if (terminatedExpr.StartsWith('{'))
|
||||
{
|
||||
String locString;
|
||||
int closeIdx = terminatedExpr.IndexOf('}');
|
||||
String locString = terminatedExpr.Substring(1, closeIdx - 1);
|
||||
if (closeIdx != -1)
|
||||
locString = terminatedExpr.Substring(1, closeIdx - 1);
|
||||
|
||||
for (int i = 0; i <= closeIdx; i++)
|
||||
terminatedExpr[i] = ' ';
|
||||
|
@ -9728,7 +9760,7 @@ String WinDebugger::Evaluate(const StringImpl& expr, DwFormatInfo formatInfo, in
|
|||
foundLockMatch = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -9995,6 +10027,8 @@ String WinDebugger::Evaluate(const StringImpl& expr, DwFormatInfo formatInfo, in
|
|||
return result;
|
||||
}
|
||||
|
||||
pendingExpr->mUsedSpecifiedLock = usedSpecifiedLock;
|
||||
pendingExpr->mStackIdxOverride = stackIdxOverride;
|
||||
pendingExpr->mExplitType = explicitType;
|
||||
pendingExpr->mFormatInfo = formatInfo;
|
||||
String result = EvaluateContinue(pendingExpr, bfPassInstance);
|
||||
|
@ -10012,13 +10046,7 @@ String WinDebugger::Evaluate(const StringImpl& expr, DwFormatInfo formatInfo, in
|
|||
mActiveThread->mBreakpointAddressContinuing = 0;
|
||||
}
|
||||
else
|
||||
delete pendingExpr;
|
||||
|
||||
if ((!formatInfo.mRawString) && (usedSpecifiedLock))
|
||||
result += "\n:usedLock";
|
||||
|
||||
if ((!formatInfo.mRawString) && (stackIdxOverride != -1))
|
||||
result += StrFormat("\n:stackIdx\t%d", stackIdxOverride);
|
||||
delete pendingExpr;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -10579,8 +10607,17 @@ String WinDebugger::CompactChildExpression(const StringImpl& expr, const StringI
|
|||
parser.SetSource(terminatedExpr.c_str(), terminatedExpr.length());
|
||||
parser.Parse(&bfPassInstance);
|
||||
|
||||
BfParser parentParser(mBfSystem);
|
||||
auto terminatedParentExpr = parentExpr + ";";
|
||||
|
||||
String parentPrefix;
|
||||
if (terminatedParentExpr.StartsWith('{'))
|
||||
{
|
||||
int prefixEnd = terminatedParentExpr.IndexOf('}');
|
||||
parentPrefix = terminatedParentExpr.Substring(0, prefixEnd + 1);
|
||||
terminatedParentExpr.Remove(0, prefixEnd + 1);
|
||||
}
|
||||
|
||||
BfParser parentParser(mBfSystem);
|
||||
parentParser.mCompatMode = language != DbgLanguage_Beef;
|
||||
parentParser.SetSource(terminatedParentExpr.c_str(), terminatedParentExpr.length());
|
||||
parentParser.Parse(&bfPassInstance);
|
||||
|
@ -10633,7 +10670,9 @@ String WinDebugger::CompactChildExpression(const StringImpl& expr, const StringI
|
|||
printer.mIgnoreTrivia = true;
|
||||
printer.mReformatting = true;
|
||||
printer.VisitChild(headNode);
|
||||
auto result = printer.mOutString;
|
||||
String result;
|
||||
result += parentPrefix;
|
||||
result += printer.mOutString;
|
||||
if (formatInfo.mNoVisualizers)
|
||||
result += ", nv";
|
||||
if (formatInfo.mNoMembers)
|
||||
|
|
|
@ -288,6 +288,8 @@ public:
|
|||
Array<DbgCallResult> mCallResults;
|
||||
int mIdleTicks;
|
||||
String mException;
|
||||
bool mUsedSpecifiedLock;
|
||||
int mStackIdxOverride;
|
||||
|
||||
DbgPendingExpr();
|
||||
~DbgPendingExpr();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue