public inbox for dtrace@lists.linux.dev
 help / color / mirror / Atom feed
* [PATCH v3 0/6] usdt typed args, translators and arg remapping
@ 2024-10-30 12:08 Nick Alcock
  2024-10-30 12:08 ` [PATCH REVIEWED v3 1/6] error: add missing EDT_PRINT entry Nick Alcock
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Nick Alcock @ 2024-10-30 12:08 UTC (permalink / raw)
  To: dtrace, dtrace-devel

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 while reshuffling
things into dt_argdesc_t's, 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,
when arg counts change, and when there are no args at all, 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.

Changes since v2:
  Populate dt_argdesc_t's in USDT probe discovery rather than in
  probe_info.

Changes since v1:
  Adapted to review comments (all comments but the stuff around
  trampolines and arg mapping, which I don't understand well
  enough to implement); in particular track xlated args and
  mappings together, and move from a flags word in the
  dof_parser struct's DIT_PROBE record to an arg count

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 mapping in the trampoline
  usdt: typed args and arg mapping
  usdt: fix create_underlying error path

 dtprobed/dof_stash.c                          |  21 +--
 dtprobed/dtprobed.c                           |  10 +-
 include/dtrace/pid.h                          |   7 +
 libcommon/dof_parser.c                        | 150 ++++++++++++----
 libcommon/dof_parser.h                        |  64 ++++++-
 libdtrace/dt_cg.c                             |  36 +++-
 libdtrace/dt_cg.h                             |   1 +
 libdtrace/dt_error.c                          |   3 +-
 libdtrace/dt_pid.c                            |  60 +++++++
 libdtrace/dt_prov_uprobe.c                    | 168 +++++++++++++++++-
 test/triggers/usdt-tst-argmap-prov.d          |   5 +-
 test/triggers/usdt-tst-argmap.c               |   5 +-
 .../dtrace-util/tst.ListProbesArgsUSDT.r      |  34 ++++
 .../dtrace-util/tst.ListProbesArgsUSDT.r.p    |   2 +
 .../dtrace-util/tst.ListProbesArgsUSDT.sh     |  83 +++++++++
 test/unittest/usdt/err.argmap-null.d          |  40 +++++
 test/unittest/usdt/err.argmap-null.r          |   2 +
 test/unittest/usdt/err.argmap-null.r.p        |   2 +
 test/unittest/usdt/tst.argmap-null.d          |  32 ++++
 test/unittest/usdt/tst.argmap-typed-partial.d |  49 +++++
 test/unittest/usdt/tst.argmap-typed.d         |  48 +++++
 test/unittest/usdt/tst.argmap.d               |   3 +-
 test/utils/showUSDT.c                         |   5 +-
 23 files changed, 759 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/err.argmap-null.d
 create mode 100644 test/unittest/usdt/err.argmap-null.r
 create mode 100755 test/unittest/usdt/err.argmap-null.r.p
 create mode 100644 test/unittest/usdt/tst.argmap-null.d
 create mode 100644 test/unittest/usdt/tst.argmap-typed-partial.d
 create mode 100644 test/unittest/usdt/tst.argmap-typed.d


base-commit: 8a1264bf0e818c8624be250eb5174714b62ed93c
-- 
2.46.0.278.g36e3a12567


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2024-10-31 18:56 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-30 12:08 [PATCH v3 0/6] usdt typed args, translators and arg remapping Nick Alcock
2024-10-30 12:08 ` [PATCH REVIEWED v3 1/6] error: add missing EDT_PRINT entry Nick Alcock
2024-10-30 12:08 ` [PATCH v3 2/6] usdt: get arg types and xlations into DTrace from the DOF Nick Alcock
2024-10-30 12:08 ` [PATCH REVIEWED v3 3/6] dtprobed: stop skipping zero-tracepoint probes in dof_stash.c Nick Alcock
2024-10-30 12:08 ` [PATCH v3 4/6] cg: add argument mapping in the trampoline Nick Alcock
2024-10-30 12:08 ` [PATCH v3 5/6] usdt: typed args and arg mapping Nick Alcock
2024-10-30 12:08 ` [PATCH REVIEWED v3 6/6] usdt: fix create_underlying error path Nick Alcock
2024-10-31 18:56 ` [PATCH v3 0/6] usdt typed args, translators and arg remapping Kris Van Hees

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox