[cfe-dev] 'recording' program execution w/clang
Edward Peschko
horos11 at gmail.com
Mon Nov 3 15:51:43 PST 2008
All,
I had a question with regards to clang - ie whether or not it was
suited for the following.
Right now, I have a very, very hackish set of perl modules which
instrument my c and c++ code with tracing code, per step via macros.
ie: I start out with -
main()
{
fprintf(stderr, "HERE\n");
}
and end up with
__pa1(main())
__pe1({)
__pf1(fprintf(stderr, "HERE\n");)
__pe1(})
The purpose of these macros is to print out the code steps as they are
executing, and to record stack entrances and exits.
Right now, it all works fairly well and is great for debugging, but I
would like to deprecate supporting it in favor of something more
standard. And I would like to implement what I have already
implemented in perl - namely reverse watchpoints - where you give the
value of the variables you are looking for when a piece of c executes,
and it watches ALL assignments and reports on which variables match
these values. This is especially good for untangling large object
hierarchies, and I was hoping to have the same power in C/C++ that I
do in perl.
But as it stands, my hack-of-a-perl-module to do this is reaching the
point of no return - it's not a true parser, so the more I add to it,
the more likely it is to break something elsewhere - and in any case a
c solution would probably be a lot faster.
So - does this sound like something clang could do easily? And, more
to the point, does something like this already exist?
Thanks much,
Ed
More information about the cfe-dev
mailing list