Merge pull request #3882 from Kingcom/BranchLines

Crash fix and more scanning
This commit is contained in:
Henrik Rydgård 2013-09-22 04:37:54 -07:00
commit 1dccc952d9
2 changed files with 14 additions and 3 deletions

View File

@ -103,7 +103,9 @@ void CtrlDisAsmView::scanFunctions()
for (int funcPos = info.address; funcPos < funcEnd; funcPos += instructionSize)
{
MIPSAnalyst::MipsOpcodeInfo opInfo = MIPSAnalyst::GetOpcodeInfo(debugger,funcPos);
if (opInfo.isBranch && !opInfo.isBranchToRegister && !opInfo.isLinkedBranch)
bool inFunction = (opInfo.branchTarget >= info.address && opInfo.branchTarget < funcEnd);
if (opInfo.isBranch && !opInfo.isBranchToRegister && !opInfo.isLinkedBranch && inFunction)
{
BranchLine line;
if (opInfo.branchTarget < funcPos)
@ -471,6 +473,7 @@ void CtrlDisAsmView::assembleOpcode(u32 address, std::string defaultText)
// In case this is a delay slot or combined instruction, clear cache above it too.
if (MIPSComp::jit)
MIPSComp::jit->ClearCacheAt(address - 4, 8);
scanFunctions();
redraw();
} else {
std::wstring error = ConvertUTF8ToWString(MIPSAsm::GetAssembleError());
@ -666,6 +669,7 @@ void CtrlDisAsmView::onPaint(WPARAM wParam, LPARAM lParam)
for (int i = 0; i < visibleFunctionAddresses.size(); i++)
{
auto it = functions.find(visibleFunctionAddresses[i]);
if (it == functions.end()) continue;
DisassemblyFunction& func = it->second;
for (int l = 0; l < func.lines.size(); l++)
@ -859,6 +863,8 @@ void CtrlDisAsmView::scrollAddressIntoView()
windowStart = curAddress;
else if (curAddress >= windowEnd)
windowStart = curAddress - visibleRows * instructionSize + instructionSize;
scanFunctions();
}
bool CtrlDisAsmView::curAddressIsVisible()

View File

@ -119,7 +119,12 @@ public:
bool curAddressIsVisible();
void redraw();
void scanFunctions();
void clearFunctions() { functions.clear(); };
void clearFunctions()
{
functions.clear();
visibleFunctionAddresses.clear();
strayLines.clear();
};
void getOpcodeText(u32 address, char* dest);
u32 yToAddress(int y);
@ -146,6 +151,7 @@ public:
}
setCurAddress(newAddress);
scanFunctions();
redraw();
}
void gotoPC()
@ -178,6 +184,5 @@ public:
selectRangeStart = extend ? std::min(selectRangeStart, newAddress) : newAddress;
selectRangeEnd = extend ? std::max(selectRangeEnd, after) : after;
updateStatusBarText();
scanFunctions();
}
};