On Sat, Dec 24, 2011 at 12:05 PM, Jonathan Wakely <jwakely....@gmail.com> wrote: > On 24 December 2011 11:46, Bart Van Assche wrote: >> Would it be acceptable to replace the >> _GLIBCXX_SYNCHRONIZATION_HAPPENS_BEFORE() and ..._AFTER() macros by >> something like this: >> >> if (pf) (*pf)(addr, before_or_after_flag) >> >> where pf is a function pointer that is NULL by default and can be set >> by libstdc++ users. That approach would also avoid that libstdc++ has >> to be recompiled in order to instrument reference count decrementing >> for data race detectors. > > I think the cost of checking that on every ref-count update would be > too high for the vast majority of users who don't use race detectors. > A macro has zero cost if it's not used, and even people using race > detectors don't want them enabled all the time. As I said, you don't > need to recompile the whole library to instrument the parts that are > affected, only specific objects. I think the right thing to do is > identify the parts that need to be recompiled and document how to do > just that.
Would it be technically possible to implement a binary patching approach in a user space shared library similar to the binary patching technique used in the kprobe implementation in the Linux kernel ? For more information, see also http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=blob;f=Documentation/kprobes.txt. Bart. Bart.