1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
9 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** No Commercial Usage
13 ** This file contains pre-release code and may not be distributed.
14 ** You may use this file in accordance with the terms and conditions
15 ** contained in the Technology Preview License Agreement accompanying
18 ** GNU Lesser General Public License Usage
20 ** Alternatively, this file may be used under the terms of the GNU Lesser
21 ** General Public License version 2.1 as published by the Free Software
22 ** Foundation and appearing in the file LICENSE.LGPL included in the
23 ** packaging of this file. Please review the following information to
24 ** ensure the GNU Lesser General Public License version 2.1 requirements
25 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
27 ** In addition, as a special exception, Nokia gives you certain additional
28 ** rights. These rights are described in the Nokia Qt LGPL Exception
29 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
31 ** If you have questions regarding the use of this file, please contact
32 ** Nokia at qt-info@nokia.com.
34 **************************************************************************/
36 #ifndef VALGRIND_RUNNER_P_H
37 #define VALGRIND_RUNNER_P_H
39 #include <utils/qtcprocess.h>
45 * Abstract process that can be subclassed to supply local and remote valgrind runs
47 class ValgrindProcess : public QObject
51 explicit ValgrindProcess(QObject *parent = 0);
52 virtual ~ValgrindProcess();
54 virtual bool isRunning() const = 0;
56 virtual void run(const QString &valgrindExecutable, const QStringList &valgrindArguments,
57 const QString &debuggeeExecutable, const QString &debuggeeArguments) = 0;
58 virtual void close() = 0;
60 virtual QString errorString() const = 0;
61 virtual QProcess::ProcessError error() const = 0;
63 virtual void setProcessChannelMode(QProcess::ProcessChannelMode mode) = 0;
64 virtual void setWorkingDirectory(const QString &path) = 0;
65 virtual void setEnvironment(const Utils::Environment &environment) = 0;
69 void finished(int, QProcess::ExitStatus);
70 void error(QProcess::ProcessError);
71 void standardOutputReceived(const QByteArray &);
72 void standardErrorReceived(const QByteArray &);
76 * Run valgrind on the local machine
78 class LocalValgrindProcess : public ValgrindProcess
83 explicit LocalValgrindProcess(QObject *parent = 0);
84 virtual ~LocalValgrindProcess();
86 virtual bool isRunning() const;
88 virtual void run(const QString &valgrindExecutable, const QStringList &valgrindArguments,
89 const QString &debuggeeExecutable, const QString &debuggeeArguments);
92 virtual QString errorString() const;
93 QProcess::ProcessError error() const;
95 virtual void setProcessChannelMode(QProcess::ProcessChannelMode mode);
96 virtual void setWorkingDirectory(const QString &path);
97 virtual void setEnvironment(const Utils::Environment &environment);
102 void readyReadStandardError();
103 void readyReadStandardOutput();
106 Utils::QtcProcess m_process;
109 // remote support will be supplied later
114 #endif // VALGRIND_RUNNER_P_H