Extend follow functionality of disassembly
This commit is contained in:
parent
ebd3763c7e
commit
aae08173f1
3 changed files with 35 additions and 3 deletions
|
@ -401,6 +401,32 @@ namespace MIPSAnalyst {
|
||||||
MIPSInfo opInfo = MIPSGetInfo(op);
|
MIPSInfo opInfo = MIPSGetInfo(op);
|
||||||
info.isLikelyBranch = (opInfo & LIKELY) != 0;
|
info.isLikelyBranch = (opInfo & LIKELY) != 0;
|
||||||
|
|
||||||
|
// gather relevant address for alu operations
|
||||||
|
// that's usually the value of the dest register
|
||||||
|
switch (MIPS_GET_OP(op))
|
||||||
|
{
|
||||||
|
case 0: // special
|
||||||
|
switch (MIPS_GET_FUNC(op))
|
||||||
|
{
|
||||||
|
case 0x20: // add
|
||||||
|
case 0x21: // addu
|
||||||
|
info.hasRelevantAddress = true;
|
||||||
|
info.releventAddress = cpu->GetRegValue(0,MIPS_GET_RS(op))+cpu->GetRegValue(0,MIPS_GET_RT(op));
|
||||||
|
break;
|
||||||
|
case 0x22: // sub
|
||||||
|
case 0x23: // subu
|
||||||
|
info.hasRelevantAddress = true;
|
||||||
|
info.releventAddress = cpu->GetRegValue(0,MIPS_GET_RS(op))-cpu->GetRegValue(0,MIPS_GET_RT(op));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 0x08: // addi
|
||||||
|
case 0x09: // adiu
|
||||||
|
info.hasRelevantAddress = true;
|
||||||
|
info.releventAddress = cpu->GetRegValue(0,MIPS_GET_RS(op))+((s16)(op & 0xFFFF));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
//j , jal, ...
|
//j , jal, ...
|
||||||
if (opInfo & IS_JUMP) {
|
if (opInfo & IS_JUMP) {
|
||||||
info.isBranch = true;
|
info.isBranch = true;
|
||||||
|
@ -502,6 +528,9 @@ namespace MIPSAnalyst {
|
||||||
u32 rs = cpu->GetRegValue(0, (int)MIPS_GET_RS(op));
|
u32 rs = cpu->GetRegValue(0, (int)MIPS_GET_RS(op));
|
||||||
s16 imm16 = op & 0xFFFF;
|
s16 imm16 = op & 0xFFFF;
|
||||||
info.dataAddress = rs + imm16;
|
info.dataAddress = rs + imm16;
|
||||||
|
|
||||||
|
info.hasRelevantAddress = true;
|
||||||
|
info.releventAddress = info.dataAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
|
|
|
@ -113,6 +113,9 @@ namespace MIPSAnalyst
|
||||||
bool isDataAccess;
|
bool isDataAccess;
|
||||||
int dataSize;
|
int dataSize;
|
||||||
u32 dataAddress;
|
u32 dataAddress;
|
||||||
|
|
||||||
|
bool hasRelevantAddress;
|
||||||
|
u32 releventAddress;
|
||||||
} MipsOpcodeInfo;
|
} MipsOpcodeInfo;
|
||||||
|
|
||||||
MipsOpcodeInfo GetOpcodeInfo(DebugInterface* cpu, u32 address);
|
MipsOpcodeInfo GetOpcodeInfo(DebugInterface* cpu, u32 address);
|
||||||
|
|
|
@ -751,10 +751,10 @@ void CtrlDisAsmView::followBranch()
|
||||||
{
|
{
|
||||||
jumpStack.push_back(curAddress);
|
jumpStack.push_back(curAddress);
|
||||||
gotoAddr(info.branchTarget);
|
gotoAddr(info.branchTarget);
|
||||||
} else if (info.isDataAccess)
|
} else if (info.hasRelevantAddress)
|
||||||
{
|
{
|
||||||
// well, not exactly a branch, but we can do something anyway
|
// well, not exactly a branch, but we can do something anyway
|
||||||
SendMessage(GetParent(wnd),WM_DEB_GOTOHEXEDIT,info.dataAddress,0);
|
SendMessage(GetParent(wnd),WM_DEB_GOTOHEXEDIT,info.releventAddress,0);
|
||||||
SetFocus(wnd);
|
SetFocus(wnd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -849,7 +849,7 @@ void CtrlDisAsmView::onKeyDown(WPARAM wParam, LPARAM lParam)
|
||||||
break;
|
break;
|
||||||
case VK_NEXT:
|
case VK_NEXT:
|
||||||
if (curAddress != windowEnd - instructionSize && curAddressIsVisible()) {
|
if (curAddress != windowEnd - instructionSize && curAddressIsVisible()) {
|
||||||
setCurAddress(windowEnd - instructionSize, GetAsyncKeyState(VK_SHIFT));
|
setCurAddress(windowEnd - instructionSize, KeyDownAsync(VK_SHIFT));
|
||||||
scrollAddressIntoView();
|
scrollAddressIntoView();
|
||||||
} else {
|
} else {
|
||||||
setCurAddress(curAddress + visibleRows * instructionSize, KeyDownAsync(VK_SHIFT));
|
setCurAddress(curAddress + visibleRows * instructionSize, KeyDownAsync(VK_SHIFT));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue