[cfe-dev] 'recording' program execution w/clang

steve naroff snaroff at apple.com
Mon Nov 3 16:15:37 PST 2008


Hi Ed,

I'm not aware of any clang application that does what you want.

If you want to accomplish this as a source-to-source rewriter, then  
you can try using the rewriter infrastructure.

See RewriteObjC and RewriteBlocks for a couple applications of our  
Rewriter infrastructure.

If you dive into these and have any questions, let me know.

snaroff

On Nov 3, 2008, at 6:51 PM, Edward Peschko wrote:

> 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
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev




More information about the cfe-dev mailing list