Thanks much , i can try that really appreciate your help Regards Ankur raj Oracle India pvt ltd:
On Wed, Dec 19, 2018 at 6:33 PM Dan Liew <[email protected]> wrote: > On Wed, 19 Dec 2018 at 10:48, Ankur Raj <[email protected]> wrote: > > > > Its part of a large and complected code base ! malloc and free wrappers > exists for some book keeping reason > > and i am afraid i cant change it either ! > > I don't know if there is way to get around this > > A possible solution to this is to detect when your code is being built > with ASan and in that case use ASan's malloc hooks so you can get > notified when malloc/free happen and do you book keeping there. > > Take a look at > https://github.com/llvm-mirror/compiler-rt/blob/52af2fe7c3feb14de9780e6c4f8e57e33012204d/include/sanitizer/allocator_interface.h#L55 > > You can define: > > ``` > void __sanitizer_malloc_hook(const volatile void *ptr, size_t size); > void __sanitizer_free_hook(const volatile void *ptr); > ``` > > to receive notifications or use the ` > __sanitizer_install_malloc_and_free_hooks` API. > > A few notes on this functionality: > > * You should probably avoid triggering any mallocs/frees from > happening inside you hooks (e.g. Using C++ templated data structured > to store information could trigger this). I'm not entirely sure what > will happen but you could easily end up with infinite recursion. > * Remember these API names are the C symbols names so if you are using > C++ remember to use `extern "C"`. > > HTH, > Dan. > > -- > You received this message because you are subscribed to the Google Groups > "address-sanitizer" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "address-sanitizer" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
