-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This implementation is in many ways similar to v1's, but contains one significant simplification: rather than is-enabled probes appearing to the user as a function that returns a 1 or 0, they appear as a function that returns void and takes the address of a local variable: the _IS_ENABLED macros use the GCC statement-expression extension to declare and initialize a distinct local for each use of the is-enabled probe: ({ uint32_t enabled = 0; \ __dtraceenabled_foo___bar(&enabled); \ enabled; }) The is-enabled trampoline writes a 1 into this local variable. This allows the dt_link code to discard all the architecture-dependent code dealing with return value handling and treat is-enabled probes just like other USDT probes: it still tracks whether is-enabled probes are used, but doesn't use the info for anything but setting the DOF version. The downside of this approach, of course, is that users need the statement-expression extension to work, and that old is-enabled probes from DTrace v1 aren't going to work without regeneration with dtrace -G. Neither of these seem likely to be serious problems in practice, and the commit before this one should help. We use #pragma system_header to suppress -pedantic warnings about use of the extension. Internally, there are tiny changes in the dtprobed and dt_pid uprobe-registration-and-creation layers to put is-enabled probes in a different uprobe group to prevent their names clashing with USDT probes with the same name (dt_pid_is_enabled/ rather than dt_pid/). Normal USDT probes enable the correspondinng is-enabled probe, if any, when they are enabled: those probes have custom trampoline that copy a 64-bit-wide 1 into the first function parameter (and have truncated parameter-copying code that avoids preserving any parameter but the first, because there will never be any more). Please ignore the code duplication between trampoline() and trampoline_is_enabled(): this is temporary to make it easier to make changes for getting globbed systemwide probing working later on. Signed-off-by: Nick Alcock <nick.alcock@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
- Loading branch information
1 parent
73f8bb9
commit c200591
Showing
14 changed files
with
322 additions
and
217 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.