KittyMemoryEx 1.0.0
Dedicated library for runtime code patching, memory scanning, tracing, injection and some more useful memory utilities. works for both Android and Linux
Loading...
Searching...
No Matches
KittyPerfWatch Class Reference

Class to manage hardware watchpoins. More...

#include <KittyPerfEvent.hpp>

Inheritance diagram for KittyPerfWatch:

Classes

struct  WatchInfo

Public Member Functions

bool add (pid_t tid, uintptr_t addr, KT_WATCH_TYPE bp_type, KT_WATCH_LEN bp_len)
 Adds a new hardware watchpoint to the watch list.
void poll (int timeout_ms, const std::function< bool(const KittyPerfSample &)> &cb)
 Polls the watch list for new samples.
void clear ()
 Clears all watchpoints from the watch list.

Protected Member Functions

bool enable ()
bool disable ()
void consumeRecord (const WatchInfo &w, KittyPerfSample *out)
void pollOnce (int timeout_ms, KittyPerfSample *out)

Static Protected Member Functions

static int perf_event_open (struct perf_event_attr *attr, pid_t pid, int cpu, int group_fd, unsigned long flags)

Protected Attributes

std::vector< WatchInfo > _watches

Detailed Description

Class to manage hardware watchpoins.

Member Function Documentation

◆ add()

bool KittyPerfWatch::add ( pid_t tid,
uintptr_t addr,
KT_WATCH_TYPE bp_type,
KT_WATCH_LEN bp_len )

Adds a new hardware watchpoint to the watch list.

Parameters
tidThe thread ID to attach the watchpoint to.
addrThe address to watch.
bp_typeThe type of watchpoint (read, write, or read/write).
bp_lenThe length of the watchpoint in bytes.
Returns
True if the watchpoint was added successfully, false otherwise.

◆ poll()

void KittyPerfWatch::poll ( int timeout_ms,
const std::function< bool(const KittyPerfSample &)> & cb )

Polls the watch list for new samples.

Parameters
timeout_msThe maximum time to wait for new samples in milliseconds.
cbA callback function to process each new sample.

The documentation for this class was generated from the following file: