dwatch(1): Guard against error when given -t "*..."

dwatch allows you to customnize the predicate (condition) for when
information is displayed. The DTrace syntax for this is:

	probe[, ...] /predicate/ { [actions] }

But if predicate is something like "*args[1]!=NULL" to test that
the first pointer in an array is non-NULL, the syntax produced is:

	probe[, ...] /*arg1!=NULL/ { [actions] }

The issue being that "/*" is the beginning of a comment and thus
the following error is emitted:

	dtrace: failed to compile script /dev/stdin:
		line 535: /* encountered inside a comment

This patch adds whitespace around the argument given to -t,
producing:

	probe[, ...] / *arg1!=NULL / { [actions] }

Sponsored by:	Smule, Inc.
This commit is contained in:
Devin Teske 2018-05-27 22:27:47 +00:00
parent 877c96bedc
commit e08e9e9990
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=334261

View File

@ -47,7 +47,7 @@ DTRACE_PRAGMA="
############################################################ GLOBALS
VERSION='$Version: 1.2 $' # -V
VERSION='$Version: 1.3 $' # -V
pgm="${0##*/}" # Program basename
@ -1353,7 +1353,7 @@ $ACTIONS
}
/*********************************************************/
$PROBE${EVENT_TEST:+ /$EVENT_TEST/} /* probe ID $ID */
$PROBE${EVENT_TEST:+ / $EVENT_TEST /} /* probe ID $ID */
{${TRACE:+
printf("<$ID>");
}