1 --- LeakTracer.cc.orig 2005-12-10 23:57:27.000000000 +0000
2 +++ LeakTracer.cc 2005-12-11 00:12:19.592655400 +0000
5 #define INITIALSIZE 32768
8 +const void* caller_address(const void* return_address)
10 + unsigned long c = (unsigned long)return_address;
11 +#if defined(__i386__) || defined(__x86_64__)
12 +// x86-32: call [mem] takes 5 bytes.
13 +// x86-64: callq/jmpq [mem] takes 5 bytes.
15 +#elif defined(__powerpc__)
16 +// ppc32: bl [mem] takes 4 bytes.
19 + return (const void*)c;
22 static class LeakTracer {
29 - leaks[i].allocAddr=__builtin_return_address(1);
30 + leaks[i].allocAddr = caller_address(__builtin_return_address(1));
32 // allow to lookup our index fast.
33 int *hashPos = &leakHash[ ADDR_HASH(p) ];
35 "S %10p %10p # new%s but delete%s "
38 - __builtin_return_address(1),
39 + caller_address(__builtin_return_address(1)),
40 ((!type) ? "[]" : " normal"),
41 ((type) ? "[]" : " normal"),