This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Log every call and exit in embedded system


John Zoidberg wrote:
Is this the only way? Can anyone give me any suggestions or hints?

The way profiling works is that the compiler inserts a call to a function (mcount?) at each function call (*). I'm not sure on the precise rules for this, or whether it varies between target types, but these are details that you can certainly dig up from somewhere.


If you provide your own implementation for this function then it can do anything you like. Printing a call graph at run time should not be too hard (though it may be tricky if your print mechanisms are also instrumented).

* It typically also adds some kind of interrupt to count to time spent in various parts of the program, but that is probably not interesting here.

Hope that helps,

Andrew


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]