File indexing completed on 2024-05-05 04:39:53

0001 /*
0002     SPDX-FileCopyrightText: 1999-2001 John Birch <jbb@kdevelop.org>
0003     SPDX-FileCopyrightText: 2001 Bernd Gehrmann <bernd@kdevelop.org>
0004     SPDX-FileCopyrightText: 2007 Hamish Rodda <rodda@kde.org>
0005     SPDX-FileCopyrightText: 2009 Niko Sams <niko.sams@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #ifndef GDB_DEBUGSESSION_H
0011 #define GDB_DEBUGSESSION_H
0012 
0013 #include "midebugsession.h"
0014 
0015 #include "dbgglobal.h"
0016 #include "gdb.h"
0017 #include "gdbbreakpointcontroller.h"
0018 #include "gdbframestackmodel.h"
0019 #include "variablecontroller.h"
0020 #include "mi/mi.h"
0021 
0022 #include <KConfigGroup>
0023 
0024 class IExecutePlugin;
0025 
0026 namespace KDevelop {
0027 class ILaunchConfiguration;
0028 }
0029 
0030 namespace KDevMI {
0031 
0032 class STTY;
0033 
0034 namespace GDB {
0035 
0036 class CppDebuggerPlugin;
0037 class DebugSession : public MIDebugSession
0038 {
0039     Q_OBJECT
0040 public:
0041     explicit DebugSession(CppDebuggerPlugin *plugin = nullptr);
0042     ~DebugSession() override;
0043 
0044     BreakpointController * breakpointController() const override;
0045     VariableController * variableController() const override;
0046     GdbFrameStackModel * frameStackModel() const override;
0047 
0048     /// FIXME: only used in unit test currently, potentially could
0049     /// be made a user configurable option.
0050     /// Whether turn off auto-disable ASLR when starting inferiors
0051     void setAutoDisableASLR(bool enable);
0052 
0053 protected:
0054     GdbDebugger *createDebugger() const override;
0055     void initializeDebugger() override;
0056 
0057     void configInferior(KDevelop::ILaunchConfiguration* cfg, IExecutePlugin* iexec, const QString&) override;
0058 
0059     bool execInferior(KDevelop::ILaunchConfiguration* cfg, IExecutePlugin*,
0060                       const QString& executable) override;
0061 
0062     bool loadCoreFile(KDevelop::ILaunchConfiguration *cfg,
0063                       const QString &debugee, const QString &corefile) override;
0064 
0065 private Q_SLOTS:
0066     void handleVersion(const QStringList& s);
0067     void handleFileExecAndSymbols(const MI::ResultRecord& r);
0068     void handleCoreFile(const MI::ResultRecord& r);
0069 
0070 private:
0071     friend class GdbTest;
0072 
0073     BreakpointController *m_breakpointController = nullptr;
0074     VariableController *m_variableController = nullptr;
0075     GdbFrameStackModel *m_frameStackModel = nullptr;
0076 
0077     bool m_autoDisableASLR = false;
0078 };
0079 
0080 } // end of namespace GDB
0081 } // end of namespace KDevMI
0082 
0083 #endif