[GCC-XML] C++ Function Definitions

Sandeep Kakarlapudi sandeep.iitkgp at gmail.com
Wed May 2 08:35:04 EDT 2007


Brad King wrote:
> I suggest you use the line numbers just to start a search for a
> definition, but still use something else to finalize the decision about
> adding code.

Yes of course. I have to do the search anyway to find the location of
the '{' and besides I need to handle the case when there is no
definition of the function but another declaration in the source file.

> Out of curiosity, what do you want to add to the beginning of every
> function?

One can add code to the functions one is interested in (not
necessarily all functions) to print debug messages. By creating an
object on the stack at the beginning of every function and by making
its constructor and destructor push and pop function names off a
stack, we have a simple stack trace that the application can use to
associate with certain events in the application. Perhaps simple
profiling, resource locking could be done too.

Another thing I am looking at is wildcard function breakpoints. The
breakpoints can be enabled before application startup or they can be
dynamically changed using a helper application. The inserted code
retrieves the current breakpoint state and if the breakpoint for the
current function is enabled it traps to the debugger. I hope this will
be helpful while debugging libraries which are used by large
applications.

Some of the above described functionality is provided by some compiler
tool chains but not all AFAICS. I have to see if this any of this
compiler tool chain independent functionality will prove useful in
practice :)

Thanks!
Sandeep

------------------------
Sandeep Kakarlapudi
http://sandeep.iitkgp.googlepages.com/projects



More information about the gccxml mailing list