Project Home
Project Home
Trackers
Trackers
Documents
Documents
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - Code Coverage for c++ project: (8 Items)
   
Code Coverage for c++ project  
Hi,

I created c++ project in the Momentics IDE 4.0.1.

I have run that project. When i checked for the code coverage.

I found coverage to be the 90% only.

Please find the attached project folder on which i tried.

The coverage data is as follows:

main : 80%
fun1: 75%
Target_based.cc: 88.9%
 
Here i am running all the lines of code. but still it is showing lesser coverage information

Can any one, give the reason for this?

The same type of  C project  is working fine.Its showing 100% coverage information.

Thanks,
Vijay.
Attachment: Compressed file MyWorkspaceTarget.zip 134.51 KB
Re: Code Coverage for c++ project  
Thanks for attaching your project. We will investigate.

vijay kumar wrote:
> Hi,
> 
> I created c++ project in the Momentics IDE 4.0.1.
> 
> I have run that project. When i checked for the code coverage.
> 
> I found coverage to be the 90% only.
> 
> Please find the attached project folder on which i tried.
> 
> The coverage data is as follows:
> 
> main : 80%
> fun1: 75%
> Target_based.cc: 88.9%
>  
> Here i am running all the lines of code. but still it is showing lesser coverage information
> 
> Can any one, give the reason for this?
> 
> The same type of  C project  is working fine.Its showing 100% coverage information.
> 
> Thanks,
> Vijay.
> 
> _______________________________________________
> QNX Momentics Community Support
> http://community.qnx.com/sf/go/post28591
Re: Code Coverage for c++ project  
Please look at attachment. I used 4.6 IDE, but I think that the same result you will get usiing 4.5 wiith gcc 4.2. 
Attachment: Image Target_based.png 70.3 KB
Re: Code Coverage for c++ project  
Alex,

I am working on Momentics IDE 4.0.1 on QNX System.

I found the problem, It  is with the Launch configuration of the Debug.

When i try to debug the project, its giving the Error while Connecting to Target system.
Its becoming a failure while connecting to the target sytem.
So i am not getting the Code coverage of target system.

I don't know how to connect the target system.

Please let me know how to do this? 
 

Thanks,
Vijay.
Re: Code Coverage for c++ project  
Last time we talked about it you were trying to run it on Windows. Do you have a target system?

vijay kumar wrote:
> Alex,
> 
> I am working on Momentics IDE 4.0.1 on QNX System.
> 
> I found the problem, It  is with the Launch configuration of the Debug.
> 
> When i try to debug the project, its giving the Error while Connecting to Target system.
> Its becoming a failure while connecting to the target sytem.
> So i am not getting the Code coverage of target system.
> 
> I don't know how to connect the target system.
> 
> Please let me know how to do this? 
>  
> 
> Thanks,
> Vijay.
> 
> _______________________________________________
> QNX Momentics Community Support
> http://community.qnx.com/sf/go/post28721
> 
Re: Code Coverage for c++ project  
I have the Target system(QNX 6.4.0).

Now i tried with the same attached project on Momentics IDE 4.5.0 . I got 100% coverage.

When i tried the same project on Momentics on 4.0.1, Its giving as 90% covearage on QNX Host(6.3.2).

But the same project when I used the "cout" instead of "printf's". 

by enabling the "iostream" and "cstdlib" header files instead of "stdio.h"
 
and "stdlib.h" in Momentics 4.5.0

I am not getting the 100% coverage information.


Can you please give the reason for this?


Thaks,
Vijay.
Re: Code Coverage for c++ project  
If you use classes in your C++ program (which is very natural, by the way:-), for gcc 3.x and older (gcc++ ABI)  you 
newer get 100% block(branch) coverage because of gcc++ implementation  specific .  Below is a fragment extracted from < 
http://www.google.ca/search?hl=en&client=firefox-a&rls=org.mozilla%3Aen-US%3Aofficial&q=gcc+c%2B%2B+abi+constructor+two+destructors&btnG=Search&meta= >, which should explain you why it happens.

G++ emits two copies of constructors and destructors.

    In general there are three types of constructors (and destructors).

       1. The complete object constructor/destructor.
       2. The base object constructor/destructor.
       3. The allocating constructor/deallocating destructor.

    The first two are different, when virtual base classes are involved. 

Line coverage should be free of this specific. 
Re: Code Coverage for c++ project  
Thanks a lot, for this sharing this information.


Regards,
Vijay