Hi Fakharu,
you don't mention the compiler you want to modify, but I advise you to
use Clang.
The instrumentation is implemented in AddressSanitizer.cpp
(
https://llvm.org/doxygen/AddressSanitizer_8cpp_source.html), and the
function that actually adds instrumentation is called
AddressSanitizer::instrumentAddress().
You may also look at the loops in
AddressSanitizer::instrumentFunction() that collect the
instructions/operands to instrument based on their type.
Make sure to familiarize yourself with
https://llvm.org/docs/LangRef.html so that you understand how LLVM
intermediate representation is organized.
You can either construct your instrumentation code in the compiler
pass (especially if you need it to be fast), or you can put it into
the runtime library, and use out-of-line instrumentation based on
calls (enabled with `-mllvm
-asan-instrumentation-with-call-threshold=0`).
In the latter case, if you don't need the rest of ASan instrumentation
(e.g. redzones around global and stack objects), you may want to look
at -fsanitize=thread, which just adds calls to every memory load and
store.
HTH,
Alex
> --
> 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
address-saniti...@googlegroups.com.
> To view this discussion on the web visit
https://groups.google.com/d/msgid/address-sanitizer/390ebc47-e6a3-4744-b5fa-92f3337c3521n%40googlegroups.com.
--
Alexander Potapenko
Software Engineer
Google Germany GmbH
Erika-Mann-Straße, 33
80636 München
Geschäftsführer: Paul Manicle, Liana Sebastian
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg