Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Oct 2014 21:13:00 -0700
From:      Mark Johnston <markj@FreeBSD.org>
To:        freebsd-dtrace@FreeBSD.org, dtrace-discuss@lists.dtrace.org
Subject:   dtrace keywords in postfix expressions
Message-ID:  <20141004041300.GA21821@charmander.picturesperfect.net>

next in thread | raw e-mail | index | archive | help
Hello,

DTrace has a few keywords which are not keywords in C/C++ (e.g.
"provider"). One annoyance which has come up a few times is the fact
that such keywords cannot be used in expressions which would be valid in
the code being traced. For example, FreeBSD's struct g_consumer contains
a field called "provider", and attempting to run the following snippet of
D results in a syntax error:

fbt::g_vfs_done:entry {printf("%s", stringof(args[0]->bio_from->provider->name));}

I don't see any reason the D grammar can't support this, however. The
patch at [1] attempts to fix this problem by allowing certain keywords
to appear in the place of identifiers in postfix expressions. It's not a
complete solution since it doesn't handle types or probe names, but it's a
start. Any thoughts on this approach?

Thanks!
-Mark

[1] http://people.freebsd.org/~markj/patches/dtrace_keywords.diff



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20141004041300.GA21821>