OXYGENHUB
◆ main openmsx / src / debugger / ProbeBreakPoint.cc
1.2 KiB · C++ · last changed chore(): initial commit 1 month ago source blame history raw
1
#include "ProbeBreakPoint.hh"
2
3
#include "Debugger.hh"
4
#include "Probe.hh"
5
6
#include "MSXMotherBoard.hh"
7
#include "Reactor.hh"
8
#include "StateChangeDistributor.hh"
9
#include "TclObject.hh"
10
11
namespace openmsx {
12
13
ProbeBreakPoint::ProbeBreakPoint(
14
		TclObject command_,
15
		TclObject condition_,
16
		Debugger& debugger_,
17
		ProbeBase& probe_,
18
		bool once_,
19
		unsigned newId /*= -1*/)
20
	: debugger(debugger_)
21
	, probe(probe_)
22
{
23
	if (newId != unsigned(-1)) id = newId;
24
	setCommand(std::move(command_));
25
	setCondition(std::move(condition_));
26
	setOnce(once_);
27
28
	probe.attach(*this);
29
}
30
31
ProbeBreakPoint::~ProbeBreakPoint()
32
{
33
	probe.detach(*this);
34
}
35
36
void ProbeBreakPoint::update(const ProbeBase& /*subject*/) noexcept
37
{
38
	auto& motherBoard = debugger.getMotherBoard();
39
	auto scopedBlock = motherBoard.getStateChangeDistributor().tempBlockNewEventsDuringReplay();
40
	auto& reactor = motherBoard.getReactor();
41
	auto& cliComm = reactor.getGlobalCliComm();
42
	auto& interp  = reactor.getInterpreter();
43
	bool remove = checkAndExecute(cliComm, interp);
44
	if (remove) {
45
		debugger.removeProbeBreakPoint(*this);
46
	}
47
}
48
49
void ProbeBreakPoint::subjectDeleted(const ProbeBase& /*subject*/)
50
{
51
	debugger.removeProbeBreakPoint(*this);
52
}
53
54
} // namespace openmsx