~bzoltan/kubuntu-packaging/decouple_cmake_plugin

« back to all changes in this revision

Viewing changes to src/plugins/debugger/gdb/remotegdbprocess.h

  • Committer: Timo Jyrinki
  • Date: 2013-11-15 12:25:23 UTC
  • mfrom: (1.1.28)
  • Revision ID: timo.jyrinki@canonical.com-20131115122523-i2kyamsu4gs2mu1m
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/****************************************************************************
2
 
**
3
 
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
4
 
** Contact: http://www.qt-project.org/legal
5
 
**
6
 
** This file is part of Qt Creator.
7
 
**
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.
15
 
**
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.
23
 
**
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.
27
 
**
28
 
****************************************************************************/
29
 
 
30
 
#ifndef REMOTEGDBPROCESS_H
31
 
#define REMOTEGDBPROCESS_H
32
 
 
33
 
#include "abstractgdbprocess.h"
34
 
 
35
 
#include <ssh/sshconnection.h>
36
 
#include <ssh/sshremoteprocess.h>
37
 
 
38
 
#include <QQueue>
39
 
 
40
 
namespace Debugger {
41
 
namespace Internal {
42
 
 
43
 
class GdbRemotePlainEngine;
44
 
 
45
 
class RemoteGdbProcess : public AbstractGdbProcess
46
 
{
47
 
    Q_OBJECT
48
 
public:
49
 
    RemoteGdbProcess(const QSsh::SshConnectionParameters &server,
50
 
                     GdbRemotePlainEngine *adapter, QObject *parent = 0);
51
 
 
52
 
    virtual QByteArray readAllStandardOutput();
53
 
    virtual QByteArray readAllStandardError();
54
 
 
55
 
    virtual void start(const QString &cmd, const QStringList &args);
56
 
    virtual bool waitForStarted();
57
 
    virtual qint64 write(const QByteArray &data);
58
 
    virtual void kill();
59
 
    virtual bool interrupt();
60
 
 
61
 
    virtual QProcess::ProcessState state() const;
62
 
    virtual QString errorString() const;
63
 
 
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);
68
 
 
69
 
    void interruptInferior();
70
 
    void realStart(const QString &cmd, const QStringList &args,
71
 
        const QString &executableFilePath);
72
 
 
73
 
    static const QByteArray CtrlC;
74
 
 
75
 
signals:
76
 
    void started();
77
 
    void startFailed();
78
 
 
79
 
private slots:
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();
90
 
 
91
 
private:
92
 
    enum State {
93
 
        Inactive, Connecting, CreatingFifo, StartingFifoReader,
94
 
        StartingGdb, RunningGdb
95
 
    };
96
 
 
97
 
    static QByteArray readerCmdLine(const QByteArray &file);
98
 
 
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);
104
 
 
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;
112
 
    QString m_command;
113
 
    QStringList m_cmdArgs;
114
 
    QString m_wd;
115
 
    QQueue<QByteArray> m_inputToSend;
116
 
    QByteArray m_currentGdbOutput;
117
 
    QByteArray m_lastSeqNr;
118
 
    QString m_error;
119
 
    QByteArray m_appOutputFileName;
120
 
    State m_state;
121
 
 
122
 
    GdbRemotePlainEngine *m_adapter;
123
 
};
124
 
 
125
 
} // namespace Internal
126
 
} // namespace Debugger
127
 
 
128
 
#endif // REMOTEGDBPROCESS_H