top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

GCC --coverage help, few lines of code are covering and others not.

0 votes
158 views

While collecting coverage of code, I found few lines of code are covering and others not.
Ex :-
1. If function definiton is not covered, then lines within that functions are covered.
2. Function return statement is covering, even if functions has already returned from if/else conditions.
3. How the branch code is calculated ?. I found some time if(strcmp()), considering 5 branch some time 3
branches.

Could you anybody please explain me internal implementation of gcov or any link. I went through the gcc/coverage.c and other files, could not get much information

posted Jul 2, 2013 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
+1 vote
  1. GCC is available in several variations (SJLJ, DW2, SEH). When compiling plain C code (therefore either assuming or explicitly specifying -fno-exceptions), does it make any difference which GCC variation is used?

  2. Further I assume, that if my plain C code was to link to a C++ library which may throw exceptions, then it would matter which GCC variation I use. In that case, I should use the GCC variation that matches with the C++ code exception flavour, I should enable -fexceptions when compiling my plain C code, and the exceptions could
    then propagate over the C code?

+1 vote

My current compiler settings are

arm-none-eabi-gcc -Wall -mfpu=fpv4-sp-d16 -mfloat-abi=softfp -fshort-double-mcpu=cortex-m4 -mthumb -Qn -Os -finstrument-functions -mlong-calls -c temp.c -o temp.o
so on for temp1, temp2... Etc

I am compiling multiple C files. and linker settings are

ld -r temp.o -o one.o
so on for temp1, temp2... Etc

I am linking multiple .O files. Also I am using linker script i.e link.txt (invoked externally as below)

ld -cref -Map map.txt -S -T link.txt -temp.o -lm -lc -lgcc
arm-none-eabi-gcc -Wall sample.o -O Firmware.abs

Now, At output I get .abs file of 140KB.

My Questions are
1. How to optimize (reduce size of .abs) by using compiler or linker specific options?
2. There are Number of NOT used global variables and Blank Function Calls in my C files (NO Dead Code!!!!). Is it possible to perform some link time optimization.
3. Please Elaborate as I am new to this, I have referred sites, gcc help and tried some "lto" options but NO reduction is size.
4. I also tried using -fdata-sections -ffunction-sections
But It has INCREASED my firmware.abs file size from KB to MB (yes it is MB!!!!) I also wondered WHY?
I am using codesourcery arm toolchain evaluation. It has gcc version 4.5.2

0 votes

When I was building GCC, I found out that stage1-gcc is not compiled with optimization (such as -O2). So the compilation of stage2 is very slow. Is this intended or not? If not, did I made some mistakes in configure options and caused this?

+2 votes

I am getting following error when compiling my program with gcc version 4.9.0

gcc --version
gcc (GCC) 4.9.0 20131023 (experimental)

Error

./A.out: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by ./A.out)

But I gcc 4.7.3 is fine. Any guess why this may be happening.

+1 vote

I wanted to ask what is the GCC C++ equivalent implementation of Windows _ MyFirst and _MyLast vector pointers?

These give direct access to the vectors first and last element, but they are not present in the GCC implementation of the vector class.

...