Commit e76be1ca authored by hjk's avatar hjk

Debugger: Remove LldbLibEngine

That's dead code now that we go with the Python interface.

Change-Id: Ie10393d6adf5d25540c4082aeccf683e88bcdc89
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
parent baf190ff
......@@ -151,7 +151,6 @@ include(cdb/cdb.pri)
include(gdb/gdb.pri)
include(pdb/pdb.pri)
include(lldb/lldb.pri)
include(lldblib/lldbhost.pri)
include(qml/qml.pri)
include(namedemangler/namedemangler.pri)
......
......@@ -131,16 +131,6 @@ QtcPlugin {
]
}
Group {
name: "lldblib"
id: lldblib
prefix: "lldblib/"
files: [
"ipcenginehost.cpp", "ipcenginehost.h",
"lldbenginehost.cpp", "lldbenginehost.h"
]
}
Group {
name: "pdb"
prefix: "pdb/"
......@@ -247,16 +237,6 @@ QtcPlugin {
]
}
Group {
name: "LLDBOptions"
condition: qbs.targetOS.contains("osx")
files: [
"lldblib/lldboptionspage.cpp",
"lldblib/lldboptionspage.h",
"lldblib/lldboptionspagewidget.ui",
]
}
Properties {
condition: qbs.targetOS.contains("windows")
cpp.dynamicLibraries: [
......
......@@ -190,14 +190,12 @@ enum DebuggerEngineType
PdbEngineType = 0x008,
QmlEngineType = 0x020,
QmlCppEngineType = 0x040,
LldbLibEngineType = 0x080,
LldbEngineType = 0x100,
AllEngineTypes = GdbEngineType
| CdbEngineType
| PdbEngineType
| QmlEngineType
| QmlCppEngineType
| LldbLibEngineType
| LldbEngineType
};
......
......@@ -75,7 +75,6 @@ DebuggerEngine *createGdbEngine(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)
......@@ -93,8 +92,6 @@ 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 command line engine";
case Debugger::AllEngineTypes:
......@@ -518,8 +515,6 @@ 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:
......
LLDB Guest Engine
You can use the LLDB debugger from the LLVM project with the Qt Creator debugger
plugin on Mac OS.
For the Qt Creator build to pick up the LLDB Guest Engine,
you must download the LLDB debugger and configure it
to be included in the Qt Creator build.
To debug an application, Qt Creator must access the memory of the application.
On Mac OS X, this requires code signing.
To enable LLDB debugger support in Qt Creator:
1. To download the LLDB debugger, enter the following command:
svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
2. To sign the code, follow the instructions in lldb/docs/code-signing.txt.
3. To open LLDB in Xcode for building, enter the following command:
open lldb.xcodeproj
then select the Release target and press the build button.
4. In Xcode, press the build button.
5. type the following to have the qt creator build system find your lldb build:
export WITH_LLDB=/path/to/lldb
6. To rebuild Qt Creator, change back to the top level directory of
the Qt Creator source, and enter the following command:
qmake -r && make
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_GUEST_H
#define DEBUGGER_LLDBENGINE_GUEST_H
#include "ipcengineguest.h"
#include <QQueue>
#include <QVariant>
#include <QThread>
#include <QStringList>
#include <lldb/API/LLDB.h>
#if defined(HAVE_LLDB_PRIVATE)
#include "pygdbmiemu.h"
#endif
Q_DECLARE_METATYPE (lldb::SBListener *)
Q_DECLARE_METATYPE (lldb::SBEvent *)
namespace Debugger {
namespace Internal {
class LldbEventListener : public QObject
{
Q_OBJECT
public slots:
void listen(lldb::SBListener *listener);
signals:
// lldb API uses non thread safe implicit sharing with no explicit copy feature
// additionally the scope is undefined, hence this signal needs to be connected BlockingQueued
// whutever, works for now.
void lldbEvent(lldb::SBEvent *ev);
};
class LldbEngineGuest : public IPCEngineGuest
{
Q_OBJECT
public:
explicit LldbEngineGuest();
~LldbEngineGuest();
void nuke();
void setupEngine();
void setupInferior(const QString &executable, const QStringList &arguments,
const QStringList &environment);
void runEngine();
void shutdownInferior();
void shutdownEngine();
void detachDebugger();
void executeStep();
void executeStepOut() ;
void executeNext();
void executeStepI();
void executeNextI();
void continueInferior();
void interruptInferior();
void executeRunToLine(const ContextData &data);
void executeRunToFunction(const QString &functionName);
void executeJumpToLine(const ContextData &data);
void activateFrame(qint64);
void selectThread(qint64);
void disassemble(quint64 pc);
void addBreakpoint(BreakpointModelId id, const BreakpointParameters &bp);
void removeBreakpoint(BreakpointModelId id);
void changeBreakpoint(BreakpointModelId id, const BreakpointParameters &bp);
void requestUpdateWatchData(const WatchData &data,
const WatchUpdateFlags &flags);
void fetchFrameSource(qint64 frame);
private:
bool m_running;
QList<QByteArray> m_arguments;
QList<QByteArray> m_environment;
QThread m_wThread;
LldbEventListener *m_worker;
lldb::SBDebugger *m_lldb;
lldb::SBTarget *m_target;
lldb::SBProcess *m_process;
lldb::SBListener *m_listener;
lldb::SBFrame m_currentFrame;
lldb::SBThread m_currentThread;
bool m_relistFrames;
QHash<QString, lldb::SBValue> m_localesCache;
QHash<BreakpointModelId, lldb::SBBreakpoint> m_breakpoints;
QHash<qint64, QString> m_frame_to_file;
void updateThreads();
void getWatchDataR(lldb::SBValue v, int level,
const QByteArray &p_iname, QList<WatchData> &wd);
#if defined(HAVE_LLDB_PRIVATE)
PythonLLDBToGdbMiHack * py;
#endif
private slots:
void lldbEvent(lldb::SBEvent *ev);
};
} // namespace Internal
} // namespace Debugger
#endif // DEBUGGER_LLDBENGINE_H
#define SYNC_INFERIOR
/****************************************************************************
**
** 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.
**
****************************************************************************/
#include "lldbengineguest.h"
#include <QLocalSocket>
#include <QCoreApplication>
#include <QSocketNotifier>
#include <QQueue>
#include <cstdio>
// #define DO_STDIO_DEBUG 1
#ifdef DO_STDIO_DEBUG
#define D_STDIO0(x) qDebug(x)
#define D_STDIO1(x,a1) qDebug(x,a1)
#define D_STDIO2(x,a1,a2) qDebug(x,a1,a2)
#define D_STDIO3(x,a1,a2,a3) qDebug(x,a1,a2,a3)
#else
#define D_STDIO0(x)
#define D_STDIO1(x,a1)
#define D_STDIO2(x,a1,a2)
#define D_STDIO3(x,a1,a2,a3)
#endif
class Stdio : public QIODevice
{
Q_OBJECT
public:
QSocketNotifier notify;
Stdio()
: QIODevice()
, notify(fileno(stdin), QSocketNotifier::Read)
, buckethead(0)
{
setvbuf(stdin , NULL , _IONBF , 0);
setvbuf(stdout , NULL , _IONBF , 0);
setOpenMode(QIODevice::ReadWrite | QIODevice::Unbuffered);
connect(&notify, SIGNAL(activated(int)), this, SLOT(activated()));
}
virtual qint64 bytesAvailable () const
{
qint64 r = QIODevice::bytesAvailable();
foreach (const QByteArray &bucket, buckets)
r += bucket.size();
r-= buckethead;
return r;
}
virtual qint64 readData (char * data, qint64 maxSize)
{
D_STDIO1("readData %lli",maxSize);
qint64 size = maxSize;
while (size > 0) {
if (!buckets.size()) {
D_STDIO1("done prematurely with %lli", maxSize - size);
return maxSize - size;
}
QByteArray &bucket = buckets.head();
if ((size + buckethead) >= bucket.size()) {
int d = bucket.size() - buckethead;
D_STDIO3("read (over bucket) d: %i buckethead: %i bucket.size(): %i",
d, buckethead, bucket.size());
memcpy(data, bucket.data() + buckethead, d);
data += d;
size -= d;
buckets.dequeue();
buckethead = 0;
} else {
D_STDIO1("read (in bucket) size: %lli", size);
memcpy(data, bucket.data() + buckethead, size);
data += size;
buckethead += size;
size = 0;
}
}
D_STDIO1("done with %lli",(maxSize - size));
return maxSize - size;
}
virtual qint64 writeData (const char * data, qint64 maxSize)
{
return ::write(fileno(stdout), data, maxSize);
}
QQueue<QByteArray> buckets;
int buckethead;
private slots:
void activated()
{
QByteArray a;
a.resize(1000);
int ret = ::read(fileno(stdin), a.data(), 1000);
if (ret == 0)
::exit(0);
assert(ret <= 1000);
D_STDIO1("activated %i", ret);
a.resize(ret);
buckets.enqueue(a);
emit readyRead();
}
};
int main(int argc, char **argv)
{
QCoreApplication app(argc, argv);
qDebug() << "guest engine operational";
Debugger::Internal::LldbEngineGuest lldb;
Stdio stdio;
lldb.setHostDevice(&stdio);
return app.exec();
}
extern "C" {
extern const unsigned char lldbVersionString[] __attribute__ ((used)) = "@(#)PROGRAM:lldb PROJECT:lldb-26" "\n";
extern const double lldbVersionNumber __attribute__ ((used)) = (double)26.;
extern const double LLDBVersionNumber __attribute__ ((used)) = (double)26.;
}
#include "main.moc"
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleIdentifier</key>
<string>org.qt-project.qtcreator-lldb</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Qt Creator LLDB Guest</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>SecTaskAccess</key>
<array>
<string>allowed</string>
<string>safe</string>
</array>
</dict>
</plist>
WITH_LLDB = $$(WITH_LLDB)
macx: !isEmpty(WITH_LLDB) : SUBDIRS += $$PWD/qtcreator-lldb.pro
WITH_LLDB = $$(WITH_LLDB)
!macx: error (This can only be built on mac)
!exists($${WITH_LLDB}/include/lldb/lldb-enumerations.h): error(please see the README for build instructions)
QT = core network
include(../../../../../qtcreator.pri)
TEMPLATE = app
CONFIG -= app_bundle
CONFIG += debug
TARGET = qtcreator-lldb
DEPENDPATH += . .. ../.. ../../..
INCLUDEPATH += . .. ../.. ../../..
DESTDIR = $$IDE_LIBEXEC_PATH
MOC_DIR=.tmp
OBJECTS_DIR=.tmp
HEADERS += ../ipcengineguest.h \
../debuggerstreamops.h \
../breakpoint.h \
../watchdata.h \
../stackframe.h \
../disassemblerlines.h \
lldbengineguest.h
SOURCES += ../ipcengineguest.cpp \
../debuggerstreamops.cpp \
../breakpoint.cpp \
../watchdata.cpp \
../stackframe.cpp \
../disassemblerlines.cpp \
lldbengineguest.cpp \
main.cpp
LIBS += -sectcreate __TEXT __info_plist $$PWD/qtcreator-lldb.plist
POSTL = rm -rf \'$${IDE_LIBEXEC_PATH}/LLDB.framework\' $$escape_expand(\\n\\t) \
$$QMAKE_COPY_DIR $${WITH_LLDB}/build/Release/* \'$$IDE_LIBEXEC_PATH\' $$escape_expand(\\n\\t) \
install_name_tool -change '@rpath/LLDB.framework/Versions/A/LLDB' '@executable_path/LLDB.framework/Versions/A/LLDB' $(TARGET) $$escape_expand(\\n\\t) \
codesign -s lldb_codesign $(TARGET)
!isEmpty(QMAKE_POST_LINK):QMAKE_POST_LINK = $$escape_expand(\\n\\t)$$QMAKE_POST_LINK
QMAKE_POST_LINK = $$POSTL $$QMAKE_POST_LINK
silent:QMAKE_POST_LINK = @echo signing $@ && $$QMAKE_POST_LINK
LIBS += -framework Security -framework Python
DEFINES += __STDC_LIMIT_MACROS __STDC_CONSTANT_MACROS
INCLUDEPATH += $${WITH_LLDB}/include $${WITH_LLDB}/llvm/include/
LIBS += -F$${WITH_LLDB}/build/Release -framework LLDB
# include (lldb.pri)
# DEFINES += HAVE_LLDB_PRIVATE
# HEADERS += pygdbmiemu.h
# SOURCES += pygdbmiemu.cpp
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 IPCENGINEGUEST_H
#define IPCENGINEGUEST_H
#include <debugger/breakhandler.h>
#include <debugger/debuggerengine.h>
#include <debugger/disassemblerlines.h>
#include <debugger/stackhandler.h>
#include <debugger/threadshandler.h>
#include <QQueue>
#include <QThread>
#include <QVariant>
namespace Debugger {
namespace Internal {
class IPCEngineHost;
class IPCEngineGuest : public QObject
{
Q_OBJECT
public:
IPCEngineGuest();
virtual ~IPCEngineGuest();
void setLocalHost(IPCEngineHost *);
void setHostDevice(QIODevice *);
virtual void nuke() = 0;
virtual void setupEngine() = 0;
virtual void setupInferior(const QString &executeable,
const QStringList &arguments, const QStringList &environment) = 0;
virtual void runEngine() = 0;
virtual void shutdownInferior() = 0;
virtual void shutdownEngine() = 0;
virtual void detachDebugger() = 0;
virtual void executeStep() = 0;
virtual void executeStepOut() = 0;
virtual void executeNext() = 0;
virtual void executeStepI() = 0;
virtual void executeNextI() = 0;
virtual void continueInferior() = 0;
virtual void interruptInferior() = 0;
virtual void executeRunToLine(const ContextData &data) = 0;
virtual void executeRunToFunction(const QString &functionName) = 0;
virtual void executeJumpToLine(const ContextData &data) = 0;
virtual void activateFrame(qint64 token) = 0;
virtual void selectThread(qint64 token) = 0;
virtual void disassemble(quint64 pc) = 0;
virtual void addBreakpoint(BreakpointModelId id, const BreakpointParameters &bp) = 0;
virtual void removeBreakpoint(BreakpointModelId id) = 0;
virtual void changeBreakpoint(BreakpointModelId id, const BreakpointParameters &bp) = 0;
virtual void requestUpdateWatchData(const WatchData &data,
const WatchUpdateFlags & flags = WatchUpdateFlags()) = 0;
virtual void fetchFrameSource(qint64 frame) = 0;
enum Function
{
NotifyEngineSetupOk = 1,
NotifyEngineSetupFailed = 2,
NotifyEngineRunFailed = 3,
NotifyInferiorSetupOk = 4,
NotifyInferiorSetupFailed = 5,
NotifyEngineRunAndInferiorRunOk = 6,
NotifyEngineRunAndInferiorStopOk = 7,
NotifyInferiorRunRequested = 8,
NotifyInferiorRunOk = 9,
NotifyInferiorRunFailed = 10,
NotifyInferiorStopOk = 11,
NotifyInferiorSpontaneousStop = 12,
NotifyInferiorStopFailed = 13,
NotifyInferiorExited = 14,
NotifyInferiorShutdownOk = 15,
NotifyInferiorShutdownFailed = 16,
NotifyEngineSpontaneousShutdown = 17,
NotifyEngineShutdownOk = 18,
NotifyEngineShutdownFailed = 19,
NotifyInferiorIll = 20,
NotifyEngineIll = 21,
NotifyInferiorPid = 22,
ShowStatusMessage = 23,
ShowMessage = 24,
CurrentFrameChanged = 25,
CurrentThreadChanged = 26,
ListFrames = 27,
ListThreads = 28,
Disassembled = 29,
NotifyAddBreakpointOk = 30,
NotifyAddBreakpointFailed = 31,
NotifyRemoveBreakpointOk = 32,
NotifyRemoveBreakpointFailed = 33,
NotifyChangeBreakpointOk = 34,
NotifyChangeBreakpointFailed = 35,
NotifyBreakpointAdjusted = 36,
UpdateWatchData = 47,
FrameSourceFetched = 48
};
Q_ENUMS(Function)
DebuggerState state() const;
void notifyEngineSetupOk();
void notifyEngineSetupFailed();
void notifyEngineRunFailed();
void notifyInferiorSetupOk();
void notifyInferiorSetupFailed();
void notifyEngineRunAndInferiorRunOk();
void notifyEngineRunAndInferiorStopOk();
void notifyInferiorRunRequested();
void notifyInferiorRunOk();
void notifyInferiorRunFailed();
void notifyInferiorStopOk();
void notifyInferiorSpontaneousStop();
void notifyInferiorStopFailed();
void notifyInferiorExited();
void notifyInferiorShutdownOk();
void notifyInferiorShutdownFailed();
void notifyEngineSpontaneousShutdown();
void notifyEngineShutdownOk();
void notifyEngineShutdownFailed();
void notifyInferiorIll();
void notifyEngineIll();
void notifyInferiorPid(qint64 pid);
void showMessage(const QString &msg, quint16 channel = LogDebug, quint64 timeout = quint64(-1));
void showStatusMessage(const QString &msg, quint64 timeout = quint64(-1));
void currentFrameChanged(qint64 token);
void currentThreadChanged(qint64 token);
void listFrames(const StackFrames &);
void listThreads(const Threads &);
void disassembled(quint64 pc, const DisassemblerLines &da);
void notifyAddBreakpointOk(BreakpointModelId id);
void notifyAddBreakpointFailed(BreakpointModelId id);
void notifyRemoveBreakpointOk(BreakpointModelId id);
void notifyRemoveBreakpointFailed(BreakpointModelId id);
void notifyChangeBreakpointOk(BreakpointModelId id);
void notifyChangeBreakpointFailed(BreakpointModelId id);
void notifyBreakpointAdjusted(BreakpointModelId id, const BreakpointParameters &bp);