diff --git a/include/uc_allocation_tracker.hpp b/include/uc_allocation_tracker.hpp new file mode 100644 index 0000000..8dd1aa2 --- /dev/null +++ b/include/uc_allocation_tracker.hpp @@ -0,0 +1,6 @@ +#include + +extern int g_allocation_tracker; + +uc_err uct_context_alloc(uc_engine *uc, uc_context **context); +uc_err uct_context_free(uc_context *context); \ No newline at end of file diff --git a/src/uc_allocation_tracker.cpp b/src/uc_allocation_tracker.cpp new file mode 100644 index 0000000..076c208 --- /dev/null +++ b/src/uc_allocation_tracker.cpp @@ -0,0 +1,15 @@ +#include +#include + +int g_allocation_tracker; + +uc_err uct_context_alloc(uc_engine *uc, uc_context **context) +{ + std::printf("Allocations: %p\n", ++g_allocation_tracker); + return uc_context_alloc(uc, context); +} +uc_err uct_context_free(uc_context *context) +{ + std::printf("Allocations: %p\n", --g_allocation_tracker); + return uc_context_free(context); +} \ No newline at end of file