File indexing completed on 2022-11-23 12:12:11

0001 /*
0002     SPDX-FileCopyrightText: 2021 Harald Sitter <sitter@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "drkonqibackends.h"
0010 
0011 #include <QHash>
0012 #include <QTemporaryDir>
0013 
0014 #include <memory>
0015 
0016 class QProcess;
0017 
0018 class CoredumpBackend : public AbstractDrKonqiBackend
0019 {
0020     Q_OBJECT
0021 public:
0022     using AbstractDrKonqiBackend::AbstractDrKonqiBackend;
0023     bool init() override;
0024     void prepareForDebugger() override;
0025 
0026 protected:
0027     CrashedApplication *constructCrashedApplication() override;
0028     DebuggerManager *constructDebuggerManager() override;
0029 
0030 private:
0031     std::unique_ptr<QTemporaryDir> m_coreDir;
0032     std::unique_ptr<CrashedApplication> m_crashedApplication;
0033     DebuggerManager *m_debuggerManager; // parented
0034     QHash<QByteArray, QByteArray> m_journalEntry;
0035     const QByteArray m_cursor;
0036     std::unique_ptr<QProcess> m_preparationProc;
0037 
0038 #ifdef COREDUMPD_SUPPORTS_DEBUGGER_ARGUMENTS
0039     const QString m_backendType = QStringLiteral("coredumpd-248+");
0040 #else
0041     const QString m_backendType = QStringLiteral("coredumpd");
0042 #endif
0043 };