#include "IgTools/IgTrace/src/IgTrace.h"
#include "IgTools/IgHook/interface/IgHook.h"
#include "IgTools/IgHook/interface/IgHookTrace.h"
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <pthread.h>
#include <unistd.h>
Go to the source code of this file.
Classes | |
class | IgTraceMem |
Functions | |
static void * | domalloc (IgHook::SafeData< igtrace_domalloc_t > &hook, size_t size) |
IGTRACE_DUAL_HOOK (1, void *, domalloc, _main, _libc,(size_t n),(n),"malloc", 0,"libc.so.6") static bool s_initialized | |
Variables | |
static bool | autoboot = (IgTraceMem::initialize (), true) |
static void* domalloc | ( | IgHook::SafeData< igtrace_domalloc_t > & | hook, | |
size_t | size | |||
) | [static] |
Definition at line 84 of file IgTraceMem.cc.
References IgHook::SafeData< Func >::chain, IgTrace::disable(), IgTrace::enable(), IgTrace::filter(), IgTrace::program(), HLT_VtxMuL3::result, and IgHookTrace::stacktrace().
00085 { 00086 bool enabled = IgTrace::disable (); 00087 void *result = (*hook.chain) (size); 00088 00089 if (enabled) 00090 { 00091 void *stack [800]; 00092 int depth = IgHookTrace::stacktrace (stack, sizeof (stack)/sizeof(stack[0])); 00093 00094 // If the filters pass, walk the stack to print out information. 00095 if (IgTrace::filter (0, stack, depth)) 00096 { 00097 char buf [1024]; 00098 write (2, buf, sprintf (buf, 00099 "*** MALLOC %ld bytes => %p, by %.500s [thread %lu pid %ld]\n", 00100 (unsigned long) size, result, IgTrace::program(), 00101 (unsigned long) pthread_self (), (long) getpid ())); 00102 } 00103 } 00104 00105 IgTrace::enable (); 00106 return result; 00107 }
IGTRACE_DUAL_HOOK | ( | 1 | , | |
void * | , | |||
domalloc | , | |||
_main | , | |||
_libc | , | |||
(size_t n) | , | |||
(n) | , | |||
"malloc" | , | |||
0 | , | |||
"libc.so.6" | ||||
) |
Definition at line 110 of file IgTraceMem.cc.