2024-02-10 13:29:58 +00:00
|
|
|
// SPDX-FileCopyrightText: 2019-2024 Connor McLaughlin <stenzek@gmail.com>
|
2022-12-04 11:03:45 +00:00
|
|
|
// SPDX-License-Identifier: (GPL-3.0 OR CC-BY-NC-ND-4.0)
|
|
|
|
|
2020-12-16 15:18:13 +00:00
|
|
|
#pragma once
|
2024-02-10 13:29:58 +00:00
|
|
|
|
2020-12-16 15:18:13 +00:00
|
|
|
#include "ui_debuggerwindow.h"
|
2024-02-10 13:29:58 +00:00
|
|
|
|
|
|
|
#include "core/types.h"
|
|
|
|
|
2020-12-16 15:18:13 +00:00
|
|
|
#include <QtWidgets/QMainWindow>
|
|
|
|
#include <memory>
|
|
|
|
#include <optional>
|
|
|
|
|
|
|
|
namespace Bus {
|
|
|
|
enum class MemoryRegion;
|
|
|
|
}
|
|
|
|
|
|
|
|
class DebuggerCodeModel;
|
|
|
|
class DebuggerRegistersModel;
|
|
|
|
class DebuggerStackModel;
|
|
|
|
|
|
|
|
class DebuggerWindow : public QMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
explicit DebuggerWindow(QWidget* parent = nullptr);
|
|
|
|
~DebuggerWindow();
|
|
|
|
|
|
|
|
Q_SIGNALS:
|
|
|
|
void closed();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
void closeEvent(QCloseEvent* event);
|
|
|
|
|
|
|
|
private Q_SLOTS:
|
2024-02-10 13:29:58 +00:00
|
|
|
void onSystemStarted();
|
|
|
|
void onSystemDestroyed();
|
|
|
|
void onSystemPaused();
|
|
|
|
void onSystemResumed();
|
2020-12-16 15:18:13 +00:00
|
|
|
void onDebuggerMessageReported(const QString& message);
|
|
|
|
|
|
|
|
void refreshAll();
|
|
|
|
|
|
|
|
void scrollToPC();
|
|
|
|
|
|
|
|
void onPauseActionToggled(bool paused);
|
|
|
|
void onRunToCursorTriggered();
|
|
|
|
void onGoToPCTriggered();
|
|
|
|
void onGoToAddressTriggered();
|
|
|
|
void onDumpAddressTriggered();
|
|
|
|
void onFollowAddressTriggered();
|
2024-02-10 13:29:58 +00:00
|
|
|
void onTraceTriggered();
|
2020-12-16 15:18:13 +00:00
|
|
|
void onAddBreakpointTriggered();
|
|
|
|
void onToggleBreakpointTriggered();
|
|
|
|
void onClearBreakpointsTriggered();
|
|
|
|
void onStepIntoActionTriggered();
|
|
|
|
void onStepOverActionTriggered();
|
|
|
|
void onStepOutActionTriggered();
|
|
|
|
void onCodeViewItemActivated(QModelIndex index);
|
2023-01-15 05:13:45 +00:00
|
|
|
void onCodeViewContextMenuRequested(const QPoint& pt);
|
2020-12-16 15:18:13 +00:00
|
|
|
void onMemorySearchTriggered();
|
|
|
|
void onMemorySearchStringChanged(const QString&);
|
|
|
|
|
|
|
|
private:
|
|
|
|
void setupAdditionalUi();
|
|
|
|
void connectSignals();
|
|
|
|
void disconnectSignals();
|
|
|
|
void createModels();
|
2024-02-10 13:29:58 +00:00
|
|
|
void setUIEnabled(bool enabled, bool allow_pause);
|
2020-12-16 15:18:13 +00:00
|
|
|
void setMemoryViewRegion(Bus::MemoryRegion region);
|
|
|
|
void toggleBreakpoint(VirtualMemoryAddress address);
|
|
|
|
void clearBreakpoints();
|
|
|
|
std::optional<VirtualMemoryAddress> getSelectedCodeAddress();
|
|
|
|
bool tryFollowLoadStore(VirtualMemoryAddress address);
|
|
|
|
void scrollToCodeAddress(VirtualMemoryAddress address);
|
|
|
|
bool scrollToMemoryAddress(VirtualMemoryAddress address);
|
|
|
|
void refreshBreakpointList();
|
|
|
|
|
|
|
|
Ui::DebuggerWindow m_ui;
|
|
|
|
|
|
|
|
std::unique_ptr<DebuggerCodeModel> m_code_model;
|
|
|
|
std::unique_ptr<DebuggerRegistersModel> m_registers_model;
|
|
|
|
std::unique_ptr<DebuggerStackModel> m_stack_model;
|
|
|
|
|
|
|
|
Bus::MemoryRegion m_active_memory_region;
|
|
|
|
|
|
|
|
PhysicalMemoryAddress m_next_memory_search_address = 0;
|
|
|
|
};
|