Skip to content

Commit

Permalink
Replaced GuardsWrapper by GuardList
Browse files Browse the repository at this point in the history
  • Loading branch information
dirkwhoffmann committed Aug 7, 2024
1 parent 39fe450 commit 991b2d1
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 245 deletions.
12 changes: 11 additions & 1 deletion Emulator/Components/Agnus/Copper/CopperDebugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,22 @@

namespace vamiga {

CopperBreakpoints::CopperBreakpoints(Copper& ref) : GuardList(ref.emulator), copper(ref)
{

}

void
CopperBreakpoints::setNeedsCheck(bool value)
{
copper.checkForBreakpoints = value;
}

CopperWatchpoints::CopperWatchpoints(Copper& ref) : GuardList(ref.emulator), copper(ref)
{

}

void
CopperWatchpoints::setNeedsCheck(bool value)
{
Expand All @@ -40,7 +50,7 @@ CopperDebugger::_dump(Category category, std::ostream& os) const
{
using namespace util;

auto print = [&](const string &name, const GuardsWrapper &guards) {
auto print = [&](const string &name, const MoiraGuardList &guards) {

for (int i = 0; i < guards.elements(); i++) {

Expand Down
17 changes: 6 additions & 11 deletions Emulator/Components/Agnus/Copper/CopperDebugger.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ struct CopperList {
u32 end;
};

class CopperBreakpoints : public moira::Guards {
class CopperBreakpoints : public GuardList {

class Copper &copper;

public:

CopperBreakpoints(Copper& ref) : copper(ref) { }
CopperBreakpoints(Copper& ref);
void setNeedsCheck(bool value) override;
};

class CopperWatchpoints : public moira::Guards {
class CopperWatchpoints : public GuardList {

class Copper &copper;

public:

CopperWatchpoints(Copper& ref) : copper(ref) { }
CopperWatchpoints(Copper& ref);
void setNeedsCheck(bool value) override;
};

Expand Down Expand Up @@ -71,13 +71,8 @@ class CopperDebugger: public SubComponent {
public:

// Breakpoint and watchpoints
CopperBreakpoints cbreakpoints = CopperBreakpoints(copper);
CopperWatchpoints cwatchpoints = CopperWatchpoints(copper);

public:

GuardsWrapper breakpoints = GuardsWrapper(emulator, cbreakpoints);
GuardsWrapper watchpoints = GuardsWrapper(emulator, cwatchpoints);
CopperBreakpoints breakpoints = CopperBreakpoints(copper);
CopperWatchpoints watchpoints = CopperWatchpoints(copper);


//
Expand Down
4 changes: 2 additions & 2 deletions Emulator/Components/Amiga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ Amiga::computeFrame()
// Did we reach a Copper breakpoint?
if (flags & RL::COPPERBP_REACHED) {
clearFlag(RL::COPPERBP_REACHED);
auto addr = u8(agnus.copper.debugger.cbreakpoints.hit->addr);
auto addr = u8(agnus.copper.debugger.breakpoints.hit()->addr);
msgQueue.put(MSG_COPPERBP_REACHED, CpuMsg { addr, 0 });
throw StateChangeException(STATE_PAUSED);
break;
Expand All @@ -679,7 +679,7 @@ Amiga::computeFrame()
// Did we reach a Copper watchpoint?
if (flags & RL::COPPERWP_REACHED) {
clearFlag(RL::COPPERWP_REACHED);
auto addr = u8(agnus.copper.debugger.cwatchpoints.hit->addr);
auto addr = u8(agnus.copper.debugger.watchpoints.hit()->addr);
msgQueue.put(MSG_COPPERWP_REACHED, CpuMsg { addr, 0 });
throw StateChangeException(STATE_PAUSED);
break;
Expand Down
1 change: 0 additions & 1 deletion Emulator/Components/CPU/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ target_include_directories(vAmigaCore PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_sources(vAmigaCore PRIVATE

CPU.cpp
CPUDebugger.cpp

)

Expand Down
4 changes: 2 additions & 2 deletions Emulator/Components/CPU/CPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ CPU::cacheInfo(CPUInfo &info) const
void
CPU::_dump(Category category, std::ostream& os) const
{
auto print = [&](const string &name, const GuardsWrapper &guards) {
auto print = [&](const string &name, const MoiraGuardList &guards) {

for (int i = 0; i < guards.elements(); i++) {

Expand Down Expand Up @@ -807,7 +807,7 @@ CPU::processCommand(const Cmd &cmd)
{
isize nr = isize(cmd.value);
u32 addr = u32(cmd.value);
auto guards = (GuardsWrapper *)cmd.sender;
auto guards = (MoiraGuardList *)cmd.sender;

switch (cmd.type) {

Expand Down
7 changes: 3 additions & 4 deletions Emulator/Components/CPU/CPU.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
#pragma once

#include "CPUTypes.h"
#include "CPUDebugger.h"
#include "SubComponent.h"
#include "CmdQueue.h"
#include "GuardList.h"
Expand Down Expand Up @@ -45,9 +44,9 @@ class CPU : public moira::Moira, public Inspectable<CPUInfo>
public:

// Breakpoints, Watchpoints, Catchpoints
GuardsWrapper breakpoints = GuardsWrapper(emulator, debugger.breakpoints);
GuardsWrapper watchpoints = GuardsWrapper(emulator, debugger.watchpoints);
GuardsWrapper catchpoints = GuardsWrapper(emulator, debugger.catchpoints);
MoiraGuardList breakpoints = MoiraGuardList(emulator, debugger.breakpoints);
MoiraGuardList watchpoints = MoiraGuardList(emulator, debugger.watchpoints);
MoiraGuardList catchpoints = MoiraGuardList(emulator, debugger.catchpoints);

// Sub-cycle counter (overclocking)
i64 debt;
Expand Down
136 changes: 0 additions & 136 deletions Emulator/Components/CPU/CPUDebugger.cpp

This file was deleted.

78 changes: 0 additions & 78 deletions Emulator/Components/CPU/CPUDebugger.h

This file was deleted.

2 changes: 1 addition & 1 deletion Emulator/VAmiga.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "config.h"
#include "VAmiga.h"
#include "Emulator.h"
// #include "GuardList.h"
#include "GuardList.h"

namespace vamiga {

Expand Down
2 changes: 1 addition & 1 deletion Emulator/VAmiga.h
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ class GuardsAPI : public API {

friend class VAmiga;

class GuardsWrapper *guards = nullptr;
class MoiraGuardList *guards = nullptr;

public:

Expand Down
Loading

0 comments on commit 991b2d1

Please sign in to comment.