DBG: show logged line in script info
This commit is contained in:
parent
2fd8803360
commit
aaf610de54
|
@ -32,21 +32,26 @@ bool cbScriptMsgyn(int argc, char* argv[])
|
|||
|
||||
bool cbInstrLog(int argc, char* argv[])
|
||||
{
|
||||
auto logputs = [](const char* msg)
|
||||
{
|
||||
dputs_untranslated(msg);
|
||||
scriptlog(msg);
|
||||
};
|
||||
if(argc == 1) //just log newline
|
||||
{
|
||||
dputs_untranslated("");
|
||||
logputs("");
|
||||
return true;
|
||||
}
|
||||
if(argc == 2) //inline logging: log "format {rax}"
|
||||
{
|
||||
dputs_untranslated(stringformatinline(argv[1]).c_str());
|
||||
logputs(stringformatinline(argv[1]).c_str());
|
||||
}
|
||||
else //log "format {0} string", arg1, arg2, argN
|
||||
{
|
||||
FormatValueVector formatArgs;
|
||||
for(auto i = 2; i < argc; i++)
|
||||
formatArgs.push_back(argv[i]);
|
||||
dputs_untranslated(stringformat(argv[1], formatArgs).c_str());
|
||||
logputs(stringformat(argv[1], formatArgs).c_str());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ static bool volatile bAbort = false;
|
|||
|
||||
static bool volatile bIsRunning = false;
|
||||
|
||||
static bool scriptLogEnabled = false;
|
||||
|
||||
enum CMDRESULT
|
||||
{
|
||||
STATUS_ERROR = false,
|
||||
|
@ -307,6 +309,7 @@ static bool scriptisinternalcommand(const char* text, const char* cmd)
|
|||
|
||||
static CMDRESULT scriptinternalcmdexec(const char* cmd)
|
||||
{
|
||||
scriptLogEnabled = false;
|
||||
if(scriptisinternalcommand(cmd, "ret")) //script finished
|
||||
{
|
||||
if(!scriptstack.size()) //nothing on the stack
|
||||
|
@ -325,6 +328,8 @@ static CMDRESULT scriptinternalcmdexec(const char* cmd)
|
|||
return STATUS_PAUSE;
|
||||
else if(scriptisinternalcommand(cmd, "nop")) //do nothing
|
||||
return STATUS_CONTINUE;
|
||||
else if(scriptisinternalcommand(cmd, "log"))
|
||||
scriptLogEnabled = true;
|
||||
auto res = cmddirectexec(cmd);
|
||||
while(DbgIsDebugging() && dbgisrunning() && !bAbort) //while not locked (NOTE: possible deadlock)
|
||||
{
|
||||
|
@ -629,3 +634,10 @@ bool scriptgetbranchinfo(int line, SCRIPTBRANCH* info)
|
|||
memcpy(info, &linemap.at(line - 1).u.branch, sizeof(SCRIPTBRANCH));
|
||||
return true;
|
||||
}
|
||||
|
||||
void scriptlog(const char* msg)
|
||||
{
|
||||
if(!scriptLogEnabled)
|
||||
return;
|
||||
GuiScriptSetInfoLine(scriptIp, msg);
|
||||
}
|
||||
|
|
|
@ -36,6 +36,7 @@ SCRIPTLINETYPE scriptgetlinetype(int line);
|
|||
void scriptsetip(int line);
|
||||
void scriptreset();
|
||||
bool scriptgetbranchinfo(int line, SCRIPTBRANCH* info);
|
||||
void scriptlog(const char* msg);
|
||||
DWORD WINAPI scriptLoadSync(void* filename); // Load script synchronized
|
||||
DWORD WINAPI scriptRunSync(void* arg);
|
||||
|
||||
|
|
Loading…
Reference in New Issue