[antlr-interest] C/C++ instrumentation tool

Andy Tripp atripp at jazillian.com
Mon Jun 20 07:25:08 PDT 2005


>
>
>Do you want to instrument every assignment so that
>file/line/value/variable is displayed?  That sounds a bit invasive if
>you instrumenet the objects - really the only way to get at the
>post-assignment values.  On the other hand, hijacking assignment and
>just value assigned might be much simpler.
>  
>
The code I'm looking at is really C - no OO or C++ features whatsoever.

>Using ANTLR to instrument all "=" assignments should work, and allow a
>diff of the output streams to show you where the programs diverge
>(assuming they are *identical* implementations, rather than the same
>algorithm).  I've done this kind of instrumentation before (with sed,
>or with vi) and it is quite helpful.
>
>Using ANTLR to instrument all setter methods so they they report the
>value of an object member after modification is probably fairly
>difficult, as just recognizing setter functions is hard.
>
>As a third option, using ANTLR to transform either C++ or java into a
>gdb input script that watches the variables might be easy - I've never
>thought about doing that, but it might be useful for what you are
>describing.
>  
>
But is there a way to tell gdb to "keep running but print out every 
variable assignment"?
I didn't see any way to do that.

>Sorry to wander a bit, but I don't understand how you are considering
>using ANTLR to address the problem you raise.
>



More information about the antlr-interest mailing list