From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23667 invoked by alias); 27 Mar 2007 11:07:42 -0000 Received: (qmail 23649 invoked by uid 22791); 27 Mar 2007 11:07:41 -0000 X-Spam-Check-By: sourceware.org Received: from py-out-1112.google.com (HELO py-out-1112.google.com) (64.233.166.183) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 27 Mar 2007 12:07:33 +0100 Received: by py-out-1112.google.com with SMTP id p76so1136768pyb for ; Tue, 27 Mar 2007 04:07:32 -0700 (PDT) Received: by 10.35.66.1 with SMTP id t1mr14060197pyk.1174993650750; Tue, 27 Mar 2007 04:07:30 -0700 (PDT) Received: by 10.35.73.12 with HTTP; Tue, 27 Mar 2007 04:07:30 -0700 (PDT) Message-ID: Date: Tue, 27 Mar 2007 11:07:00 -0000 From: "John Zoidberg" To: "mathieu lacage" , "Andrew STUBBS" , gdb@sourceware.org Subject: Re: Log every call and exit in embedded system In-Reply-To: <1174904601.2370.5.camel@mathieu> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <46079A7F.4020308@st.com> <1174904601.2370.5.camel@mathieu> Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2007-03/txt/msg00323.txt.bz2 On 3/26/07, mathieu lacage wrote: > 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 *call_site); > void __cyg_profile_func_exit (void *this_fn, > void *call_site); I'll investigate this further. With embedded systems there are always issues... but I think I can use these functions to log to a buffer the address of the called functions (and then look them up). > > 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). > > I actually wrote a tool to do this: http://cutebugs.net/bozo-profiler/ > > Mathieu Your tool seems very interesting, it's unfortunate it's not ready for embedded systems. On the documentation you mention malloc, but some embedded systems don't have the code for malloc. Moreover, no embedded system uses glibc, it uses newlib, uclib, and others... this means that the code that is linked may not have the support for it (i.e. there are missing functions). There is the issue of the target code (the part that is linked to the application) must be compiled with the corresponding GCC (for the target system). And besides all this, there is the issue of where to log the information or how to send it. Thanks!