1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
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
16 ** GNU Lesser General Public License Usage
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.
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.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
34 #ifndef DEBUGGER_PDBENGINE_H
35 #define DEBUGGER_PDBENGINE_H
37 #include "debuggerengine.h"
39 #include <QtCore/QProcess>
40 #include <QtCore/QQueue>
41 #include <QtCore/QVariant>
50 /* A debugger engine for Python using the pdb command line debugger.
60 class PdbEngine : public DebuggerEngine
65 explicit PdbEngine(const DebuggerStartParameters &startParameters);
69 // DebuggerEngine implementation
71 void executeStepOut();
79 void shutdownInferior();
80 void shutdownEngine();
82 bool setToolTipExpression(const QPoint &mousePos,
83 TextEditor::ITextEditor *editor, const DebuggerToolTipContext &);
85 void continueInferior();
86 void interruptInferior();
88 void executeRunToLine(const ContextData &data);
89 void executeRunToFunction(const QString &functionName);
90 void executeJumpToLine(const ContextData &data);
92 void activateFrame(int index);
93 void selectThread(int index);
95 bool acceptsBreakpoint(BreakpointId id) const;
96 void insertBreakpoint(BreakpointId id);
97 void removeBreakpoint(BreakpointId id);
99 void assignValueInDebugger(const WatchData *data,
100 const QString &expr, const QVariant &value);
101 void executeDebuggerCommand(const QString &command);
103 void loadSymbols(const QString &moduleName);
104 void loadAllSymbols();
105 void requestModuleSymbols(const QString &moduleName);
106 void reloadModules();
107 void reloadRegisters() {}
108 void reloadSourceFiles() {}
109 void reloadFullStack() {}
111 bool supportsThreads() const { return true; }
112 bool isSynchronous() const { return true; }
113 void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags);
116 void outputReady(const QByteArray &data);
119 QString errorMessage(QProcess::ProcessError error) const;
120 unsigned debuggerCapabilities() const;
122 Q_SLOT void handlePdbFinished(int, QProcess::ExitStatus status);
123 Q_SLOT void handlePdbError(QProcess::ProcessError error);
124 Q_SLOT void readPdbStandardOutput();
125 Q_SLOT void readPdbStandardError();
126 Q_SLOT void handleOutput2(const QByteArray &data);
127 void handleResponse(const QByteArray &ba);
128 void handleOutput(const QByteArray &data);
131 void handleUpdateAll(const PdbResponse &response);
132 void handleFirstCommand(const PdbResponse &response);
133 void handleExecuteDebuggerCommand(const PdbResponse &response);
135 typedef void (PdbEngine::*PdbCommandCallback)
136 (const PdbResponse &response);
141 : callback(0), callbackName(0)
144 PdbCommandCallback callback;
145 const char *callbackName;
151 void handleStop(const PdbResponse &response);
152 void handleBacktrace(const PdbResponse &response);
153 void handleListLocals(const PdbResponse &response);
154 void handleListModules(const PdbResponse &response);
155 void handleListSymbols(const PdbResponse &response);
156 void handleBreakInsert(const PdbResponse &response);
158 void handleChildren(const WatchData &data0, const GdbMi &item,
159 QList<WatchData> *list);
160 void postCommand(const QByteArray &command,
161 //GdbCommandFlags flags = 0,
162 PdbCommandCallback callback = 0,
163 const char *callbackName = 0,
164 const QVariant &cookie = QVariant());
165 void postDirectCommand(const QByteArray &command);
167 QQueue<PdbCommand> m_commands;
169 QByteArray m_inbuffer;
170 QString m_scriptFileName;
175 } // namespace Internal
176 } // namespace Debugger
178 #endif // DEBUGGER_PDBENGINE_H