[DTrace-devel] [PATCH v4 0/5] add support for stapsdt probes

Alan Maguire alan.maguire at oracle.com
Mon Jun 23 10:13:05 UTC 2025


As well as using dtrace -G to generate USDT probes, programs and
libraries may have added static probes via stapsdt ELF notes.
This series adds support for such probes.  Patch 1 prepares for
this support by adding counting to parsing of stapsdt probe args
(since they do not include an explicit arg count); Patch 2 adds
the support, while patches 3-5 add tests covering that support.

Changes since v3:

- merged with USDT ELF note changes; since these use the same
argument-parsing/access code, no need to add code for this now (patch 2)
- updated said ELF note parsing to count as well as parse arguments
since stapsdt probes do not provide an arg count (patch 1)
- added explicit stapsdt provider to reflect that stapsdt probes
are fundamentally different and do not auto-register for discovery
via ioctl (patch 2, Kris)
- added simple pid wildcarding support for /proc map parsing.

Changes since v2:

- updated terminology to distinguish stapsdt from USDT probes

Alan Maguire (5):
  usdt: have copy_args() count args while parsing them
  support stapsdt ELF-note-defined static probes
  selftests/usdt: add test for stapsdt note-defined probe firing, args
  selftests/usdt: add test for stapsdt notes in shared library
  selftests/usdt: add test covering different forms of stapsdt note args

 include/dtrace/pid.h                         |   1 +
 libdtrace/dt_pid.c                           | 288 +++++++++++
 libdtrace/dt_prov_uprobe.c                   |  54 +-
 test/unittest/usdt/sdt_notes.h               | 504 +++++++++++++++++++
 test/unittest/usdt/tst.stapsdt-notes-args.r  |   2 +
 test/unittest/usdt/tst.stapsdt-notes-args.sh |  50 ++
 test/unittest/usdt/tst.stapsdt-notes-lib.r   |  14 +
 test/unittest/usdt/tst.stapsdt-notes-lib.sh  | 145 ++++++
 test/unittest/usdt/tst.stapsdt-notes.r       |  14 +
 test/unittest/usdt/tst.stapsdt-notes.sh      | 121 +++++
 10 files changed, 1184 insertions(+), 9 deletions(-)
 create mode 100644 test/unittest/usdt/sdt_notes.h
 create mode 100644 test/unittest/usdt/tst.stapsdt-notes-args.r
 create mode 100755 test/unittest/usdt/tst.stapsdt-notes-args.sh
 create mode 100644 test/unittest/usdt/tst.stapsdt-notes-lib.r
 create mode 100755 test/unittest/usdt/tst.stapsdt-notes-lib.sh
 create mode 100644 test/unittest/usdt/tst.stapsdt-notes.r
 create mode 100755 test/unittest/usdt/tst.stapsdt-notes.sh

-- 
2.43.5




More information about the DTrace-devel mailing list