Re: function instrumentation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



ratheesh kannoth <ratheesh.ksz@xxxxxxxxx> writes:

> I would like to instrument cpp file using finstrument functions. I
> have written all the files and build script.
> I noticed that  - the moment i add   iostream header file into
> test.cpp file , the program segmentaion faults.

> void __cyg_profile_func_enter (void *func,  void *caller)
> {
>      helloworld() ;
> }

> int   helloworld ()
> {
>   std::cout << "hello " ;
> }

The compiler inserts a call to your profiling function before every
function.  Your profiling function calls std::cout::operator<<.  That
function inlined into your code from <iostream.h>, and the compiler
inserts a call to the profiling function at the start of it.  Thus you
have an infinite recursion and your program crashes when it overruns the
stack.

Ian


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux