misc/159064: MFC request for dtrace to fix "invalid probe specifier"

Alex Samorukov samm at os2.kiev.ua
Wed Jul 20 19:10:10 UTC 2011

>Number:         159064
>Category:       misc
>Synopsis:       MFC request for dtrace to fix "invalid probe specifier"
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 20 19:10:10 UTC 2011
>Originator:     Alex Samorukov
>Release:        8.2-STABLE
FreeBSD bsd.home 8.2-STABLE FreeBSD 8.2-STABLE #6: Wed Jul 20 17:26:56 UTC 2011     root at bsd.home:/usr/obj/usr/src/sys/DTRACE  amd64

I found that my dtrace scripts perfectly running on -CURRENT failing with strange messages on -STABLE. This is example:

bsd# dtrace -n 'device_get_softc:entry{printf("%s",stringof(args[0]->nameunit))}'
dtrace: invalid probe specifier device_get_softc:entry{printf("%s",stringof(args[0]->nameunit))}: in action list: failed to resolve translated type for args[0]

args[0] should be "struct device" type. After debugging i found that it fail in libdrace and fix is already commited to the the HEAD.

See http://svnweb.freebsd.org/base/head/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l?r1=209305&r2=209358 for the actual fix. After applying the patch system resolving symbol correctly:

bsd# dtrace -n 'device_get_softc:entry{printf("%s",stringof(args[0]->nameunit))}'
dtrace: description 'device_get_softc:entry' matched 1 probe
dtrace: buffer size lowered to 2m
CPU     ID                    FUNCTION:NAME
  0  19594           device_get_softc:entry est0
  7  19594           device_get_softc:entry cpufreq0
  7  19594           device_get_softc:entry cpufreq0

Run dtrace -n 'device_get_softc:entry{printf("%s",stringof(args[0]->nameunit))}'
on 8-STABLE with dtrace enabled kernel
bsd# diff -u dt_lex.l.orig dt_lex.l.new 
--- dt_lex.l.orig	2010-11-08 12:54:55.000000000 +0000
+++ dt_lex.l.new	2010-08-02 13:40:53.000000000 +0000
@@ -44,7 +44,7 @@
 #undef input
 #undef unput
  * Define YY_INPUT for flex since input() can't be re-defined.
 #define YY_INPUT(buf,result,max_size) \
@@ -59,6 +59,19 @@
 			buf[n] = *yypcb->pcb_strptr++; \
 		result = n; \
+ * Do not EOF let tokens to be put back. This does not work with flex.
+ * On the other hand, leaving current buffer in same state it was when
+ * last EOF was received guarantees that input() will keep returning EOF
+ * for all subsequent invocations, which is the effect desired.
+ */
+#undef  unput
+#define unput(c)					\
+	do {						\
+		int _c = c;				\
+		if (_c != EOF)				\
+			yyunput(_c, yytext_ptr);	\
+	} while(0)
 static int id_or_type(const char *);


More information about the freebsd-bugs mailing list