DBG: added 'push' and 'pop' commands

This commit is contained in:
Mr. eXoDia 2015-08-14 17:21:22 +02:00
parent b3e3a340ca
commit 2d670c14ea
6 changed files with 90 additions and 0 deletions

25
help/pop.htm Normal file
View File

@ -0,0 +1,25 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>pop</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>push<BR></STRONG>Pop a value from the stack.</P>
<P class=rvps3>
<U>arguments</U><BR>[arg1]: The destination.</P>
<P class=rvps3 >
<U>result</U><BR>This command does not set any
result&nbsp;variables.</P></body>
</html>

26
help/push.htm Normal file
View File

@ -0,0 +1,26 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>push</title>
<meta name="GENERATOR" content="WinCHM">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<style>
html,body {
/* Default Font */
font-family: Courier New;
font-size: 11pt;
}
</style>
</head>
<body>
<P><STRONG>push<BR></STRONG>Push a value on the stack.</P>
<P class=rvps3>
<U>arguments</U><BR>&nbsp; arg1: The value to push on the stack.
</P>
<P class=rvps3 >
<U>result</U><BR>This command does not set any
result&nbsp;variables.</P></body>
</html>

Binary file not shown.

View File

@ -30,6 +30,7 @@
#include "controlflowanalysis.h"
#include "analysis_nukem.h"
#include "exceptiondirectoryanalysis.h"
#include "_scriptapi_stack.h"
static bool bRefinit = false;
@ -778,6 +779,40 @@ CMDRESULT cbInstrXor(int argc, char* argv[])
return cmddirectexec(dbggetcommandlist(), newcmd);
}
CMDRESULT cbInstrPush(int argc, char* argv[])
{
if(argc < 2)
{
dputs("not enough arguments!");
return STATUS_ERROR;
}
duint value;
if(!valfromstring(argv[1], &value))
{
dprintf("invalid argument \"%s\"!\n", argv[1]);
return STATUS_ERROR;
}
Script::Stack::Push(value);
uint csp = GetContextDataEx(hActiveThread, UE_CSP);
GuiStackDumpAt(csp, csp);
GuiUpdateRegisterView();
return STATUS_CONTINUE;
}
CMDRESULT cbInstrPop(int argc, char* argv[])
{
duint value = Script::Stack::Pop();
uint csp = GetContextDataEx(hActiveThread, UE_CSP);
GuiStackDumpAt(csp, csp);
GuiUpdateRegisterView();
if(argc > 1)
{
if(!valtostring(argv[1], value, false))
return STATUS_ERROR;
}
return STATUS_CONTINUE;
}
CMDRESULT cbInstrRefinit(int argc, char* argv[])
{
GuiReferenceInitialize("Script");

View File

@ -40,6 +40,8 @@ CMDRESULT cbInstrShr(int argc, char* argv[]);
CMDRESULT cbInstrSub(int argc, char* argv[]);
CMDRESULT cbInstrTest(int argc, char* argv[]);
CMDRESULT cbInstrXor(int argc, char* argv[]);
CMDRESULT cbInstrPush(int argc, char* argv[]);
CMDRESULT cbInstrPop(int argc, char* argv[]);
CMDRESULT cbInstrRefinit(int argc, char* argv[]);
CMDRESULT cbInstrRefadd(int argc, char* argv[]);

View File

@ -173,6 +173,8 @@ static void registercommands()
dbgcmdnew("sub", cbInstrSub, false);
dbgcmdnew("test", cbInstrTest, false);
dbgcmdnew("xor", cbInstrXor, false);
dbgcmdnew("push", cbInstrPush, true);
dbgcmdnew("pop", cbInstrPop, true);
//script
dbgcmdnew("scriptload", cbScriptLoad, false);