DynamoRIO
|
create_annotation.p5
Target applications will now be able to mark any region of memory as defined by simply invoking the macro MEMCLIENT_MARK_MEM_DEFINED_IF_ADDRESSABLE(). To implement the corresponding functionality in memclient, the client developer creates a handler function having the same signature as the annotation function and registers it for the annotation using dr_annotation_register_call(). For example:
#include "dr_api.h"
void handle_mark_mem_defined_if_addressable(void *p, size_t size)
{
hashtable_add_replace(skip_init_check_table, p, skip_size);
}
DR_EXPORT void
{
dr_annotation_register_call("memclient_mark_mem_defined_if_addressable",
handle_mark_mem_defined_if_addressable, false, 2);
}
After registering the handler, all instances of the new annotation will be transformed into a clean call to handle_mark_mem_defined_if_addressable(), where the arguments to the annotation macro become arguments to the clean call.
DR_API bool dr_annotation_register_call(const char *annotation_name, void *callee, bool save_fpstate, uint num_args, dr_annotation_calling_convention_t call_type)
Top-level include file for DynamoRIO API.
DR_EXPORT void dr_client_main(client_id_t id, int argc, const char *argv[])
void * hashtable_add_replace(hashtable_t *table, void *key, void *payload)
DR_API void * dr_global_alloc(size_t size)