Does DTrace script only support "#pragma D option ..", not "-x option"?
Nan Xiao
xiaonan830818 at gmail.com
Fri Jul 21 06:19:31 UTC 2017
Hi Mark,
Thanks very much for your explanation!
Best Regards
Nan Xiao
On Fri, Jul 21, 2017 at 1:09 PM, Mark Johnston <markj at freebsd.org> wrote:
> On Fri, Jul 21, 2017 at 12:56:28PM +0800, Nan Xiao wrote:
> > Hi Matt & Mark,
> >
> > Firstly, thanks very much for your responses!
> >
> > I change my script as this:
> >
> > #!/usr/sbin/dtrace -x dynvarsize=64m -s
> >
> > dtrace:::BEGIN
> > {
> > printf("Hello FreeBSD!\n");
> > }
> >
> > It still generates errors:
> >
> > dtrace: failed to set -x dynvarsize: Invalid option name
> >
> >
> > But dynvarsize should be a valid option name.
>
> It turns out that this won't work on FreeBSD: on a shebang line, the
> tokens following the interpreter path are passed to the interpreter as a
> single argument, so dtrace(1)'s option parser won't handle your example.
> I think it follows that you have no choice but to specify the option
> with a pragma. See the two block comments here:
> https://svnweb.freebsd.org/base/head/sys/kern/imgact_
> shell.c?view=markup#l61
>
More information about the freebsd-dtrace
mailing list