1
0
Fork 0

DBG+GUI: allow cbp to be used as register

This commit is contained in:
mrexodia 2016-10-21 16:37:39 +02:00
parent af9481d980
commit f284e6b259
No known key found for this signature in database
GPG Key ID: FC89E0AAA0C1AAD8
3 changed files with 24 additions and 14 deletions

View File

@ -177,6 +177,8 @@ static bool isregister(const char* string)
return true; return true;
if(scmp(string, "csp")) if(scmp(string, "csp"))
return true; return true;
if(scmp(string, "cbp"))
return true;
if(scmp(string, "cflags")) if(scmp(string, "cflags"))
return true; return true;
@ -860,6 +862,14 @@ duint getregister(int* size, const char* string)
{ {
return GetContextDataEx(hActiveThread, UE_CSP); return GetContextDataEx(hActiveThread, UE_CSP);
} }
if(scmp(string, "cbp"))
{
#ifdef _WIN64
return GetContextDataEx(hActiveThread, UE_RBP);
#else
return GetContextDataEx(hActiveThread, UE_EBP);
#endif //_WIN64
}
if(scmp(string, "cflags")) if(scmp(string, "cflags"))
{ {
return GetContextDataEx(hActiveThread, UE_CFLAGS); return GetContextDataEx(hActiveThread, UE_CFLAGS);
@ -1167,6 +1177,12 @@ bool setregister(const char* string, duint value)
return SetContextDataEx(hActiveThread, UE_CIP, value); return SetContextDataEx(hActiveThread, UE_CIP, value);
if(scmp(string, "csp")) if(scmp(string, "csp"))
return SetContextDataEx(hActiveThread, UE_CSP, value); return SetContextDataEx(hActiveThread, UE_CSP, value);
if(scmp(string, "cbp"))
#ifdef _WIN64
return SetContextDataEx(hActiveThread, UE_RBP, value);
#else
return SetContextDataEx(hActiveThread, UE_EBP, value);
#endif //_WIN64
if(scmp(string, "cflags")) if(scmp(string, "cflags"))
return SetContextDataEx(hActiveThread, UE_CFLAGS, value); return SetContextDataEx(hActiveThread, UE_CFLAGS, value);

View File

@ -206,8 +206,8 @@ void CPUStack::setupContextMenu()
mMenuBuilder->addAction(makeShortcutAction(DIcon("search-for.png"), tr("&Find Pattern..."), SLOT(findPattern()), "ActionFindPattern")); mMenuBuilder->addAction(makeShortcutAction(DIcon("search-for.png"), tr("&Find Pattern..."), SLOT(findPattern()), "ActionFindPattern"));
//Follow CSP //Follow CSP
mMenuBuilder->addAction(makeShortcutAction(DIcon("neworigin.png"), ArchValue(tr("Follow E&SP"), tr("Follow R&SP")), SLOT(gotoSpSlot()), "ActionGotoOrigin")); mMenuBuilder->addAction(makeShortcutAction(DIcon("neworigin.png"), ArchValue(tr("Follow E&SP"), tr("Follow R&SP")), SLOT(gotoCspSlot()), "ActionGotoOrigin"));
mMenuBuilder->addAction(makeAction(DIcon("cbp.png"), ArchValue(tr("Follow E&BP"), tr("Follow R&BP")), SLOT(gotoBpSlot())), [this](QMenu*) mMenuBuilder->addAction(makeAction(DIcon("cbp.png"), ArchValue(tr("Follow E&BP"), tr("Follow R&BP")), SLOT(gotoCbpSlot())), [this](QMenu*)
{ {
return DbgMemIsValidReadPtr(DbgValFromString("cbp")); return DbgMemIsValidReadPtr(DbgValFromString("cbp"));
}); });
@ -322,7 +322,7 @@ void CPUStack::updateFreezeStackAction()
else else
{ {
mFreezeStack->setText(tr("Freeze the stack")); mFreezeStack->setText(tr("Freeze the stack"));
gotoSpSlot(); gotoCspSlot();
} }
mFreezeStack->setChecked(bStackFrozen); mFreezeStack->setChecked(bStackFrozen);
} }
@ -568,20 +568,14 @@ void CPUStack::stackDumpAt(duint addr, duint csp)
printDumpAt(addr); printDumpAt(addr);
} }
void CPUStack::gotoSpSlot() void CPUStack::gotoCspSlot()
{ {
if(!DbgIsDebugging())
return;
DbgCmdExec("sdump csp"); DbgCmdExec("sdump csp");
} }
void CPUStack::gotoBpSlot() void CPUStack::gotoCbpSlot()
{ {
#ifdef _WIN64 DbgCmdExec("sdump cbp");
DbgCmdExec("sdump rbp");
#else
DbgCmdExec("sdump ebp");
#endif //_WIN64
} }
int CPUStack::getCurrentFrame(const std::vector<CPUStack::CPUCallStack> & mCallstack, duint wVA) int CPUStack::getCurrentFrame(const std::vector<CPUStack::CPUCallStack> & mCallstack, duint wVA)

View File

@ -31,8 +31,8 @@ public slots:
void pushSlot(); void pushSlot();
void popSlot(); void popSlot();
void stackDumpAt(duint addr, duint csp); void stackDumpAt(duint addr, duint csp);
void gotoSpSlot(); void gotoCspSlot();
void gotoBpSlot(); void gotoCbpSlot();
void gotoExpressionSlot(); void gotoExpressionSlot();
void gotoPreviousSlot(); void gotoPreviousSlot();
void gotoNextSlot(); void gotoNextSlot();