Question

how can I disable buffering on mtrace and output file with name from MALLOC_TRACE ??

the mtrace is started as:

$ cat libmtrace1.c
#include <mcheck.h>
static __attribute__((constructor)) void mtrace_install(void) {
    atexit(&muntrace);
    mtrace();
}
$gcc libmtrace1.c -fPIC -shared -o libmtrace1.so
$LD_PRELOAD=./libmtrace1.so MALLOC_TRACE=mtrace_log /bin/ls 
Was it helpful?

Solution

Hey. Just write youself an another mtrace-like plugin and install it using malloc_hook(3).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top