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__) || defined(__alpha__)
16 +// ppc32/64: bl [mem] takes 4 bytes.
17 +// alpha: bsr ra,[mem] takes 4 bytes.
19 +#elif defined(__sparc__)
20 +// sparc32/64: call with delay slot takes 8 bytes
21 +// but %i7 (r31) contains return_address-8, so no change here.
23 + return (const void*)c;
26 static class LeakTracer {
33 - leaks[i].allocAddr=__builtin_return_address(1);
34 + leaks[i].allocAddr = caller_address(__builtin_return_address(1));
36 // allow to lookup our index fast.
37 int *hashPos = &leakHash[ ADDR_HASH(p) ];
39 "S %10p %10p # new%s but delete%s "
42 - __builtin_return_address(1),
43 + caller_address(__builtin_return_address(1)),
44 ((!type) ? "[]" : " normal"),
45 ((type) ? "[]" : " normal"),