[antlr-interest] code instrumentation with Monty's C grammar
daniel_raichle
daniel.raichle at etas.de
Thu Dec 4 05:42:31 PST 2003
Hi All,
I have to do C-code instrumentation to measure the decision coverage
of a software. I think Monty's C-grammar is the right thing for me. I
think I could do the instrumentation with some changes in the
GnuCEmitter.g file, eg. I could change the rule in the grammar where
the if-clause is printed.
Example:
// Selection statements:
| #( i:"if" { print( i ); print( "(" ); }
expr { print( ")" ); print("{ counter++; "); }
statement { print("}");}
( e:"else" { print( e ); print( "(" ); }
statement { print("}");}
)?
)
But I have one big problem: I must not instrument all the functions
and all the if-statements in the software. There are some functions
with a special function name (eg. _L1_...) that should not be
instrumented. And there are some special if-statements with
automatically generated code that prevents from divisions by 0.
Is it possible to check for the functionname or the content of the
if-expression before instrumenting the if-statement? What do I have to
change? Can you please give me an example?!
Thank you very much!
P.S.: Sorry for my bad English!
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list