diff --git a/test/sclog/sclog.c b/test/sclog/sclog.c index 2d2adbf4..f12a0280 100644 --- a/test/sclog/sclog.c +++ b/test/sclog/sclog.c @@ -269,6 +269,38 @@ static void wrap_memset_pre(void *wrapctx, void **user_data) } } +/* + * Similarly to the above, wrap some versions of memmove. + */ +static void wrap_memmove_pre(void *wrapctx, void **user_data) +{ + uint was_already_paused = logging_paused++; + + if (outfile == INVALID_FILE || was_already_paused) + return; + + const void *daddr = drwrap_get_arg(wrapctx, 0); + const void *saddr = drwrap_get_arg(wrapctx, 1); + size_t size = (size_t)drwrap_get_arg(wrapctx, 2); + + + struct allocation *alloc; + + dr_fprintf(outfile, "memmove %"PRIuMAX" ", (uintmax_t)size); + if (!(alloc = find_allocation(daddr))) { + dr_fprintf(outfile, "to %"PRIxMAX" ", (uintmax_t)daddr); + } else { + dr_fprintf(outfile, "to allocations[%"PRIuPTR"] + %"PRIxMAX" ", + alloc->index, (uintmax_t)(daddr - alloc->start)); + } + if (!(alloc = find_allocation(saddr))) { + dr_fprintf(outfile, "from %"PRIxMAX"\n", (uintmax_t)saddr); + } else { + dr_fprintf(outfile, "from allocations[%"PRIuPTR"] + %"PRIxMAX"\n", + alloc->index, (uintmax_t)(saddr - alloc->start)); + } +} + /* * Common post-wrapper function for memset and free, whose entire * function is to unpause the logging. @@ -565,6 +597,7 @@ static void load_module( TRY_WRAP("realloc", wrap_realloc_pre, wrap_alloc_post); TRY_WRAP("free", wrap_free_pre, unpause_post); TRY_WRAP("memset", wrap_memset_pre, unpause_post); + TRY_WRAP("memmove", wrap_memmove_pre, unpause_post); /* * More strangely named versions of standard C library @@ -585,6 +618,8 @@ static void load_module( TRY_WRAP("__GI___libc_free", wrap_free_pre, unpause_post); TRY_WRAP("__memset_sse2_unaligned", wrap_memset_pre, unpause_post); TRY_WRAP("__memset_sse2", wrap_memset_pre, unpause_post); + TRY_WRAP("__memmove_avx_unaligned_erms", wrap_memmove_pre, + unpause_post); TRY_WRAP("cfree", wrap_free_pre, unpause_post); } }