openMSX
ProbeBreakPoint.cc
Go to the documentation of this file.
1 #include "ProbeBreakPoint.hh"
2 #include "Probe.hh"
3 #include "Debugger.hh"
4 #include "MSXMotherBoard.hh"
5 #include "Reactor.hh"
6 #include "TclObject.hh"
7 
8 namespace openmsx {
9 
11  TclObject command_,
12  TclObject condition_,
13  Debugger& debugger_,
14  ProbeBase& probe_,
15  bool once_,
16  unsigned newId /*= -1*/)
17  : BreakPointBase(command_, condition_, once_)
18  , debugger(debugger_)
19  , probe(probe_)
20  , id((newId == unsigned(-1)) ? ++lastId : newId)
21 {
22  probe.attach(*this);
23 }
24 
26 {
27  probe.detach(*this);
28 }
29 
30 void ProbeBreakPoint::update(const ProbeBase& /*subject*/)
31 {
32  auto& reactor = debugger.getMotherBoard().getReactor();
33  auto& cliComm = reactor.getGlobalCliComm();
34  auto& interp = reactor.getInterpreter();
35  checkAndExecute(cliComm, interp);
36  if (onlyOnce()) {
37  debugger.removeProbeBreakPoint(*this);
38  }
39 }
40 
41 void ProbeBreakPoint::subjectDeleted(const ProbeBase& /*subject*/)
42 {
43  debugger.removeProbeBreakPoint(*this);
44 }
45 
46 } // namespace openmsx
openmsx::MSXMotherBoard::getReactor
Reactor & getReactor()
Definition: MSXMotherBoard.hh:135
openmsx::Subject::detach
void detach(Observer< T > &observer)
Definition: Subject.hh:56
TclObject.hh
ProbeBreakPoint.hh
openmsx::Debugger
Definition: Debugger.hh:22
openmsx::BreakPointBase::onlyOnce
bool onlyOnce() const
Definition: BreakPointBase.hh:21
Probe.hh
openmsx::Subject::attach
void attach(Observer< T > &observer)
Definition: Subject.hh:50
Reactor.hh
openmsx::ProbeBreakPoint::~ProbeBreakPoint
~ProbeBreakPoint()
Definition: ProbeBreakPoint.cc:25
openmsx::Debugger::getMotherBoard
MSXMotherBoard & getMotherBoard()
Definition: Debugger.hh:44
openmsx::ProbeBreakPoint::ProbeBreakPoint
ProbeBreakPoint(TclObject command, TclObject condition, Debugger &debugger, ProbeBase &probe, bool once, unsigned newId=-1)
Definition: ProbeBreakPoint.cc:10
openmsx::Reactor::getGlobalCliComm
GlobalCliComm & getGlobalCliComm()
Definition: Reactor.hh:82
openmsx::ProbeBase
Definition: Probe.hh:12
openmsx::BreakPointBase
Base class for CPU break and watch points.
Definition: BreakPointBase.hh:14
openmsx::Debugger::removeProbeBreakPoint
void removeProbeBreakPoint(ProbeBreakPoint &bp)
Definition: Debugger.cc:143
openmsx::TclObject
Definition: TclObject.hh:21
openmsx::BreakPointBase::checkAndExecute
void checkAndExecute(GlobalCliComm &cliComm, Interpreter &interp)
Definition: BreakPointBase.cc:22
openmsx
Thanks to enen for testing this on a real cartridge:
Definition: Autofire.cc:5
MSXMotherBoard.hh
Debugger.hh