2012-10-02 09:12:39 +02:00
|
|
|
/****************************************************************************
|
2010-06-09 16:13:47 +02:00
|
|
|
**
|
2014-01-07 13:27:11 +01:00
|
|
|
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
|
2012-10-02 09:12:39 +02:00
|
|
|
** Contact: http://www.qt-project.org/legal
|
2010-06-09 16:13:47 +02:00
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
** This file is part of Qt Creator.
|
2010-06-09 16:13:47 +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
|
|
|
|
|
** a written agreement between you and Digia. For licensing terms and
|
|
|
|
|
** conditions see http://qt.digia.com/licensing. For further information
|
|
|
|
|
** use the contact form at http://qt.digia.com/contact-us.
|
2010-06-09 16:13:47 +02:00
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
2012-10-02 09:12:39 +02:00
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** In addition, as a special exception, Digia gives you certain additional
|
|
|
|
|
** rights. These rights are described in the Digia Qt LGPL Exception
|
2010-12-17 16:01:08 +01:00
|
|
|
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
|
|
|
|
|
**
|
2012-10-02 09:12:39 +02:00
|
|
|
****************************************************************************/
|
2010-06-09 16:13:47 +02:00
|
|
|
|
2012-05-09 14:56:04 +02:00
|
|
|
#ifndef QMLENGINE_H
|
|
|
|
|
#define QMLENGINE_H
|
2010-06-09 16:13:47 +02:00
|
|
|
|
2012-05-09 14:56:04 +02:00
|
|
|
#include "interactiveinterpreter.h"
|
|
|
|
|
#include "qmladapter.h"
|
|
|
|
|
#include "qmlinspectoradapter.h"
|
2013-08-29 16:36:42 +02:00
|
|
|
#include <debugger/debuggerengine.h>
|
2012-05-09 14:56:04 +02:00
|
|
|
|
|
|
|
|
#include <projectexplorer/applicationlauncher.h>
|
2012-04-18 12:06:10 +02:00
|
|
|
#include <qmldebug/qdebugmessageclient.h>
|
2012-05-09 14:56:04 +02:00
|
|
|
#include <qmldebug/qmloutputparser.h>
|
2012-10-08 13:17:10 +02:00
|
|
|
#include <qmljs/iscriptevaluator.h>
|
2011-01-07 18:04:38 +01:00
|
|
|
|
2012-05-09 14:56:04 +02:00
|
|
|
#include <QTextDocument>
|
2011-12-21 10:39:54 +01:00
|
|
|
|
2014-02-11 21:55:42 +02:00
|
|
|
namespace Core { class IDocument; }
|
2011-12-21 10:39:54 +01:00
|
|
|
|
2010-06-09 16:13:47 +02:00
|
|
|
namespace Debugger {
|
2010-11-22 10:20:31 +01:00
|
|
|
namespace Internal {
|
2010-12-03 12:07:32 +01:00
|
|
|
|
2012-04-18 14:20:54 +02:00
|
|
|
class QmlAdapter;
|
2012-10-05 13:42:14 +02:00
|
|
|
class WatchTreeView;
|
2010-06-09 16:13:47 +02:00
|
|
|
|
2012-10-08 13:17:10 +02:00
|
|
|
class QmlEngine : public DebuggerEngine, QmlJS::IScriptEvaluator
|
2010-06-09 16:13:47 +02:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2012-11-27 17:16:57 +01:00
|
|
|
explicit QmlEngine(const DebuggerStartParameters &startParameters,
|
|
|
|
|
DebuggerEngine *masterEngine = 0);
|
2010-12-03 12:07:32 +01:00
|
|
|
~QmlEngine();
|
2010-06-09 16:13:47 +02:00
|
|
|
|
2013-04-18 10:01:05 +02:00
|
|
|
void notifyInferiorSetupOk();
|
2012-06-13 11:29:26 +02:00
|
|
|
void notifyEngineRemoteSetupDone(int gdbServerPort, int qmlPort);
|
|
|
|
|
void notifyEngineRemoteSetupFailed(const QString &message);
|
2013-04-18 10:01:05 +02:00
|
|
|
void notifyEngineRemoteServerRunning(const QByteArray &, int pid);
|
2010-09-16 17:08:07 +02:00
|
|
|
|
2011-01-24 16:58:35 +01:00
|
|
|
bool canDisplayTooltip() const;
|
2010-11-15 17:09:28 +01:00
|
|
|
|
2011-02-21 17:01:40 +01:00
|
|
|
void showMessage(const QString &msg, int channel = LogDebug,
|
|
|
|
|
int timeout = -1) const;
|
2011-11-30 15:23:02 +01:00
|
|
|
void gotoLocation(const Internal::Location &location);
|
|
|
|
|
|
2011-02-21 17:01:40 +01:00
|
|
|
void filterApplicationMessage(const QString &msg, int channel);
|
2011-07-26 16:22:49 +02:00
|
|
|
void inferiorSpontaneousStop();
|
|
|
|
|
|
2012-05-09 14:56:04 +02:00
|
|
|
enum LogDirection {
|
|
|
|
|
LogSend,
|
|
|
|
|
LogReceive
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
void logMessage(const QString &service, LogDirection direction,
|
|
|
|
|
const QString &str);
|
2011-02-21 17:01:40 +01:00
|
|
|
|
2011-11-30 15:23:02 +01:00
|
|
|
void setSourceFiles(const QStringList &fileNames);
|
2012-05-09 14:56:04 +02:00
|
|
|
void updateScriptSource(const QString &fileName, int lineOffset,
|
|
|
|
|
int columnOffset, const QString &source);
|
2011-10-06 17:38:28 +02:00
|
|
|
|
2012-03-09 09:06:21 +01:00
|
|
|
void insertBreakpoint(BreakpointModelId id);
|
|
|
|
|
|
2012-05-09 14:56:04 +02:00
|
|
|
signals:
|
|
|
|
|
void tooltipRequested(const QPoint &mousePos,
|
2014-07-23 19:10:38 +02:00
|
|
|
TextEditor::BaseTextEditor *editor, int cursorPos);
|
2013-04-18 10:01:05 +02:00
|
|
|
void aboutToNotifyInferiorSetupOk();
|
2012-05-09 14:56:04 +02:00
|
|
|
|
|
|
|
|
private slots:
|
2010-08-10 14:42:44 +02:00
|
|
|
void disconnected();
|
2012-02-28 17:30:15 +01:00
|
|
|
void documentUpdated(QmlJS::Document::Ptr doc);
|
2012-03-07 16:19:55 +01:00
|
|
|
void expressionEvaluated(quint32 queryId, const QVariant &result);
|
2010-06-25 14:08:53 +02:00
|
|
|
|
2012-02-23 13:03:22 +01:00
|
|
|
void errorMessageBoxFinished(int result);
|
2012-02-15 12:35:43 +01:00
|
|
|
void updateCurrentContext();
|
2012-02-22 11:50:05 +01:00
|
|
|
void appendDebugOutput(QtMsgType type, const QString &message,
|
2012-04-18 12:06:10 +02:00
|
|
|
const QmlDebug::QDebugContextInfo &info);
|
2011-02-21 17:01:40 +01:00
|
|
|
|
2012-05-09 14:56:04 +02:00
|
|
|
void tryToConnect(quint16 port = 0);
|
|
|
|
|
void beginConnection(quint16 port = 0);
|
|
|
|
|
void connectionEstablished();
|
|
|
|
|
void connectionStartupFailed();
|
|
|
|
|
void appStartupFailed(const QString &errorMessage);
|
2014-05-05 17:18:11 +02:00
|
|
|
void connectionError(QDebugSupport::Error error);
|
2012-05-09 14:56:04 +02:00
|
|
|
void serviceConnectionError(const QString &service);
|
|
|
|
|
void appendMessage(const QString &msg, Utils::OutputFormat);
|
|
|
|
|
|
|
|
|
|
void synchronizeWatchers();
|
|
|
|
|
|
2010-06-09 16:13:47 +02:00
|
|
|
private:
|
2010-12-03 12:07:32 +01:00
|
|
|
// DebuggerEngine implementation.
|
2010-08-30 07:52:41 +02:00
|
|
|
bool isSynchronous() const { return false; }
|
2010-06-09 16:13:47 +02:00
|
|
|
void executeStep();
|
|
|
|
|
void executeStepOut();
|
|
|
|
|
void executeNext();
|
|
|
|
|
void executeStepI();
|
|
|
|
|
void executeNextI();
|
|
|
|
|
|
2010-07-08 18:10:50 +02:00
|
|
|
void setupEngine();
|
2010-07-09 17:07:59 +02:00
|
|
|
void setupInferior();
|
|
|
|
|
void runEngine();
|
|
|
|
|
void shutdownInferior();
|
|
|
|
|
void shutdownEngine();
|
|
|
|
|
|
2014-07-23 19:10:38 +02:00
|
|
|
bool setToolTipExpression(TextEditor::BaseTextEditor *editor,
|
2014-07-08 18:16:54 +02:00
|
|
|
const DebuggerToolTipContext &);
|
2010-06-09 16:13:47 +02:00
|
|
|
|
|
|
|
|
void continueInferior();
|
|
|
|
|
void interruptInferior();
|
|
|
|
|
|
2011-02-23 10:16:11 +01:00
|
|
|
void executeRunToLine(const ContextData &data);
|
2010-06-09 16:13:47 +02:00
|
|
|
void executeRunToFunction(const QString &functionName);
|
2011-02-23 10:16:11 +01:00
|
|
|
void executeJumpToLine(const ContextData &data);
|
2010-06-09 16:13:47 +02:00
|
|
|
|
|
|
|
|
void activateFrame(int index);
|
2012-10-19 16:37:57 +02:00
|
|
|
void selectThread(ThreadId threadId);
|
2010-06-09 16:13:47 +02:00
|
|
|
|
|
|
|
|
void attemptBreakpointSynchronization();
|
2011-08-17 11:47:42 +02:00
|
|
|
void removeBreakpoint(BreakpointModelId id);
|
|
|
|
|
void changeBreakpoint(BreakpointModelId id);
|
2011-06-24 16:25:30 +02:00
|
|
|
bool acceptsBreakpoint(BreakpointModelId id) const;
|
2010-06-09 16:13:47 +02:00
|
|
|
|
2010-12-03 12:07:32 +01:00
|
|
|
void assignValueInDebugger(const WatchData *data,
|
2010-11-10 16:33:11 +01:00
|
|
|
const QString &expr, const QVariant &value);
|
2011-11-30 15:23:02 +01:00
|
|
|
|
|
|
|
|
|
2010-06-09 16:13:47 +02:00
|
|
|
void loadSymbols(const QString &moduleName);
|
|
|
|
|
void loadAllSymbols();
|
|
|
|
|
void requestModuleSymbols(const QString &moduleName);
|
|
|
|
|
void reloadModules();
|
|
|
|
|
void reloadRegisters() {}
|
2011-11-30 15:23:02 +01:00
|
|
|
void reloadSourceFiles();
|
2010-06-09 16:13:47 +02:00
|
|
|
void reloadFullStack() {}
|
|
|
|
|
|
2010-08-06 13:48:43 +02:00
|
|
|
bool supportsThreads() const { return false; }
|
2010-12-03 12:07:32 +01:00
|
|
|
void updateWatchData(const WatchData &data,
|
|
|
|
|
const WatchUpdateFlags &flags);
|
2012-11-23 13:35:44 +01:00
|
|
|
void watchDataSelected(const QByteArray &iname);
|
2012-04-10 09:36:15 +02:00
|
|
|
void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
|
2012-10-08 13:17:10 +02:00
|
|
|
bool evaluateScript(const QString &expression);
|
2010-06-09 16:13:47 +02:00
|
|
|
|
2012-01-12 20:28:17 +01:00
|
|
|
bool hasCapability(unsigned) const;
|
2012-06-12 10:48:54 +02:00
|
|
|
void quitDebugger();
|
2010-06-25 14:08:53 +02:00
|
|
|
|
2010-07-01 11:48:43 +02:00
|
|
|
private:
|
2010-11-15 17:09:28 +01:00
|
|
|
void closeConnection();
|
|
|
|
|
void startApplicationLauncher();
|
|
|
|
|
void stopApplicationLauncher();
|
|
|
|
|
|
2010-09-08 13:31:12 +02:00
|
|
|
bool isShadowBuildProject() const;
|
|
|
|
|
QString fromShadowBuildFilename(const QString &filename) const;
|
2010-10-27 15:23:30 +02:00
|
|
|
QString mangleFilenamePaths(const QString &filename,
|
|
|
|
|
const QString &oldBasePath, const QString &newBasePath) const;
|
2010-09-08 13:31:12 +02:00
|
|
|
QString qmlImportPath() const;
|
|
|
|
|
|
2013-07-09 12:14:33 +02:00
|
|
|
void updateDocument(Core::IDocument *document, const QTextDocument *textDocument);
|
2012-02-15 12:35:43 +01:00
|
|
|
bool canEvaluateScript(const QString &script);
|
2012-02-28 17:30:15 +01:00
|
|
|
bool adjustBreakpointLineAndColumn(const QString &filePath, quint32 *line,
|
|
|
|
|
quint32 *column, bool *valid);
|
2011-12-21 10:39:54 +01:00
|
|
|
|
2012-05-09 14:56:04 +02:00
|
|
|
QmlAdapter m_adapter;
|
|
|
|
|
QmlInspectorAdapter m_inspectorAdapter;
|
|
|
|
|
ProjectExplorer::ApplicationLauncher m_applicationLauncher;
|
|
|
|
|
QTimer m_noDebugOutputTimer;
|
2012-05-10 10:29:11 +02:00
|
|
|
QmlDebug::QmlOutputParser m_outputParser;
|
2012-05-09 14:56:04 +02:00
|
|
|
QHash<QString, QTextDocument*> m_sourceDocuments;
|
2014-07-23 19:10:38 +02:00
|
|
|
QHash<QString, QWeakPointer<TextEditor::BaseTextEditor> > m_sourceEditors;
|
2012-05-09 14:56:04 +02:00
|
|
|
InteractiveInterpreter m_interpreter;
|
|
|
|
|
QHash<QString,BreakpointModelId> pendingBreakpoints;
|
|
|
|
|
QList<quint32> queryIds;
|
|
|
|
|
bool m_retryOnConnectFail;
|
|
|
|
|
bool m_automaticConnect;
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
friend class QmlCppEngine;
|
2010-06-09 16:13:47 +02:00
|
|
|
};
|
|
|
|
|
|
2010-12-03 12:07:32 +01:00
|
|
|
} // namespace Internal
|
2010-06-09 16:13:47 +02:00
|
|
|
} // namespace Debugger
|
|
|
|
|
|
2012-05-09 14:56:04 +02:00
|
|
|
#endif // QMLENGINE_H
|