1
/****************************************************************************
3
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
6
** This file is part of Qt Creator.
8
** Commercial License Usage
9
** Licensees holding valid commercial Qt licenses may use this file in
10
** accordance with the commercial license agreement provided with the
11
** Software or, alternatively, in accordance with the terms contained in
12
** a written agreement between you and Digia. For licensing terms and
13
** conditions see http://qt.digia.com/licensing. For further information
14
** use the contact form at http://qt.digia.com/contact-us.
16
** GNU Lesser General Public License Usage
17
** Alternatively, this file may be used under the terms of the GNU Lesser
18
** General Public License version 2.1 as published by the Free Software
19
** Foundation and appearing in the file LICENSE.LGPL included in the
20
** packaging of this file. Please review the following information to
21
** ensure the GNU Lesser General Public License version 2.1 requirements
22
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
** In addition, as a special exception, Digia gives you certain additional
25
** rights. These rights are described in the Digia Qt LGPL Exception
26
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28
****************************************************************************/
30
#ifndef REMOTEGDBPROCESS_H
31
#define REMOTEGDBPROCESS_H
33
#include "abstractgdbprocess.h"
35
#include <ssh/sshconnection.h>
36
#include <ssh/sshremoteprocess.h>
43
class GdbRemotePlainEngine;
45
class RemoteGdbProcess : public AbstractGdbProcess
49
RemoteGdbProcess(const QSsh::SshConnectionParameters &server,
50
GdbRemotePlainEngine *adapter, QObject *parent = 0);
52
virtual QByteArray readAllStandardOutput();
53
virtual QByteArray readAllStandardError();
55
virtual void start(const QString &cmd, const QStringList &args);
56
virtual bool waitForStarted();
57
virtual qint64 write(const QByteArray &data);
59
virtual bool interrupt();
61
virtual QProcess::ProcessState state() const;
62
virtual QString errorString() const;
64
virtual QProcessEnvironment processEnvironment() const;
65
virtual void setProcessEnvironment(const QProcessEnvironment &env);
66
virtual void setEnvironment(const QStringList &env);
67
virtual void setWorkingDirectory(const QString &dir);
69
void interruptInferior();
70
void realStart(const QString &cmd, const QStringList &args,
71
const QString &executableFilePath);
73
static const QByteArray CtrlC;
80
void handleConnected();
81
void handleConnectionError();
82
void handleFifoCreationFinished(int exitStatus);
83
void handleAppOutputReaderStarted();
84
void handleAppOutputReaderFinished(int exitStatus);
85
void handleGdbStarted();
86
void handleGdbFinished(int exitStatus);
87
void handleGdbOutput();
88
void handleAppOutput();
89
void handleErrOutput();
93
Inactive, Connecting, CreatingFifo, StartingFifoReader,
94
StartingGdb, RunningGdb
97
static QByteArray readerCmdLine(const QByteArray &file);
99
int findAnchor(const QByteArray &data) const;
100
void sendInput(const QByteArray &data);
101
QByteArray removeCarriageReturn(const QByteArray &data);
102
void emitErrorExit(const QString &error);
103
void setState(State newState);
105
QSsh::SshConnectionParameters m_connParams;
106
QSsh::SshConnection *m_conn;
107
QSsh::SshRemoteProcess::Ptr m_gdbProc;
108
QSsh::SshRemoteProcess::Ptr m_appOutputReader;
109
QSsh::SshRemoteProcess::Ptr m_fifoCreator;
110
QByteArray m_gdbOutput;
111
QByteArray m_errorOutput;
113
QStringList m_cmdArgs;
115
QQueue<QByteArray> m_inputToSend;
116
QByteArray m_currentGdbOutput;
117
QByteArray m_lastSeqNr;
119
QByteArray m_appOutputFileName;
122
GdbRemotePlainEngine *m_adapter;
125
} // namespace Internal
126
} // namespace Debugger
128
#endif // REMOTEGDBPROCESS_H