This is the mail archive of the
mailing list for the GDB project.
Re: Log every call and exit in embedded system
- From: mathieu lacage <Mathieu dot Lacage at sophia dot inria dot fr>
- To: Andrew STUBBS <andrew dot stubbs at st dot com>
- Cc: John Zoidberg <the dot real dot doctor dot zoidberg at gmail dot com>, gdb at sourceware dot org
- Date: Mon, 26 Mar 2007 12:23:21 +0200
- Subject: Re: Log every call and exit in embedded system
- References: <email@example.com> <46079A7F.firstname.lastname@example.org>
On Mon, 2007-03-26 at 11:03 +0100, Andrew STUBBS wrote:
> 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.
with gcc, -finstrument-functions
generates calls to:
void __cyg_profile_func_enter (void *this_fn,
void __cyg_profile_func_exit (void *this_fn,
> 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
I actually wrote a tool to do this: http://cutebugs.net/bozo-profiler/