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() 
    9494    *m_proc << KShell::splitArgs(str);
    9595    m_proc->setOutputChannelMode(KProcess::OnlyStdoutChannel);
    9696    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    }
    97102    connect(m_proc, SIGNAL(readyReadStandardOutput()),
    98103            SLOT(slotReadInput()));
    99104    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]
     2Name=lldb
     3TryExec=lldb
     4Backends=KCrash
     5
     6[KCrash]
     7Exec=konsole --nofork -e lldb -p %pid
     8Terminal=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]
     2Name=lldb
     3TryExec=lldb
     4Backends=KCrash
     5
     6[KCrash]
     7Exec=lldb -p %pid
     8ExecInputFile=%tempfile
     9BatchCommands=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 
    106106    }
    107107}
    108108
     109QString 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
    109118//static
    110119void Debugger::expandString(QString & str, ExpandStringUsage usage, const QString & tempFile)
    111120{
  • drkonqi/debugger.h

    diff --git drkonqi/debugger.h drkonqi/debugger.h
    index 1451397..4de773a 100644
    public: 
    7070    /** If this is an external debugger, it returns whether it should be run in a terminal or not */
    7171    bool runInTerminal() const;
    7272
     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;
    7375
    7476    enum ExpandStringUsage {
    7577        ExpansionUsagePlainText,
  • drkonqi/drkonqibackends.cpp

    diff --git drkonqi/drkonqibackends.cpp drkonqi/drkonqibackends.cpp
    index 064d07d..90de626 100644
     
    3838#include "debuggermanager.h"
    3939#include "backtracegenerator.h"
    4040
     41#ifdef Q_OS_MAC
     42#include <AvailabilityMacros.h>
     43#endif
     44
    4145AbstractDrKonqiBackend::~AbstractDrKonqiBackend()
    4246{
    4347}
    DebuggerManager *KCrashBackend::constructDebuggerManager() 
    168172{
    169173    QList<Debugger> internalDebuggers = Debugger::availableInternalDebuggers("KCrash");
    170174    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)
    172178    QString defaultDebuggerName = config.readEntry("Debugger", QString("gdb"));
    173179#else
    174180    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 
    33    backtraceparsergdb.cpp
    44    backtraceparserkdbgwin.cpp
    55    backtraceparsernull.cpp
     6    backtraceparserlldb.cpp
    67)
    78
    89kde4_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
     
    1818#include "backtraceparser_p.h"
    1919#include "backtraceparsergdb.h"
    2020#include "backtraceparserkdbgwin.h"
     21#include "backtraceparserlldb.h"
    2122#include "backtraceparsernull.h"
    2223#include <QtCore/QRegExp>
    2324#include <QtCore/QMetaEnum>
    BacktraceParser *BacktraceParser::newParser(const QString & debuggerName, QObjec 
    3031        return new BacktraceParserGdb(parent);
    3132    } else if (debuggerName == "kdbgwin") {
    3233        return new BacktraceParserKdbgwin(parent);
     34    } else if (debuggerName == "lldb") {
     35        return new BacktraceParserLldb(parent);
    3336    } else {
    3437        return new BacktraceParserNull(parent);
    3538    }
    static bool lineShouldBeIgnored(const BacktraceLine & line) 
    198201        || line.functionName().startsWith(QLatin1String("*__GI_")) //glibc2.9 uses *__GI_ as prefix
    199202        || line.libraryName().contains("libpthread.so")
    200203        || 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
    201208        || line.libraryName().contains("ntdll.dll")
    202209        || line.libraryName().contains("kernel32.dll")
    203210        || 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
     23class BacktraceLineLldb : public BacktraceLine
     24{
     25public:
     26    BacktraceLineLldb(const QString & line);
     27};
     28
     29BacktraceLineLldb::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
     42BacktraceParserLldb::BacktraceParserLldb(QObject *parent) : BacktraceParser(parent) {}
     43
     44BacktraceParserPrivate *BacktraceParserLldb::constructPrivate() const
     45{
     46    BacktraceParserPrivate *d = BacktraceParser::constructPrivate();
     47    d->m_usefulness = MayBeUseful;
     48    return d;
     49}
     50
     51void 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
     23class BacktraceParserLldb : public BacktraceParser
     24{
     25    Q_OBJECT
     26public:
     27    explicit BacktraceParserLldb(QObject *parent = 0);
     28
     29protected Q_SLOTS:
     30    virtual void newLine(const QString & lineStr);
     31
     32protected:
     33    virtual BacktraceParserPrivate *constructPrivate() const;
     34};
     35
     36#endif // BACKTRACEPARSERLLDB_H