[llvm-commits] Asan interception library patch (issue 6010049)

samsonov at google.com samsonov at google.com
Thu Apr 12 07:21:26 PDT 2012


http://codereview.appspot.com/6010049/diff/1/interception.h
File interception.h (right):

http://codereview.appspot.com/6010049/diff/1/interception.h#newcode78
interception.h:78: # define DECLARE_WRAPPER(ret_type, convention, func,
...)
Naming was not self-explanatory already and now it's even worse :( As I
get it, you use DECLARE_WRAPPER(...func...) to define "func" that is:
1) alias to an interceptor if instrumented code doesn't define its own
"func"
2) breaks linkage if instrumented code does define its own "func"
Why not call this macro smth like "ADD_GUARD_AGAINST_CUSTOM_DEFINITION"
or smth like that.

http://codereview.appspot.com/6010049/diff/1/interception.h#newcode91
interception.h:91: # define WRAP(x) interception_wrap_##x
This fails on our output tests: the top stack frame of allocation now
says "interception_wrap_malloc" instead of "malloc". Can we use some
other naming?

http://codereview.appspot.com/6010049/diff/1/interception.h#newcode96
interception.h:96: __attribute__((weak,
alias("interception_wrap_"#func), \
alias(WRAPPER_NAME(func)) ?

http://codereview.appspot.com/6010049/diff/1/interception.h#newcode97
interception.h:97: visibility("default")))
You can use INTERCEPTOR_ATTRIBUTE instead of visibility("default")

http://codereview.appspot.com/6010049/diff/1/interception_linux.h
File interception_linux.h (right):

http://codereview.appspot.com/6010049/diff/1/interception_linux.h#newcode32
interception_linux.h:32: (void*)&func, (void*)&WRAP(func))
I think that
&& (void*)&func == (void*)&WRAP(func)
would be better.
Anyway, it's worth explaining this magic in the comment here or in
interception.h

http://codereview.appspot.com/6010049/



More information about the llvm-commits mailing list