[DTrace-devel] [PATCH 0/6] usdt typed args, translators and arg remapping
Nick Alcock
nick.alcock at oracle.com
Fri Oct 18 19:58:02 UTC 2024
This series adds back support for the probe foo (...) : (...) syntax
in USDT provider definitions. The dtprobed side is routine, pulling
in the DOF and adding it to a new set of dof_parser.h records fed
through to the DOF stash and ultimately to dt_pid.c and eventually
dt_prov_uprobe.c: the end result is that the DOF for a given probe's
remappings ends up in the dt_uprobe_t in more or less the same form
as it was in the DOF.
After that things get tricky, because we want to remap not only arg[N]
but also argN references (the single existing test for USDT arg
remapping verifies that this works), but the SDT machinery depends on
argN being unremapped! So we do the remapping in dt_prov_uprobe.c and
tell the higher layers that no arg remapping is ever being performed,
then do the remapping in the trampoline by physically reshuffling
the arguments. This seems to work without breaking SDT on all supported
architectures, and is surprisingly simple (at least, it surprised me:
multiple places where I thought I'd need hundreds of lines of complex
code turned out to need only three or four lines).
New tests are added to verify that USDT translators work when types
change, and that dtrace -vln produces the right output (all previous
tests for USDT -vln, translated or not, are currently disabled
because they all use wildcards: this new one doesn't).
We also fix a couple of tiny error-related bugs encountered in the
course of development, one in usdt, one related to the print action.
Nick Alcock (6):
error: add missing EDT_PRINT entry
usdt: get arg types and xlations into DTrace from the DOF
dtprobed: stop skipping zero-tracepoint probes in dof_stash.c
cg: add argument remapping in the trampoline
usdt: typed args and arg remapping
usdt: fix create_underlying error path
dtprobed/dof_stash.c | 20 +--
dtprobed/dtprobed.c | 12 +-
include/dtrace/pid.h | 9 +
libcommon/dof_parser.c | 167 ++++++++++++++----
libcommon/dof_parser.h | 80 ++++++++-
libdtrace/dt_cg.c | 35 +++-
libdtrace/dt_cg.h | 1 +
libdtrace/dt_error.c | 3 +-
libdtrace/dt_pid.c | 71 ++++++++
libdtrace/dt_prov_uprobe.c | 165 ++++++++++++++++-
test/triggers/usdt-tst-argmap-prov.d | 3 +-
test/triggers/usdt-tst-argmap.c | 3 +-
.../dtrace-util/tst.ListProbesArgsUSDT.r | 34 ++++
.../dtrace-util/tst.ListProbesArgsUSDT.r.p | 2 +
.../dtrace-util/tst.ListProbesArgsUSDT.sh | 83 +++++++++
test/unittest/usdt/tst.argmap-typed.d | 40 +++++
test/unittest/usdt/tst.argmap.d | 3 +-
17 files changed, 660 insertions(+), 71 deletions(-)
create mode 100644 test/unittest/dtrace-util/tst.ListProbesArgsUSDT.r
create mode 100755 test/unittest/dtrace-util/tst.ListProbesArgsUSDT.r.p
create mode 100755 test/unittest/dtrace-util/tst.ListProbesArgsUSDT.sh
create mode 100644 test/unittest/usdt/tst.argmap-typed.d
base-commit: 8a1264bf0e818c8624be250eb5174714b62ed93c
--
2.46.0.278.g36e3a12567
More information about the DTrace-devel
mailing list