void ValgrindEngine::start()
{
    emit starting(this);

    Core::FutureProgress* fp = Core::ICore::instance()->progressManager()->addTask(m_progress->future(),
                                                        progressTitle(), "valgrind");
    fp->setKeepOnFinish(Core::FutureProgress::DontKeepOnFinish);
    m_progress->reportStarted();

#if VALGRIND_DEBUG_OUTPUT
    emit standardOutputReceived(tr("Valgrind options: %1").arg(toolArguments().join(" ")));
    emit standardOutputReceived(tr("Working directory: %1").arg(m_workingDirectory));
    emit standardOutputReceived(tr("Command-line arguments: %1").arg(m_commandLineArguments));
#endif

    runner()->setWorkingDirectory(m_workingDirectory);
    runner()->setValgrindExecutable(m_settings->subConfig<ValgrindSettings>()->valgrindExecutable());
    runner()->setValgrindArguments(toolArguments());
    runner()->setDebuggeeExecutable(m_executable);
    // note that m_commandLineArguments may contain several arguments in one string
    runner()->setDebuggeeArguments(m_commandLineArguments);
    runner()->setEnvironment(m_environment);

    connect(runner(), SIGNAL(standardOutputReceived(QByteArray)),
            SLOT(receiveStandardOutput(QByteArray)));
    connect(runner(), SIGNAL(standardErrorReceived(QByteArray)),
            SLOT(receiveStandardError(QByteArray)));
    connect(runner(), SIGNAL(processErrorReceived(QString, QProcess::ProcessError)),
            SLOT(receiveProcessError(QString, QProcess::ProcessError)));
    connect(runner(), SIGNAL(finished()),
            SLOT(runnerFinished()));

    runner()->start();
}
Пример #2
0
bool ValgrindEngine::start()
{
    emit starting(this);

    Core::FutureProgress *fp = Core::ICore::progressManager()->addTask(m_progress->future(),
                                                        progressTitle(), "valgrind");
    fp->setKeepOnFinish(Core::FutureProgress::HideOnFinish);
    m_progress->setProgressRange(0, progressMaximum);
    m_progress->reportStarted();
    m_progressWatcher->setFuture(m_progress->future());
    m_progress->setProgressValue(progressMaximum / 10);

#if VALGRIND_DEBUG_OUTPUT
    emit outputReceived(tr("Valgrind options: %1").arg(toolArguments().join(" ")), Utils::DebugFormat);
    emit outputReceived(tr("Working directory: %1").arg(m_workingDirectory), Utils::DebugFormat);
    emit outputReceived(tr("Command-line arguments: %1").arg(m_commandLineArguments), Utils::DebugFormat);
#endif

    const AnalyzerStartParameters &sp = startParameters();
    runner()->setWorkingDirectory(sp.workingDirectory);
    QString valgrindExe = m_settings->subConfig<ValgrindBaseSettings>()->valgrindExecutable();
    if (!sp.analyzerCmdPrefix.isEmpty())
        valgrindExe = sp.analyzerCmdPrefix + ' ' + valgrindExe;
    runner()->setValgrindExecutable(valgrindExe);
    runner()->setValgrindArguments(toolArguments());
    runner()->setDebuggeeExecutable(sp.debuggee);
    runner()->setDebuggeeArguments(sp.debuggeeArgs);
    runner()->setEnvironment(sp.environment);
    runner()->setConnectionParameters(sp.connParams);
    runner()->setStartMode(sp.startMode);

    connect(runner(), SIGNAL(processOutputReceived(QByteArray,Utils::OutputFormat)),
            SLOT(receiveProcessOutput(QByteArray,Utils::OutputFormat)));
    connect(runner(), SIGNAL(processErrorReceived(QString,QProcess::ProcessError)),
            SLOT(receiveProcessError(QString,QProcess::ProcessError)));
    connect(runner(), SIGNAL(finished()),
            SLOT(runnerFinished()));

    if (!runner()->start()) {
        m_progress->cancel();
        return false;
    }
    return true;
}