1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-09 03:52:19 +02:00

Fixed step out in disassembly

This commit is contained in:
Brian Fiete 2020-02-20 09:31:06 -08:00
parent 07fd22f9e0
commit ace51cb7be
5 changed files with 16 additions and 84 deletions

View file

@ -897,11 +897,6 @@ void BeMCColorizer::Prepare()
mReserveParamRegs = false; mReserveParamRegs = false;
mNodes.Resize(mContext->mVRegInfo.size()); mNodes.Resize(mContext->mVRegInfo.size());
if (mContext->mDebugging)
{
NOP;
}
for (int vregIdx = 0; vregIdx < (int)mNodes.size(); vregIdx++) for (int vregIdx = 0; vregIdx < (int)mNodes.size(); vregIdx++)
{ {
auto node = &mNodes[vregIdx]; auto node = &mNodes[vregIdx];
@ -1282,11 +1277,6 @@ void BeMCColorizer::GenerateRegCosts()
void BeMCColorizer::AssignRegs(RegKind regKind) void BeMCColorizer::AssignRegs(RegKind regKind)
{ {
if (mContext->mDebugging)
{
NOP;
}
X64CPURegister highestReg; X64CPURegister highestReg;
int totalRegs32 = 0; int totalRegs32 = 0;
@ -3339,11 +3329,6 @@ void BeMCContext::CreateBinarySwitchSection(BeSwitchInst* switchInst, int startI
void BeMCContext::CreateCondBr(BeMCBlock* mcBlock, BeMCOperand& testVal, const BeMCOperand& trueBlock, const BeMCOperand& falseBlock) void BeMCContext::CreateCondBr(BeMCBlock* mcBlock, BeMCOperand& testVal, const BeMCOperand& trueBlock, const BeMCOperand& falseBlock)
{ {
if (mDebugging)
{
NOP;
}
if (testVal.IsImmediate()) if (testVal.IsImmediate())
{ {
if (testVal.mImmediate != 0) if (testVal.mImmediate != 0)
@ -3785,11 +3770,6 @@ BeMCOperand BeMCContext::AllocRelativeVirtualReg(BeType* type, const BeMCOperand
BF_ASSERT(relTo.IsVRegAny()); BF_ASSERT(relTo.IsVRegAny());
auto relToVRegInfo = GetVRegInfo(relTo); auto relToVRegInfo = GetVRegInfo(relTo);
if ((mDebugging) && (mVRegInfo.size() == 5))
{
NOP;
}
if ((relToVRegInfo->mRelTo) && (relToVRegInfo->mRelOffsetScale == 1) && (relToVRegInfo->mRelOffset.IsImmediate()) && if ((relToVRegInfo->mRelTo) && (relToVRegInfo->mRelOffsetScale == 1) && (relToVRegInfo->mRelOffset.IsImmediate()) &&
(relOffset.IsImmediate()) && (relScale == 1)) (relOffset.IsImmediate()) && (relScale == 1))
{ {
@ -6948,11 +6928,6 @@ void BeMCContext::DoInstCombinePass()
BeVTrackingValue vTrackingVal((int)mVRegInfo.size()); BeVTrackingValue vTrackingVal((int)mVRegInfo.size());
HashSet<int> wantUnwrapVRegs; HashSet<int> wantUnwrapVRegs;
if (mDebugging)
{
NOP;
}
for (auto mcBlock : mBlocks) for (auto mcBlock : mBlocks)
{ {
BeDbgLoc* curDbgLoc = NULL; BeDbgLoc* curDbgLoc = NULL;
@ -8170,11 +8145,6 @@ bool BeMCContext::DoLegalization()
auto inst = mcBlock->mInstructions[instIdx]; auto inst = mcBlock->mInstructions[instIdx];
SetCurrentInst(inst); SetCurrentInst(inst);
if ((mDebugging) && (inst->mKind == BeMCInstKind_IMul))
{
NOP;
}
if (inst->mKind == BeMCInstKind_Mov) if (inst->mKind == BeMCInstKind_Mov)
{ {
// Useless mov, remove it // Useless mov, remove it
@ -8841,13 +8811,6 @@ bool BeMCContext::DoLegalization()
int disp = 0; int disp = 0;
int errorVRegIdx = -1; int errorVRegIdx = -1;
bool isValid = GetRMParams(inst->mArg0, regA, regB, bScale, disp, &errorVRegIdx) != BeMCRMMode_Invalid; bool isValid = GetRMParams(inst->mArg0, regA, regB, bScale, disp, &errorVRegIdx) != BeMCRMMode_Invalid;
if (mDebugging)
{
if ((inst->mArg0.mVRegIdx == 272) || (inst->mArg0.mVRegIdx == 274))
{
NOP;
}
}
if (!isValid) if (!isValid)
{ {
@ -10609,11 +10572,6 @@ void BeMCContext::DoRegFinalization()
{ {
case BeMCInstKind_PreserveVolatiles: case BeMCInstKind_PreserveVolatiles:
{ {
if (mDebugging)
{
NOP;
}
int preserveIdx; int preserveIdx;
BeMCInst* preserveInst; BeMCInst* preserveInst;
BeMCInst* restoreInst; BeMCInst* restoreInst;
@ -11490,10 +11448,6 @@ void BeMCContext::EmitAggMov(const BeMCOperand& dest, const BeMCOperand& src)
int curOfs = 0; int curOfs = 0;
bool allowRep = dataVec.size() >= BF_REP_MOV_LIMIT; bool allowRep = dataVec.size() >= BF_REP_MOV_LIMIT;
if (mDebugging)
{
NOP;
}
union IntUnion union IntUnion
{ {
@ -14751,7 +14705,7 @@ void BeMCContext::Generate(BeFunction* function)
mDbgPreferredRegs[32] = X64Reg_R8;*/ mDbgPreferredRegs[32] = X64Reg_R8;*/
//mDbgPreferredRegs[8] = X64Reg_RAX; //mDbgPreferredRegs[8] = X64Reg_RAX;
//mDebugging = function->mName == "?TestTagCount@Program@bf@@SAXXZ"; //mDebugging = function->mName == "?Hey@Blurg@bf@@SAXXZ";
//"?ColorizeCodeString@IDEUtils@IDE@bf@@SAXPEAVString@System@3@W4CodeKind@123@@Z"; //"?ColorizeCodeString@IDEUtils@IDE@bf@@SAXPEAVString@System@3@W4CodeKind@123@@Z";
//"?Main@Program@bf@@CAHPEAV?$Array1@PEAVString@System@bf@@@System@2@@Z"; //"?Main@Program@bf@@CAHPEAV?$Array1@PEAVString@System@bf@@@System@2@@Z";
@ -15281,11 +15235,6 @@ void BeMCContext::Generate(BeFunction* function)
break; break;
case BeAllocaInst::TypeId: case BeAllocaInst::TypeId:
{ {
if (mDebugging)
{
NOP;
}
int homeSize = BF_ALIGN(BF_MAX(mMaxCallParamCount, 4) * 8, 16); int homeSize = BF_ALIGN(BF_MAX(mMaxCallParamCount, 4) * 8, 16);
auto castedInst = (BeAllocaInst*)inst; auto castedInst = (BeAllocaInst*)inst;
auto mcSize = BeMCOperand::FromImmediate(castedInst->mType->mSize); auto mcSize = BeMCOperand::FromImmediate(castedInst->mType->mSize);
@ -15755,11 +15704,6 @@ void BeMCContext::Generate(BeFunction* function)
break; break;
case BeCondBrInst::TypeId: case BeCondBrInst::TypeId:
{ {
if (mDebugging)
{
NOP;
}
auto castedInst = (BeCondBrInst*)inst; auto castedInst = (BeCondBrInst*)inst;
auto testVal = GetOperand(castedInst->mCond, true); auto testVal = GetOperand(castedInst->mCond, true);
auto trueBlock = GetOperand(castedInst->mTrueBlock); auto trueBlock = GetOperand(castedInst->mTrueBlock);
@ -16301,11 +16245,6 @@ void BeMCContext::Generate(BeFunction* function)
break; break;
case BeDbgDeclareInst::TypeId: case BeDbgDeclareInst::TypeId:
{ {
if (mDebugging)
{
NOP;
}
auto castedInst = (BeDbgDeclareInst*)inst; auto castedInst = (BeDbgDeclareInst*)inst;
auto dbgVar = castedInst->mDbgVar; auto dbgVar = castedInst->mDbgVar;
auto mcValue = GetOperand(castedInst->mValue); auto mcValue = GetOperand(castedInst->mValue);

View file

@ -2599,6 +2599,7 @@ void BeModule::DoInlining(BeFunction* func)
auto destDbgGlobalVar = mOwnedValues.Alloc<BeDbgVariable>(); auto destDbgGlobalVar = mOwnedValues.Alloc<BeDbgVariable>();
destDbgGlobalVar->mName = dbgGlobalVar->mName; destDbgGlobalVar->mName = dbgGlobalVar->mName;
destDbgGlobalVar->mType = dbgGlobalVar->mType; destDbgGlobalVar->mType = dbgGlobalVar->mType;
destDbgGlobalVar->mInitType = dbgGlobalVar->mInitType;
if (dbgGlobalVar->mValue != NULL) if (dbgGlobalVar->mValue != NULL)
{ {
BF_ASSERT(BeValueDynCast<BeConstant>(dbgGlobalVar->mValue) != NULL); BF_ASSERT(BeValueDynCast<BeConstant>(dbgGlobalVar->mValue) != NULL);

View file

@ -1135,16 +1135,6 @@ BfLocalVariable* BfModule::HandleVariableDeclaration(BfVariableDeclaration* varD
if (bfAutocomplete != NULL) if (bfAutocomplete != NULL)
bfAutocomplete->CheckTypeRef(varDecl->mTypeRef, true, true); bfAutocomplete->CheckTypeRef(varDecl->mTypeRef, true, true);
// if (varDecl->mNameNode == NULL)
// {
// // Minimum parsing requirements
// auto resolvedType = ResolveTypeRef(varDecl->mTypeRef);
// if (resolvedType != NULL)
// AddDependency(resolvedType, mCurTypeInstance, BfDependencyMap::DependencyFlag_LocalUsage);
// AssertErrorState();
// return NULL;
// }
bool isConst = (varDecl->mModSpecifier != NULL) && (varDecl->mModSpecifier->GetToken() == BfToken_Const); bool isConst = (varDecl->mModSpecifier != NULL) && (varDecl->mModSpecifier->GetToken() == BfToken_Const);
bool isReadOnly = (varDecl->mModSpecifier != NULL) && (varDecl->mModSpecifier->GetToken() == BfToken_ReadOnly); bool isReadOnly = (varDecl->mModSpecifier != NULL) && (varDecl->mModSpecifier->GetToken() == BfToken_ReadOnly);

View file

@ -4324,6 +4324,8 @@ bool WinDebugger::SetupStep(StepType stepType)
CPUInst inst; CPUInst inst;
while (true) while (true)
{ {
if (mStepInAssembly)
break;
if (!mDebugTarget->DecodeInstruction(pcAddress, &inst)) if (!mDebugTarget->DecodeInstruction(pcAddress, &inst))
break; break;
if ((inst.IsBranch()) || (inst.IsCall()) || (inst.IsReturn())) if ((inst.IsBranch()) || (inst.IsCall()) || (inst.IsReturn()))