onkar has asked for the wisdom of the Perl Monks concerning the following question:

I am writing a script to parse C file containing functions. for each function , I have to add logs at 2 places : (1) when the func is entered (2) when func is exiting. I tried it , it even worked with a fairly complex regex , but it sometimes adds logs in struct,if,else,while blocks. Does anyone have any idea as to such thing already existing in Perl ?

Replies are listed 'Best First'.
Re: parsing C functions.
by Anonymous Monk on Jun 15, 2009 at 06:55 UTC
Re: parsing C functions.
by Jenda (Abbot) on Jun 15, 2009 at 23:37 UTC

    Modifying the source code looks pretty dangerous to me. Most likely you should use a profiler instead, it should be able to do the logging. It would be best though to ask elsewhere. This is a site about Perl, not C.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.

A reply falls below the community's threshold of quality. You may see it by logging in.