Bug 159064

Summary: [dtrace] MFC request for dtrace to fix "invalid probe specifier"
Product: Base System Reporter: Oleksii Samorukov <samm>
Component: kernAssignee: Andriy Gapon <avg>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 8.2-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Oleksii Samorukov freebsd_committer freebsd_triage 2011-07-20 20:10:10 UTC
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

Fix: bsd# diff -u dt_lex.l.orig dt_lex.l.new 
How-To-Repeat: Run dtrace -n 'device_get_softc:entry{printf("%s",stringof(args[0]->nameunit))}'
on 8-STABLE with dtrace enabled kernel
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-07-20 22:45:04 UTC
Responsible Changed
From-To: freebsd-bugs->kan

Over to committer of the change in question.
Comment 2 Mark Linimon freebsd_committer freebsd_triage 2011-08-15 15:51:26 UTC
Responsible Changed
From-To: kan->marcel

Fix mis-assignment of MFC request.
Comment 3 dfilter service freebsd_committer freebsd_triage 2011-09-15 11:40:00 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"
Comment 4 dfilter service freebsd_committer freebsd_triage 2011-09-15 11:43:13 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"
Comment 5 Andriy Gapon freebsd_committer freebsd_triage 2011-09-15 11:43:22 UTC
State Changed
From-To: open->closed

The requested commits has been MFCed. 


Comment 6 Andriy Gapon freebsd_committer freebsd_triage 2011-09-15 11:43:22 UTC
Responsible Changed
From-To: marcel->avg

Acted on this PR.