Commit 6f549a22 authored by hjk's avatar hjk

Debugger: Introduce a debugger engine talking to lldb command line

Change-Id: Ie6b9cb68045db12cff1bbb06a7049529fc39c21f
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent 85d12bb4
......@@ -147,6 +147,7 @@ include(cdb/cdb.pri)
include(gdb/gdb.pri)
include(script/script.pri)
include(pdb/pdb.pri)
include(lldb/lldb.pri)
include(lldblib/lldbhost.pri)
include(qml/qml.pri)
include(namedemangler/namedemangler.pri)
......
......@@ -195,19 +195,21 @@ enum LogChannel
enum DebuggerEngineType
{
NoEngineType = 0,
GdbEngineType = 0x01,
ScriptEngineType = 0x02,
CdbEngineType = 0x04,
PdbEngineType = 0x08,
QmlEngineType = 0x20,
QmlCppEngineType = 0x40,
LldbEngineType = 0x80,
GdbEngineType = 0x001,
ScriptEngineType = 0x002,
CdbEngineType = 0x004,
PdbEngineType = 0x008,
QmlEngineType = 0x020,
QmlCppEngineType = 0x040,
LldbLibEngineType = 0x080,
LldbEngineType = 0x100,
AllEngineTypes = GdbEngineType
| ScriptEngineType
| CdbEngineType
| PdbEngineType
| QmlEngineType
| QmlCppEngineType
| LldbLibEngineType
| LldbEngineType
};
......
......@@ -132,10 +132,12 @@ DebuggerKitConfigDialog::DebuggerKitConfigDialog(QWidget *parent)
formLayout->setFieldGrowthPolicy(QFormLayout::AllNonFixedFieldsGrow);
m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(GdbEngineType), QVariant(int(GdbEngineType)));
if (ProjectExplorer::Abi::hostAbi().os() == ProjectExplorer::Abi::WindowsOS)
if (ProjectExplorer::Abi::hostAbi().os() == ProjectExplorer::Abi::WindowsOS) {
m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(CdbEngineType), QVariant(int(CdbEngineType)));
else
} else {
m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(LldbEngineType), QVariant(int(LldbEngineType)));
m_comboBox->addItem(DebuggerKitInformation::debuggerEngineName(LldbLibEngineType), QVariant(int(LldbLibEngineType)));
}
connect(m_comboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(refreshLabel()));
QLabel *engineTypeLabel = new QLabel(tr("&Engine:"));
engineTypeLabel->setBuddy(m_comboBox);
......
......@@ -32,12 +32,13 @@
#include "debuggeractions.h"
#include "debuggercore.h"
#include "debuggerengine.h"
#include "debuggerkitinformation.h"
#include "debuggerplugin.h"
#include "debuggerstringutils.h"
#include "debuggerstartparameters.h"
#include "debuggerkitinformation.h"
#include "lldblib/lldbenginehost.h"
#include "debuggerstringutils.h"
#include "debuggertooltipmanager.h"
#include "breakhandler.h"
#ifdef Q_OS_WIN
# include "peutils.h"
......@@ -78,6 +79,7 @@ DebuggerEngine *createScriptEngine(const DebuggerStartParameters &sp);
DebuggerEngine *createPdbEngine(const DebuggerStartParameters &sp);
DebuggerEngine *createQmlEngine(const DebuggerStartParameters &sp);
DebuggerEngine *createQmlCppEngine(const DebuggerStartParameters &sp, QString *error);
DebuggerEngine *createLldbLibEngine(const DebuggerStartParameters &sp);
DebuggerEngine *createLldbEngine(const DebuggerStartParameters &sp);
static const char *engineTypeName(DebuggerEngineType et)
......@@ -97,8 +99,10 @@ static const char *engineTypeName(DebuggerEngineType et)
return "QML engine";
case Debugger::QmlCppEngineType:
return "QML C++ engine";
case Debugger::LldbLibEngineType:
return "LLDB binary engine";
case Debugger::LldbEngineType:
return "LLDB engine";
return "LLDB command line engine";
case Debugger::AllEngineTypes:
break;
}
......@@ -651,6 +655,8 @@ DebuggerEngine *DebuggerRunControlFactory::createEngine(DebuggerEngineType et,
return createQmlEngine(sp);
case LldbEngineType:
return createLldbEngine(sp);
case LldbLibEngineType:
return createLldbLibEngine(sp);
case QmlCppEngineType:
return createQmlCppEngine(sp, errorMessage);
default:
......
HEADERS += $$PWD/lldbengine.h
SOURCES += $$PWD/lldbengine.cpp
INCLUDEPATH *= $$PWD
This diff is collapsed.
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of Qt Creator.
**
** 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.
**
** GNU Lesser General Public License Usage
** 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
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef DEBUGGER_LLDBENGINE
#define DEBUGGER_LLDBENGINE
#include "debuggerengine.h"
#include <QProcess>
#include <QQueue>
#include <QVariant>
namespace Debugger {
namespace Internal {
class WatchData;
class GdbMi;
/* A debugger engine for using the lldb command line debugger.
*/
class LldbResponse
{
public:
QByteArray data;
QVariant cookie;
};
class LldbEngine : public DebuggerEngine
{
Q_OBJECT
public:
explicit LldbEngine(const DebuggerStartParameters &startParameters);
~LldbEngine();
private:
// DebuggerEngine implementation
void executeStep();
void executeStepOut();
void executeNext();
void executeStepI();
void executeNextI();
void setupEngine();
void setupInferior();
void runEngine();
void shutdownInferior();
void shutdownEngine();
bool setToolTipExpression(const QPoint &mousePos,
TextEditor::ITextEditor *editor, const DebuggerToolTipContext &);
void continueInferior();
void interruptInferior();
void executeRunToLine(const ContextData &data);
void executeRunToFunction(const QString &functionName);
void executeJumpToLine(const ContextData &data);
void activateFrame(int index);
void selectThread(ThreadId threadId);
bool acceptsBreakpoint(BreakpointModelId id) const;
void insertBreakpoint(BreakpointModelId id);
void removeBreakpoint(BreakpointModelId id);
void assignValueInDebugger(const WatchData *data,
const QString &expr, const QVariant &value);
void executeDebuggerCommand(const QString &command, DebuggerLanguages languages);
void loadSymbols(const QString &moduleName);
void loadAllSymbols();
void requestModuleSymbols(const QString &moduleName);
void reloadModules();
void reloadRegisters() {}
void reloadSourceFiles() {}
void reloadFullStack() {}
bool supportsThreads() const { return true; }
bool isSynchronous() const { return true; }
void updateWatchData(const WatchData &data, const WatchUpdateFlags &flags);
signals:
void outputReady(const QByteArray &data);
private:
QString errorMessage(QProcess::ProcessError error) const;
bool hasCapability(unsigned cap) const;
Q_SLOT void handleLldbFinished(int, QProcess::ExitStatus status);
Q_SLOT void handleLldbError(QProcess::ProcessError error);
Q_SLOT void readLldbStandardOutput();
Q_SLOT void readLldbStandardError();
Q_SLOT void handleOutput2(const QByteArray &data);
void handleResponse(const QByteArray &ba);
void handleOutput(const QByteArray &data);
void updateAll();
void updateLocals();
void handleUpdateAll(const LldbResponse &response);
void handleFirstCommand(const LldbResponse &response);
void handleExecuteDebuggerCommand(const LldbResponse &response);
void handleInferiorSetup(const LldbResponse &response);
void handleRunEngine(const LldbResponse &response);
void handleInferiorInterrupt(const LldbResponse &response);
void handleContinue(const LldbResponse &response);
typedef void (LldbEngine::*LldbCommandCallback)
(const LldbResponse &response);
struct LldbCommand
{
LldbCommand()
: callback(0), callbackName(0)
{}
LldbCommandCallback callback;
const char *callbackName;
QByteArray command;
QVariant cookie;
//QTime postTime;
};
void handleStop(const LldbResponse &response);
void handleBacktrace(const LldbResponse &response);
void handleListLocals(const LldbResponse &response);
void handleListModules(const LldbResponse &response);
void handleListSymbols(const LldbResponse &response);
void handleBreakInsert(const LldbResponse &response);
void handleChildren(const WatchData &data0, const GdbMi &item,
QList<WatchData> *list);
void postCommand(const QByteArray &command,
LldbCommandCallback callback = 0,
const char *callbackName = 0,
const QVariant &cookie = QVariant());
void postDirectCommand(const QByteArray &command);
QQueue<LldbCommand> m_commands;
QByteArray m_inbuffer;
QString m_scriptFileName;
QProcess m_lldbProc;
QString m_lldb;
};
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGER_LLDBENGINE
......@@ -222,7 +222,7 @@ void LldbEngineHost::stderrReady()
fprintf(stderr,"%s", m_guestProcess->readAllStandardError().data());
}
DebuggerEngine *createLldbEngine(const DebuggerStartParameters &startParameters)
DebuggerEngine *createLldbLibEngine(const DebuggerStartParameters &startParameters)
{
return new LldbEngineHost(startParameters);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment