void DebuggerMagager::internal_stop()
{
    interrupted = true;

    ConfigVariable::IncreasePauseLevel();

    // unlock console thread to display prompt again
    ThreadManagement::SendConsoleExecDoneSignal();

    //return to console so change mode to 2
    int iOldMode = ConfigVariable::getPromptMode();
    ConfigVariable::setPromptMode(2);

    int iPauseLevel = ConfigVariable::getPauseLevel();
    while (ConfigVariable::getPauseLevel() == iPauseLevel)
    {
        ThreadManagement::SendAwakeRunnerSignal();
        ThreadManagement::WaitForRunMeSignal();
        try
        {
            StaticRunner_launch();
        }
        catch (const ast::InternalError& ie)
        {
            //return from console so change mode to initial
            ConfigVariable::setPromptMode(iOldMode);
            //clean current seqexp
            clearExp();
            interrupted = false;

            throw ie;
        }
        catch (const ast::InternalAbort& ia)
        {
            //return from console so change mode to initial
            ConfigVariable::setPromptMode(iOldMode);
            //clean current seqexp
            clearExp();
            interrupted = false;

            throw ia;
        }
    }

    //return from console so change mode to initial
    ConfigVariable::setPromptMode(iOldMode);
    //clean current seqexp
    interrupted = false;
}
Exemplo n.º 2
0
types::Function::ReturnValue sci_pause(types::typed_list &in, int _iRetCount, types::typed_list &out)
{
    if (ConfigVariable::getEnableDebug() == true)
    {
        sciprint(_("%s: function is disabled in debug mode.\n"), "pause");
        return types::Function::OK;
    }
    

    if (in.size() != 0)
    {
        Scierror(77, _("%s: Wrong number of input argument(s): %d expected.\n"), "pause", 0);
        return types::Function::Error;
    }

    ConfigVariable::IncreasePauseLevel();

    // unlock console thread to display prompt again
    ThreadManagement::SendConsoleExecDoneSignal();

    //return to console so change mode to 2
    int iOldMode = ConfigVariable::getPromptMode();
    ConfigVariable::setPromptMode(2);

    int iPauseLevel = ConfigVariable::getPauseLevel();
    while (ConfigVariable::getPauseLevel() == iPauseLevel)
    {
        ThreadManagement::SendAwakeRunnerSignal();
        ThreadManagement::WaitForRunMeSignal();
        StaticRunner_launch();
    }

    //return from console so change mode to initial
    ConfigVariable::setPromptMode(iOldMode);
    return types::Function::OK;
}