Enable branch tracing for hardware breakpoints

This commit is contained in:
momo5502 2022-11-05 10:26:34 +01:00
parent a9ef15c526
commit 3fce9f6fdd
2 changed files with 15 additions and 0 deletions

View File

@ -89,6 +89,17 @@ namespace utils::hardware_breakpoint
}
}
void set_branch_tracing(const bool enabled, CONTEXT& context)
{
set_bits(context.Dr7, 8, 1, enabled ? 1 : 0);
}
void set_branch_tracing(const bool enabled, const uint32_t thread_id)
{
debug_context context(thread_id);
set_branch_tracing(enabled, context);
}
uint32_t activate(const uint64_t address, uint32_t length, const condition cond, CONTEXT& context)
{
const auto index = find_free_index(context);

View File

@ -11,6 +11,10 @@ namespace utils::hardware_breakpoint
read_write = 3
};
void set_branch_tracing(bool enabled, CONTEXT& context);
void set_branch_tracing(bool enabled, uint32_t thread_id = GetCurrentThreadId());
uint32_t activate(uint64_t address, uint32_t length, condition cond, CONTEXT& context);
uint32_t activate(void* address, uint32_t length, condition cond, uint32_t thread_id = GetCurrentThreadId());
uint32_t activate(uint64_t address, uint32_t length, condition cond, uint32_t thread_id = GetCurrentThreadId());