File indexing completed on 2024-04-28 05:48:30
0001 /** 0002 * Description: Debugger backend selector 0003 * 0004 * SPDX-FileCopyrightText: 2022 Héctor Mesa Jiménez <wmj.py@gmx.com> 0005 * 0006 * SPDX-License-Identifier: LGPL-2.0-or-later 0007 */ 0008 #pragma once 0009 0010 #include <QObject> 0011 #include <memory> 0012 #include <optional> 0013 0014 #include "backendinterface.h" 0015 #include "configview.h" 0016 0017 class Backend : public BackendInterface 0018 { 0019 Q_OBJECT 0020 public: 0021 Backend(QObject *parent); 0022 ~Backend() override = default; 0023 0024 void runDebugger(const GDBTargetConf &conf, const QStringList &ioFifos); 0025 void runDebugger(const DAPTargetConf &conf); 0026 0027 bool debuggerRunning() const override; 0028 bool debuggerBusy() const override; 0029 bool hasBreakpoint(QUrl const &url, int line) const override; 0030 bool supportsMovePC() const override; 0031 bool supportsRunToCursor() const override; 0032 bool canSetBreakpoints() const override; 0033 bool canMove() const override; 0034 bool canContinue() const override; 0035 void toggleBreakpoint(QUrl const &url, int line) override; 0036 void movePC(QUrl const &url, int line) override; 0037 void runToCursor(QUrl const &url, int line) override; 0038 void issueCommand(QString const &cmd) override; 0039 QString targetName() const override; 0040 void setFileSearchPaths(const QStringList &paths) override; 0041 0042 public Q_SLOTS: 0043 void slotInterrupt() override; 0044 void slotStepInto() override; 0045 void slotStepOver() override; 0046 void slotStepOut() override; 0047 void slotContinue() override; 0048 void slotKill() override; 0049 void slotReRun() override; 0050 QString slotPrintVariable(const QString &variable) override; 0051 void slotQueryLocals(bool display) override; 0052 void changeStackFrame(int index) override; 0053 void changeThread(int thread) override; 0054 void changeScope(int scopeId) override; 0055 0056 private: 0057 enum DebugMode { NONE, GDB, DAP } m_mode = NONE; 0058 0059 void bind(); 0060 void unbind(); 0061 0062 BackendInterface *m_debugger; 0063 std::optional<bool> m_displayQueryLocals = std::nullopt; 0064 };