示例#1
0
static CMDRESULT scriptinternalcmdexec(const char* cmd)
{
    if(scriptisinternalcommand(cmd, "ret")) //script finished
    {
        if(!scriptstack.size()) //nothing on the stack
        {
            String TranslatedString = GuiTranslateText(QT_TRANSLATE_NOOP("DBG", "Script finished!"));
            GuiScriptMessage(TranslatedString.c_str());
            return STATUS_EXIT;
        }
        scriptIp = scriptstack.back(); //set scriptIp to the call address (scriptinternalstep will step over it)
        scriptstack.pop_back(); //remove last stack entry
        return STATUS_CONTINUE;
    }
    else if(scriptisinternalcommand(cmd, "invalid")) //invalid command for testing
        return STATUS_ERROR;
    else if(scriptisinternalcommand(cmd, "pause")) //pause the script
        return STATUS_PAUSE;
    else if(scriptisinternalcommand(cmd, "nop")) //do nothing
        return STATUS_CONTINUE;
    auto res = cmddirectexec(cmd);
    while(DbgIsDebugging() && dbgisrunning() && !bAbort) //while not locked (NOTE: possible deadlock)
    {
        Sleep(1);
        GuiProcessEvents(); //workaround for scripts being executed on the GUI thread
    }
    return res ? STATUS_CONTINUE : STATUS_ERROR;
}
示例#2
0
static CMDRESULT scriptinternalcmdexec(const char* cmd)
{
    if(scriptisinternalcommand(cmd, "ret")) //script finished
    {
        if(!scriptstack.size()) //nothing on the stack
        {
            GuiScriptMessage("Script finished!");
            return STATUS_EXIT;
        }
        scriptIp = scriptstack.back(); //set scriptIp to the call address (scriptinternalstep will step over it)
        scriptstack.pop_back(); //remove last stack entry
        return STATUS_CONTINUE;
    }
    else if(scriptisinternalcommand(cmd, "invalid")) //invalid command for testing
        return STATUS_ERROR;
    else if(scriptisinternalcommand(cmd, "pause")) //pause the script
        return STATUS_PAUSE;
    else if(scriptisinternalcommand(cmd, "nop")) //do nothing
        return STATUS_CONTINUE;
    char command[deflen] = "";
    strcpy_s(command, StringUtils::Trim(cmd).c_str());
    COMMAND* found = cmdfindmain(dbggetcommandlist(), command);
    if(!found) //invalid command
        return STATUS_ERROR;
    if(arraycontains(found->name, "var")) //var
    {
        cmddirectexec(dbggetcommandlist(), command);
        return STATUS_CONTINUE;
    }
    CMDRESULT res = cmddirectexec(dbggetcommandlist(), command);
    while(DbgIsDebugging() && dbgisrunning()) //while not locked (NOTE: possible deadlock)
        Sleep(10);
    return res;
}
示例#3
0
bool cbScriptMsg(int argc, char* argv[])
{
    if(IsArgumentsLessThan(argc, 2))
        return false;
    GuiScriptMessage(stringformatinline(argv[1]).c_str());
    return true;
}
示例#4
0
CMDRESULT cbScriptMsg(int argc, char* argv[])
{
    if(argc < 2)
    {
        dputs("not enough arguments!");
        return STATUS_ERROR;
    }
    GuiScriptMessage(argv[1]);
    return STATUS_CONTINUE;
}