Gcov can39t open source file while using it in Android AOSP

De openkb
Aller à : Navigation, rechercher

Sommaire

Questions

I have following AOSP project setup

1) I have test.cpp in (AOSP root directory)/vendor/myProject/test.cpp

2) In Android.mk i have used

  LOCAL_CFLAGS += -g -fprofile-arcs -ftest-coverage
  LOCAL_LDFLAGS += -lgcov

3) When I compile the code i get test.gcno in:

 (AOSP root directory)/out/target/product/generic/obj/EXECUTABLES/myProject_intermediates

4) Then i put the test on device (adb sync)

5) Then on device i have used following:

   export GCOV_PREFIX=/vendor
export GCOV_PREFIX_STRIP=13 (to strip down the un-necessary path)

6) I run the test ./system/bin/test and i get test.gcda file on

  device (shell) /vendor/test.gcda

7) I copy the test.gcda (from device) to my build directory (/out/target/product/generic/obj/EXECUTABLES/myProject_intermediates) where i already have test.gcno

8) Now i am in /out/target/product/generic/obj/EXECUTABLES/myProject_intermediates Then run gcov as follows:

(AOSP root directory)/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcov test

For this i get output as follows:

File vendor/myProject/test.cpp Lines executed:23.00% of 223 vendor/myProject/test.cpp:creating test.cpp.gcov vendor/myProject/test.cpp:cannot open source file

Can anybody help me on how to solve this. It says test.cpp:cannot open source file gcov is not generating complete report. I have also checked -b option by specifying the path to source as follows:

(AOSP root directory)/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcov -b (AOSP root directory)/vendor/myProject test

It didn t worked.

I guess the problem is because of distributed files (gcno,gcda,test.cpp) in different directories.

Thanks

Answers

Hi even i wanted to do same thing like u..Even i got the same problem..

I solved this problem..

Solution is while building the test in which directory u were u should be in the same directory while running gcov later...then all the .gcov files will be created successfully...

For Eg:

project directory : android/frameworks/Myproj in this u have test.cpp & Android.mk

then say suppose from android directory u ll build the app or test.cpp i.e android$

then *.gcno files will be present in android/out/Myproj_Intermediates/

u will get the *.gcda files by running app in device & u will bring that *.gcda files from device to folder android/out/Myproj_intermediates/

Now to run gcov on these

u should be in the android directory (since u built app from there)

android$ ./prebuilts/gcc/linux-x86/arm/arm-eabi-4.6/bin/arm-eabi-gcov -o out/Myproj_intermediates/ -a frameworks/Myproj/test.cpp -b -c

Hope this solves ur problem...Enjoy

Source

License : cc by-sa 3.0

http://stackoverflow.com/questions/17277518/gcov-cant-open-source-file-while-using-it-in-android-aosp

Related

Outils personnels
Espaces de noms

Variantes
Actions
Navigation
Outils