freebsd-dev/cddl/lib/libdtrace
Mark Johnston e572bc11ec Add a function, memstr, which can be used to convert a buffer of
null-separated strings to a single string. This can be used to print the
full arguments of a process using execsnoop (from the DTrace toolkit) or
with the following one-liner:

dtrace -n 'syscall::execve:return {trace(curpsinfo->pr_psargs);}'

Note that this relies on the process arguments being cached via the struct
proc, which means that it will not work for argvs longer than
kern.ps_arg_cache_limit. However, the following rather non-portable
script can be used to extract any argv at exec time:

fbt::kern_execve:entry
{
    printf("%s", memstr(args[1]->begin_argv, ' ',
        args[1]->begin_envv - args[1]->begin_argv));
}

The debug.dtrace.memstr_max sysctl limits the maximum argument size to
memstr(). Thanks to Brendan Gregg for helpful comments on freebsd-dtrace.

Tested by:	Fabian Keil (earlier version)
MFC after:	2 weeks
2013-10-16 01:39:26 +00:00
..
errno.d
io.d Revert previous change in favor of a fix to the actual dtrace 2013-03-28 20:22:43 +00:00
ip.d Implement the ip, tcp, and udp DTrace providers. The probe definitions use 2013-08-25 21:54:41 +00:00
libproc_compat.h Add libdtrace support for tracing userland programs. 2010-08-21 11:50:53 +00:00
Makefile Implement the ip, tcp, and udp DTrace providers. The probe definitions use 2013-08-25 21:54:41 +00:00
net.d
nfs.d DTrace: NFS translators should be split into client/server pieces 2013-04-18 01:20:08 +00:00
nfssrv.d DTrace: NFS translators should be split into client/server pieces 2013-04-18 01:20:08 +00:00
psinfo.d Add a function, memstr, which can be used to convert a buffer of 2013-10-16 01:39:26 +00:00
regs_x86.d Add libdtrace support for tracing userland programs. 2010-08-21 11:50:53 +00:00
sched.d
signal.d
tcp.d Add a separate translator for headers passed to the TCP probes in the 2013-10-02 17:14:12 +00:00
udp.d Implement the ip, tcp, and udp DTrace providers. The probe definitions use 2013-08-25 21:54:41 +00:00
unistd.d