2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2011-04-04 14:39:27 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2011-04-04 14:39:27 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2011-04-04 14:39:27 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2011-04-04 14:39:27 +02:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2011-05-06 15:05:37 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2011-04-04 14:39:27 +02:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2011-04-04 14:39:27 +02:00
|
|
|
|
2012-05-18 10:49:35 +02:00
|
|
|
#include <ssh/sshremoteprocess.h>
|
|
|
|
|
#include <ssh/sftpchannel.h>
|
2017-06-28 18:45:57 +02:00
|
|
|
#include <ssh/sshconnection.h>
|
2011-04-04 14:39:27 +02:00
|
|
|
|
2017-06-28 18:45:57 +02:00
|
|
|
#include <projectexplorer/runnables.h>
|
2011-04-04 14:39:27 +02:00
|
|
|
|
2017-06-28 18:45:57 +02:00
|
|
|
#include <QProcess>
|
2011-04-04 14:39:27 +02:00
|
|
|
|
2017-06-28 18:45:57 +02:00
|
|
|
namespace Valgrind {
|
2011-04-04 14:39:27 +02:00
|
|
|
namespace Callgrind {
|
|
|
|
|
|
2011-07-05 10:40:37 +02:00
|
|
|
class CallgrindController : public QObject
|
2011-04-04 14:39:27 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
2011-05-18 17:05:49 +02:00
|
|
|
Q_ENUMS(Option)
|
2011-04-04 14:39:27 +02:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
enum Option {
|
|
|
|
|
Unknown,
|
|
|
|
|
Dump,
|
|
|
|
|
ResetEventCounters,
|
2017-06-28 18:45:57 +02:00
|
|
|
Pause,
|
|
|
|
|
UnPause
|
2011-04-04 14:39:27 +02:00
|
|
|
};
|
|
|
|
|
|
2017-06-28 18:45:57 +02:00
|
|
|
CallgrindController();
|
|
|
|
|
~CallgrindController() override;
|
2011-04-04 14:39:27 +02:00
|
|
|
|
2017-06-28 18:45:57 +02:00
|
|
|
void run(Option option);
|
2011-04-04 14:39:27 +02:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Make data file available locally, triggers @c localParseDataAvailable.
|
|
|
|
|
*
|
|
|
|
|
* If the valgrind process was run remotely, this transparently
|
|
|
|
|
* downloads the data file first and returns a local path.
|
|
|
|
|
*/
|
|
|
|
|
void getLocalDataFile();
|
2017-06-28 18:45:57 +02:00
|
|
|
void setValgrindPid(qint64 pid);
|
|
|
|
|
void setValgrindRunnable(const ProjectExplorer::Runnable &runnable);
|
2011-04-04 14:39:27 +02:00
|
|
|
|
2017-03-19 20:10:35 +02:00
|
|
|
signals:
|
2011-04-04 14:39:27 +02:00
|
|
|
void finished(Valgrind::Callgrind::CallgrindController::Option option);
|
|
|
|
|
void localParseDataAvailable(const QString &file);
|
|
|
|
|
void statusMessage(const QString &msg);
|
|
|
|
|
|
2017-03-19 20:10:35 +02:00
|
|
|
private:
|
2017-06-28 18:45:57 +02:00
|
|
|
void handleControllerProcessError(QProcess::ProcessError);
|
2011-04-04 14:39:27 +02:00
|
|
|
|
2011-11-14 17:23:51 +01:00
|
|
|
void foundRemoteFile();
|
2011-04-04 14:39:27 +02:00
|
|
|
void sftpInitialized();
|
2012-05-18 10:49:35 +02:00
|
|
|
void sftpJobFinished(QSsh::SftpJobId job, const QString &error);
|
2011-04-04 14:39:27 +02:00
|
|
|
void cleanupTempFile();
|
|
|
|
|
|
2017-06-28 18:45:57 +02:00
|
|
|
void controllerProcessFinished(int, QProcess::ExitStatus);
|
|
|
|
|
void controllerProcessError(QProcess::ProcessError);
|
|
|
|
|
void controllerProcessClosed(bool success);
|
|
|
|
|
|
|
|
|
|
ProjectExplorer::ApplicationLauncher *m_controllerProcess;
|
|
|
|
|
ProjectExplorer::StandardRunnable m_valgrindRunnable;
|
|
|
|
|
qint64 m_pid = 0;
|
2011-04-04 14:39:27 +02:00
|
|
|
|
2017-06-28 18:45:57 +02:00
|
|
|
Option m_lastOption = Unknown;
|
2011-04-04 14:39:27 +02:00
|
|
|
|
|
|
|
|
// remote callgrind support
|
2017-06-28 18:45:57 +02:00
|
|
|
QSsh::SshConnection *m_ssh = nullptr;
|
2011-04-04 14:39:27 +02:00
|
|
|
QString m_tempDataFile;
|
2012-05-18 10:49:35 +02:00
|
|
|
QSsh::SshRemoteProcess::Ptr m_findRemoteFile;
|
|
|
|
|
QSsh::SftpChannel::Ptr m_sftp;
|
|
|
|
|
QSsh::SftpJobId m_downloadJob;
|
2011-04-04 14:39:27 +02:00
|
|
|
QByteArray m_remoteFile;
|
|
|
|
|
};
|
|
|
|
|
|
2011-05-18 17:05:49 +02:00
|
|
|
} // namespace Callgrind
|
|
|
|
|
} // namespace Valgrind
|