OSDN Git Service

It's 2011 now.
[qt-creator-jp/qt-creator-jp.git] / src / plugins / debugger / lldb / ipcengineguest.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef DEBUGGER_IPCENGINE_H
35 #define DEBUGGER_IPCENGINE_H
36
37 #include "breakhandler.h"
38 #include "debuggerengine.h"
39 #include "disassemblerlines.h"
40 #include "stackhandler.h"
41 #include "threadshandler.h"
42
43 #include <QtCore/QQueue>
44 #include <QtCore/QThread>
45 #include <QtCore/QVariant>
46
47 namespace Debugger {
48 namespace Internal {
49
50 class IPCEngineHost;
51 class IPCEngineGuest : public QObject
52 {
53     Q_OBJECT
54
55 public:
56     IPCEngineGuest();
57     virtual ~IPCEngineGuest();
58
59     void setLocalHost(IPCEngineHost *);
60     void setHostDevice(QIODevice *);
61
62     virtual void nuke() = 0;
63     virtual void setupEngine() = 0;
64     virtual void setupInferior(const QString &executeable,
65             const QStringList &arguments, const QStringList &environment) = 0;
66     virtual void runEngine() = 0;
67     virtual void shutdownInferior() = 0;
68     virtual void shutdownEngine() = 0;
69     virtual void detachDebugger() = 0;
70     virtual void executeStep() = 0;
71     virtual void executeStepOut() = 0;
72     virtual void executeNext() = 0;
73     virtual void executeStepI() = 0;
74     virtual void executeNextI() = 0;
75     virtual void continueInferior() = 0;
76     virtual void interruptInferior() = 0;
77     virtual void executeRunToLine(const QString &fileName, int lineNumber) = 0;
78     virtual void executeRunToFunction(const QString &functionName) = 0;
79     virtual void executeJumpToLine(const QString &fileName, int lineNumber) = 0;
80     virtual void activateFrame(qint64 token) = 0;
81     virtual void selectThread(qint64 token) = 0;
82     virtual void disassemble(quint64 pc) = 0;
83     virtual void addBreakpoint(BreakpointId id, const BreakpointParameters &bp) = 0;
84     virtual void removeBreakpoint(BreakpointId id) = 0;
85     virtual void changeBreakpoint(BreakpointId id, const BreakpointParameters &bp) = 0;
86     virtual void requestUpdateWatchData(const WatchData &data,
87             const WatchUpdateFlags & flags = WatchUpdateFlags()) = 0;
88     virtual void fetchFrameSource(qint64 frame) = 0;
89
90     enum Function
91     {
92         NotifyEngineSetupOk              = 1,
93         NotifyEngineSetupFailed          = 2,
94         NotifyEngineRunFailed            = 3,
95         NotifyInferiorSetupOk            = 4,
96         NotifyInferiorSetupFailed        = 5,
97         NotifyEngineRunAndInferiorRunOk  = 6,
98         NotifyEngineRunAndInferiorStopOk = 7,
99         NotifyInferiorRunRequested       = 8,
100         NotifyInferiorRunOk              = 9,
101         NotifyInferiorRunFailed          = 10,
102         NotifyInferiorStopOk             = 11,
103         NotifyInferiorSpontaneousStop    = 12,
104         NotifyInferiorStopFailed         = 13,
105         NotifyInferiorExited             = 14,
106         NotifyInferiorShutdownOk         = 15,
107         NotifyInferiorShutdownFailed     = 16,
108         NotifyEngineSpontaneousShutdown  = 17,
109         NotifyEngineShutdownOk           = 18,
110         NotifyEngineShutdownFailed       = 19,
111         NotifyInferiorIll                = 20,
112         NotifyEngineIll                  = 21,
113         NotifyInferiorPid                = 22,
114         ShowStatusMessage                = 23,
115         ShowMessage                      = 24,
116         CurrentFrameChanged              = 25,
117         CurrentThreadChanged             = 26,
118         ListFrames                       = 27,
119         ListThreads                      = 28,
120         Disassembled                     = 29,
121         NotifyAddBreakpointOk            = 30,
122         NotifyAddBreakpointFailed        = 31,
123         NotifyRemoveBreakpointOk         = 32,
124         NotifyRemoveBreakpointFailed     = 33,
125         NotifyChangeBreakpointOk         = 34,
126         NotifyChangeBreakpointFailed     = 35,
127         NotifyBreakpointAdjusted         = 36,
128         UpdateWatchData                  = 47,
129         FrameSourceFetched               = 48
130     };
131     Q_ENUMS(Function)
132
133     DebuggerState state() const;
134     void notifyEngineSetupOk();
135     void notifyEngineSetupFailed();
136     void notifyEngineRunFailed();
137     void notifyInferiorSetupOk();
138     void notifyInferiorSetupFailed();
139     void notifyEngineRunAndInferiorRunOk();
140     void notifyEngineRunAndInferiorStopOk();
141     void notifyInferiorRunRequested();
142     void notifyInferiorRunOk();
143     void notifyInferiorRunFailed();
144     void notifyInferiorStopOk();
145     void notifyInferiorSpontaneousStop();
146     void notifyInferiorStopFailed();
147     void notifyInferiorExited();
148     void notifyInferiorShutdownOk();
149     void notifyInferiorShutdownFailed();
150     void notifyEngineSpontaneousShutdown();
151     void notifyEngineShutdownOk();
152     void notifyEngineShutdownFailed();
153     void notifyInferiorIll();
154     void notifyEngineIll();
155     void notifyInferiorPid(qint64 pid);
156     void showMessage(const QString &msg, quint16 channel = LogDebug, quint64 timeout = -1);
157     void showStatusMessage(const QString &msg, quint64 timeout = -1);
158
159     void currentFrameChanged(qint64 token);
160     void currentThreadChanged(qint64 token);
161     void listFrames(const StackFrames &);
162     void listThreads(const Threads &);
163     void disassembled(quint64 pc, const DisassemblerLines &da);
164
165     void notifyAddBreakpointOk(BreakpointId id);
166     void notifyAddBreakpointFailed(BreakpointId id);
167     void notifyRemoveBreakpointOk(BreakpointId id);
168     void notifyRemoveBreakpointFailed(BreakpointId id);
169     void notifyChangeBreakpointOk(BreakpointId id);
170     void notifyChangeBreakpointFailed(BreakpointId id);
171     void notifyBreakpointAdjusted(BreakpointId id, const BreakpointParameters &bp);
172
173     void updateWatchData(bool fullCycle, const QList<WatchData> &);
174
175     void frameSourceFetched(qint64 frame, const QString &name, const QString &sourceCode);
176
177     void rpcCall(Function f, QByteArray payload = QByteArray());
178 public slots:
179     void rpcCallback(quint64 f, QByteArray payload = QByteArray());
180 private slots:
181     void readyRead();
182 private:
183     IPCEngineHost *m_local_host;
184     quint64 m_nextMessageCookie;
185     quint64 m_nextMessageFunction;
186     quint64 m_nextMessagePayloadSize;
187     quint64 m_cookie;
188     QIODevice *m_device;
189     DebuggerState m_state;
190 };
191
192 } // namespace Internal
193 } // namespace Debugger
194
195 #endif // DEBUGGER_LLDBENGINE_H