summaryrefslogtreecommitdiff
path: root/sys/src/cmd/dtracy
diff options
context:
space:
mode:
authoraiju <devnull@localhost>2018-12-13 10:42:49 +0000
committeraiju <devnull@localhost>2018-12-13 10:42:49 +0000
commitc7304ea03caf68cf035d14f50f6e24e0c16ccdfe (patch)
treef4b5e8047078c41caa0d98cc0ea3d5012c4d17f9 /sys/src/cmd/dtracy
parentdae5a44111dfb21a714824a5cec2abee4f9f9080 (diff)
dtracy: get rid of DTName struct, support more than three parts in a probe name, wildcard matching
Diffstat (limited to 'sys/src/cmd/dtracy')
-rw-r--r--sys/src/cmd/dtracy/act.c24
-rw-r--r--sys/src/cmd/dtracy/parse.y8
2 files changed, 29 insertions, 3 deletions
diff --git a/sys/src/cmd/dtracy/act.c b/sys/src/cmd/dtracy/act.c
index 3412382c3..dde47ae57 100644
--- a/sys/src/cmd/dtracy/act.c
+++ b/sys/src/cmd/dtracy/act.c
@@ -41,6 +41,28 @@ mkval(int type, ...)
return r;
}
+static char *
+insertstars(char *n)
+{
+ Fmt f;
+ int partlen;
+
+ fmtstrinit(&f);
+ partlen = 0;
+ for(; *n != 0; n++){
+ if(*n == ':'){
+ if(partlen == 0)
+ fmtrune(&f, '*');
+ partlen = 0;
+ }else
+ partlen++;
+ fmtrune(&f, *n);
+ }
+ if(partlen == 0)
+ fmtrune(&f, '*');
+ return fmtstrflush(&f);
+}
+
void
clausebegin(void)
{
@@ -52,7 +74,7 @@ void
addprobe(char *s)
{
clause->probs = erealloc(clause->probs, sizeof(char *) * (clause->nprob + 1));
- clause->probs[clause->nprob++] = strdup(s);
+ clause->probs[clause->nprob++] = insertstars(s);
}
static char *aggtypes[] = {
diff --git a/sys/src/cmd/dtracy/parse.y b/sys/src/cmd/dtracy/parse.y
index 81a57f79b..893d6dac3 100644
--- a/sys/src/cmd/dtracy/parse.y
+++ b/sys/src/cmd/dtracy/parse.y
@@ -19,6 +19,7 @@
%type <n> expr optexpr
%type <sym> optsym
%type <t> type
+%type <str> probe
%token <sym> TSYM
%token <num> TNUM
@@ -119,8 +120,11 @@ type:
| TSTRING { $$ = type(TYPSTRING); }
probes:
- TSYM { addprobe($1->name); }
- | probes ',' TSYM { addprobe($3->name); }
+ probe { addprobe($1); }
+ | probes ',' probe { addprobe($3); }
+probe:
+ TSYM { $$ = $1->name; }
+ | TSTR { $$ = $1; }
%%