From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 27211 invoked by alias); 12 Jun 2012 13:12:11 -0000 Received: (qmail 26929 invoked by uid 22791); 12 Jun 2012 13:12:08 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from eos.fwall.u-szeged.hu (HELO eos.fwall.u-szeged.hu) (160.114.120.248) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 12 Jun 2012 13:11:52 +0000 Received: from [192.168.105.4] (helo=esym.fwall.u-szeged.hu) by eos.fwall.u-szeged.hu with esmtp (Exim 4.63) (envelope-from ) id 1SeQsw-0006ad-Cx; Tue, 12 Jun 2012 15:11:50 +0200 Received: from eos.fwall.u-szeged.hu (eos.intra [192.168.105.3]) by esym.fwall.u-szeged.hu (Symantec Messaging Gateway) with SMTP id 0D.93.19690.61047DF4; Tue, 12 Jun 2012 15:11:50 +0200 (CEST) Received: from mail.inf.u-szeged.hu ([160.114.37.227]) by eos.fwall.u-szeged.hu with esmtp (Exim 4.63) (envelope-from ) id 1SeQsw-0006bM-77; Tue, 12 Jun 2012 15:11:50 +0200 Received: from [10.6.11.8] (reni.inf.u-szeged.hu [10.6.11.8]) by mail.inf.u-szeged.hu (Postfix) with ESMTP id 2DD2816A03F0; Tue, 12 Jun 2012 15:11:50 +0200 (CEST) Message-ID: <4FD74016.4020803@inf.u-szeged.hu> Date: Tue, 12 Jun 2012 13:12:00 -0000 From: Renata Hodovan User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: Ian Lance Taylor CC: gcc-help@gcc.gnu.org Subject: Re: Question about instrumenting gcc References: <4FCE31EF.7060307@inf.u-szeged.hu> <4FCE331A.5060702@inf.u-szeged.hu> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-SZTE-local: YES X-SZTE-HU-local: YES X-SZTE-AVcheck: YES X-IsSubscribed: yes Mailing-List: contact gcc-help-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-help-owner@gcc.gnu.org X-SW-Source: 2012-06/txt/msg00109.txt.bz2 Hi Ian, thank you very much your help. I redesigned __cyg_profile_enter and __cyg_profile_exit functions and I stay in the right memory interval. Furthermore I'm using now main_constructor and main_destructor instead of start_test and end_test. The settings of make also seem good, it creates the output of instrumentation that way what I expected. But the compilation failed after a point because it couldn't understand e.g. size_t in filenames.h and a lot of similar errors in files what I haven't touched. I thought, since I add file IO operations to the main.c or linking the instrument file to the project, I distracted somehow the dependency. At this point I tried to compile the gcc --disable-bootstrap but then the instrumentation flag hadn't any results. What is the problem now? :S thanks, Reni On 06/05/2012 09:38 PM, Ian Lance Taylor wrote: > Renata Hodovan writes: > >> I have to instrument gcc for some purposes. The goal is to be able to >> track what GCC functions are called during a particularly >> compile. Unfortunately I'm not really familiar with the architecture >> of GCC so I need a little help. I tried the following steps: >> >> 1) Hacking gcc/Makefile.in and adding "-finstrument-functions" flag to >> T_CFLAGS. >> 2) I have an already implemented and tested version of __start_test__ >> and __end_test__ functions. They are called from gcc/main.c, before >> and after toplev_main() call. The containing file is linked to gcc >> (the object is added to OBJS-common and the dependency is defined >> later in gcc/Makefile.in) >> 3) Downloading prerequisites with contrib/download_prerequisites. >> 4) Executing the configuration from a clean build directory (on the >> same level with the source dir): ./../gcc-4.6.2/configure >> --prefix="/opt/gcc-4.6.2/" --enable-languages="c,c++" >> 5) Starting the build with "make all" >> >> This way I ran out of memory, although I had 28G. > You should not have run out of memory at this step, not with 28G. > Adding -finstrument-functions should not have significantly changed the > memory usage of the build. > > But I suppose you could have run out of memory if your > __cyg_profile_func_enter function uses a lot of memory. If that is the > problem, then that is what you will have to fix. > > >> Next I tried to remove the T_CFLAGS settings from the Makefile and >> gave -finstrument-functions to the make command: >> make CFLAGS+="-finstrument-functions" all > This won't build the compiler itself with -finstrument-functions. For > that you need to use > make BOOT_CFLAGS="-g -O2 -finstrument-functions" > > Ian