Breakpoints triggering.

This commit is contained in:
Ben Vanik
2013-12-22 23:04:24 -08:00
parent 5881a58c49
commit 31b8c02cbf
15 changed files with 155 additions and 2 deletions

View File

@@ -9,6 +9,7 @@
#include <alloy/runtime/function.h>
#include <alloy/runtime/debugger.h>
#include <alloy/runtime/symbol_info.h>
#include <alloy/runtime/thread_state.h>
@@ -57,6 +58,20 @@ int Function::RemoveBreakpoint(Breakpoint* breakpoint) {
return found ? 0 : 1;
}
Breakpoint* Function::FindBreakpoint(uint64_t address) {
LockMutex(lock_);
Breakpoint* result = NULL;
for (auto it = breakpoints_.begin(); it != breakpoints_.end(); ++it) {
Breakpoint* breakpoint = *it;
if (breakpoint->address() == address) {
result = breakpoint;
break;
}
}
UnlockMutex(lock_);
return result;
}
int Function::Call(ThreadState* thread_state, uint64_t return_address) {
ThreadState* original_thread_state = ThreadState::Get();
if (original_thread_state != thread_state) {