I recently got familiar with the -pg option for compilers, which makes your program generate profiling information while running. (See: http://www.cs.utah.edu/dept/old/texinfo/as/gprof_toc.html
It works by implicitly putting a small code segment into every function.
Currently I'm debugging a segfault generated by a big application. Doesn't matter how I try, it doesn't generate any cores. Debugging is also out of question as this is part of a much bigger real-time system.
So my idea was to scatter trace information in the code.
Doing this by hand would be very tedious, so I'm looking for a way to make the compiler put output-trace-information-code into every function, just like the -pg does with profiling.
Does anyone has any idea?
Oh, and I'm using g++ 4.1.2.