Ticket #46975: patch-support-for-lldb.diff
File patch-support-for-lldb.diff, 8.8 KB (added by RJVB (René Bertin), 10 years ago) |
---|
-
drkonqi/backtracegenerator.cpp
diff --git drkonqi/backtracegenerator.cpp drkonqi/backtracegenerator.cpp index 1107e11..8347ca6 100644
bool BacktraceGenerator::start() 94 94 *m_proc << KShell::splitArgs(str); 95 95 m_proc->setOutputChannelMode(KProcess::OnlyStdoutChannel); 96 96 m_proc->setNextOpenMode(QIODevice::ReadWrite | QIODevice::Text); 97 QString stdinFile = m_debugger.backendValueOfParameter(QLatin1String("ExecInputFile")); 98 Debugger::expandString(stdinFile, Debugger::ExpansionUsageShell, m_temp->fileName()); 99 if (!stdinFile.isEmpty()) { 100 m_proc->setStandardInputFile(stdinFile); 101 } 97 102 connect(m_proc, SIGNAL(readyReadStandardOutput()), 98 103 SLOT(slotReadInput())); 99 104 connect(m_proc, SIGNAL(finished(int,QProcess::ExitStatus)), -
new file drkonqi/data/debuggers/external/lldbrc
diff --git drkonqi/data/debuggers/external/lldbrc drkonqi/data/debuggers/external/lldbrc new file mode 100644 index 0000000..c8ef63b
- + 1 [General] 2 Name=lldb 3 TryExec=lldb 4 Backends=KCrash 5 6 [KCrash] 7 Exec=konsole --nofork -e lldb -p %pid 8 Terminal=true -
new file drkonqi/data/debuggers/internal/lldbrc
diff --git drkonqi/data/debuggers/internal/lldbrc drkonqi/data/debuggers/internal/lldbrc new file mode 100644 index 0000000..1b44430
- + 1 [General] 2 Name=lldb 3 TryExec=lldb 4 Backends=KCrash 5 6 [KCrash] 7 Exec=lldb -p %pid 8 ExecInputFile=%tempfile 9 BatchCommands=set set term-width 200\nthread info\nbt all\ndetach\nquit -
drkonqi/debugger.cpp
diff --git drkonqi/debugger.cpp drkonqi/debugger.cpp index 26ca338..ce32a82 100644
bool Debugger::runInTerminal() const 106 106 } 107 107 } 108 108 109 QString Debugger::backendValueOfParameter(const QString &key) const 110 { 111 if (!isValid() || !m_config->hasGroup(m_backend)) { 112 return QString(); 113 } else { 114 return m_config->group(m_backend).readEntry(key, QString()); 115 } 116 } 117 109 118 //static 110 119 void Debugger::expandString(QString & str, ExpandStringUsage usage, const QString & tempFile) 111 120 { -
drkonqi/debugger.h
diff --git drkonqi/debugger.h drkonqi/debugger.h index 1451397..4de773a 100644
public: 70 70 /** If this is an external debugger, it returns whether it should be run in a terminal or not */ 71 71 bool runInTerminal() const; 72 72 73 /** Returns the value of the arbitrary configuration parameter @param key, or an empty QString if @param key isn't defined */ 74 QString backendValueOfParameter(const QString &key) const; 73 75 74 76 enum ExpandStringUsage { 75 77 ExpansionUsagePlainText, -
drkonqi/drkonqibackends.cpp
diff --git drkonqi/drkonqibackends.cpp drkonqi/drkonqibackends.cpp index 064d07d..90de626 100644
38 38 #include "debuggermanager.h" 39 39 #include "backtracegenerator.h" 40 40 41 #ifdef Q_OS_MAC 42 #include <AvailabilityMacros.h> 43 #endif 44 41 45 AbstractDrKonqiBackend::~AbstractDrKonqiBackend() 42 46 { 43 47 } … … DebuggerManager *KCrashBackend::constructDebuggerManager() 168 172 { 169 173 QList<Debugger> internalDebuggers = Debugger::availableInternalDebuggers("KCrash"); 170 174 KConfigGroup config(KGlobal::config(), "DrKonqi"); 171 #ifndef Q_OS_WIN 175 #if defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED > 1070 176 QString defaultDebuggerName = config.readEntry("Debugger", QString("lldb")); 177 #elif !defined(Q_OS_WIN) 172 178 QString defaultDebuggerName = config.readEntry("Debugger", QString("gdb")); 173 179 #else 174 180 QString defaultDebuggerName = config.readEntry("Debugger", QString("kdbgwin")); -
drkonqi/parser/CMakeLists.txt
diff --git drkonqi/parser/CMakeLists.txt drkonqi/parser/CMakeLists.txt index d08d0d7..e6e3a8c 100644
set(BACKTRACEPARSER_SRCS 3 3 backtraceparsergdb.cpp 4 4 backtraceparserkdbgwin.cpp 5 5 backtraceparsernull.cpp 6 backtraceparserlldb.cpp 6 7 ) 7 8 8 9 kde4_add_library(drkonqi_backtrace_parser STATIC ${BACKTRACEPARSER_SRCS}) -
drkonqi/parser/backtraceparser.cpp
diff --git drkonqi/parser/backtraceparser.cpp drkonqi/parser/backtraceparser.cpp index 7f62c97..10d863b 100644
18 18 #include "backtraceparser_p.h" 19 19 #include "backtraceparsergdb.h" 20 20 #include "backtraceparserkdbgwin.h" 21 #include "backtraceparserlldb.h" 21 22 #include "backtraceparsernull.h" 22 23 #include <QtCore/QRegExp> 23 24 #include <QtCore/QMetaEnum> … … BacktraceParser *BacktraceParser::newParser(const QString & debuggerName, QObjec 30 31 return new BacktraceParserGdb(parent); 31 32 } else if (debuggerName == "kdbgwin") { 32 33 return new BacktraceParserKdbgwin(parent); 34 } else if (debuggerName == "lldb") { 35 return new BacktraceParserLldb(parent); 33 36 } else { 34 37 return new BacktraceParserNull(parent); 35 38 } … … static bool lineShouldBeIgnored(const BacktraceLine & line) 198 201 || line.functionName().startsWith(QLatin1String("*__GI_")) //glibc2.9 uses *__GI_ as prefix 199 202 || line.libraryName().contains("libpthread.so") 200 203 || line.libraryName().contains("libglib-2.0.so") 204 #ifdef Q_OS_MAC 205 || (line.libraryName().startsWith(QLatin1String("libsystem_")) && line.libraryName().endsWith(QLatin1String(".dylib"))) 206 || line.libraryName().contains(QLatin1String("Foundation`")) 207 #endif 201 208 || line.libraryName().contains("ntdll.dll") 202 209 || line.libraryName().contains("kernel32.dll") 203 210 || line.functionName().contains("_tmain") -
new file drkonqi/parser/backtraceparserlldb.cpp
diff --git drkonqi/parser/backtraceparserlldb.cpp drkonqi/parser/backtraceparserlldb.cpp new file mode 100644 index 0000000..914c12f
- + 1 /* 2 Copyright (C) 2014 René J.V. Bertin <rjvbertin@gmail.com> 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License along 15 with this program; if not, write to the Free Software Foundation, Inc., 16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 */ 18 #include "backtraceparserlldb.h" 19 #include "backtraceparser_p.h" 20 21 //BEGIN BacktraceParserLldb 22 23 class BacktraceLineLldb : public BacktraceLine 24 { 25 public: 26 BacktraceLineLldb(const QString & line); 27 }; 28 29 BacktraceLineLldb::BacktraceLineLldb(const QString & line) 30 : BacktraceLine() 31 { 32 d->m_line = line; 33 // For now we'll have faith that lldb provides useful information, and that it would 34 // be unwarranted to give it a rating of "MissingEverything". 35 d->m_rating = Good; 36 } 37 38 //END BacktraceLineLldb 39 40 //BEGIN BacktraceParserLldb 41 42 BacktraceParserLldb::BacktraceParserLldb(QObject *parent) : BacktraceParser(parent) {} 43 44 BacktraceParserPrivate *BacktraceParserLldb::constructPrivate() const 45 { 46 BacktraceParserPrivate *d = BacktraceParser::constructPrivate(); 47 d->m_usefulness = MayBeUseful; 48 return d; 49 } 50 51 void BacktraceParserLldb::newLine(const QString & lineStr) 52 { 53 d_ptr->m_linesList.append(BacktraceLineLldb(lineStr)); 54 } 55 56 57 //END BacktraceParserLldb 58 59 #include "backtraceparserlldb.moc" -
new file drkonqi/parser/backtraceparserlldb.h
diff --git drkonqi/parser/backtraceparserlldb.h drkonqi/parser/backtraceparserlldb.h new file mode 100644 index 0000000..8ac7dd7
- + 1 /* 2 Copyright (C) 2014 René J.V. Bertin <rjvbertin@gmail.com> 3 4 This program is free software; you can redistribute it and/or modify 5 it under the terms of the GNU General Public License as published by 6 the Free Software Foundation; either version 2 of the License, or 7 (at your option) any later version. 8 9 This program is distributed in the hope that it will be useful, 10 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License along 15 with this program; if not, write to the Free Software Foundation, Inc., 16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 17 */ 18 #ifndef BACKTRACEPARSERLLDB_H 19 #define BACKTRACEPARSERLLDB_H 20 21 #include "backtraceparser.h" 22 23 class BacktraceParserLldb : public BacktraceParser 24 { 25 Q_OBJECT 26 public: 27 explicit BacktraceParserLldb(QObject *parent = 0); 28 29 protected Q_SLOTS: 30 virtual void newLine(const QString & lineStr); 31 32 protected: 33 virtual BacktraceParserPrivate *constructPrivate() const; 34 }; 35 36 #endif // BACKTRACEPARSERLLDB_H