From 30989ff366dfb5fbe830a28e969061be87017632 Mon Sep 17 00:00:00 2001
From: Arvid Ephraim Picciani <arvid.picciani@nokia.com>
Date: Fri, 26 Nov 2010 14:40:45 +0100
Subject: [PATCH] lldb: detect lldb build in environment WITH_LLDB

---
 src/plugins/debugger/lldb/guest/README             | 13 +++++++------
 src/plugins/debugger/lldb/guest/qtcreator-lldb.pri |  3 ++-
 src/plugins/debugger/lldb/guest/qtcreator-lldb.pro | 11 ++++++-----
 src/plugins/debugger/lldb/ipcengineguest.cpp       |  2 +-
 src/plugins/debugger/lldb/lldbhost.pri             |  8 ++++++--
 5 files changed, 22 insertions(+), 15 deletions(-)

diff --git a/src/plugins/debugger/lldb/guest/README b/src/plugins/debugger/lldb/guest/README
index ac304f55e14..be9d4fbee7a 100644
--- a/src/plugins/debugger/lldb/guest/README
+++ b/src/plugins/debugger/lldb/guest/README
@@ -12,18 +12,19 @@ On Mac OS X, this requires code signing.
 
 To enable LLDB debugger support in Qt Creator:
 
-1. Change to the directory this readme is located in.
-
-2. To download the LLDB debugger, enter the following command:
+1. To download the LLDB debugger, enter the following command:
    svn co http://llvm.org/svn/llvm-project/lldb/trunk lldb
 
-3. To sign the code, follow the instructions in lldb/docs/code-signing.txt.
+2. To sign the code, follow the instructions in lldb/docs/code-signing.txt.
 
-4. To open LLDB in Xcode for building, enter the following command:
+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.
 
-5. In Xcode, 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:
diff --git a/src/plugins/debugger/lldb/guest/qtcreator-lldb.pri b/src/plugins/debugger/lldb/guest/qtcreator-lldb.pri
index ce6a7c91ad3..f44c3e9c849 100644
--- a/src/plugins/debugger/lldb/guest/qtcreator-lldb.pri
+++ b/src/plugins/debugger/lldb/guest/qtcreator-lldb.pri
@@ -1 +1,2 @@
-macx: exists($$PWD/lldb/include/lldb/lldb-enumerations.h) : SUBDIRS += $$PWD/qtcreator-lldb.pro
+WITH_LLDB = $$(WITH_LLDB)
+macx: !isEmpty(WITH_LLDB) : SUBDIRS += $$PWD/qtcreator-lldb.pro
diff --git a/src/plugins/debugger/lldb/guest/qtcreator-lldb.pro b/src/plugins/debugger/lldb/guest/qtcreator-lldb.pro
index c885675ebc3..55688aad539 100644
--- a/src/plugins/debugger/lldb/guest/qtcreator-lldb.pro
+++ b/src/plugins/debugger/lldb/guest/qtcreator-lldb.pro
@@ -1,5 +1,7 @@
+WITH_LLDB = $$(WITH_LLDB)
+
 !macx: error (This can only be built on mac)
-!exists($$PWD/lldb): error(please see the README for build instructions)
+!exists($${WITH_LLDB}/include/lldb/lldb-enumerations.h): error(please see the README for build instructions)
 
 include(../../../../../qtcreator.pri)
 TEMPLATE = app
@@ -8,7 +10,6 @@ CONFIG += debug
 TARGET = qtcreator-lldb
 DEPENDPATH += . .. ../.. ../../..  ../../../../libs
 INCLUDEPATH += . .. ../.. ../../.. ../../../../libs
-DEFINES += IPC_STANDALONE_GUEST
 DESTDIR  = $$IDE_LIBEXEC_PATH
 
 QT = core network
@@ -37,7 +38,7 @@ SOURCES +=  ../ipcengineguest.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 lldb/build/Release/* \'$$IDE_LIBEXEC_PATH\' $$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)
 
@@ -49,8 +50,8 @@ LIBS +=  -framework Security -framework Python
 
 DEFINES += __STDC_LIMIT_MACROS __STDC_CONSTANT_MACROS
 
-INCLUDEPATH += lldb/include lldb/llvm/include/
-LIBS += -F$$PWD/lldb/build/Release -framework LLDB
+INCLUDEPATH += $${WITH_LLDB}/include $${WITH_LLDB}/llvm/include/
+LIBS += -F$${WITH_LLDB}/build/Release -framework LLDB
 
 # include (lldb.pri)
 # DEFINES += HAVE_LLDB_PRIVATE
diff --git a/src/plugins/debugger/lldb/ipcengineguest.cpp b/src/plugins/debugger/lldb/ipcengineguest.cpp
index 27cdf371523..1268a6967eb 100644
--- a/src/plugins/debugger/lldb/ipcengineguest.cpp
+++ b/src/plugins/debugger/lldb/ipcengineguest.cpp
@@ -70,7 +70,7 @@ void IPCEngineGuest::setLocalHost(IPCEngineHost *host)
 void IPCEngineGuest::setHostDevice(QIODevice *device)
 {
     if (m_device) {
-        disconnect(m_device, SIGNAL(readyRead()), SLOT(readyRead()));
+        disconnect(m_device, SIGNAL(readyRead()), this, SLOT(readyRead()));
         delete m_device;
     }
     m_device = device;
diff --git a/src/plugins/debugger/lldb/lldbhost.pri b/src/plugins/debugger/lldb/lldbhost.pri
index e2f63b0b2b7..31ed06dbfea 100644
--- a/src/plugins/debugger/lldb/lldbhost.pri
+++ b/src/plugins/debugger/lldb/lldbhost.pri
@@ -1,3 +1,5 @@
+WITH_LLDB = $$(WITH_LLDB)
+
 HEADERS += $$PWD/ipcenginehost.h \
            $$PWD/lldbenginehost.h
 
@@ -6,8 +8,10 @@ SOURCES +=  $$PWD/ipcenginehost.cpp \
 
 INCLUDEPATH+=
 
-DEFINES += IPC_STANDALONE_HOST
-
 FORMS +=
 
 RESOURCES +=
+
+!isEmpty(WITH_LLDB) {
+    DEFINES += WITH_LLDB
+}
-- 
GitLab