duckstation

duckstation, but archived from the revision just before upstream changed it to a proprietary software project, this version is the libre one
git clone https://git.neptards.moe/u3shit/duckstation.git
Log | Files | Refs | README | LICENSE

debuggerwindow.h (2626B)


      1 // SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
      2 // SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
      3 
      4 #pragma once
      5 
      6 #include "ui_debuggerwindow.h"
      7 
      8 #include "core/cpu_core.h"
      9 #include "core/types.h"
     10 
     11 #include <QtWidgets/QMainWindow>
     12 #include <memory>
     13 #include <optional>
     14 
     15 namespace Bus {
     16 enum class MemoryRegion;
     17 }
     18 
     19 class DebuggerCodeModel;
     20 class DebuggerRegistersModel;
     21 class DebuggerStackModel;
     22 
     23 class DebuggerWindow : public QMainWindow
     24 {
     25   Q_OBJECT
     26 
     27 public:
     28   explicit DebuggerWindow(QWidget* parent = nullptr);
     29   ~DebuggerWindow();
     30 
     31 Q_SIGNALS:
     32   void closed();
     33 
     34 protected:
     35   void closeEvent(QCloseEvent* event);
     36 
     37 private Q_SLOTS:
     38   void onSystemStarted();
     39   void onSystemDestroyed();
     40   void onSystemPaused();
     41   void onSystemResumed();
     42   void onDebuggerMessageReported(const QString& message);
     43 
     44   void refreshAll();
     45 
     46   void scrollToPC();
     47 
     48   void onPauseActionToggled(bool paused);
     49   void onRunToCursorTriggered();
     50   void onGoToPCTriggered();
     51   void onGoToAddressTriggered();
     52   void onDumpAddressTriggered();
     53   void onFollowAddressTriggered();
     54   void onTraceTriggered();
     55   void onAddBreakpointTriggered();
     56   void onToggleBreakpointTriggered();
     57   void onClearBreakpointsTriggered();
     58   void onBreakpointListContextMenuRequested();
     59   void onStepIntoActionTriggered();
     60   void onStepOverActionTriggered();
     61   void onStepOutActionTriggered();
     62   void onCodeViewItemActivated(QModelIndex index);
     63   void onCodeViewContextMenuRequested(const QPoint& pt);
     64   void onMemorySearchTriggered();
     65   void onMemorySearchStringChanged(const QString&);
     66 
     67 private:
     68   void setupAdditionalUi();
     69   void connectSignals();
     70   void disconnectSignals();
     71   void createModels();
     72   void setUIEnabled(bool enabled, bool allow_pause);
     73   void setMemoryViewRegion(Bus::MemoryRegion region);
     74   void toggleBreakpoint(VirtualMemoryAddress address);
     75   void clearBreakpoints();
     76   std::optional<VirtualMemoryAddress> getSelectedCodeAddress();
     77   bool tryFollowLoadStore(VirtualMemoryAddress address);
     78   void scrollToCodeAddress(VirtualMemoryAddress address);
     79   bool scrollToMemoryAddress(VirtualMemoryAddress address);
     80   void refreshBreakpointList();
     81   void refreshBreakpointList(const CPU::BreakpointList& bps);
     82   void addBreakpoint(CPU::BreakpointType type, u32 address);
     83   void removeBreakpoint(CPU::BreakpointType type, u32 address);
     84 
     85   Ui::DebuggerWindow m_ui;
     86 
     87   std::unique_ptr<DebuggerCodeModel> m_code_model;
     88   std::unique_ptr<DebuggerRegistersModel> m_registers_model;
     89   std::unique_ptr<DebuggerStackModel> m_stack_model;
     90 
     91   Bus::MemoryRegion m_active_memory_region;
     92 
     93   PhysicalMemoryAddress m_next_memory_search_address = 0;
     94 };