Files
qt-creator/src/plugins/valgrind/valgrindprocess.h
hjk 3418070a4f Valgrind: Remove CallgrindController's use of ValgrindProcess
It's simply one-shot command execution, using (only some part of) the
ValgrindProcess machinery that just happens to also to wrap a process
is conceptually different from ValgrindProcess that "is" the
valgrind-with-debuggee entity (and an unneeded dependency)

Change-Id: I57a2c3d1cab6b15e59cb41b8e131948c170297b6
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-06-29 14:52:46 +00:00

100 lines
3.2 KiB
C++

/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Author: Milian Wolff, KDAB (milian.wolff@kdab.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <projectexplorer/applicationlauncher.h>
#include <projectexplorer/devicesupport/idevice.h>
#include <projectexplorer/runnables.h>
#include <ssh/sshremoteprocess.h>
#include <ssh/sshconnection.h>
#include <utils/osspecificaspects.h>
#include <utils/outputformat.h>
namespace Valgrind {
/**
* Process for supplying local and remote valgrind runs
*/
class ValgrindProcess : public QObject
{
Q_OBJECT
public:
ValgrindProcess();
~ValgrindProcess();
bool isRunning() const;
void setValgrindExecutable(const QString &valgrindExecutable);
void setValgrindArguments(const QStringList &valgrindArguments);
void setDebuggee(const ProjectExplorer::StandardRunnable &debuggee);
void run(ProjectExplorer::ApplicationLauncher::Mode runMode);
void close();
QString errorString() const;
QProcess::ProcessError processError() const;
void setProcessChannelMode(QProcess::ProcessChannelMode mode);
QString workingDirectory() const;
ProjectExplorer::IDevice::ConstPtr device() const { return m_device; }
void setDevice(const ProjectExplorer::IDevice::ConstPtr &device);
bool isLocal() const;
signals:
void valgrindStarted(qint64 pid);
void finished(int, QProcess::ExitStatus);
void error(QProcess::ProcessError);
void processOutput(const QString &, Utils::OutputFormat format);
private:
void handleRemoteStderr(const QByteArray &b);
void handleRemoteStdout(const QByteArray &b);
void closed(bool success);
void localProcessStarted();
void remoteProcessStarted();
void findPIDOutputReceived(const QByteArray &out);
QString argumentString(Utils::OsType osType) const;
ProjectExplorer::StandardRunnable m_debuggee;
ProjectExplorer::ApplicationLauncher m_valgrindProcess;
ProjectExplorer::IDevice::ConstPtr m_device;
ProjectExplorer::ApplicationLauncher m_findPID;
QSsh::SshConnectionParameters m_params;
QString m_valgrindExecutable;
QStringList m_valgrindArguments;
};
} // namespace Valgrind