Skip to content

Commit

Permalink
Debugger: Ignore invalid branches.
Browse files Browse the repository at this point in the history
These happen on bytes that are not actually code.
  • Loading branch information
unknownbrackets committed Jun 7, 2018
1 parent 15fa8b5 commit 0eab4c2
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions Core/Debugger/DisassemblyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -491,11 +491,12 @@ void DisassemblyFunction::generateBranchLines()
MIPSAnalyst::MipsOpcodeInfo opInfo = MIPSAnalyst::GetOpcodeInfo(cpu,funcPos);

bool inFunction = (opInfo.branchTarget >= address && opInfo.branchTarget < end);
if (opInfo.isBranch && !opInfo.isBranchToRegister && !opInfo.isLinkedBranch && inFunction)
{
if (opInfo.isBranch && !opInfo.isBranchToRegister && !opInfo.isLinkedBranch && inFunction) {
if (!Memory::IsValidAddress(opInfo.branchTarget))
continue;

BranchLine line;
if (opInfo.branchTarget < funcPos)
{
if (opInfo.branchTarget < funcPos) {
line.first = opInfo.branchTarget;
line.second = funcPos;
line.type = LINE_UP;
Expand Down Expand Up @@ -756,13 +757,14 @@ void DisassemblyOpcode::getBranchLines(u32 start, u32 size, std::vector<BranchLi
for (u32 pos = start; pos < start+size; pos += 4)
{
MIPSAnalyst::MipsOpcodeInfo info = MIPSAnalyst::GetOpcodeInfo(DisassemblyManager::getCpu(),pos);
if (info.isBranch && !info.isBranchToRegister && !info.isLinkedBranch)
{
if (info.isBranch && !info.isBranchToRegister && !info.isLinkedBranch) {
if (!Memory::IsValidAddress(info.branchTarget))
continue;

BranchLine line;
line.laneIndex = lane++;

if (info.branchTarget < pos)
{
if (info.branchTarget < pos) {
line.first = info.branchTarget;
line.second = pos;
line.type = LINE_UP;
Expand Down

0 comments on commit 0eab4c2

Please sign in to comment.