This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: Log every call and exit in embedded system
- From: Andrew STUBBS <andrew dot stubbs at st dot com>
- To: John Zoidberg <the dot real dot doctor dot zoidberg at gmail dot com>
- Cc: gdb at sourceware dot org
- Date: Mon, 26 Mar 2007 11:03:43 +0100
- Subject: Re: Log every call and exit in embedded system
- References: <adbca6b50703241305v7ed29ad6k98ebd64c369271d8@mail.gmail.com>
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