diff --git a/src/common/utils/hardware_breakpoint.cpp b/src/common/utils/hardware_breakpoint.cpp index 6a5e39f9..8d39d7fc 100644 --- a/src/common/utils/hardware_breakpoint.cpp +++ b/src/common/utils/hardware_breakpoint.cpp @@ -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); diff --git a/src/common/utils/hardware_breakpoint.hpp b/src/common/utils/hardware_breakpoint.hpp index e37fdea0..0e66f77a 100644 --- a/src/common/utils/hardware_breakpoint.hpp +++ b/src/common/utils/hardware_breakpoint.hpp @@ -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());