[llvm-dev] Where does the LLVM implement the Ubsan's instrumentations?

John Regehr via llvm-dev
Fri, 21 Jul 2017 17:14:44 -0000

> But I have another question about the trap-function. I hope to print the
wrong code running IP address in my trap function (then, I can use
llvm-symbolizer to know its code location), and I also hope to print undefined
behavior specific type info, e.g. add_overflow, type_mismatch_v1, etc., which
are defined in compiler-rt\lib\ubsan\ubsan_interface.inc. How should I correctly
define the __my_sanitizer_trap() and let clang/llvm input relative info into my
trap function?

IIRC nothing gets pushed onto the stack before your custom trap function
is called. A bit of Clang hacking will be required if you want to alter
this behavior.

John