From nobody@FreeBSD.org  Wed Jul 20 19:08:36 2011
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 083221065676
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 20 Jul 2011 19:08:36 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from red.freebsd.org (red.freebsd.org [IPv6:2001:4f8:fff6::22])
	by mx1.freebsd.org (Postfix) with ESMTP id D2C828FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 20 Jul 2011 19:08:35 +0000 (UTC)
Received: from red.freebsd.org (localhost [127.0.0.1])
	by red.freebsd.org (8.14.4/8.14.4) with ESMTP id p6KJ8Zb6059351
	for <freebsd-gnats-submit@FreeBSD.org>; Wed, 20 Jul 2011 19:08:35 GMT
	(envelope-from nobody@red.freebsd.org)
Received: (from nobody@localhost)
	by red.freebsd.org (8.14.4/8.14.4/Submit) id p6KJ8Z8G059350;
	Wed, 20 Jul 2011 19:08:35 GMT
	(envelope-from nobody)
Message-Id: <201107201908.p6KJ8Z8G059350@red.freebsd.org>
Date: Wed, 20 Jul 2011 19:08:35 GMT
From: Alex Samorukov <samm@os2.kiev.ua>
To: freebsd-gnats-submit@FreeBSD.org
Subject: MFC request for dtrace to fix "invalid probe specifier"
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         159064
>Category:       kern
>Synopsis:       [dtrace] MFC request for dtrace to fix "invalid probe specifier"
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    avg
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Jul 20 19:10:10 UTC 2011
>Closed-Date:    Thu Sep 15 10:44:17 UTC 2011
>Last-Modified:  Thu Sep 15 10:50:03 UTC 2011
>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:
Responsible-Changed-From-To: freebsd-bugs->kan 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Wed Jul 20 21:45:04 UTC 2011 
Responsible-Changed-Why:  
Over to committer of the change in question. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=159064 
Responsible-Changed-From-To: kan->marcel 
Responsible-Changed-By: linimon 
Responsible-Changed-When: Mon Aug 15 14:51:26 UTC 2011 
Responsible-Changed-Why:  
Fix mis-assignment of MFC request. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=159064 
State-Changed-From-To: open->closed 
State-Changed-By: avg 
State-Changed-When: Thu Sep 15 10:43:22 UTC 2011 
State-Changed-Why:  
The requested commits has been MFCed. 


Responsible-Changed-From-To: marcel->avg 
Responsible-Changed-By: avg 
Responsible-Changed-When: Thu Sep 15 10:43:22 UTC 2011 
Responsible-Changed-Why:  
Acted on this PR. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=159064 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/159064: commit references a PR
Date: Thu, 15 Sep 2011 10:40:00 +0000 (UTC)

 Author: avg
 Date: Thu Sep 15 10:39:44 2011
 New Revision: 225578
 URL: http://svn.freebsd.org/changeset/base/225578
 
 Log:
   MFC r209305,209358: Do not allow EOF token to be put back into input buffer.
   
   PR:		kern/159064
   On behalf of:	kan, marcel
 
 Modified:
   stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l
 Directory Properties:
   stable/8/cddl/contrib/opensolaris/   (props changed)
 
 Modified: stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l
 ==============================================================================
 --- stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l	Thu Sep 15 10:35:38 2011	(r225577)
 +++ stable/8/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l	Thu Sep 15 10:39:44 2011	(r225578)
 @@ -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 *);
 @@ -810,8 +823,7 @@ id_or_type(const char *s)
  			longjmp(yypcb->pcb_jmpbuf, EDT_NOMEM);
  	}
  
 -	if (c0 != EOF)
 -		unput(c0);
 +	unput(c0);
  	return (ttok);
  }
  
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 

From: dfilter@FreeBSD.ORG (dfilter service)
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: kern/159064: commit references a PR
Date: Thu, 15 Sep 2011 10:43:13 +0000 (UTC)

 Author: avg
 Date: Thu Sep 15 10:42:55 2011
 New Revision: 225579
 URL: http://svn.freebsd.org/changeset/base/225579
 
 Log:
   MFC r209030,209305,209358: In dtrace lexer, do not unput token if it is EOF.
   
   PR:		kern/159064
   On behalf of:	kan, marcel
 
 Modified:
   stable/7/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l
 Directory Properties:
   stable/7/cddl/contrib/opensolaris/   (props changed)
 
 Modified: stable/7/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l
 ==============================================================================
 --- stable/7/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l	Thu Sep 15 10:39:44 2011	(r225578)
 +++ stable/7/cddl/contrib/opensolaris/lib/libdtrace/common/dt_lex.l	Thu Sep 15 10:42:55 2011	(r225579)
 @@ -45,7 +45,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) \
 @@ -60,6 +60,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 *);
 _______________________________________________
 svn-src-all@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/svn-src-all
 To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org"
 
>Unformatted:
