Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Jul 2011 19:08:35 GMT
From:      Alex Samorukov <samm@os2.kiev.ua>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   misc/159064: MFC request for dtrace to fix "invalid probe specifier"
Message-ID:  <201107201908.p6KJ8Z8G059350@red.freebsd.org>
Resent-Message-ID: <201107201910.p6KJAAPW014457@freefall.freebsd.org>

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

>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
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 20 19:10:10 UTC 2011
>Closed-Date:
>Last-Modified:
>Originator:     Alex Samorukov
>Release:        8.2-STABLE
>Organization:
netart
>Environment:
FreeBSD bsd.home 8.2-STABLE FreeBSD 8.2-STABLE #6: Wed Jul 20 17:26:56 UTC 2011     root@bsd.home:/usr/obj/usr/src/sys/DTRACE  amd64

>Description:
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
^C
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

>How-To-Repeat:
Run dtrace -n 'device_get_softc:entry{printf("%s",stringof(args[0]->nameunit))}'
on 8-STABLE with dtrace enabled kernel
>Fix:
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
 #else
-/* 
+/*
  * 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)
 #endif
 
 static int id_or_type(const char *);


>Release-Note:
>Audit-Trail:
>Unformatted:



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