Breakpoints triggering.
This commit is contained in:
@@ -131,3 +131,8 @@ void Debugger::OnFunctionDefined(FunctionInfo* symbol_info,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Debugger::OnBreakpointHit(
|
||||
ThreadState* thread_state, Breakpoint* breakpoint) {
|
||||
//
|
||||
}
|
||||
@@ -21,6 +21,7 @@ namespace runtime {
|
||||
class Function;
|
||||
class FunctionInfo;
|
||||
class Runtime;
|
||||
class ThreadState;
|
||||
|
||||
|
||||
class Breakpoint {
|
||||
@@ -55,6 +56,7 @@ public:
|
||||
uint64_t address, std::vector<Breakpoint*>& out_breakpoints);
|
||||
|
||||
void OnFunctionDefined(FunctionInfo* symbol_info, Function* function);
|
||||
void OnBreakpointHit(ThreadState* thread_state, Breakpoint* breakpoint);
|
||||
|
||||
private:
|
||||
Runtime* runtime_;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -45,6 +45,7 @@ public:
|
||||
int Call(ThreadState* thread_state, uint64_t return_address);
|
||||
|
||||
protected:
|
||||
Breakpoint* FindBreakpoint(uint64_t address);
|
||||
virtual int AddBreakpointImpl(Breakpoint* breakpoint) { return 0; }
|
||||
virtual int RemoveBreakpointImpl(Breakpoint* breakpoint) { return 0; }
|
||||
virtual int CallImpl(ThreadState* thread_state, uint64_t return_address) = 0;
|
||||
|
||||
Reference in New Issue
Block a user