11 Jun 2012 17:58
dtrace vs. lex
Chuck Silvers <chuq <at> chuq.com>
2012-06-11 15:58:02 GMT
2012-06-11 15:58:02 GMT
dtrace's use of lex sometimes gets confused about EOF. the flex-generated code does some fancy stuff with EOF that I haven't looked at enough to completely understand yet, and can result in the last of several calls to yyparse() that is made to set up the dtrace library state thinking that the string it's trying to parse is empty, which leads dtrace to give a bogus error. I think what needs to be done is call yyrestart() before each subsequent call to yyparse(), and the attached patch does allow dtrace to work on a script that previously failed. is this the right way to deal with this? -Chuck
Index: src/external/cddl/osnet/dist/lib/libdtrace/common/dt_cc.c =================================================================== RCS file: /home/chs/netbsd/cvs/src/external/cddl/osnet/dist/lib/libdtrace/common/dt_cc.c,v retrieving revision 1.2 diff -u -p -r1.2 dt_cc.c --- src/external/cddl/osnet/dist/lib/libdtrace/common/dt_cc.c 21 Feb 2010 00:49:54 -0000 1.2 +++ src/external/cddl/osnet/dist/lib/libdtrace/common/dt_cc.c 11 Jun 2012 15:44:46 -0000 <at> <at> -2216,6 +2216,7 <at> <at> dt_compile(dtrace_hdl_t *dtp, int contex * will longjmp back to pcb_jmpbuf to abort. If parsing succeeds, * we optionally display the parse tree if debugging is enabled. */ + yyrestart(pcb.pcb_fileptr); if (yyparse() != 0 || yypcb->pcb_root == NULL) xyerror(D_EMPTY, "empty D program translation unit\n");(Continue reading)
RSS Feed