Date: Sun, 19 Apr 2026 01:38:20 +0100
There are currently two threads on this mailing list about interceptor
functions.
My own thread describes a runtime feature, whereby you can at runtime
replace the address of a function with the address of an 'interceptor'
which will do some processing (e.g. logging, debugging, change global
state) and then jump to the original function. My own feature can
intercept a function of any signature (i.e. any return type, any
number of arguments of any type, and can even be a member function),
as the stack and all argument registers are preserved. That is to say,
the entire call state is saved and then later restored. Note that my
interceptor functions return void and take no arguments. Note that my
[[interceptor]] attribute is placed on the interceptor function -- not
on the function being intercepted. The interception happens at runtime
when a function pointer (such as returned from 'dlsym' or
'GetProcAddress') is replaced with the address of an interceptor which
does some processing and then jumps to the original function. No
marking of the intercepted function takes place.
There's a separate thread by Zhao YunShan about what could be
described as compile-time interception. Zhao describes a feature
whereby the intercepted function is marked, and the interception is
done at compile-time by the compiler, it's hard-coded into the binary.
It's similar to the GNU "--wrap" feature.
>From now on, could I ask that we edit the subject line on future posts
so that people know what's being talked about.
My own thread = Interceptor Functions [runtime]
Zhao's thread = Interceptor Functions [compile-time]
functions.
My own thread describes a runtime feature, whereby you can at runtime
replace the address of a function with the address of an 'interceptor'
which will do some processing (e.g. logging, debugging, change global
state) and then jump to the original function. My own feature can
intercept a function of any signature (i.e. any return type, any
number of arguments of any type, and can even be a member function),
as the stack and all argument registers are preserved. That is to say,
the entire call state is saved and then later restored. Note that my
interceptor functions return void and take no arguments. Note that my
[[interceptor]] attribute is placed on the interceptor function -- not
on the function being intercepted. The interception happens at runtime
when a function pointer (such as returned from 'dlsym' or
'GetProcAddress') is replaced with the address of an interceptor which
does some processing and then jumps to the original function. No
marking of the intercepted function takes place.
There's a separate thread by Zhao YunShan about what could be
described as compile-time interception. Zhao describes a feature
whereby the intercepted function is marked, and the interception is
done at compile-time by the compiler, it's hard-coded into the binary.
It's similar to the GNU "--wrap" feature.
>From now on, could I ask that we edit the subject line on future posts
so that people know what's being talked about.
My own thread = Interceptor Functions [runtime]
Zhao's thread = Interceptor Functions [compile-time]
Received on 2026-04-19 00:38:34
