Continued ripping up the source.
[aesalon.git] / monitor / src / ptrace / Breakpoint.cpp
blob257f83f41be4cf608e81681e0202838d4349b1e2
1 #include "Breakpoint.h"
2 #include "BreakpointReference.h"
4 namespace Aesalon {
5 namespace Monitor {
6 namespace PTrace {
8 Breakpoint::Breakpoint(Word address, Byte original)
9 : address(address), original(original),
10 #if AESALON_PLATFORM == AESALON_PLATFORM_x86
11 BREAKPOINT_CHARACTER(0xcc),
12 #elif AESALON_PLATFORM == AESALON_PLATFORM_x86_64
13 BREAKPOINT_CHARACTER(0xcc),
14 #endif
15 valid(true)
17 static std::size_t last_id = 0;
18 id = ++last_id;
22 void Breakpoint::notify() {
23 if(observer_list.size() == 0) {
24 set_valid(false);
25 return;
27 int last_size = observer_list.size();
28 for(int x = 0; x < last_size && observer_list.size(); x ++) {
29 observer_list_t::iterator i = observer_list.begin();
30 for(int y = 0; y < x; y ++) i ++;
31 if((*i).is_valid()) (*i)->handle_breakpoint(BreakpointReference(this));
32 if((unsigned)last_size != observer_list.size()) x --;
36 } // namespace PTrace
37 } // namespace Monitor
38 } // namespace Aesalon