[DTrace-devel] [PATCH v3 0/2] Add print() action support

Alan Maguire alan.maguire at oracle.com
Wed Nov 22 11:29:27 UTC 2023


The print() action supports CTF-powered dumping of data pointed
to by the argument passed in [1].  This is a useful feature for
kernel debugging.

Changes since v2 [2]:
- Fixed reg leak, various typos/comment issues (Eugene, patch 1)
- Got rid of unneeded param check (Kris, patch 1)
- Moved print-related code into dt_printf.c (Kris, patch 1)
- Made printsize a dynamic option that is checked at consume
  time to limit output rather than data copying (Kris, patch 1)
- Added Eugene's error tests (Eugene, patch 2)
- Added size 0 test (Eugene, patch 2)
- Augmented truncation test to verify dynamic setopt()-adjusted
  printsize setting works also (Kris, patch 2)

Changes since RFC [3]:

- Removed unneeded dtrace: from subject, removed passing test resuts,
  added doc link to [1] in patch 1 (Eugene, patches 1, 2)
- Fixed output to use the address passed in; this provides a more
  informative view saying "address 0xfeedfacefeedface is a pointer to
  struct sk_buff, here's the data".  This also resolves the issue that
  we were saving the address but not using it.  See patch 1 for output
  format (Eugene, patch 1).
- Revamped the register handling in dt_cg.c to be safer as per Eugene's
  suggestions (Eugene, patch 1)
- Fixed order of data/size and removed local vars that were unneeded
  (Eugene, patch 1)
- Fixed tests to use .d, .r for DTrace script and expected results
  instead of stuffing it all in a .sh script (Eugene, patch 2).

[1] https://docs.oracle.com/en/operating-systems/solaris/oracle-solaris/11.4/dtrace-guide/print-action.html#GUID-533E6BD9-8DE8-474E-9770-96F84244911C
[2] https://oss.oracle.com/pipermail/dtrace-devel/2023-November/004022.html
[3] https://oss.oracle.com/pipermail/dtrace-devel/2023-November/004013.html

Alan Maguire (1):
  Add support for the print() action

Eugene Loh (1):
  test: Add print() tests

 include/dtrace/actions_defines.h              |   1 +
 include/dtrace/options_defines.h              |   3 +-
 libdtrace/dt_cg.c                             |  48 +++
 libdtrace/dt_consume.c                        |  26 ++
 libdtrace/dt_errtags.h                        |   3 +-
 libdtrace/dt_impl.h                           |   6 +-
 libdtrace/dt_open.c                           |   2 +
 libdtrace/dt_options.c                        |  25 ++
 libdtrace/dt_printf.c                         | 302 +++++++++++++++++-
 libdtrace/dt_printf.h                         |   2 +
 test/unittest/print/err.D_PRINT_SIZE.zero.d   |  15 +
 test/unittest/print/err.D_PRINT_SIZE.zero.r   |   2 +
 test/unittest/print/err.D_PROTO_ARG.arg.d     |  12 +
 test/unittest/print/err.D_PROTO_ARG.arg.r     |   4 +
 test/unittest/print/err.D_PROTO_LEN.toofew.d  |  12 +
 test/unittest/print/err.D_PROTO_LEN.toofew.r  |   2 +
 test/unittest/print/err.D_PROTO_LEN.toomany.d |  13 +
 test/unittest/print/err.D_PROTO_LEN.toomany.r |   2 +
 test/unittest/print/tst.print.local.d         |  45 +++
 test/unittest/print/tst.print.local.r         |  21 ++
 test/unittest/print/tst.print.local.trunc.d   |  49 +++
 test/unittest/print/tst.print.local.trunc.r   |  27 ++
 test/unittest/print/tst.print.local.zeroed.d  |  46 +++
 test/unittest/print/tst.print.local.zeroed.r  |   8 +
 test/unittest/print/tst.print.regleak.d       |  37 +++
 test/unittest/print/tst.print.regleak.r       |  81 +++++
 test/unittest/print/tst.print.skb.d           |  19 ++
 test/unittest/print/tst.print.skb.r           |  14 +
 28 files changed, 822 insertions(+), 5 deletions(-)
 create mode 100644 test/unittest/print/err.D_PRINT_SIZE.zero.d
 create mode 100644 test/unittest/print/err.D_PRINT_SIZE.zero.r
 create mode 100644 test/unittest/print/err.D_PROTO_ARG.arg.d
 create mode 100644 test/unittest/print/err.D_PROTO_ARG.arg.r
 create mode 100644 test/unittest/print/err.D_PROTO_LEN.toofew.d
 create mode 100644 test/unittest/print/err.D_PROTO_LEN.toofew.r
 create mode 100644 test/unittest/print/err.D_PROTO_LEN.toomany.d
 create mode 100644 test/unittest/print/err.D_PROTO_LEN.toomany.r
 create mode 100644 test/unittest/print/tst.print.local.d
 create mode 100644 test/unittest/print/tst.print.local.r
 create mode 100644 test/unittest/print/tst.print.local.trunc.d
 create mode 100644 test/unittest/print/tst.print.local.trunc.r
 create mode 100644 test/unittest/print/tst.print.local.zeroed.d
 create mode 100644 test/unittest/print/tst.print.local.zeroed.r
 create mode 100644 test/unittest/print/tst.print.regleak.d
 create mode 100644 test/unittest/print/tst.print.regleak.r
 create mode 100644 test/unittest/print/tst.print.skb.d
 create mode 100644 test/unittest/print/tst.print.skb.r

-- 
2.39.3




More information about the DTrace-devel mailing list