aboutsummaryrefslogtreecommitdiff
path: root/cddl/contrib/opensolaris/cmd/dtrace
Commit message (Collapse)AuthorAgeFilesLines
* dtrace tests: Update names after the syscall::exit probe was renamedMark Johnston2025-12-014-4/+4
| | | | | MFC after: 1 week Fixes: e7e964cb2ebd ("syscalls: normalize _exit(2) declerations")
* dtrace.1: remove sparcMinsoo Choo2025-12-011-5/+1
| | | | | | | | Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Reviewed by: markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1907
* opensolaris: remove references to sparcMinsoo Choo2025-12-013-14/+0
| | | | | | | | Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Reviewed by: markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1907
* dtrace: remove sparc testsMinsoo Choo2025-12-0122-1185/+0
| | | | | | | | Signed-off-by: Minsoo Choo <minsoochoo0122@proton.me> Reviewed by: markj MFC after: 1 week Pull Request: https://github.com/freebsd/freebsd-src/pull/1907
* dtrace_priv.4: Document the DTrace priv providerMateusz Piotrowski2025-11-121-1/+2
| | | | | | Fixes: 6efcc2f26ab0 Add static tracing for privilege checking MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D53630
* dtrace.1: Document DTRACE_DEBUGMateusz Piotrowski2025-11-081-1/+9
| | | | | | Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D53627
* dtrace.1: Fix mdoc macros around -xMateusz Piotrowski2025-11-061-1/+1
| | | | | | There should be no space between -x's "arg" and "=value". MFC after: 3 days
* dtrace_pid.4: Document the DTrace PID providerMateusz Piotrowski2025-11-061-1/+2
| | | | | MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D51287
* dtrace_callout_execute.4: Document the DTrace callout_execute providerMateusz Piotrowski2025-11-041-1/+2
| | | | | | MFC after: 2 weeks Fixes: 91dd9aae1ab8 Add explicit static DTrace tracing to the callout mechanism Differential Revision: https://reviews.freebsd.org/D51397
* dtrace_vfs.4: Document the DTrace vfs providerMateusz Piotrowski2025-11-031-1/+2
| | | | | | Reviewed by: bcr MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51317
* dtrace.1: Document security.bsd.allow_destructive_dtraceMateusz Piotrowski2025-08-011-1/+24
| | | | | | | | PR: 288284 Reviewed by: bcr, markj MFC after: 3 days Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D51633
* libdtrace: Permit taking the address of an identifier without type infoMark Johnston2025-07-211-0/+54
| | | | | | | | | | | | | | | | | | | | | | | | | | Symbols defined using assembler directives lack type info, but in this case one ought to be able to cast a pointer to the symbol and dereference the pointer to get a value. Without this change, D disallows this trick since it requires all identifiers to have a type. Relax the rules slightly and allow an identifier to have type "void" if we know we're just taking its address. As a result, the following dtrace invocation works: dtrace -n 'tick-1s {printf("%d", *(int *)&`ticks);}' In particular, since commit b2b974f7ef4c ("clock: Simplify subr_ticks and rename"), "ticks" does not have any type info associated with it, so its value couldn't be printed. This trick provides a workaround and is probably generally useful. Add a regression test which exercises this functionality. PR: 287752 Reviewed by: avg MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D51417
* dtrace_fbt.4: Document the DTrace fbt providerMateusz Piotrowski2025-07-161-1/+2
| | | | | | | | | Reported by: markj Reviewed by: christos, markj (earlier version), ziaee Obtained from: Mark Johnston, DTrace, FreeBSD Journal, May 2014 Obtained from: https://wiki.freebsd.org/DTrace/One-Liners MFC after: 2 weeks Relnotes: yes
* dtrace.1: Document evaltimeMateusz Piotrowski2025-07-141-1/+47
| | | | | | Reviewed by: christos, ziaee MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D51301
* dtrace_profile.4: Document the DTrace profile providerMateusz Piotrowski2025-07-141-0/+1
| | | | | | | Event: Berlin Hackathon 202507 Reviewed by: bcr, christos Relnotes: yes Differential Revision: https://reviews.freebsd.org/D51278
* d.7: Document the DTrace scripting languageMateusz Piotrowski2025-07-141-1/+2
| | | | | | | Reviewed by: bcr, christos, ziaee Event: Berlin Hackathon 202507 Relnotes: yes Differential Revision: https://reviews.freebsd.org/D51268
* dtrace_dtrace.4: Document the DTrace dtrace providerMateusz Piotrowski2025-07-141-0/+1
| | | | | | | Reviewed by: bcr, christos Event: Berlin Hackathon 202507 Relnotes: yes Differential Revision: https://reviews.freebsd.org/D51267
* dtrace.1: Reference dwatch(1) and tracing(7)Mateusz Piotrowski2025-07-121-1/+3
| | | | | Reviewed by: bcr Event: Berlin 2025 Hackathon
* dtrace.1: Mention providers in SEE ALSOMateusz Piotrowski2025-06-141-1/+12
| | | | | | | Reviewed by: bnovkov, christos, markj Approved by: bnovkov (mentor), christos (mentor), markj (mentor) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D50852
* dtrace tests: Fix nits in some test programsMark Johnston2025-06-042-5/+7
| | | | | | | | Otherwise these tests fail spuriously, depending on which compiler is installed as cc. MFC after: 2 weeks Sponsored by: Innovate UK
* libdtrace: Generalize handling of data models a bitMark Johnston2025-01-251-4/+3
| | | | | | | | | | Make it easier to support data models other than ILP32 and LP64 by avoiding constructs which assume that it must be one or the other. No functional change intended. MFC after: 2 weeks Sponsored by: Innovate UK
* dtrace tests: Add a test case which validates FBT probe argumentsMark Johnston2024-09-192-0/+37
| | | | | | Reviewed by: avg MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D46674
* sdt: Implement SDT probes using hot-patchingMark Johnston2024-06-191-6/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea here is to avoid a memory access and conditional branch per probe site. Instead, the probe is represented by an "unreachable" unconditional function call. asm goto is used to store the address of the probe site (represented by a no-op sled) and the address of the function call into a tracepoint record. Each SDT probe carries a list of tracepoints. When the probe is enabled, the no-op sled corresponding to each tracepoint is overwritten with a jmp to the corresponding label. The implementation uses smp_rendezvous() to park all other CPUs while the instruction is being overwritten, as this can't be done atomically in general. The compiler moves argument marshalling code and the sdt_probe() function call out-of-line, i.e., to the end of the function. Per gallatin@ in D43504, this approach has less overhead when probes are disabled. To make the implementation a bit simpler, I removed support for probes with 7 arguments; nothing makes use of this except a regression test case. It could be re-added later if need be. The approach taken in this patch enables some more improvements: 1. We can now automatically fill out the "function" field of SDT probe names. The SDT macros let the programmer specify the function and module names, but this is really a bug and shouldn't have been allowed. The intent was to be able to have the same probe in multiple functions and to let the user restrict which probes actually get enabled by specifying a function name or glob. 2. We can avoid branching on SDT_PROBES_ENABLED() by adding the ability to include blocks of code in the out-of-line path. For example: if (SDT_PROBES_ENABLED()) { int reason = CLD_EXITED; if (WCOREDUMP(signo)) reason = CLD_DUMPED; else if (WIFSIGNALED(signo)) reason = CLD_KILLED; SDT_PROBE1(proc, , , exit, reason); } could be written SDT_PROBE1_EXT(proc, , , exit, reason, int reason; reason = CLD_EXITED; if (WCOREDUMP(signo)) reason = CLD_DUMPED; else if (WIFSIGNALED(signo)) reason = CLD_KILLED; ); In the future I would like to use this mechanism more generally, e.g., to remove branches and marshalling code used by hwpmc, and generally to make it easier to add new tracepoint consumers without having to add more conditional branches to hot code paths. Reviewed by: Domagoj Stolfa, avg MFC after: 2 months Differential Revision: https://reviews.freebsd.org/D44483
* dtrace tests: Catch up with ping(8) output changesMark Johnston2024-01-101-1/+1
| | | | MFC after: 1 week
* dtrace tests: Stop hard-coding an incorrect path to sleep(1)Mark Johnston2024-01-104-4/+4
| | | | MFC after: 1 week
* dtrace tests: Run ksh with -pMark Johnston2024-01-1010-10/+10
| | | | | | | | In particular, avoid loading the user's .profile file, since that can have undesirable side effects. Most tests were already careful to do this. MFC after: 1 week
* dtrace: Add the 'oformat' libdtrace optionDomagoj Stolfa2024-01-1028-9/+2132
| | | | | | | | | | | | | | | | | | | | | | | | | | | | This option can be used to specify a format to use in DTrace output. The following formats are supported: - json - xml - html - none (default DTrace output) This is implemented using libxo and integrated into libdtrace. Client code only works with the following API: - dtrace_oformat_setup(dtrace_hdl_t *) -- to be called when output is starting. - dtrace_oformat_teardown(dtrace_hdl_t *) -- to be called when output is finished - dtrace_oformat(dtrace_hdl_t *) -- check if oformat is enabled. - dtrace_set_outfp(FILE *) -- sets the output file for oformat. - Ensure that oformat is correctly checked in the drop handler and record processing callbacks. This commit also adds tests which check if the generated output is valid (JSON, XML) and extends the dtrace(1) describing the structured output. Reviewed by: markj Discussed with: phil MFC after: 2 months Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D41745
* Trim various $FreeBSD$John Baldwin2023-10-101-2/+0
| | | | | | Approved by: markj (cddl/contrib changes) Reviewed by: imp, emaste Differential Revision: https://reviews.freebsd.org/D41961
* dtrace: move kinst tests to commonChristos Margiolis2023-07-041-0/+0
| | | | | | | Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40414
* kinst: fix memcpy() tracing crashChristos Margiolis2023-05-261-0/+1
| | | | | | | | | | | | Tracing memcpy() would crash the kernel, because we'd also trace the memcpy() calls from kinst_invop(). To fix this, introduce kinst_memcpy() whose arguments are 'volatile', so that we avoid having the compiler replace it with a regular memcpy(). Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D40284
* dtrace.1: fix mandoc -TlintChristos Margiolis2023-05-231-5/+5
| | | | | | Reviewed by: markj Approved by: markj (mentor) Differential Revision: https://reviews.freebsd.org/D40230
* dtrace(1): add -d flag to dump D script post-dt_sugarChristos Margiolis2023-05-232-4/+15
| | | | | | | | | | | By specifying the -d flag, libdtrace will dump the D script after it has applied syntactical sugar transformations (e.g if/else). This is useful for both understanding what dt_sugar does, as well as debugging it. Reviewed by: markj Approved by: markj (mentor) Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D38732
* dtrace tests: Extend the kinst regression testMark Johnston2022-12-081-0/+1
| | | | Trace a function which disables interrupts.
* kinst: Add a rudimentary regression test caseMark Johnston2022-10-111-0/+46
| | | | | | | The test instruments a number of large, frequently called kernel functions while generating load in the background. MFC after: 3 months
* dtrace tests: Rename some test type names to avoid a conflictMark Johnston2022-08-031-6/+6
| | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation
* dtrace tests: Override RLIMIT_CORE for a test which triggers a core dumpMark Johnston2022-08-031-1/+1
| | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation
* dtrace tests: Fix expected outout for tst.system.dLi-Wen Hsu2022-03-091-6/+6
| | | | | | | This is follow up of d500a85e640d1cd270747c12e17c511b53864436 PR: 262415 Sponsored by: The FreeBSD Foundation
* dtrace: Disable getf() as it is broken on FreeBSDDomagoj Stolfa2021-12-171-1/+1
| | | | | | | | | | | | | | | | | | getf() on FreeBSD calls _sx_slock(), _sx_sunlock() and fget_locked(). Furthermore, it does not set the per-core fault flag, meaning it usually ends up in a double fault panic once getf() does get called, especially from fbt. Reviewing the DTrace Toolkit + a number of other scripts scattered around FreeBSD, I have not been able to find one use of getf(). Given how broken the implementation currently is, we disable it until it can be implemented properly. Also comment out a test in aggs/tst.subr.d for getf(). Reviewed by: markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D33378
* dtrace.1: Document a couple of preprocessor-related optionsMark Johnston2021-09-071-0/+11
| | | | | | Suggested by: swills MFC after: 1 week Sponsored by: The FreeBSD Foundation
* dtrace.1: Document -x ldpathMark Johnston2021-09-071-1/+9
| | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation
* dtrace tests: Fix tst.system.d after ping/ping6 unificationMark Johnston2021-04-231-3/+3
| | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation
* dtrace: Document the libdir, nolibs and syslibdir optionsDomagoj Stolfa2021-04-021-1/+9
| | | | | MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D29541
* dtrace tests: fix prototypes for gcc buildRyan Libby2021-01-114-6/+9
| | | | | | | | | - quiet -Wstrict-prototypes - provide prototypes for weak aliases Reviewed by: markj Sponsored by: Dell EMC Isilon Differential Revision: https://reviews.freebsd.org/D28036
* dtrace: honor LC_NUMERIC for %'d and alike, and LC_TIME for %TAndriy Gapon2020-12-031-0/+9
| | | | | | | | | | | | | Note that the public documentation on dtrace.org fails to mention %T and incorrectly documents %Y. The latter actually uses format "%Y %b %e %T" where %b is always in C locale. Discussed with: markj MFC after: 1 month Sponsored by: Panzura Notes: svn path=/head/; revision=368300
* Address compiler warnings in C code used by the DTrace test suite.Mark Johnston2020-09-1933-112/+105
| | | | | | | | Reported by: Jenkins MFC after: 1 week Notes: svn path=/head/; revision=365907
* Add HISTORY sections to ZFS and dtrace manpageGordon Bergling2020-06-141-1/+6
| | | | | | | | | | Reviewed by: bcr (mentor) Approved by: bcr (mentor) MFC after: 7 days Differential Revision: https://reviews.freebsd.org/D23833 Notes: svn path=/head/; revision=362170
* Fix inconsistencies in anonymous DOF files.Mark Johnston2019-11-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | The DOF file output by dtrace -A contains only the loadable sections. However, as it was created by a call to dtrace_dof_create() without flags, the original DOF was created with the loadable sections. The result is that the DOF includes the section headers for the unloadable sections (COMMENTS and UTSNAME) without these sections actually being present. This is inconsistent. A simple change to anon_prog() ensures that the missing sections are present in the outputted DOF. Alternatively, the call to dtrace_dof_create() could pass the DTRACE_D_STRIP flag stripping out the loadable sections. As the unloadable sections contain info useful for debugging purposes they haven't been stripped. Submitted by: Graeme Jenkinson <graeme.jenkinson@cl.cam.ac.uk> MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21875 Notes: svn path=/head/; revision=354822
* Fix dtrace test case after r351423 due to ping6(8) options changedLi-Wen Hsu2019-08-311-1/+1
| | | | | | | | | | Failure test case: cddl.usr.sbin.dtrace.common.ip.t_dtrace_contrib.tst_ipv6localicmp_ksh Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351644
* Fix tests use /etc/motd after r350184 by using an always existing fileLi-Wen Hsu2019-08-313-3/+3
| | | | | | | Sponsored by: The FreeBSD Foundation Notes: svn path=/head/; revision=351643
* DTrace: create an amd64 test suitMariusz Zaborski2019-06-053-0/+161
| | | | | | | | | | | | | Create two tests checking if we can read urgs registers and if the rax register returns a correct number. Reviewed by: markj Discussed with: lwhsu MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D20364 Notes: svn path=/head/; revision=348706