Lena is a small SDK that allows you to quickly write effective tracers for windows. Written in C++ it allows for an easy integration in existing SDK. Currently, we only support one tracer per thread.
See tests/test_lena.cpp
for a quick example.
- Support more tracer (up to 4 per thread?)
- Build a C API
void lena::Init(LenaDebugger* debugger)
Initialize the library. LenaInit
must be called first in order to use tracing functionalities.
LenaDebugger
that will be used to set and unset hardware breakpoints.
Lena
uses debug registers internally to initialize its tracers. To avoid incompatibilities with external SDKs, the user must provide its own debugger managing the different hardware breakpoints himself.
struct lena::Debugger
{
// Callback handling the initialization of the hardware breakpoint.
void (*SetHardwareBreakpoint)(CONTEXT* ctx, uintptr_t address, uint32_t thread_id);
// Callback only called when the hardware breakpoint is hit.
void (*UnsetHardwareBreakpoint)(CONTEXT* context, uint32_t thread_id);
};
User defined callbacks to set and unset hardware breakpoints. Hardware breakpoints are used internally to know when to start tracing.