Anton's fix for parsing of syscall names that are also tokens in the btrace
grammar broke parsing of 'profile:hz:number', because it forces 'hz' to be
handled as a string rather than a token. I can't see how we'd ever end up
with a syscall named 'hz', so one way we could fix this would be to exclude
the HZ token from the lexer backdoor.
ok?
Index: bt_parse.y
===================================================================
RCS file: /cvs/src/usr.sbin/btrace/bt_parse.y,v
retrieving revision 1.20
diff -u -p -r1.20 bt_parse.y
--- bt_parse.y 11 Dec 2020 07:27:55 -0000 1.20
+++ bt_parse.y 8 Jan 2021 21:37:53 -0000
@@ -792,10 +792,14 @@ again:
/*
* Probe lexer backdoor, interpret the token as a string
* rather than a keyword. Otherwise, reserved keywords
- * would conflict with syscall names.
+ * would conflict with syscall names. The exception to
+ * this is 'hz', which hopefully will never be a
+ * syscall.
*/
- yylval.v.string = kwp->word;
- return STRING;
+ if (kwp->token != HZ) {
+ yylval.v.string = kwp->word;
+ return STRING;
+ }
}
yylval.v.i = kwp->type;
return kwp->token;