From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16591 invoked by alias); 22 Nov 2012 07:50:05 -0000 Received: (qmail 16505 invoked by uid 22791); 22 Nov 2012 07:50:01 -0000 X-SWARE-Spam-Status: No, hits=-0.0 required=5.0 tests=BAYES_00,SPF_SOFTFAIL,TW_GC,URI_HEX X-Spam-Check-By: sourceware.org Received: from sam.nabble.com (HELO sam.nabble.com) (216.139.236.26) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 22 Nov 2012 07:49:56 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1TbRXn-00056F-4w for gcc-help@gcc.gnu.org; Wed, 21 Nov 2012 23:49:55 -0800 Date: Thu, 22 Nov 2012 07:50:00 -0000 From: IAMTubby To: gcc-help@gcc.gnu.org Message-ID: <1353570594528-890705.post@n5.nabble.com> Subject: gcda files not getting formed from gcov MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit 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-11/txt/msg00171.txt.bz2 Hi, I understand this question is very specific to gcov, but I would like to go ahead and ask as I have been stuck for a long time. [u][b]My scenario is as follows[/b][/u] 1. My code contains an app folder and a lib folder. The lib folder contains a shared library called libcli.so 2. On building, gcno files are created for files both in the app and lib folder 3. This application is then run(executed) on a powerpc architecture. 4. On running, gcda files are created only for those source files which reside in the app folder, but not for those source files in the lib folder. 5. a) On executing gcov for a source file from within the app folder [u]Assume that main.c exists within the app folder[/u] [code] #gcov main.c File '/home/projects/src/main.c' Lines executed:61.19% of 67 [/code] b) On executing gcov for a source file from within the lib folder(constituent of libcli.so) [U]Assume that getfile.c exists within the lib folder[/U] [code] #gcov getfile.c File '/home/projects/src/getfile.c' Lines executed:0.00% of 27 /home/projects/src/getfile.c :creating 'getfile.c.gcov'[/code] As you can see, it says 0.00% because the corresponding .gcda file is not created. [u][b]Common mistakes I have taken care of and learnt from other forums[/b][/u] 1. Yes, I have run the executable in a way(with appropriate arguments) such that the code in getfile.c gets called. I'm running the executable on the powerpc from a local folder. The .gcda files do not get created here for getfile.c but main.gcda gets created here. 2. I have checked if the .gcda's are created in the .libs folder. No it's not. 3. I have created the same file chain on the target powerpc machine as is on the host machine where code was compiled in case it was expecting this path. 4. I have checked if I have write permission for the .libs folder. Yes I have. 5. I have flashed the libcli.so on the target PC. 6. I have added -fprofile-arcs --coverage on both the CFLAGS as well as LDFLAGS My Makefiles in both the app as well as lib folder look as follows [code] CFLAGS+= -fprofile-arcs -ftest-coverage --coverage LDFLAGS+= --cref --warn-common -shared -nostdlib -Wl,-Bsymbolic --fprofile-arcs . . . . $(LIBFILE) : $(OBJS) $(LINK) $(LDFLAGS) /home/projects/toolchain/ppc_4xx/usr/lib/gcc/ppc-linux/4.2.2/libgcov.a \ --retain-symbols-file,$(SYMFILE) \ -Wl,-soname,$(LIBFILE) \ -Wl,-Map,$(MAPFILE) \ -o $@ \ $(OBJS) \ $(LIBS) /home/projects/toolchain/ppc_4xx/usr/lib/gcc/ppc-linux/4.2.2/libgcov.a [/code] 7.I didn't quite understand how to use these 2 environment variables. Please refer [url]http://gcc.gnu.org/onlinedocs/gcc/Cross_002dprofiling.html#Cross_002dprofiling[/url] [b][u]Some important paths[/u][/b] 1. All the sources files on the x86 pc are on : /home/projects/map/src/cli 2. Code is getting built on the x86 pc from : /home/projects/map/build/cli/lib/linux 3. I's running the executable on the powerpc from : /tmp(I have copied main.gcno and getfile.gcno here and have copied main.c and getfile.c into /home/projects/map/src/cli on the powerpc. (Yes I created the same path on the powerpc). Please advise. -- View this message in context: http://gcc.1065356.n5.nabble.com/gcda-files-not-getting-formed-from-gcov-tp890705.html Sent from the gcc - Help mailing list archive at Nabble.com.