File indexing completed on 2024-04-28 04:38:57
0001 /* 0002 SPDX-FileCopyrightText: 2016 Aetf <aetf@unlimitedcodeworks.xyz> 0003 0004 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0005 */ 0006 0007 #ifndef LLDB_DEBUGSESSION_H 0008 #define LLDB_DEBUGSESSION_H 0009 0010 #include "midebugsession.h" 0011 0012 #include "controllers/breakpointcontroller.h" 0013 #include "controllers/framestackmodel.h" 0014 #include "controllers/variablecontroller.h" 0015 #include "lldbdebugger.h" 0016 0017 namespace KDevelop { 0018 class ILaunchConfiguration; 0019 } 0020 0021 namespace KDevMI { 0022 0023 namespace MI { 0024 struct ResultRecord; 0025 } 0026 0027 namespace LLDB { 0028 0029 class LldbDebuggerPlugin; 0030 class DebugSession : public MIDebugSession 0031 { 0032 Q_OBJECT 0033 public: 0034 explicit DebugSession(LldbDebuggerPlugin *plugin = nullptr); 0035 ~DebugSession() override; 0036 0037 BreakpointController * breakpointController() const override; 0038 VariableController * variableController() const override; 0039 LldbFrameStackModel * frameStackModel() const override; 0040 0041 std::unique_ptr<MI::MICommand> createCommand(MI::CommandType type, const QString& arguments, 0042 MI::CommandFlags flags) const override; 0043 std::unique_ptr<MI::MICommand> createUserCommand(const QString& cmd) const override; 0044 0045 void updateAllVariables(); 0046 0047 void setFormatterPath(const QString &path); 0048 0049 public Q_SLOTS: 0050 void interruptDebugger() override; 0051 0052 protected: 0053 LldbDebugger *createDebugger() const override; 0054 void initializeDebugger() override; 0055 0056 void configInferior(KDevelop::ILaunchConfiguration *cfg, IExecutePlugin *iexec, 0057 const QString &executable) override; 0058 0059 bool execInferior(KDevelop::ILaunchConfiguration *cfg, IExecutePlugin *iexec, 0060 const QString &executable) override; 0061 bool loadCoreFile(KDevelop::ILaunchConfiguration * cfg, 0062 const QString & debugee, const QString & corefile) override; 0063 0064 void ensureDebuggerListening() override; 0065 0066 void setupToolViews(); 0067 void unloadToolViews(); 0068 0069 private Q_SLOTS: 0070 void handleFileExecAndSymbols(const MI::ResultRecord &r); 0071 void handleTargetSelect(const MI::ResultRecord &r); 0072 void handleCoreFile(const QStringList &s); 0073 void handleVersion(const QStringList& s); 0074 0075 void handleSessionStateChange(IDebugSession::DebuggerState state); 0076 0077 private: 0078 BreakpointController *m_breakpointController = nullptr; 0079 VariableController *m_variableController = nullptr; 0080 LldbFrameStackModel *m_frameStackModel = nullptr; 0081 0082 QString m_formatterPath; 0083 bool m_hasCorrectCLIOutput = false; 0084 }; 0085 0086 } // end of namespace GDB 0087 } // end of namespace KDevMI 0088 0089 #endif // LLDB_DEBUGSESSION_H