For the upcoming DSO support, we want to reuse code between the "static"
version of XRay, already within the main binary and possibly initialized
at startup, and the "dynamic" part bundled with .so libraries which will
need to communicate with it. Wherever patching/unpatching happens needs
to be clearly defined for the patching code to recognize which memory is
it actually operating on.
This diff introduces an "always visible" pointer (*DSOContext), which is
local for each DSO, only visible within its own "copy" of XRay. Whoever
initializes that context (xray_init.cc in the main binary or xray_dso.cc
in a DSO during dlopen(3)) will populate that pointer. The advantage of
having a pointer instead of scattered functions and variables is:
- we have something to identify a DSO (it will have a numeric ID soon)
- it is easier to add per-DSO behaviour later, and control it globally
- it is clearer for the reader which C++ code is intended to be shared
When this is in, it is easy to take xray_interface{.cc,_internal.h} and
build a DSO version of the XRay runtime with it.