<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>change log for rtems-testing (2011-12-02)</title>
</head>
<body text='#000000' bgcolor='#ffffff'>
<a name='cs1'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-12-01 Joel Sherrill <joel.sherrill@oarcorp.com>

        * jmr3904.in: Add Data Bus Error to detected faults to exit simulator
        on.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/sim-scripts/ChangeLog.diff?r1=text&tr1=1.106&r2=text&tr2=1.107&diff_format=h">M</a></td><td width='1%'>1.107</td><td width='100%'>sim-scripts/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/sim-scripts/jmr3904.in.diff?r1=text&tr1=1.7&r2=text&tr2=1.8&diff_format=h">M</a></td><td width='1%'>1.8</td><td width='100%'>sim-scripts/jmr3904.in</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems-testing/sim-scripts/ChangeLog:1.106 rtems-testing/sim-scripts/ChangeLog:1.107
--- rtems-testing/sim-scripts/ChangeLog:1.106   Sun Nov  6 10:55:26 2011
+++ rtems-testing/sim-scripts/ChangeLog Thu Dec  1 13:12:53 2011
</font><font color='#997700'>@@ -1,3 +1,8 @@
</font><font color='#000088'>+2011-12-01    Joel Sherrill <joel.sherrill@oarcorp.com>
+
+       * jmr3904.in: Add Data Bus Error to detected faults to exit simulator
+       on.
+
</font> 2011-11-06        Joel Sherrill <joel.sherrill@oarcorp.com>
 
        * uC5282.in: Use grep -E rather rather than egrep as Open Group has

<font color='#006600'>diff -u rtems-testing/sim-scripts/jmr3904.in:1.7 rtems-testing/sim-scripts/jmr3904.in:1.8
--- rtems-testing/sim-scripts/jmr3904.in:1.7    Mon Oct 12 16:16:23 2009
+++ rtems-testing/sim-scripts/jmr3904.in        Thu Dec  1 13:12:53 2011
</font><font color='#997700'>@@ -16,7 +16,10 @@
</font>   exceptionExit=$?
   grep "^mips-core: " ${logfile}
   badAccessExit=$?
<font color='#880000'>-  if [ $badAccessExit -eq 0 -o $exceptionExit -eq 0 ] ; then
</font><font color='#000088'>+  grep "Data Bus Error" ${logfile}
+  dataBusError=$?
+  if [ $badAccessExit -eq 0 -o $exceptionExit -eq 0 -o \
+       $dataBusError -eq 0 ] ; then
</font>     return 1
   fi
   return 0
</pre>
<p> </p>
<a name='cs2'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-12-01 Joel Sherrill <joel.sherrill@oarcorp.com>

        * do_one: If a secondary language fails to build, do not abort build but
        continue on and attempt other secondary languages.
        Clean up arguments to rundeja to reflect clean up in that script.
        * rtems_gcc_main.c: Add /tmp directory and file support so more tests pass.
        Make sure argc/argv are correctly setup.
        * rtems_gcj_init.c: Add comment.
        * rundeja: Consolidate similar cases to eliminate duplication.
        * test_driver: Install autotools if autoconf is not at install point.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/gcc/ChangeLog.diff?r1=text&tr1=1.24&r2=text&tr2=1.25&diff_format=h">M</a></td><td width='1%'>1.25</td><td width='100%'>gcc/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/gcc/do_one.diff?r1=text&tr1=1.26&r2=text&tr2=1.27&diff_format=h">M</a></td><td width='1%'>1.27</td><td width='100%'>gcc/do_one</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/gcc/rtems_gcc_main.c.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>gcc/rtems_gcc_main.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/gcc/rtems_gcj_init.c.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>gcc/rtems_gcj_init.c</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/gcc/rundeja.diff?r1=text&tr1=1.17&r2=text&tr2=1.18&diff_format=h">M</a></td><td width='1%'>1.18</td><td width='100%'>gcc/rundeja</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/gcc/test_driver.diff?r1=text&tr1=1.24&r2=text&tr2=1.25&diff_format=h">M</a></td><td width='1%'>1.25</td><td width='100%'>gcc/test_driver</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems-testing/gcc/ChangeLog:1.24 rtems-testing/gcc/ChangeLog:1.25
--- rtems-testing/gcc/ChangeLog:1.24    Sun Nov  6 09:35:35 2011
+++ rtems-testing/gcc/ChangeLog Thu Dec  1 13:17:33 2011
</font><font color='#997700'>@@ -1,3 +1,14 @@
</font><font color='#000088'>+2011-12-01    Joel Sherrill <joel.sherrill@oarcorp.com>
+
+       * do_one: If a secondary language fails to build, do not abort build but
+       continue on and attempt other secondary languages.
+       Clean up arguments to rundeja to reflect clean up in that script.
+       * rtems_gcc_main.c: Add /tmp directory and file support so more tests pass.
+       Make sure argc/argv are correctly setup.
+       * rtems_gcj_init.c: Add comment.
+       * rundeja: Consolidate similar cases to eliminate duplication.
+       * test_driver: Install autotools if autoconf is not at install point.
+
</font> 2011-11-06        Joel Sherrill <joel.sherrill@oarcorp.com>
 
        * do_one: do_cleanup defaults to "no".

<font color='#006600'>diff -u rtems-testing/gcc/do_one:1.26 rtems-testing/gcc/do_one:1.27
--- rtems-testing/gcc/do_one:1.26       Sun Nov  6 09:35:35 2011
+++ rtems-testing/gcc/do_one    Thu Dec  1 13:17:34 2011
</font><font color='#997700'>@@ -592,7 +592,6 @@
</font>     echo "Failed to install GCC C/C++ .. bailing"
     exit 1
   fi
<font color='#880000'>-
</font> }
 
 if [ ${do_stage1} = "yes" ] ; then
<font color='#997700'>@@ -647,13 +646,15 @@
</font>   cd ..
   if [ $status -ne 0 ] ; then
     echo "Failed building RTEMS for ${cpuArg}/${bspArg}"
<font color='#880000'>-    exit $status
</font><font color='#000088'>+    if [ ${bspArg} != "multilib" ] ; then
+      exit $status
+    fi
</font>   fi
 }
 
 if [ ${do_rtems} = "yes" ] ; then<span style="background-color: #FF0000"> </span>
   echo "Building RTEMS for ${cpu} ${bsp} ..."
<font color='#880000'>-  time j_rtems ${cpu} multilib >${LOGDIR}/${cpu}-rtems-multilib.log 2>&1
</font><font color='#000088'>+  time j_rtems ${cpu} multilib ${bsp} >${LOGDIR}/${cpu}-rtems-multilib.log 2>&1
</font>   if [ $? -ne 0 ] ; then
     echo "Failed to build RTEMS multilib for ${cpu}"
     exit 1
<font color='#997700'>@@ -828,7 +829,7 @@
</font>   make install
   status=$?
   if [ $status -ne 0 ] ; then
<font color='#880000'>-    echo "Failed building Ada"
</font><font color='#000088'>+    echo "Failed building Ada - continuing to next secondary language"
</font>   fi
   return $status
 }
<font color='#997700'>@@ -917,9 +918,9 @@
</font>   make install
   status=$?
   if [ $status -ne 0 ] ; then
<font color='#880000'>-    echo "Failed building Go"
</font><font color='#000088'>+    echo "Failed building Go - continuing to next secondary language"
</font>   fi
<font color='#880000'>-  exit $status
</font><font color='#000088'>+  return $status
</font> }
 
 go_fail="no"
<font color='#997700'>@@ -986,7 +987,6 @@
</font> if [ ${do_gccgo} = "yes" ] ; then<span style="background-color: #FF0000"> </span>
   test ${do_cleanup} = "yes" && rm -rf ${BUILDDIR}/b-${cpu}-go
 fi
<font color='#880000'>-exit 0
</font> 
 ##### Build a GCJ compiler now that we have a cross installed
 j_gcj()
<font color='#997700'>@@ -1031,9 +1031,9 @@
</font>   make install
   status=$?
   if [ $status -ne 0 ] ; then
<font color='#880000'>-    echo "Failed building GCJ"
</font><font color='#000088'>+    echo "Failed building GCJ - continuing to next secondary language"
</font>   fi
<font color='#880000'>-  exit $status
</font><font color='#000088'>+  return $status
</font> }
 
 gcj_fail="no"
<font color='#997700'>@@ -1054,7 +1054,7 @@
</font>      -d ${BASEDIR}/b-${cpu}-gcj -a ${gcj_fail} = "no" ] ; then
   echo "Running libjava DejaGNU tests..."
   cd ${BASEDIR}/b-${cpu}-gcj || exit 1
<font color='#880000'>-  time sh -x ${SCRIPTDIR}/gcc/rundeja ${bsp} libjava \
</font><font color='#000088'>+  time sh -x ${SCRIPTDIR}/gcc/rundeja ${bsp} java \
</font>     >${LOGDIR}/${cpu}-libjavatests-${bsp}.log 2>&1
 
   RDIR=${RESULTSDIR}/${TARGET}-${bsp}/`date +%Y-%m-%d-%H-%M-%S`
<font color='#997700'>@@ -1096,9 +1096,9 @@
</font>   make install
   status=$?
   if [ $status -ne 0 ] ; then
<font color='#880000'>-    echo "Failed building FORTRAN"
</font><font color='#000088'>+    echo "Failed building FORTRAN - continuing to next secondary language"
</font>   fi
<font color='#880000'>-  exit $status
</font><font color='#000088'>+  return $status
</font> }
 
 fortran_fail="no"

<font color='#006600'>diff -u rtems-testing/gcc/rtems_gcc_main.c:1.2 rtems-testing/gcc/rtems_gcc_main.c:1.3
--- rtems-testing/gcc/rtems_gcc_main.c:1.2      Tue Jan 20 16:16:52 2009
+++ rtems-testing/gcc/rtems_gcc_main.c  Thu Dec  1 13:17:34 2011
</font><font color='#997700'>@@ -1,6 +1,7 @@
</font><font color='#880000'>-/*  Init
- *
- *  COPYRIGHT (c) 1989-2008.
</font><font color='#000088'>+/*
+ *  Main for GCC Tests
+ *<span style="background-color: #FF0000">  </span>
+ *  COPYRIGHT (c) 1989-2011.
</font>  *  On-Line Applications Research Corporation (OAR).
  *
  *  The license and distribution terms for this file may be
<font color='#997700'>@@ -11,8 +12,23 @@
</font>  */
 
 #include <rtems.h>
<font color='#000088'>+#include <sys/stat.h>
+#include <sys/types.h>
+
+/*
+ * Set up first argument
+ */
+static int   argc     = 1;
+static char  arg0[20] = "rtems";
+static char *argv[20] = { arg0 };
</font> 
<font color='#880000'>-int main( int, char **, char **);
</font><font color='#000088'>+int main(int argc, char **argv, char **environp);
+
+rtems_task Init(rtems_task_argument ignored)
+{
+  mkdir( "/tmp", 0777 );
+  main(argc, argv, NULL);
+}
</font> 
 /* configuration information */
 #define CONFIGURE_MAXIMUM_TASKS 1
<font color='#997700'>@@ -24,7 +40,6 @@
</font> 
 /* GCC tests start at main, use a lot of stack and may use the FPU */
 #define CONFIGURE_RTEMS_INIT_TASKS_TABLE
<font color='#880000'>-#define CONFIGURE_INIT_TASK_ENTRY_POINT   (void *)main
</font> #if defined(__m32c__)
   #define CONFIGURE_INIT_TASK_STACK_SIZE    (16 * 1024)
 #else
<font color='#997700'>@@ -32,6 +47,10 @@
</font> #endif
 #define CONFIGURE_INIT_TASK_ATTRIBUTES    RTEMS_FLOATING_POINT
 
<font color='#000088'>+/* This helps language tests which need a real filesystem */
+#define CONFIGURE_USE_IMFS_AS_BASE_FILESYSTEM
+#define CONFIGURE_LIBIO_MAXIMUM_FILE_DESCRIPTORS 20
+
</font> #define CONFIGURE_APPLICATION_NEEDS_CONSOLE_DRIVER
 #define CONFIGURE_APPLICATION_NEEDS_CLOCK_DRIVER
 #define CONFIGURE_INIT

<font color='#006600'>diff -u rtems-testing/gcc/rtems_gcj_init.c:1.1 rtems-testing/gcc/rtems_gcj_init.c:1.2
--- rtems-testing/gcc/rtems_gcj_init.c:1.1      Sat Aug 20 13:37:29 2011
+++ rtems-testing/gcc/rtems_gcj_init.c  Thu Dec  1 13:17:34 2011
</font><font color='#997700'>@@ -1,3 +1,7 @@
</font><font color='#000088'>+/*
+ *   Main for GCJ Testing
+ */
+
</font> #include <bsp.h>
 #include <stdlib.h>
 #include <pthread.h>

<font color='#006600'>diff -u rtems-testing/gcc/rundeja:1.17 rtems-testing/gcc/rundeja:1.18
--- rtems-testing/gcc/rundeja:1.17      Sun Nov  6 09:35:36 2011
+++ rtems-testing/gcc/rundeja   Thu Dec  1 13:17:34 2011
</font><font color='#997700'>@@ -117,7 +117,32 @@
</font>   echo "set boards_dir ${SCRIPTDIR}/dejagnu/boards" >${dfile}
 fi
 
<font color='#880000'>-case $2 in
</font><font color='#000088'>+testsuite=$2
+case ${testsuite} in
+  libgo) ;;
+  gccgo)
+     testmain=rtems_gccgo_init.o
+     makefile=Makefile.rtems_gccgoinit
+     stanza=check-go
+     ;;
+  java)
+     testmain=rtems_gcj_init.o
+     makefile=Makefile.rtems_gcjinit
+     stanza=check-gcc-java
+     ;;
+  gcc|objc|fortran|gccgo|java)
+     testmain=rtems_gcc_main.o
+     makefile=Makefile.rtems_gccmain
+     stanza=check-${testsuite}
+     ;;
+  *)
+     testmain=rtems_gcc_main.o
+     makefile=Makefile.rtems_gccmain
+     stanza=check
+     ;;
+esac
+
+case ${testsuite} in
</font>   libgo)
     rtems_libgo_init=${SCRIPTDIR}/gcc/rtems_libgo_init.c
     rtems_bin2c=${INSTALL}/bin/rtems-bin2c
<font color='#997700'>@@ -130,86 +155,21 @@
</font>     --target_board=rtems-${CPU}-${DEJABSP} \
     "
     ;;
<font color='#880000'>-  gccgo)
-    RTEMS_MAKEFILE_PATH=${rtemsdir} \
-    SCRIPTDIR=${SCRIPTDIR} \
-      make -f ${SCRIPTDIR}/gcc/Makefile.rtems_gccgoinit
-    if [ $? -ne 0 ] ; then
-      echo unable to compile RTEMS GCC Go Init File
-      exit 1
-    fi
-    rtems_config=`pwd`/rtems_gccgo_init.o
-    make check-go RUNTESTFLAGS="\
-    SIM=${BSP_SIM} \
-    RTEMS_MAKEFILE_PATH=${rtemsdir} \
-    RTEMS_CONFIG_OBJ=${rtems_config} \
-    --target_board=rtems-${CPU}-${DEJABSP} \
-    "
-    ;;
-  objc)
-    RTEMS_MAKEFILE_PATH=${rtemsdir} \
-    SCRIPTDIR=${SCRIPTDIR} \
-      make -f ${SCRIPTDIR}/gcc/Makefile.rtems_gccmain
-    if [ $? -ne 0 ] ; then
-      echo unable to compile RTEMS GCC Main
-      exit 1
-    fi
-    rtems_config=`pwd`/rtems_gcc_main.o
-    make check-objc RUNTESTFLAGS="\
-    SIM=${BSP_SIM} \
-    RTEMS_MAKEFILE_PATH=${rtemsdir} \
-    RTEMS_CONFIG_OBJ=${rtems_config} \
-    --target_board=rtems-${CPU}-${DEJABSP} \
-    "
-    ;;
-  libjava)
-    RTEMS_MAKEFILE_PATH=${rtemsdir} \
-    SCRIPTDIR=${SCRIPTDIR} \
-      make -f ${SCRIPTDIR}/gcc/Makefile.rtems_gcjinit
-    if [ $? -ne 0 ] ; then
-      echo unable to compile RTEMS GCC Java Init File
-      exit 1
-    fi
-    rtems_config=`pwd`/rtems_gcj_init.o
-    make check-gcc-java RUNTESTFLAGS="\
-    SIM=${BSP_SIM} \
-    RTEMS_MAKEFILE_PATH=${rtemsdir} \
-    RTEMS_CONFIG_OBJ=${rtems_config} \
-    --target_board=rtems-${CPU}-${DEJABSP} \
-    "
-    ;;
-  gcc)
-    RTEMS_MAKEFILE_PATH=${rtemsdir} \
-    SCRIPTDIR=${SCRIPTDIR} \
-      make -f ${SCRIPTDIR}/gcc/Makefile.rtems_gccmain
-    if [ $? -ne 0 ] ; then
-      echo unable to compile RTEMS GCC Main
-      exit 1
-    fi
-    rtems_config=`pwd`/rtems_gcc_main.o
-    make check-gcc RUNTESTFLAGS="\
-    SIM=${BSP_SIM} \
-    RTEMS_MAKEFILE_PATH=${rtemsdir} \
-    RTEMS_CONFIG_OBJ=${rtems_config} \
-    --target_board=rtems-${CPU}-${DEJABSP} \
-    "
-    ;;
-  *)
</font><font color='#000088'>+  gcc|objc|fortran|gccgo|java|*)
</font>     RTEMS_MAKEFILE_PATH=${rtemsdir} \
     SCRIPTDIR=${SCRIPTDIR} \
<font color='#880000'>-      make -f ${SCRIPTDIR}/gcc/Makefile.rtems_gccmain
</font><font color='#000088'>+      make -f ${SCRIPTDIR}/gcc/${makefile}
</font>     if [ $? -ne 0 ] ; then
<font color='#880000'>-      echo unable to compile RTEMS GCC Main
</font><font color='#000088'>+      echo unable to compile RTEMS Init File for ${testsuite}
</font>       exit 1
     fi
<font color='#880000'>-    rtems_config=`pwd`/rtems_gcc_main.o
-    echo make check RUNTESTFLAGS="\
</font><font color='#000088'>+    rtems_config=`pwd`/${testmain}
+    make ${stanza} RUNTESTFLAGS="\
</font>     SIM=${BSP_SIM} \
     RTEMS_MAKEFILE_PATH=${rtemsdir} \
     RTEMS_CONFIG_OBJ=${rtems_config} \
     --target_board=rtems-${CPU}-${DEJABSP} \
     "
<font color='#880000'>-exit 0
</font>     ;;
 esac
 

<font color='#006600'>diff -u rtems-testing/gcc/test_driver:1.24 rtems-testing/gcc/test_driver:1.25
--- rtems-testing/gcc/test_driver:1.24  Sun Nov  6 09:35:36 2011
+++ rtems-testing/gcc/test_driver       Thu Dec  1 13:17:34 2011
</font><font color='#997700'>@@ -298,7 +298,7 @@
</font> fi
 
 # Update gcc and install autotools in parallel
<font color='#880000'>-  if [ ${doCleanInstallPoint} = "yes" ] ; then
</font><font color='#000088'>+  if [ ! -r ${INSTALL}/bin/autoconf ] ; then
</font>     install_auto
   fi
   if [ ${doUpdateTools} = "yes" ] ; then
</pre>
<p> </p>
<a name='cs3'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-11-06 Pawel Zagorski <pzagor@agh.edu.pl>

        * DesiredSymbols.cc, ExecutableInfo.cc, SymbolTable.cc, covoar.cc:
        Added methods dumpExecutableInfo( void ) and dumpSymbolTable( void )
        that can dump cointainers to stdout for debug purposes. Covoar now
        accepts aditional command line argument -g GCNOS_LIST with list of
        xxx.gcno files. If non-empty list is provided gcov outputs will be
        craeated based on each file in the list.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/covoar/ChangeLog.diff?r1=text&tr1=1.26&r2=text&tr2=1.27&diff_format=h">M</a></td><td width='1%'>1.27</td><td width='100%'>covoar/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/covoar/CoverageMapBase.h.diff?r1=text&tr1=1.5&r2=text&tr2=1.6&diff_format=h">M</a></td><td width='1%'>1.6</td><td width='100%'>covoar/CoverageMapBase.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/covoar/DesiredSymbols.cc.diff?r1=text&tr1=1.11&r2=text&tr2=1.12&diff_format=h">M</a></td><td width='1%'>1.12</td><td width='100%'>covoar/DesiredSymbols.cc</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/covoar/ExecutableInfo.h.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h">M</a></td><td width='1%'>1.2</td><td width='100%'>covoar/ExecutableInfo.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/covoar/ExecutableInfo.cc.diff?r1=text&tr1=1.3&r2=text&tr2=1.4&diff_format=h">M</a></td><td width='1%'>1.4</td><td width='100%'>covoar/ExecutableInfo.cc</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/covoar/GcovData.h?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">covoar/GcovData.h</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/covoar/GcovData.cc?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">covoar/GcovData.cc</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/covoar/GcovFunctionData.h?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">covoar/GcovFunctionData.h</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/covoar/GcovFunctionData.cc?rev=1.1&content-type=text/vnd.viewcvs-markup">A</a></td><td width='1%'><font color="#000088">1.1</font></td><td width='100%'><font color="#000088">covoar/GcovFunctionData.cc</font></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/covoar/Makefile.diff?r1=text&tr1=1.3&r2=text&tr2=1.4&diff_format=h">M</a></td><td width='1%'>1.4</td><td width='100%'>covoar/Makefile</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/covoar/SymbolTable.h.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>covoar/SymbolTable.h</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/covoar/SymbolTable.cc.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>covoar/SymbolTable.cc</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/covoar/covoar.cc.diff?r1=text&tr1=1.5&r2=text&tr2=1.6&diff_format=h">M</a></td><td width='1%'>1.6</td><td width='100%'>covoar/covoar.cc</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems-testing/covoar/ChangeLog:1.26 rtems-testing/covoar/ChangeLog:1.27
--- rtems-testing/covoar/ChangeLog:1.26 Fri Nov  4 11:02:36 2011
+++ rtems-testing/covoar/ChangeLog      Thu Dec  1 14:24:46 2011
</font><font color='#997700'>@@ -1,3 +1,12 @@
</font><font color='#000088'>+2011-11-06    Pawel Zagorski <pzagor@agh.edu.pl>
+
+       * DesiredSymbols.cc, ExecutableInfo.cc, SymbolTable.cc, covoar.cc:
+       Added methods dumpExecutableInfo( void ) and dumpSymbolTable( void )
+       that can dump cointainers to stdout for debug purposes. Covoar now<span style="background-color: #FF0000"> </span>
+       accepts aditional command line argument -g GCNOS_LIST with list of<span style="background-color: #FF0000"> </span>
+       xxx.gcno files. If non-empty list is provided gcov outputs will be<span style="background-color: #FF0000"> </span>
+       craeated based on each file in the list.
+
</font> 2011-11-04        Joel Sherrill <joel.sherrill@oarcorp.com>
 
        * DesiredSymbols.cc, ReportsBase.h, ReportsText.cc, ReportsText.h,

<font color='#006600'>diff -u rtems-testing/covoar/CoverageMapBase.h:1.5 rtems-testing/covoar/CoverageMapBase.h:1.6
--- rtems-testing/covoar/CoverageMapBase.h:1.5  Wed Aug 31 15:44:25 2011
+++ rtems-testing/covoar/CoverageMapBase.h      Thu Dec  1 14:24:46 2011
</font><font color='#997700'>@@ -46,7 +46,8 @@
</font>     /*
      *  This type identifies a list of ranges.
      */
<font color='#880000'>-    typedef std::list< AddressRange_t > AddressRange;
</font><font color='#000088'>+    typedef std::list< AddressRange_t ><span style="background-color: #FF0000"> </span>     AddressRange;
+    typedef std::list< AddressRange_t >::iterator AddressRangeIterator_t;
</font> 
     /*!<span style="background-color: #FF0000"> </span>
      *  This method constructs a CoverageMapBase instance.

<font color='#006600'>diff -u rtems-testing/covoar/DesiredSymbols.cc:1.11 rtems-testing/covoar/DesiredSymbols.cc:1.12
--- rtems-testing/covoar/DesiredSymbols.cc:1.11 Fri Nov  4 11:02:36 2011
+++ rtems-testing/covoar/DesiredSymbols.cc      Thu Dec  1 14:24:46 2011
</font><font color='#997700'>@@ -72,7 +72,6 @@
</font>         inputBuffer[0] = '\0';
         inputBuffer2[0] = '\0';
         cStatus = fscanf( sFile, "%s %s", inputBuffer, inputBuffer2 );
<font color='#880000'>-        //TODO: Store inputBuffer2 value containing symbol source file
</font>         if ( cStatus == EOF ) {
           done = true;
         }
<font color='#997700'>@@ -97,9 +96,8 @@
</font>         }
 
         // Add this to the set of symbols.
<font color='#880000'>-        else {
</font><font color='#000088'>+        else<span style="background-color: #FF0000"> </span>
</font>           set[ inputBuffer ] = *symInfo;
<font color='#880000'>-        }
</font>       }
     }
   }
<font color='#997700'>@@ -462,6 +460,7 @@
</font>       "ranges1.tmp",
       "ranges2.tmp"
     );
<font color='#000088'>+
</font>     if (system( command )) {
       fprintf(
         stderr,

<font color='#006600'>diff -u rtems-testing/covoar/ExecutableInfo.h:1.1 rtems-testing/covoar/ExecutableInfo.h:1.2
--- rtems-testing/covoar/ExecutableInfo.h:1.1   Mon May 24 15:07:08 2010
+++ rtems-testing/covoar/ExecutableInfo.h       Thu Dec  1 14:24:47 2011
</font><font color='#997700'>@@ -52,6 +52,11 @@
</font>     void dumpCoverageMaps( void );
 
     /*!
<font color='#000088'>+     *  This method prints the contents of Executable info containers
+     */
+    void dumpExecutableInfo( void );
+
+    /*!
</font>      *  This method returns a pointer to the executable's coverage map
      *  that contains the specified address.
      *

<font color='#006600'>diff -u rtems-testing/covoar/ExecutableInfo.cc:1.3 rtems-testing/covoar/ExecutableInfo.cc:1.4
--- rtems-testing/covoar/ExecutableInfo.cc:1.3  Tue Jan 25 15:26:00 2011
+++ rtems-testing/covoar/ExecutableInfo.cc      Thu Dec  1 14:24:47 2011
</font><font color='#997700'>@@ -47,6 +47,14 @@
</font>     }
   }
 
<font color='#000088'>+  void ExecutableInfo::dumpExecutableInfo( void ){
+    fprintf( stdout, "\n== Executable info ==\n");
+    fprintf( stdout, "executableName = %s\n", executableName.c_str());
+    fprintf( stdout, "libraryName = %s\n", libraryName.c_str());
+    fprintf( stdout, "loadAddress = %u\n", loadAddress);
+    theSymbolTable->dumpSymbolTable();
+  }
+
</font>   CoverageMapBase* ExecutableInfo::getCoverageMap ( uint32_t address )
   {
     CoverageMapBase*         aCoverageMap = NULL;

<font color='#006600'>diff -u /dev/null rtems-testing/covoar/GcovData.h:1.1
--- /dev/null   Fri Dec  2 01:31:47 2011
+++ rtems-testing/covoar/GcovData.h     Thu Dec  1 14:24:47 2011
</font><font color='#997700'>@@ -0,0 +1,204 @@
</font><font color='#000088'>+/*
+ *  $Id$
+ */
+
+/*! @file GcovData.h
+ *  @brief GcovData Specification
+ *
+ *  This file contains the specification of the GcovGcnoWriter class.
+ */
+
+#ifndef __GCOV_DATA_H__
+#define __GCOV_DATA_H__
+
+#include <stdint.h>
+#include <list>
+#include <iostream>
+#include "GcovFunctionData.h"
+
+namespace Gcov {
+
+#define GCDA_MAGIC ((uint32_t) 0x67636461 )<span style="background-color: #FF0000"> </span>      /* "gcda" */
+#define GCNO_MAGIC ((uint32_t) 0x67636e6f )<span style="background-color: #FF0000"> </span>      /* "gcno" */
+
+/* we are using gcc 4.6 release format, coded as "406R" */
+#define GCNO_VERSION ((uint32_t) 0x34303652 )
+
+/* GCOV tags */
+#define GCOV_TAG_FUNCTION      <span style="background-color: #FF0000"> </span>          ((uint32_t)0x01000000)
+#define GCOV_TAG_BLOCKS                <span style="background-color: #FF0000"> </span>          ((uint32_t)0x01410000)
+#define GCOV_TAG_ARCS          <span style="background-color: #FF0000"> </span>          ((uint32_t)0x01430000)
+#define GCOV_TAG_LINES         <span style="background-color: #FF0000"> </span>          ((uint32_t)0x01450000)
+#define GCOV_TAG_COUNTER<span style="background-color: #FF0000"> </span>                 ((uint32_t)0x01a10000)
+#define GCOV_TAG_OBJECT_SUMMARY<span style="background-color: #FF0000">  </span> ((uint32_t)0xa1000000)
+#define GCOV_TAG_PROGRAM_SUMMARY<span style="background-color: #FF0000"> </span> ((uint32_t)0xa3000000)
+
+
+typedef std::list<Gcov::GcovFunctionData*><span style="background-color: #FF0000"> </span>         functions_t;
+typedef std::list<Gcov::GcovFunctionData*>::iterator     functions_iterator_t;
+
+struct gcov_preamble
+{
+    uint32_t magic;
+    uint32_t version;
+    uint32_t timestamp;
+};
+
+struct gcov_frame_header
+{
+    uint32_t tag;
+    uint32_t length;
+};
+
+struct gcov_statistics
+{
+    uint32_t checksum;         // checksum
+    uint32_t counters;         // number of counters
+    uint32_t runs;             // number of runs
+    uint64_t sum;              // sum of all couter values
+    uint64_t max;              // max value on a single run
+    uint64_t sumMax;           // sum of individual runs max values
+};
+
+  /*! @class GcovData
+   *
+   *  This is the specification of the GcovData class.
+   */
+  class GcovData {
+
+  public:
+
+    /*!
+     *  This method constructs a GcnoReader instance.
+     */
+    GcovData();
+
+    /*!
+     *  This method destructs a GcnoReader instance.
+     */
+    virtual ~GcovData();
+
+    /*!
+     *  This method reads the *.gcno file
+     *
+     *  @param[in] fileName name of the file to read
+     *
+     *  @return Returns TRUE if the method succeeded and FALSE if it failed.
+     */
+    bool readGcnoFile( const char* const  fileName );
+
+    /*!
+     *  This method writes the *.gcda file. It also produces and stores<span style="background-color: #FF0000"> </span>
+     *  gcda and txt file names for future outputs.
+     *
+     *  @return Returns TRUE if the method succeeded and FALSE if it failed.
+     */
+    bool writeGcdaFile ();
+
+    /*!
+     *  This method writes all contained information to stdout file
+     *
+     *  @return Returns TRUE if the method succeeded and FALSE if it failed.
+     */
+    bool writeReportFile();
+
+    /*!
+     *  This method runs gcov to generate report. This method should
+     *  be used only when gcno and gcda files are already generated.
+     */
+    void writeGcovFile( );
+
+    /*!
+     *  This method calculates values of counters for all functions
+     */
+    bool processCounters( void );
+
+  private:
+
+    uint32_t                           numberOfFunctions;
+    gcov_preamble<span style="background-color: #FF0000"> </span>                        gcdaPreamble;
+    gcov_preamble<span style="background-color: #FF0000"> </span>                        gcnoPreamble;
+    char                               gcnoFileName[FILE_NAME_LENGTH];
+    char                               gcdaFileName[FILE_NAME_LENGTH];
+    char                               textFileName[FILE_NAME_LENGTH];
+    char                               cFileName[FILE_NAME_LENGTH];
+    functions_t                                functions;
+
+
+    /*!
+     *  This method reads a frame from *.gcno file
+     *
+     *  @param[in] file points to a file to read
+     *
+     *  @return true if read was succesfull, false otherwise
+     */
+    bool readFrame(
+            FILE*      gcovFile
+    );
+
+    /*!
+     *  This method reads a string from gcov file
+     *
+     *  @param[in] buffer stores the string
+     *  @param[in] file specifies the name of the file to read
+     *
+     *  @return Returns length of words read (word = 32bit) or -1 if error ocurred
+     */
+    int readString(
+            char*      buffer,
+            FILE*      gcovFile
+    );
+
+    /*!
+     *  This method reads a frame header from gcov file
+     *
+     *  @param[in] header stores the header
+     *  @param[in] file specifies the name of the file to read
+     *
+     *  @return Returns length of words read (word = 32bit)<span style="background-color: #FF0000"> </span>
+     *  or -1 if error ocurred
+     */
+    int readFrameHeader(
+            gcov_frame_header* header,
+            FILE*              gcovFile
+    );
+
+    /*!
+     *  This method reads a frame header from gcov file
+     *
+     *  @param[in] preamble stores the preamble
+     *  @param[in] gcovFile specifies the name of the file to read
+     *  @param[in] desiredMagic stores the expected magic of a file
+     *
+     *  @return Returns length of words read (word = 32bit)<span style="background-color: #FF0000"> </span>
+     *          or -1 if error ocurred
+     */
+    int readFilePreamble(
+            gcov_preamble*<span style="background-color: #FF0000"> </span>       preamble,
+            FILE*<span style="background-color: #FF0000">         </span>        gcovFile,
+            const uint32_t     desiredMagic
+    );
+
+    /*!
+     *  This method reads a function frame from gcov file
+     *
+     *  @param[in] header passes frame header
+     *  @param[in] gcovFile specifies the name of the file to read
+     *  @param[in] function stores the expected magic of a file
+     *
+     *  @return Returns true if operation was succesfull
+     */
+    bool readFunctionFrame(
+            gcov_frame_header<span style="background-color: #FF0000"> </span>    header,
+            FILE*<span style="background-color: #FF0000">         </span>        gcovFile,
+            GcovFunctionData*  function
+    );
+
+    /*!
+     *  This method prints info about previously read *.gcno file
+     *  to a specified report file
+     */
+    void printGcnoFileInfo( FILE * textFile );
+  };
+}
+#endif
</font>
<font color='#006600'>diff -u /dev/null rtems-testing/covoar/GcovData.cc:1.1
--- /dev/null   Fri Dec  2 01:31:48 2011
+++ rtems-testing/covoar/GcovData.cc    Thu Dec  1 14:24:47 2011
</font><font color='#997700'>@@ -0,0 +1,506 @@
</font><font color='#000088'>+/*
+ *  $Id$
+ *
+ *  TODO: use strings instead of cstrings for reliability and saving memory
+ *  TODO: use global buffers
+ *
+ */
+
+/*! @file GcovData.cc
+ *  @brief GcovData Implementation
+ *
+ *  This file contains the implementation of the functions supporting
+ *  reading *.gcno and writing *.gcda files for gcov support
+ */
+
+#include <libgen.h>
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+//#include <sys/stat.h>
+
+//#include "app_common.h"
+#include "GcovData.h"
+//#include "ExecutableInfo.h"
+//#include "CoverageMap.h"
+//#include "qemu-traces.h"
+
+
+namespace Gcov {
+
+  GcovData::GcovData()
+  {
+       <span style="background-color: #FF0000">  </span> numberOfFunctions = 0;
+  }
+
+  GcovData::~GcovData()
+  {
+  }
+
+  bool GcovData::readGcnoFile( const char* const  fileName )
+  {
+    int                 status;
+    FILE*               gcovFile;
+    char*              tempString;
+    char*              tempString2;
+    char*              tempString3;
+
+    if ( strlen(fileName) >= FILE_NAME_LENGTH ){
+      fprintf( stderr, "ERROR: File name is to long to be correctly stored: %u\n", strlen(fileName) );
+      return false;
+    }
+    strcpy( gcnoFileName, fileName );
+    strcpy( gcdaFileName, fileName );
+    strcpy( textFileName, fileName );
+    strcpy( cFileName, fileName );
+    tempString = strstr( gcdaFileName,".gcno" );
+    tempString2 = strstr( textFileName,".gcno" );
+    tempString3 = strstr( cFileName,".gcno" );
+
+    if ( (tempString == NULL) && (tempString2 == NULL) ){
+      fprintf(stderr, "ERROR: incorrect name of *.gcno file\n");
+    }<span style="background-color: #FF0000"> </span>
+    else
+    {
+      strcpy( tempString, ".gcda");          // construct gcda file name
+      strcpy( tempString2, ".txt");          // construct report file name
+      strcpy( tempString3, ".c");            // construct source file name
+    }
+
+    // Debug message
+    // fprintf( stderr, "Readning file: %s\n",  gcnoFileName);
+
+    // Open the notes file.
+    gcovFile = fopen( gcnoFileName, "r" );
+    if ( !gcovFile ) {
+<span style="background-color: #FF0000">    </span>      fprintf( stderr, "Unable to open %s\n", gcnoFileName );
+<span style="background-color: #FF0000">    </span>      return false;
+    }
+
+    // Read and validate the gcnoPreamble (magic, version, timestamp) from the file
+    status = readFilePreamble( &gcnoPreamble, gcovFile, GCNO_MAGIC );
+    if ( status <= 0 ){
+<span style="background-color: #FF0000">    </span>      fprintf( stderr, "Unable to read %s\n", gcnoFileName );
+       fclose( gcovFile );
+<span style="background-color: #FF0000">    </span>      return false;
+    }
+
+    //Read all remaining frames from file
+    while( readFrame(gcovFile) ){}
+
+    fclose( gcovFile );
+    return true;
+  }
+
+
+  bool GcovData::writeGcdaFile ()
+  {
+         gcov_preamble<span style="background-color: #FF0000"> </span>           preamble;
+         gcov_frame_header             header;
+         FILE*                         gcdaFile;
+         functions_iterator_t  currentFunction;
+         arcs_iterator_t               currentArc;
+         uint32_t                      buffer;
+         uint32_t                      countersFound;
+         uint32_t                      countersFoundSum;
+         uint64_t                      countersSum;
+         uint64_t                      countersMax;
+         uint64_t                      llBuffer[4096];         // TODO: Use common buffer
+         gcov_statistics               objectStats;
+         gcov_statistics               programStats;
+         size_t                        status;
+
+         // Debug message
+         // fprintf( stderr, "Writing file: %s\n",  gcdaFileName);
+
+         // Lets clear counters sumators
+         countersSum<span style="background-color: #FF0000"> </span>             = 0;
+         countersMax<span style="background-color: #FF0000"> </span>             = 0;
+         countersFoundSum<span style="background-color: #FF0000"> </span>        = 0;
+
+         // Open the data file.
+         gcdaFile = fopen( gcdaFileName, "w" );
+         if ( !gcdaFile ) {
+                 fprintf( stderr, "Unable to create %s\n", gcdaFileName );
+                 return false;
+         }
+
+         //Form preamble
+         preamble.magic        = GCDA_MAGIC;
+         preamble.version      = gcnoPreamble.version;
+         preamble.timestamp    = gcnoPreamble.timestamp;
+
+         //Write preamble
+         status = fwrite (&preamble , sizeof( preamble ), 1 , gcdaFile );
+         if ( status != 1 )
+            fprintf( stderr, "Error while writing gcda preamble to a file %s\n", gcdaFileName );
+
+         //Write function info and counter counts
+         for (
+                         currentFunction = functions.begin();
+                         currentFunction != functions.end();
+                         currentFunction++
+         )
+         {
+                 //Write function announcement frame header (length always equals 2)
+                 header.tag = GCOV_TAG_FUNCTION;
+                 header.length = 2;
+                 status = fwrite (&header, sizeof(header), 1, gcdaFile );
+                 if ( status != 1 )
+                    fprintf( stderr, "Error while writing function announcement to a file %s\n", gcdaFileName );
+
+                 //Write function id
+                 buffer = (*currentFunction)->getId();
+                 status = fwrite (&buffer, sizeof( buffer ), 1, gcdaFile );
+                 if ( status != 1 )
+                    fprintf( stderr, "Error while writing function id to a file %s\n", gcdaFileName );
+
+                 //Write function checksum
+                 buffer = (*currentFunction)->getChecksum();
+                 status = fwrite (&buffer, sizeof( buffer ), 1, gcdaFile );
+                 if ( status != 1 )
+                    fprintf( stderr, "Error while writing function checksum to a file %s\n", gcdaFileName );
+
+                 // Determine how many counters there are
+                 // and store their counts in buffer
+                 countersFound = 0;
+                 (*currentFunction)->getCounters( llBuffer, countersFound, countersSum, countersMax );
+                 countersFoundSum += countersFound;
+
+                 //Write info about counters
+                 header.tag = GCOV_TAG_COUNTER;
+                 header.length = countersFound * 2;
+                 status = fwrite (&header, sizeof( header ), 1, gcdaFile );
+                 if ( status != 1 )
+                    fprintf( stderr, "Error while writing counter header to a file %s\n", gcdaFileName );
+
+                 status = fwrite (llBuffer, sizeof( uint64_t ), countersFound , gcdaFile );
+                 if ( status != countersFound )
+                    fprintf( stderr, "Error while writing counter data to a file %s\n", gcdaFileName );
+         }
+
+         // Prepare frame with object file statistics
+         header.tag = GCOV_TAG_OBJECT_SUMMARY;
+         header.length = 9;
+         objectStats.checksum = 0;                     // TODO: have no idea hov to calculates it :)
+         objectStats.counters = countersFoundSum;
+         objectStats.runs = 1;                         // We are lying for now, we have no means of figuring this out
+         objectStats.sum = countersSum;                // Sum of all counters
+         objectStats.max = countersMax;                // max value for counter on last run, we have no clue
+         objectStats.sumMax = countersMax;             // we have no clue
+
+         // Write data
+         status = fwrite (&header, sizeof( header ), 1, gcdaFile );
+         if ( status != 1 )
+            fprintf( stderr, "Error while writing stats header to a file %s\n", gcdaFileName );
+         status = fwrite (&objectStats, sizeof( objectStats ), 1, gcdaFile );
+         if ( status != 1 )
+            fprintf( stderr, "Error while writing object stats to a file %s\n", gcdaFileName );
+
+
+         // Prepare frame with program statistics
+         header.tag = GCOV_TAG_PROGRAM_SUMMARY;
+         header.length = 9;
+         programStats.checksum = 0;                    // TODO: have no idea hov to calculate it :)
+         programStats.counters = countersFoundSum;
+         programStats.runs = 1;                        // We are lying for now, we have no clue
+         programStats.sum = countersSum;               // Sum of all counters
+         programStats.max = countersMax;               // max value for counter on last run, we have no clue
+         programStats.sumMax = countersMax;            // we have no clue
+
+         // Write data
+         status = fwrite (&header, sizeof( header ), 1, gcdaFile );
+         if ( status != 1 )
+            fprintf( stderr, "Error while writing stats header to a file %s\n", gcdaFileName );
+         status = fwrite (&programStats, sizeof( programStats ), 1, gcdaFile );
+         if ( status != 1 )
+            fprintf( stderr, "Error while writing program stats to a file %s\n", gcdaFileName );
+
+         fclose( gcdaFile );
+
+         return true;
+  }
+
+  bool GcovData::readFrame(
+              FILE*         gcovFile
+   )
+  {
+           gcov_frame_header<span style="background-color: #FF0000"> </span>     header;
+           char<span style="background-color: #FF0000"> </span>          buffer[512];
+           uint32_t            intBuffer[4096];
+           uint32_t            tempBlockId;
+           blocks_iterator_t   tempBlockIterator;
+           int                 status;
+           GcovFunctionData*   newFunction;
+
+           status = readFrameHeader( &header, gcovFile);
+
+           if ( status <= 0 ){
+                // Not printing error message because this<span style="background-color: #FF0000"> </span>
+               // happenns at the end of each file
+       <span style="background-color: #FF0000">    </span>       return false;
+           }
+
+           switch (header.tag){
+
+                       case GCOV_TAG_FUNCTION:
+
+                               numberOfFunctions++;
+                               newFunction = new GcovFunctionData;
+                               if ( !readFunctionFrame(header, gcovFile, newFunction) ){
+                                       fprintf( stderr, "Error while reading FUNCTION from gcov file...\n" );
+                                       return false;
+                               }
+                               functions.push_back(newFunction);
+                               break;
+
+                       case GCOV_TAG_BLOCKS:
+
+                               status = fread( &intBuffer, 4, header.length, gcovFile );
+                               if ( status != (int) header.length){
+                                       fprintf(<span style="background-color: #FF0000"> </span>
+                                               stderr, "Error while reading BLOCKS from gcov file...\n"
+                                               "Header lenght is %u instead of %u\n",<span style="background-color: #FF0000"> </span>
+                                               header.length,<span style="background-color: #FF0000"> </span>
+                                               status<span style="background-color: #FF0000"> </span>
+                                       );
+                                       return false;
+                               }
+
+                               for( uint32_t i = 0; i < header.length; i++ )
+                                       functions.back()->addBlock(i, intBuffer[i], "");
+
+                               break;
+
+                       case GCOV_TAG_ARCS:
+
+                               status = fread( &intBuffer, 4, header.length, gcovFile );
+                               if (status != (int) header.length){
+                                       return false;
+                               }
+
+                               for ( int i = 1; i < (int) header.length; i += 2 )
+                                       functions.back()->addArc(intBuffer[0], intBuffer[i], intBuffer[i+1]);
+
+                               break;
+
+                       case GCOV_TAG_LINES:
+
+                               status = fread( &intBuffer, 4, 2, gcovFile );
+                               if (status != 2 || intBuffer[1] != 0){
+                                       fprintf(
+                                               stderr,
+                                               "Error while reading block id for LINES from gcov file..."
+                                       );
+                                       return false;
+                               }
+                               tempBlockId = intBuffer[0];
+                               header.length -= 2;
+
+                               // Find the right block
+                               tempBlockIterator =functions.back()->findBlockById(tempBlockId);
+
+                               header.length -= readString(buffer, gcovFile);
+                               functions.back()->setBlockFileName( tempBlockIterator, buffer );
+
+                               status = fread( &intBuffer, 4, header.length, gcovFile );
+                               if (status != (int) header.length){
+                                       fprintf( stderr, "Error while reading LINES from gcov file..." );
+                                       return false;
+                               }
+
+                               else
+                                       for (int i = 0; i < (int) (header.length - 2); i++)
+                                               functions.back()->addBlockLine( tempBlockIterator, intBuffer[i] );
+
+                               break;
+
+                       default:
+
+                               fprintf( stderr, "\n\nERROR - encountered unknown *.gcno tag : 0x%x\n", header.tag );
+                               break;
+           }
+
+           return true;
+  }
+
+  int GcovData::readString(
+                  char*                 buffer,   //TODO: use global buffer here
+              FILE*         gcovFile
+  )
+  {
+           int                                 status;
+           int                                 length;
+
+           status = fread( &length, sizeof(int), 1, gcovFile );
+           if (status != 1){
+              fprintf( stderr, "ERROR: Unable to read string length from gcov file\n" );
+             return -1;
+            }
+
+           status = fread( buffer, length * 4 , 1, gcovFile );
+           if (status != 1){
+              fprintf( stderr, "ERROR: Unable to read string from gcov file\n" );
+             return -1;
+            }
+
+           buffer[length * 4] = '\0';
+
+           return length +1;
+  }
+
+  int GcovData::readFrameHeader(
+              gcov_frame_header*<span style="background-color: #FF0000"> </span> header,
+              FILE*<span style="background-color: #FF0000">         </span>              gcovFile
+   )
+  {
+           int                                 status;
+           int                                 length;
+
+           length = sizeof(gcov_frame_header);
+           status = fread( header, length, 1, gcovFile );
+           if (status != 1){
+               //fprintf( stderr, "ERROR: Unable to read frame header from gcov file\n" );
+       <span style="background-color: #FF0000">    </span>       return -1;
+           }
+
+           return length / 4;
+  }
+
+  int GcovData::readFilePreamble(
+<span style="background-color: #FF0000">  </span>           gcov_preamble*           preamble,
+          FILE*<span style="background-color: #FF0000">         </span>          gcovFile,
+          uint32_t                             desiredMagic
+  )
+  {
+           int                                 status;
+           int                                 length;
+
+           length = sizeof( gcov_preamble );
+           status = fread( preamble, sizeof( gcov_preamble), 1, gcovFile );
+           if (status <= 0) {
+             fprintf( stderr, "Error while reading file preamble\n" );
+             return -1;
+           }
+
+           if ( preamble->magic != GCNO_MAGIC ) {
+             fprintf( stderr, "File is not a valid *.gcno output (magic: 0x%4x)\n", preamble->magic );
+             return -1;
+           }
+
+           return length / 4;
+  }
+
+  bool GcovData::readFunctionFrame(
+          gcov_frame_header<span style="background-color: #FF0000"> </span>      header,
+          FILE*<span style="background-color: #FF0000">         </span>  gcovFile,
+          GcovFunctionData*    function
+  )
+  {
+         char<span style="background-color: #FF0000"> </span>                buffer[512];                //TODO: use common buffers
+         uint32_t          intBuffer[4096];
+         int               status;
+
+         status = fread( &intBuffer, 8, 1, gcovFile );
+         if (status != 1){
+               fprintf( stderr, "ERROR: Unable to read Function ID & checksum\n" );
+       <span style="background-color: #FF0000">  </span> return false;
+         }
+         header.length -= 2;
+         function->setId( intBuffer[0] );
+         function->setChecksum( intBuffer[1] );
+
+         header.length -= readString( buffer, gcovFile );
+         function->setFunctionName( buffer );
+         header.length -= readString( buffer, gcovFile );
+         function->setFileName( buffer );
+         status = fread( &intBuffer, 4, header.length, gcovFile );
+         if (status <= 0){
+               fprintf( stderr, "ERROR: Unable to read Function starting line number\n" );
+       <span style="background-color: #FF0000">  </span> return false;
+         }
+         function->setFirstLineNumber( intBuffer[0] );
+
+         return true;
+  }
+
+  bool GcovData::writeReportFile()
+  {
+         functions_iterator_t<span style="background-color: #FF0000"> </span>            currentFunction;
+         uint32_t                      i = 1;                                  //iterator
+         FILE*                         textFile;
+
+         // Debug message
+         // fprintf( stderr, "Writing file: %s\n",  textFileName);
+
+        // Open the data file.
+        textFile = fopen( textFileName, "w" );
+       if ( !textFile ) {
+         fprintf( stderr, "Unable to create %s\n", textFileName );
+         return false;
+       }
+
+       printGcnoFileInfo( textFile );
+
+       for (
+                       currentFunction = functions.begin();
+                       currentFunction != functions.end();
+                       currentFunction++
+               )
+       {
+               (*currentFunction)->printFunctionInfo( textFile, i );
+                (*currentFunction)->printCoverageInfo( textFile, i );
+               i++;
+       }
+
+       fclose ( textFile );
+       return true;
+  }
+
+  void GcovData::printGcnoFileInfo( FILE * textFile )
+  {
+      fprintf(
+        textFile,
+        "\nFILE:\t\t\t%s\n"
+        "magic:\t\t\t%x\n"
+        "version:\t\t%x\n"
+        "timestamp:\t\t%x\n"
+        "functions found: \t%u\n\n",
+        gcnoFileName,
+        gcnoPreamble.magic,
+        gcnoPreamble.version,
+        gcnoPreamble.timestamp,
+        numberOfFunctions
+      );
+  }
+
+  void GcovData::writeGcovFile( )
+  {
+    char        path[512];
+    char        command[512];
+
+    //fprintf (stderr, "Attempting to run gcov for: %s\n", cFileName );
+    strcpy( path, cFileName );
+    dirname( path );
+    sprintf( command, "( cd %s && gcov %s &>> gcov.log)", path, basename( cFileName ) );
+    //fprintf (stderr, "> %s\n", command );
+    system( command );
+  }
+
+  bool GcovData::processCounters(  )
+  {
+    functions_iterator_t<span style="background-color: #FF0000"> </span> currentFunction;
+    bool                       status = true;
+    for (
+      currentFunction = functions.begin();
+      currentFunction != functions.end();
+      currentFunction++
+    )
+    {
+      if ( !(*currentFunction)->processFunctionCounters(  ) )
+        status = false;
+    }
+
+    return status;
+  }
+}
</font>
<font color='#006600'>diff -u /dev/null rtems-testing/covoar/GcovFunctionData.h:1.1
--- /dev/null   Fri Dec  2 01:31:48 2011
+++ rtems-testing/covoar/GcovFunctionData.h     Thu Dec  1 14:24:47 2011
</font><font color='#997700'>@@ -0,0 +1,278 @@
</font><font color='#000088'>+/*
+ *  $Id$
+ */
+
+/*! @file GcovFunctionData.h
+ *  @brief GcovFunctionData Specification
+ *
+ *  This file contains the specification of the GcovGcnoWriter class.
+ */
+
+#ifndef __GCOV_FUNCTION_DATA_H__
+#define __GCOV_FUNCTION_DATA_H__
+
+#include <stdint.h>
+#include <list>
+#include "CoverageMapBase.h"
+#include "DesiredSymbols.h"
+
+namespace Gcov {
+
+#define FUNCTION_NAME_LENGTH           64
+#define FILE_NAME_LENGTH               256
+
+#define ON_TREE_ARC_FLAG               0x1
+#define FAKE_ARC_FLAG                  0x2
+#define FALLTHROUGH_ARC_FLAG           0x4
+
+struct gcov_arc_info
+{
+    uint32_t   sourceBlock;
+    uint32_t   destinationBlock;
+    uint32_t   flags;
+    uint64_t   counter;
+};
+
+struct gcov_block_info
+{
+    uint32_t<span style="background-color: #FF0000"> </span>                     id;
+    uint32_t                   flags;
+    uint32_t                   numberOfLines;
+    uint64_t<span style="background-color: #FF0000"> </span>                     counter;
+    char                       sourceFileName[FILE_NAME_LENGTH];
+    std::list<uint32_t>          lines;
+};
+
+typedef std::list<gcov_arc_info>         arcs_t;
+typedef std::list<gcov_arc_info>::iterator       arcs_iterator_t;
+typedef std::list<gcov_block_info>               blocks_t;
+typedef std::list<gcov_block_info>::iterator     blocks_iterator_t;
+
+  /*! @class GcovFunctionData
+   *
+   *  This is the specification of the GcovFunctionData class.
+   */
+  class GcovFunctionData {
+
+  public:
+
+    /*!
+     *  This method constructs a GcovFunctionData instance.
+     */
+       GcovFunctionData();
+
+    /*!
+     *  This method destructs a GcovFunctionData instance.
+     */
+    virtual ~GcovFunctionData();
+
+    /*!
+     *  This method stores checksum related to function
+     *
+     *  @param[in] chk stores the checksum value
+     */
+    void setChecksum(
+            const uint32_t             chk
+    );
+
+    /*!
+     *  This method stores id of function
+     *
+     *  @param[in] idNumber stores the id value
+     */
+    void setId(
+            const uint32_t             idNumber
+    );
+
+    /*!
+     *  This method stores checksum related to function
+     *
+     *  @param[in] lineNo passes number of the line begining the function
+     */
+    void setFirstLineNumber(
+            const uint32_t             lineNo
+    );
+
+    /*!
+     *  This method stores name of the function and ties it to its<span style="background-color: #FF0000"> </span>
+     *  unified coverage map.
+     *
+     *  @param[in] functionName passes name of the the function
+     *
+     *  @return Returns TRUE if the method succeeded and FALSE if it failed.
+     */
+    bool setFunctionName(
+            const char*                        fcnName
+    );
+
+    /*!
+     *  This method stores name of the source file where function is located
+     *
+     *  @param[in] fileName passes name of the the file
+     *
+     *  @return Returns TRUE if the method succeeded and FALSE if it failed.
+     */
+    bool setFileName(
+            const char*                        fileName
+    );
+
+    /*!
+     *  This method stores name of the source file where block is located
+     *
+     *  @param[in] block identifies block
+     *  @param[in] fileName passes name of the the file
+     *
+     *  @return Returns TRUE if the method succeeded and FALSE if it failed.
+     */
+    void setBlockFileName(
+            const blocks_iterator_t            block,
+            const char*                                fileName
+    );
+
+    /*!
+     *  This method returns arcs list
+     */
+    arcs_t getArcs() const;
+
+    /*!
+     *  This method returns blocks list
+     */
+    blocks_t getBlocks() const;
+
+    /*!
+     *  This method returns checksum
+     */
+    uint32_t getChecksum() const;
+
+    /*!
+     *  This method returns id
+     */
+    uint32_t getId() const;
+
+    /*!
+     *  This method returns counters
+     *
+     *  @param[out] counterValues array of counter values
+     *  @param[out] countersFound used to return counters number
+     *  @param[out] countersSum used to return sum counters values
+     *  @param[out] countersMax used to return max counter value
+     */
+    void getCounters( uint64_t* counterValues, uint32_t &countersFound, uint64_t &countersSum, uint64_t &countersMax );
+
+    /*!
+     *  This method adds new arc to arc list
+     *
+     *  @param[in] source passes source block number
+     *  @param[in] destination passes destination block number
+     */
+    void addArc(
+            uint32_t   source,
+            uint32_t   destination,
+            uint32_t   flags
+    );
+
+    /*!
+     *  This method adds new arc to arc list
+     *
+     *  @param[in] block identifies block
+     *  @param[in] line passes the line number
+     */
+    void addBlockLine(
+            const blocks_iterator_t    block,
+            const uint32_t             line
+    );
+
+    /*!
+     *  This method finds block by its ID
+     *
+     *  @param[in] id passes block id number
+     *
+     *  @return Returns iterator to a matching block or NULL for error.
+     */
+    blocks_iterator_t findBlockById(
+            const uint32_t             id
+    );
+
+    /*!
+     *  This method adds new block to block list
+     *
+     *  @param[in] id passes block id number
+     *  @param[in] flags passes per block flags
+     *  @param[in] sourceFileName passes containing file name
+     */
+    void addBlock(
+            const uint32_t             id,
+            const uint32_t             flags,
+            const char *               sourceFileName
+    );
+
+    /*!
+     *  This method prints info about function
+     */
+    void printFunctionInfo( FILE * textFile, uint32_t function_number );
+
+    /*!
+     *  This method prints info about coverage of this function
+     */
+    void printCoverageInfo( FILE * textFile, uint32_t function_number );
+
+    /*!
+     *  This method prints info about chosen arc in arcs list
+     *
+     *  @param[in] textFile specifies output file
+     *  @param[in] arc passes iterator identifying arc
+     */
+    void printArcInfo(
+            FILE * textFile,<span style="background-color: #FF0000"> </span>
+            arcs_iterator_t arc<span style="background-color: #FF0000"> </span>
+    );
+
+    /*!
+     *  This method prints info about chosen block in blocks list
+     *
+     *  @param[in] block passes iterator identifying block
+     */
+    void printBlockInfo(
+            FILE * textFile,<span style="background-color: #FF0000"> </span>
+            blocks_iterator_t block
+    );
+
+    /*!
+     *  This method calculates values of arc counters
+     */
+    bool processFunctionCounters( void );
+
+  private:
+
+    uint32_t           id;
+    uint32_t           checksum;
+    uint32_t           firstLineNumber;
+    uint32_t           numberOfBlocks;
+    uint32_t           numberOfArcs;
+    arcs_t             arcs;
+    blocks_t           blocks;
+    char               functionName[FUNCTION_NAME_LENGTH];
+    char               sourceFileName[FILE_NAME_LENGTH];
+
+    /*!
+     *  This member contains the unified or merged coverage map
+     *  and symbol info for the symbol.
+     */
+    Coverage::CoverageMapBase*          coverageMap;
+    Coverage::SymbolInformation*<span style="background-color: #FF0000"> </span> symbolInfo;
+
+    /*!
+     *  This method creates list of taken/not taken values
+     *  for branches
+     *
+     *  @param[in] taken      used to return taken counts list
+     *  @param[in] notTaken   used to return not taken counts list
+     */
+    bool processBranches(
+            std::list<uint64_t> * taken ,<span style="background-color: #FF0000"> </span>
+            std::list<uint64_t> * notTaken<span style="background-color: #FF0000"> </span>
+    );
+  };
+
+}
+#endif
</font>
<font color='#006600'>diff -u /dev/null rtems-testing/covoar/GcovFunctionData.cc:1.1
--- /dev/null   Fri Dec  2 01:31:48 2011
+++ rtems-testing/covoar/GcovFunctionData.cc    Thu Dec  1 14:24:47 2011
</font><font color='#997700'>@@ -0,0 +1,595 @@
</font><font color='#000088'>+/*
+ *  $Id$
+ */
+
+/*! @file GcovFunctionData.cc
+ *  @brief GcovFunctionData Implementation
+ *
+ *  This file contains the implementation of the class storing information
+ *  about single function.
+ */
+
+#include <stdio.h>
+#include <string.h>
+//#include <stdlib.h>
+//#include <sys/stat.h>
+
+#include "app_common.h"
+#include "GcovFunctionData.h"
+#include "ObjdumpProcessor.h"
+#include "CoverageMapBase.h"
+//#include "ExecutableInfo.h"
+//#include "CoverageMap.h"
+//#include "qemu-traces.h"
+
+
+namespace Gcov {
+
+  GcovFunctionData::GcovFunctionData()
+  {
+    numberOfArcs = 0;
+    numberOfBlocks = 0;
+    coverageMap = NULL;
+  }
+
+  GcovFunctionData::~GcovFunctionData()
+  {
+  }
+
+  void GcovFunctionData::setChecksum( const uint32_t chk )
+  {
+    checksum = chk;
+  }
+
+  void GcovFunctionData::setId( const uint32_t idNumber )
+  {
+    id = idNumber;
+  }
+
+
+  void GcovFunctionData::setFirstLineNumber( const uint32_t lineNo )
+  {
+    firstLineNumber = lineNo;
+  }
+
+  bool GcovFunctionData::setFunctionName( const char* fcnName )
+  {
+    std::string<span style="background-color: #FF0000"> </span>  symbolName;
+
+    symbolName = fcnName;
+
+    if ( strlen(fcnName) >= FUNCTION_NAME_LENGTH ) {
+      fprintf( stderr,<span style="background-color: #FF0000"> </span>
+              "ERROR: Function name is to long to be correctly stored: %u\n",<span style="background-color: #FF0000"> </span>
+              strlen(fcnName)
+              );
+      return false;
+    }
+
+    strcpy (functionName, fcnName);
+
+    // Tie function to its coverage map
+    symbolInfo = SymbolsToAnalyze->find( symbolName );
+    if ( symbolInfo != NULL )
+      coverageMap = symbolInfo->unifiedCoverageMap;
+
+    //if ( coverageMap == NULL)
+    //  fprintf( stderr, "ERROR: Could not find coverage map for: %s\n", symbolName.c_str() );
+    //else
+    //  fprintf( stderr, "SUCCESS: Hound coverage map for: %s\n", symbolName.c_str() );
+
+    return true;
+  }
+
+  bool GcovFunctionData::setFileName( const char* fileName ) {
+    if ( strlen(fileName) >= FILE_NAME_LENGTH ){
+      fprintf( stderr,<span style="background-color: #FF0000"> </span>
+              "ERROR: File name is to long to be correctly stored: %u\n",<span style="background-color: #FF0000"> </span>
+              strlen(fileName)<span style="background-color: #FF0000"> </span>
+      );
+      return false;
+    }
+    strcpy (sourceFileName, fileName);
+    return true;
+  }
+
+  arcs_t GcovFunctionData::getArcs() const
+  {
+    return arcs;
+  }
+
+  uint32_t GcovFunctionData::getChecksum() const
+  {
+    return checksum;
+  }
+
+  uint32_t GcovFunctionData::getId() const
+  {
+    return id;
+  }
+
+  void GcovFunctionData::getCounters(
+<span style="background-color: #FF0000">    </span>              uint64_t* counterValues,
+<span style="background-color: #FF0000">    </span>              uint32_t &countersFound,
+<span style="background-color: #FF0000">    </span>              uint64_t &countersSum,
+<span style="background-color: #FF0000">    </span>              uint64_t &countersMax
+  )<span style="background-color: #FF0000"> </span>
+  {
+    arcs_iterator_t            currentArc;
+    int                                        i;
+
+    countersFound<span style="background-color: #FF0000"> </span>        = 0;
+    countersSum                = 0;
+    countersMax                = 0;
+
+    // Locate relevant counters and copy their values
+    i = 0;
+    for(
+      currentArc = arcs.begin();
+      currentArc != arcs.end();
+      currentArc++
+    )
+    {
+      if ( currentArc->flags == 0 || currentArc->flags == 2 || currentArc->flags == 4 ) {
+        countersFound++;
+        countersSum += currentArc->counter;
+        counterValues[i] = currentArc->counter;
+        if ( countersMax <= currentArc->counter)
+          countersMax = currentArc->counter;
+        i++;
+      }
+    }
+  }
+
+  blocks_t GcovFunctionData::getBlocks() const
+  {
+    return blocks;
+  }
+
+  void GcovFunctionData::addArc(
+<span style="background-color: #FF0000">    </span>              uint32_t        source,
+<span style="background-color: #FF0000">    </span>              uint32_t        destination,
+<span style="background-color: #FF0000">    </span>              uint32_t        flags
+  )
+  {
+    gcov_arc_info arc;
+
+    numberOfArcs++;
+    arc.sourceBlock = source;
+    arc.destinationBlock = destination;
+    arc.flags = flags;
+    arc.counter = 0;
+    arcs.push_back(arc);
+  }
+
+  void GcovFunctionData::addBlock(
+    const uint32_t             id,
+    const uint32_t             flags,
+    const char *               sourceFileName
+  )
+  {
+    gcov_block_info block;
+    numberOfBlocks++;
+    block.id<span style="background-color: #FF0000"> </span>              = id;
+    block.flags<span style="background-color: #FF0000"> </span>           = flags;
+    block.numberOfLines         = 0;
+    block.counter      <span style="background-color: #FF0000">  </span>  = 0;
+    strcpy (block.sourceFileName, sourceFileName);
+    blocks.push_back(block);
+  }
+
+  void GcovFunctionData::printFunctionInfo( FILE * textFile,<span style="background-color: #FF0000"> </span>
+<span style="background-color: #FF0000">  </span>                  uint32_t function_number
+  )
+  {
+    blocks_iterator_t  currentBlock;
+    arcs_iterator_t            currentArc;
+
+    fprintf(
+          textFile,
+          "\n\n=========================="
+          "FUNCTION %3d "
+          "==========================\n\n",
+          function_number
+    );
+    fprintf(
+          textFile,
+          "Name:      %s\n"
+          "File:      %s\n"
+          "Line:      %u\n"
+          "Id:        %u\n"
+          "Checksum:  0x%x\n\n",
+          functionName,
+          sourceFileName,
+          firstLineNumber,
+          id,
+          checksum
+    );
+
+    // Print arcs info
+    for (
+        currentArc = arcs.begin();
+        currentArc != arcs.end();
+        currentArc++
+    )
+    {
+        printArcInfo( textFile, currentArc );
+    }
+    fprintf( textFile, "\n");
+
+    // Print blocks info
+    for (
+        currentBlock =<span style="background-color: #FF0000"> </span>   blocks.begin();
+        currentBlock != blocks.end();
+        currentBlock++
+    )
+    {
+      printBlockInfo( textFile, currentBlock );
+    }
+  }
+
+  void GcovFunctionData::printCoverageInfo( FILE * textFile,<span style="background-color: #FF0000"> </span>
+<span style="background-color: #FF0000">  </span>                  uint32_t function_number
+  )
+  {
+    uint32_t       baseAddress = 0;
+    uint32_t        baseSize;
+    uint32_t        currentAddress;
+    std::list<Coverage::ObjdumpProcessor::objdumpLine_t>::iterator   instruction;
+
+    if ( coverageMap != NULL ) {
+
+      for (instruction = symbolInfo->instructions.begin(); instruction != symbolInfo->instructions.end(); instruction++)
+        if( instruction->isInstruction ) {
+          baseAddress = instruction->address;
+          break;
+        }
+      baseSize   = coverageMap->getSize();
+
+      fprintf( textFile,
+              "\nInstructions (Base address: 0x%08x, Size: %4u): \n\n",
+              baseAddress,<span style="background-color: #FF0000"> </span>
+              baseSize<span style="background-color: #FF0000"> </span>
+      );
+      for (
+            instruction = symbolInfo->instructions.begin();<span style="background-color: #FF0000"> </span>
+            instruction != symbolInfo->instructions.end();<span style="background-color: #FF0000"> </span>
+            instruction++
+      )
+      {
+        if ( instruction->isInstruction ) {
+          currentAddress = instruction->address - baseAddress;
+          fprintf( textFile, "0x%-70s ", instruction->line.c_str() );
+          fprintf( textFile, "| 0x%08x ",   currentAddress );
+          fprintf( textFile, "*");
+          fprintf( textFile,<span style="background-color: #FF0000"> </span>
+                    "| exec: %4u ",<span style="background-color: #FF0000"> </span>
+                    coverageMap->getWasExecuted( currentAddress )<span style="background-color: #FF0000"> </span>
+          );
+          fprintf( textFile, "| taken/not: %4u/%4u ",
+                    coverageMap->getWasTaken( currentAddress ),<span style="background-color: #FF0000"> </span>
+                    coverageMap->getWasNotTaken( currentAddress )<span style="background-color: #FF0000"> </span>
+          );
+
+          if ( instruction->isBranch )
+            fprintf( textFile, "| Branch " );
+          else
+            fprintf( textFile, "         " );
+
+          if ( instruction->isNop )
+            fprintf( textFile, "| NOP(%3u) \n", instruction->nopSize );
+          else
+            fprintf( textFile, "           \n" );
+        }
+      }
+    }
+  }
+
+  void GcovFunctionData::setBlockFileName(
+                const blocks_iterator_t  block,
+                const char               *fileName
+  )
+  {
+    strcpy(block->sourceFileName, fileName);
+  }
+
+  void GcovFunctionData::addBlockLine(
+<span style="background-color: #FF0000">    </span>              const blocks_iterator_t  block,
+<span style="background-color: #FF0000">    </span>              const uint32_t           line
+  )
+  {
+    block->lines.push_back(line);
+    (block->numberOfLines)++;
+  }
+
+  blocks_iterator_t GcovFunctionData::findBlockById(
+                const uint32_t    id
+  )
+  {
+    blocks_iterator_t blockIterator;
+    if ( !blocks.empty() ){
+      blockIterator = blocks.begin();
+      while (  blockIterator != blocks.end( ) ){
+        if ( blockIterator->id ==  id)
+          break;
+        blockIterator++;
+      }
+    }
+    else
+      fprintf( stderr,
+              "ERROR: GcovFunctionData::findBlockById() failed,"
+              "no blocks present\n"
+      );
+    return blockIterator;
+  }
+
+  void GcovFunctionData::printArcInfo(<span style="background-color: #FF0000"> </span>
+                FILE * textFile, arcs_iterator_t arc
+  )
+  {
+    fprintf( textFile,
+            " > ARC %3u -> %3u ",
+            arc->sourceBlock,
+            arc->destinationBlock
+    );
+
+    fprintf( textFile, "\tFLAGS: ");
+    switch ( arc->flags ){
+      case 0:
+        fprintf( textFile, "( ___________ ____ _______ )");
+        break;
+      case 1:
+        fprintf( textFile, "( ___________ ____ ON_TREE )");
+        break;
+      case 2:
+        fprintf( textFile, "( ___________ FAKE _______ )");
+        break;
+      case 3:
+        fprintf( textFile, "( ___________ FAKE ON_TREE )");
+        break;
+      case 4:
+        fprintf( textFile, "( FALLTHROUGH ____ _______ )");
+        break;
+      case 5:
+        fprintf( textFile, "( FALLTHROUGH ____ ON_TREE )");
+        break;
+      default:
+        fprintf( textFile, "( =======FLAGS_ERROR====== )");
+        fprintf( stderr,
+                " ERROR: Unknown arc flag: 0x%x\n",
+                arcs.back().flags
+        );
+        break;
+    }
+    fprintf( textFile, "\tTaken: %5llu\n", arc->counter );
+  }
+
+  void GcovFunctionData::printBlockInfo(<span style="background-color: #FF0000"> </span>
+                FILE * textFile,<span style="background-color: #FF0000"> </span>
+                blocks_iterator_t block )
+  {
+    std::list<uint32_t>::iterator        line;
+
+    fprintf( textFile,
+            " > BLOCK %3u from %s\n"
+            "    -counter: %5llu\n"
+            "    -flags: 0x%x\n"
+            "    -lines: ",
+            block->id,
+            block->sourceFileName,
+            block->counter,
+            block->flags
+    );
+    if ( !block->lines.empty( ) )
+      for ( line = block->lines.begin() ; line != block->lines.end(); line++ )
+      fprintf ( textFile, "%u, ", *line);
+    fprintf ( textFile, "\n");
+  }
+
+  bool GcovFunctionData::processFunctionCounters( void ) {
+
+    uint32_t                                                   baseAddress = 0;
+    uint32_t<span style="background-color: #FF0000">        </span>                                              currentAddress = 0;
+    std::list<Coverage::ObjdumpProcessor::objdumpLine_t>::iterator  instruction;
+    blocks_iterator_t<span style="background-color: #FF0000"> </span>                                            blockIterator;
+    blocks_iterator_t<span style="background-color: #FF0000"> </span>                                            blockIterator2;
+    arcs_iterator_t<span style="background-color: #FF0000"> </span>                                              arcIterator;
+    arcs_iterator_t<span style="background-color: #FF0000"> </span>                                              arcIterator2;
+    std::list<uint64_t>                 taken;       // List of taken counts for branches
+    std::list<uint64_t>                 notTaken;    // List of not taken counts for branches
+
+    //fprintf( stderr, "DEBUG: Processing counters for file: %s\n", sourceFileName  );<span style="background-color: #FF0000"> </span>
+    if ( blocks.empty() || arcs.empty() || coverageMap == NULL || symbolInfo->instructions.empty())
+    {
+      //fprintf( stderr,<span style="background-color: #FF0000"> </span>
+      //          "DEBUG: sanity check returned false for function: %s from file: %s\n",<span style="background-color: #FF0000"> </span>
+      //          functionName,<span style="background-color: #FF0000"> </span>
+      //          sourceFileName<span style="background-color: #FF0000"> </span>
+      //);
+      return false;<span style="background-color: #FF0000"> </span>
+    }
+
+    // Reset iterators and variables
+    blockIterator = blocks.begin();
+    arcIterator = arcs.begin();
+    arcIterator2 = arcIterator;
+    arcIterator2++;
+    instruction = symbolInfo->instructions.begin();
+    baseAddress = coverageMap->getFirstLowAddress();      //symbolInfo->baseAddress;
+    currentAddress = baseAddress;
+
+    // Find taken/not taken values for branches
+    if ( !processBranches( &taken , &notTaken ) )
+    {
+      //fprintf( stderr,<span style="background-color: #FF0000"> </span>
+      //          "ERROR: Failed to process branches for function: %s from file: %s\n",<span style="background-color: #FF0000"> </span>
+      //          functionName,<span style="background-color: #FF0000"> </span>
+      //          sourceFileName<span style="background-color: #FF0000"> </span>
+      //);
+      return false;<span style="background-color: #FF0000"> </span>
+    };
+
+    // Process the branching arcs
+    while ( blockIterator != blocks.end() ) {
+      //fprintf( stderr, "DEBUG: Processing branches\n" );
+      while ( arcIterator->sourceBlock != blockIterator->id ) {
+        if ( arcIterator == arcs.end() ) {
+          //fprintf( stderr, "ERROR: Unexpectedly runned out of arcs to analyze\n" );
+          return false;
+        }
+        arcIterator++;
+        arcIterator2++;
+      }
+
+      // If no more branches break;
+      if ( arcIterator2 == arcs.end() )
+        break;
+
+      // If this is a branch without FAKE arcs process it
+      if (<span style="background-color: #FF0000"> </span>
+        (arcIterator->sourceBlock == arcIterator2->sourceBlock ) &&<span style="background-color: #FF0000"> </span>
+        !( arcIterator->flags & FAKE_ARC_FLAG ) &&
+        !( arcIterator2->flags & FAKE_ARC_FLAG )<span style="background-color: #FF0000"> </span>
+      )
+      {
+        if ( taken.empty() || notTaken.empty() ) {
+          fprintf( stderr,<span style="background-color: #FF0000"> </span>
+                    "ERROR: Branchess missing for function: %s from file: %s\n",<span style="background-color: #FF0000"> </span>
+                    functionName,<span style="background-color: #FF0000"> </span>
+                    sourceFileName<span style="background-color: #FF0000"> </span>
+        );
+        return false;
+      }
+      //fprintf( stderr, "DEBUG: Found true branching arc %3u -> %3u\n", arcIterator->sourceBlock, arcIterator->destinationBlock );
+      if ( arcIterator->flags & FALLTHROUGH_ARC_FLAG ) {
+        arcIterator->counter = notTaken.front();
+        notTaken.pop_front();
+        arcIterator2->counter = taken.front();
+        taken.pop_front();
+      }
+      else {
+        arcIterator2->counter = notTaken.front();
+        notTaken.pop_front();
+        arcIterator->counter = taken.front();
+        taken.pop_front();<span style="background-color: #FF0000">                   </span>
+      }
+
+      blockIterator2 = blocks.begin();
+      //TODO: ADD FAILSAFE
+      while ( arcIterator->destinationBlock != blockIterator2->id)<span style="background-color: #FF0000"><span style="background-color: #FF0000"> </span> </span>
+        blockIterator2++;
+      blockIterator2->counter += arcIterator->counter;
+
+      blockIterator2 = blocks.begin();
+      //TODO: ADD FAILSAFE
+      while ( arcIterator2->destinationBlock != blockIterator2->id)
+          blockIterator2++;
+        blockIterator2->counter += arcIterator2->counter;
+    }<span style="background-color: #FF0000">      </span>
+    blockIterator++;
+  }
+
+
+    // Reset iterators and variables
+    blockIterator = blocks.begin();
+    arcIterator = arcs.begin();
+    arcIterator2 = arcIterator;
+    arcIterator2++;
+
+    // Set the first block
+    blockIterator->counter = coverageMap->getWasExecuted( currentAddress );
+
+    // Analyze remaining arcs and blocks
+    while ( blockIterator != blocks.end() ) {
+      while ( arcIterator->sourceBlock != blockIterator->id ) {
+        if ( arcIterator == arcs.end() ) {
+          fprintf( stderr, "ERROR: Unexpectedly runned out of arcs to analyze\n" );
+          return false;
+        }
+        arcIterator++;
+        arcIterator2++;
+      }
+
+      // If this is the last arc, propagate counter and exit
+      if ( arcIterator2 == arcs.end() ) {
+        //fprintf( stderr,<span style="background-color: #FF0000"> </span>
+        //        "DEBUG: Found last arc %3u -> %3u\n",<span style="background-color: #FF0000"> </span>
+        //        arcIterator->sourceBlock,<span style="background-color: #FF0000"> </span>
+        //        arcIterator->destinationBlock<span style="background-color: #FF0000"> </span>
+        //);
+        arcIterator->counter = blockIterator->counter;
+        blockIterator2 =  blocks.begin();
+        while ( arcIterator->destinationBlock != blockIterator2->id)<span style="background-color: #FF0000">  </span>      //TODO: ADD FAILSAFE
+          blockIterator2++;
+        blockIterator2->counter += arcIterator->counter;
+        return true;
+      }<span style="background-color: #FF0000"> </span>
+
+      // If this is not a branch, propagate counter and continue
+      if ( arcIterator->sourceBlock != arcIterator2->sourceBlock ) {
+        //fprintf( stderr, "DEBUG: Found simple arc %3u -> %3u\n", arcIterator->sourceBlock, arcIterator->destinationBlock );
+        arcIterator->counter = blockIterator->counter;
+        blockIterator2 =  blocks.begin();;
+        while ( arcIterator->destinationBlock != blockIterator2->id)<span style="background-color: #FF0000"> </span>       //TODO: ADD FAILSAFE<span style="background-color: #FF0000"> </span>
+          blockIterator2++;
+        blockIterator2->counter += arcIterator->counter;
+      }
+<span style="background-color: #FF0000">           </span>
+      // If this is  a branch with FAKE arc
+      else if ( (arcIterator->sourceBlock == arcIterator2->sourceBlock ) && ( arcIterator2->flags & FAKE_ARC_FLAG ))
+      {
+        //fprintf( stderr, "DEBUG: Found fake branching arc %3u -> %3u\n", arcIterator->sourceBlock, arcIterator->destinationBlock );
+        arcIterator->counter = blockIterator->counter;
+        blockIterator2 =  blocks.begin();
+        while ( arcIterator->destinationBlock != blockIterator2->id)<span style="background-color: #FF0000"> </span>       //TODO: ADD FAILSAFE
+          blockIterator2++;
+        blockIterator2->counter += arcIterator->counter;
+      }
+
+      // If this is a legitimate branch<span style="background-color: #FF0000">            </span>
+      blockIterator++;
+    }
+
+    return true;
+  }
+<span style="background-color: #FF0000">    </span>
+  bool GcovFunctionData::processBranches(<span style="background-color: #FF0000"> </span>
+            std::list<uint64_t> * taken ,<span style="background-color: #FF0000"> </span>
+            std::list<uint64_t> * notTaken<span style="background-color: #FF0000"> </span>
+  )
+  {
+    uint32_t       baseAddress = 0;
+    uint32_t        currentAddress;
+    std::list<Coverage::ObjdumpProcessor::objdumpLine_t>::iterator   instruction;
+
+    if ( coverageMap == NULL )
+      return false;
+
+    //baseAddress = coverageMap->getFirstLowAddress();      //symbolInfo->baseAddress;
+    for (instruction = symbolInfo->instructions.begin(); instruction != symbolInfo->instructions.end(); instruction++)
+      if( instruction->isInstruction ) {
+        baseAddress = instruction->address;
+        break;
+      }
+
+    //fprintf( stderr, "DEBUG: Processing instructions in search of branches\n" );
+    for (instruction = symbolInfo->instructions.begin(); instruction != symbolInfo->instructions.end(); instruction++)
+    {
+      if ( instruction->isInstruction) {
+        currentAddress = instruction-> address - baseAddress;
+        if ( instruction->isBranch ) {
+          taken->push_back ( (uint64_t) coverageMap->getWasTaken( currentAddress  ) );
+          notTaken->push_back ( (uint64_t) coverageMap->getWasNotTaken( currentAddress ) );
+          //fprintf( stderr,<span style="background-color: #FF0000"> </span>
+          //          "Added branch to list taken/not: %4u/%4u\n",
+          //          coverageMap->getWasTaken( currentAddress ),<span style="background-color: #FF0000"> </span>
+          //          coverageMap->getWasNotTaken( currentAddress )<span style="background-color: #FF0000"> </span>
+          //);
+        }
+      }
+    }
+    return true;
+  }
+}
+
+
</font>
<font color='#006600'>diff -u rtems-testing/covoar/Makefile:1.3 rtems-testing/covoar/Makefile:1.4
--- rtems-testing/covoar/Makefile:1.3   Fri Jun 18 11:13:00 2010
+++ rtems-testing/covoar/Makefile       Thu Dec  1 14:24:47 2011
</font><font color='#997700'>@@ -24,6 +24,8 @@
</font>   DesiredSymbols.o \
   ExecutableInfo.o \
   Explanations.o \
<font color='#000088'>+  GcovData.o \
+  GcovFunctionData.o \
</font>   ObjdumpProcessor.o \
   ReportsBase.o \
   ReportsText.o \
<font color='#997700'>@@ -125,6 +127,8 @@
</font> ExecutableInfo.o: ExecutableInfo.cc ExecutableInfo.h CoverageMap.h \
   DesiredSymbols.h SymbolTable.h
 Explanations.o: Explanations.cc Explanations.h
<font color='#000088'>+GcovData.o: GcovData.h GcovData.cc
+GcovFunctionData.o: GcovFunctionData.h GcovFunctionData.cc
</font> ObjdumpProcessor.o: ObjdumpProcessor.cc ObjdumpProcessor.h ExecutableInfo.h \
   TargetBase.h TargetFactory.h
 ReportsBase.o: ReportsBase.cc ReportsBase.h CoverageRanges.h DesiredSymbols.h \

<font color='#006600'>diff -u rtems-testing/covoar/SymbolTable.h:1.2 rtems-testing/covoar/SymbolTable.h:1.3
--- rtems-testing/covoar/SymbolTable.h:1.2      Tue Jan 25 15:26:00 2011
+++ rtems-testing/covoar/SymbolTable.h  Thu Dec  1 14:24:47 2011
</font><font color='#997700'>@@ -37,6 +37,7 @@
</font>     } symbolInfo_t;
  
    typedef std::list< symbolInfo_t > symbolInfo;
<font color='#000088'>+   typedef std::list< symbolInfo_t >::iterator       symbolInfoIterator_t;
</font>  
     
 
<font color='#997700'>@@ -98,6 +99,12 @@
</font>       uint32_t address
     );
 
<font color='#000088'>+    /*!
+     *  This method prints SymbolTable content to stdout
+     *
+     */
+    void dumpSymbolTable( void );
+
</font>   private:
 
     /*!
<font color='#997700'>@@ -117,6 +124,7 @@
</font>      *  the symbol's information.
      */
     typedef std::map<std::string, symbolInfo> info_t;
<font color='#000088'>+    typedef std::map<std::string, symbolInfo>::iterator infoIterator_t;
</font>     info_t info;
 
   };

<font color='#006600'>diff -u rtems-testing/covoar/SymbolTable.cc:1.2 rtems-testing/covoar/SymbolTable.cc:1.3
--- rtems-testing/covoar/SymbolTable.cc:1.2     Tue Jan 25 15:26:00 2011
+++ rtems-testing/covoar/SymbolTable.cc Thu Dec  1 14:24:47 2011
</font><font color='#997700'>@@ -104,4 +104,19 @@
</font>     return "";
   }
 
<font color='#000088'>+  void SymbolTable::dumpSymbolTable( void )
+  {
+    symbolInfo<span style="background-color: #FF0000">   </span>         symbolTable;
+    symbolInfoIterator_t<span style="background-color: #FF0000"> </span> symbolIterator;
+    infoIterator_t             infoIterator;
+
+    for (infoIterator = info.begin() ; infoIterator != info.end(); infoIterator++)
+    {
+      for (symbolIterator = infoIterator->second.begin() ; symbolIterator != infoIterator->second.end(); symbolIterator++)
+      {
+         fprintf( stdout, "%s:\tStarting address = %#x\tLength = %u\n", infoIterator->first.c_str(), symbolIterator->startingAddress, symbolIterator->length );
+      }
+    }
+  }
+
</font> }

<font color='#006600'>diff -u rtems-testing/covoar/covoar.cc:1.5 rtems-testing/covoar/covoar.cc:1.6
--- rtems-testing/covoar/covoar.cc:1.5  Fri Nov  4 11:02:36 2011
+++ rtems-testing/covoar/covoar.cc      Thu Dec  1 14:24:47 2011
</font><font color='#997700'>@@ -25,6 +25,7 @@
</font> #include "ObjdumpProcessor.h"
 #include "ReportsBase.h"
 #include "TargetFactory.h"
<font color='#000088'>+#include "GcovData.h"
</font> 
 /*
  *  Variables to control general behavior
<font color='#997700'>@@ -41,8 +42,14 @@
</font> const char*                          explanations = NULL;
 char*                                progname;
 const char*                          symbolsFile = NULL;
<font color='#000088'>+const char*                             gcnosFileName = NULL;
+char                                gcnoFileName[FILE_NAME_LENGTH];
+char                                gcdaFileName[FILE_NAME_LENGTH];
+char                                gcovBashCommand[256];
</font> const char*                          target = NULL;
 const char*                          format = NULL;
<font color='#000088'>+FILE*                                   gcnosFile = NULL;
+Gcov::GcovData*<span style="background-color: #FF0000"> </span>               gcovFile;
</font> 
 /*
  *  Print program usage message
<font color='#997700'>@@ -64,6 +71,7 @@
</font>     "  -1 EXECUTABLE             - name of executable to get symbols from\n"
     "  -e EXE_EXTENSION          - extension of the executables to analyze\n"
     "  -c COVERAGEFILE_EXTENSION - extension of the coverage files to analyze\n"
<font color='#000088'>+    "  -g GCNOS_LIST             - name of file with list of *.gcno files\n"
</font>     "  -p PROJECT_NAME           - name of the project\n"
     "  -C ConfigurationFileName  - name of configuration file\n"
     "  -O Output_Directory       - name of output directory (default=."
<font color='#997700'>@@ -88,6 +96,7 @@
</font>   { "outputDirectory",      NULL },
   { "executableExtension",  NULL },
   { "coverageExtension",    NULL },
<font color='#000088'>+  { "gcnosFile",            NULL },
</font>   { "target",               NULL },
   { "verbose",              NULL },
   { "projectName",          NULL },
<font color='#997700'>@@ -127,6 +136,7 @@
</font>   GET_STRING( "outputDirectory",      outputDirectory );
   GET_STRING( "executableExtension",  executableExtension );
   GET_STRING( "coverageExtension",    coverageFileExtension );
<font color='#000088'>+  GET_STRING( "gcnosFile",            gcnosFileName );
</font>   GET_STRING( "projectName",          projectName );
 
   // Now calculate some values
<font color='#997700'>@@ -160,13 +170,14 @@
</font>   //
   progname = argv[0];
 
<font color='#880000'>-  while ((opt = getopt(argc, argv, "C:1:L:e:c:E:f:s:T:O:p:v")) != -1) {
</font><font color='#000088'>+  while ((opt = getopt(argc, argv, "C:1:L:e:c:g:E:f:s:T:O:p:v")) != -1) {
</font>     switch (opt) {
       case 'C': CoverageConfiguration->processFile( optarg ); break;
       case '1': singleExecutable      = optarg; break;
       case 'L': dynamicLibrary        = optarg; break;
       case 'e': executableExtension   = optarg; break;
       case 'c': coverageFileExtension = optarg; break;
<font color='#000088'>+      case 'g': gcnosFileName         = optarg; break;
</font>       case 'E': explanations          = optarg; break;
       case 'f': format                = optarg; break;
       case 's': symbolsFile           = optarg; break;
<font color='#997700'>@@ -348,7 +359,7 @@
</font>   SymbolsToAnalyze->load( symbolsFile );
   if (Verbose)
     fprintf(
<font color='#880000'>-      stderr, "Analyzing %ld symbols\n", SymbolsToAnalyze->set.size()
</font><font color='#000088'>+      stderr, "Analyzing %u symbols\n", SymbolsToAnalyze->set.size()
</font>     );
 
   // Create explanations.
<font color='#997700'>@@ -412,6 +423,9 @@
</font>     // Merge each symbols coverage map into a unified coverage map.
     (*eitr)->mergeCoverage();
 
<font color='#000088'>+    // DEBUG Print ExecutableInfo content
+    //(*eitr)->dumpExecutableInfo();
+
</font>     if (!singleExecutable)
       eitr++;
   }
<font color='#997700'>@@ -421,6 +435,37 @@
</font>     fprintf( stderr, "Preprocess uncovered ranges and branches\n" );
   SymbolsToAnalyze->preprocess();
 
<font color='#000088'>+  //
+  // Generate Gcov reports
+  //
+  if (Verbose)
+    fprintf( stderr, "Generating Gcov reports...\n");
+  gcnosFile = fopen ( gcnosFileName , "r" );<span style="background-color: #FF0000"> </span>
+
+  if ( !gcnosFile ) {
+    fprintf( stderr, "Unable to open %s\n", gcnosFileName );
+  }
+  else {
+    while ( fscanf( gcnosFile, "%s", inputBuffer ) != EOF) {
+      gcovFile = new Gcov::GcovData();
+      strcpy( gcnoFileName, inputBuffer );
+
+      if ( Verbose )
+       fprintf( stderr, "Processing file: %s\n", gcnoFileName );
+
+      if ( gcovFile->readGcnoFile( gcnoFileName ) ) {
+        // Those need to be in this order
+        gcovFile->processCounters();
+        gcovFile->writeReportFile();
+        gcovFile->writeGcdaFile();
+        gcovFile->writeGcovFile();
+      }
+
+      delete gcovFile;
+    }
+  fclose( gcnosFile );
+  }
+
</font>   // Determine the uncovered ranges and branches.
   if (Verbose)
     fprintf( stderr, "Computing uncovered ranges and branches\n" );
</pre>
<p> </p>
<a name='cs4'></a>
<table border='0' cellspacing='0' cellpadding='5' width='100%' bgcolor='#eeeeee'>
<tr><td colspan='3' bgcolor='#dddddd'>
 <font color='#bb2222'><strong>joel</strong></font>
</td></tr>
<tr><td colspan='3' bgcolor='#dddddd'><pre>2011-12-01 Pawel Zagorski <pzagor@agh.edu.pl>

        * do_coverage, rtems_config.in: Add GNU coverage support.
</pre></td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/rtems-coverage/ChangeLog.diff?r1=text&tr1=1.311&r2=text&tr2=1.312&diff_format=h">M</a></td><td width='1%'>1.312</td><td width='100%'>rtems-coverage/ChangeLog</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/rtems-coverage/do_coverage.diff?r1=text&tr1=1.78&r2=text&tr2=1.79&diff_format=h">M</a></td><td width='1%'>1.79</td><td width='100%'>rtems-coverage/do_coverage</td></tr>
<tr><td width='1%'><a href="http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems-testing/rtems-coverage/rtems_config.in.diff?r1=text&tr1=1.2&r2=text&tr2=1.3&diff_format=h">M</a></td><td width='1%'>1.3</td><td width='100%'>rtems-coverage/rtems_config.in</td></tr>
</table>
<pre>
<font color='#006600'>diff -u rtems-testing/rtems-coverage/ChangeLog:1.311 rtems-testing/rtems-coverage/ChangeLog:1.312
--- rtems-testing/rtems-coverage/ChangeLog:1.311        Mon Nov 28 09:02:20 2011
+++ rtems-testing/rtems-coverage/ChangeLog      Thu Dec  1 14:28:13 2011
</font><font color='#997700'>@@ -1,3 +1,7 @@
</font><font color='#000088'>+2011-12-01    Pawel Zagorski <pzagor@agh.edu.pl>
+
+       * do_coverage, rtems_config.in: Add GNU coverage support.
+
</font> 2011-11-28        Aleksejs Popovs <me@popoffka.ru>
 
        * generate_coverage_html, style.css: Google Code-In 2011 task to make

<font color='#006600'>diff -u rtems-testing/rtems-coverage/do_coverage:1.78 rtems-testing/rtems-coverage/do_coverage:1.79
--- rtems-testing/rtems-coverage/do_coverage:1.78       Fri Nov  4 14:29:01 2011
+++ rtems-testing/rtems-coverage/do_coverage    Thu Dec  1 14:28:13 2011
</font><font color='#997700'>@@ -39,6 +39,7 @@
</font>         -L        -- do not link files to test execution point (default=link)
         -r        -- run the tests (default=no)
         -R        -- generate reports (default=no)
<font color='#000088'>+        -g        -- generate GCOV reports (default=no)
</font>         -f        -- publish the results to ftp site (default=no)
         -t        -- save the results locally (default=no)
         -O        -- output directory (default=BSP-CONF-YYYYMMDD-HHMM)
<font color='#997700'>@@ -81,6 +82,7 @@
</font> 
 # parse arguments for these
 verbose="no"
<font color='#000088'>+do_all="no"
</font> do_posix="yes"
 do_optimize_size="no"
 do_covoar="no"
<font color='#997700'>@@ -90,6 +92,7 @@
</font> do_copy_tests="no"
 do_link_tests="yes"
 do_run_tests="no"
<font color='#000088'>+do_generate_gcov="no"
</font> do_reports="no"
 do_publish="no"
 do_save_tarballs="yes"
<font color='#997700'>@@ -98,10 +101,11 @@
</font> outputDir=""
 BSP="not_set"
 
<font color='#880000'>-while getopts vB:PSmAucbCLrRftO:dD OPT
</font><font color='#000088'>+while getopts vB:PSmAucbCLrgRftO:dD OPT
</font> do
     case "$OPT" in
         A)
<font color='#000088'>+          do_all="yes"
</font>           do_covoar="yes"
           do_posix="yes"
           do_rtems_update="yes"
<font color='#997700'>@@ -125,6 +129,7 @@
</font>         C) do_copy_tests=`toggle ${do_copy_tests}` ;;
         L) do_link_tests=`toggle ${do_link_tests}` ;;
         r) do_run_tests=`toggle ${do_run_tests}` ;;
<font color='#000088'>+        g) do_generate_gcov=`toggle ${do_generate_gcov}` ;;
</font>         R) do_reports=`toggle ${do_reports}` ;;
         f) do_publish=`toggle ${do_publish}` ;;
         t) do_save_tarballs=`toggle ${do_save_tarballs}` ;;
<font color='#997700'>@@ -221,6 +226,7 @@
</font>   echo "POSIX Enabled:        " ${do_posix}
   echo "Core Configuration    " ${do_core}
   echo "Developmental Code:   " ${do_developmental}
<font color='#000088'>+  echo "do_all:               " ${do_all}
</font>   echo "do_covoar             " ${do_covoar}
   echo "do_rtems_update:      " ${do_rtems_update}
   echo "do_rtems_configure:   " ${do_rtems_configure}
<font color='#997700'>@@ -228,6 +234,7 @@
</font>   echo "do_copy_tests:        " ${do_copy_tests}
   echo "do_link_tests:        " ${do_link_tests}
   echo "do_run_tests:         " ${do_run_tests}
<font color='#000088'>+  echo "do_generate_gcov:     " ${do_generate_gcov}
</font>   echo "do_reports:           " ${do_reports}
   echo "do_publish:           " ${do_publish}
   echo "do_save_tarballs:     " ${do_save_tarballs}
<font color='#997700'>@@ -283,7 +290,7 @@
</font>   fi
 fi
 
<font color='#880000'>-grep "^CFLAGS_OPTIMIZE_V.*=.*-O[s01234]" ${custom} >/dev/null
</font><font color='#000088'>+grep "^CFLAGS_OPTIMIZE_V.*=.*-O[s01234].*" ${custom} >/dev/null
</font> if [ $? -ne 0 ] ; then
   echo "Unable to find CFLAGS_OPTIMIZE_V in ${custom}"
   exit 1
<font color='#997700'>@@ -386,6 +393,7 @@
</font>       -e "s,@OUTPUT_DIRECTORY@,${results_dir}," \
       -e "s/@EXECUTABLE_EXTENSION@/exe/" \
       -e "s/@COVERAGE_EXTENSION@/${RTEMSEXT}.${COVEXT}/" \
<font color='#000088'>+      -e "s,@GCNOS_LIST@,${rtems_gcnos_file}," \
</font>       -e "s/@PROJECT_NAME@/RTEMS ${RTEMS_VERSION}/" \
       <${COVBASE}/rtems_config.in \
       >${BASEDIR}/${BSP}-tests/config
<font color='#997700'>@@ -418,7 +426,7 @@
</font>   RTEMSLIB=${BASEDIR}/b-${BSP}/${TARGET}/${BSP}/lib/librtemscpu.a
 
   if [ -r ${RTEMSLIB} ] ; then
<font color='#880000'>-    cut -d' ' -f1 ${results_dir}/no_range_uncovered.txt | while read symbol
</font><font color='#000088'>+    while read symbol
</font>     do
       line=`${TARGET}-nm --format=sysv \
        ${BASEDIR}/b-${BSP}/${TARGET}/${BSP}/lib/librtemscpu.a | \
<font color='#997700'>@@ -426,7 +434,7 @@
</font>       size=`echo ${line} | cut -d'|' -f5 | tr "[:lower:]" "[:upper:]"`
       size=`echo 16 i ${size} p | dc`
       echo "${size}       ${symbol}       unknown"
<font color='#880000'>-    done | sort -n -r \
</font><font color='#000088'>+    done <${results_dir}/no_range_uncovered.txt | sort -n -r \
</font>          >${results_dir}/sizes_unreferenced.txt
   fi
 
<font color='#997700'>@@ -602,7 +610,15 @@
</font> # If requested, configure RTEMS
 if [ ${do_rtems_configure} = "yes" ] ; then
   # Now let's patch the make/custom file
<font color='#880000'>-  sed -e "s/-O[0123s]/${c_opt}/" <${custom} >${custom}.tmp
</font><font color='#000088'>+  cat ${custom} |<span style="background-color: #FF0000"> </span>
+  sed -e '/^CFLAGS_OPTIMIZE_V.*=.*-ftest-coverage -finline-functions -g/d' \
+      -e "s/-O[0123s]/${c_opt}/" |<span style="background-color: #FF0000"> </span>
+  if [ ${do_generate_gcov} = "yes" ] ; then
+    sed -e \
+      '/^CFLAGS_OPTIMIZE_V/a CFLAGS_OPTIMIZE_V += -ftest-coverage -finline-functions -g'<span style="background-color: #FF0000"> </span>
+  else
+    cat
+  fi >${custom}.tmp
</font>   mv ${custom}.tmp ${custom}
 
   echo "Configuring RTEMS..."
<font color='#997700'>@@ -694,6 +710,22 @@
</font>   echo "Skipping copying tests..."
 fi
 
<font color='#000088'>+# If requested prepare data to create gcov reports<span style="background-color: #FF0000"> </span>
+if [ ${do_generate_gcov} = "yes" ] ; then
+  echo "Preparing data for gcov reports..."
+
+  cd ${BASEDIR}/b-${BSP}/
+  check_status $? "cd b-${BSP}"
+
+  rtems_gcnos_file="${BASEDIR}/${BSP}-tests/rtems.gcnos"
+  find `pwd`  -name \*.gcno >${rtems_gcnos_file}
+
+  check_status $? "Preparing data for gcov reports for for ${BSP}"
+else
+  rtems_gcnos_file="/dev/null"
+  echo "Skipping creating gcov reports ..."
+fi
+
</font> # If requested, run the tests with coverage reporting enabled
 if [ ${do_run_tests} = "yes" ] ; then
   echo "Running tests..."

<font color='#006600'>diff -u rtems-testing/rtems-coverage/rtems_config.in:1.2 rtems-testing/rtems-coverage/rtems_config.in:1.3
--- rtems-testing/rtems-coverage/rtems_config.in:1.2    Fri May 21 15:14:30 2010
+++ rtems-testing/rtems-coverage/rtems_config.in        Thu Dec  1 14:28:14 2011
</font><font color='#997700'>@@ -22,6 +22,9 @@
</font> # This is the extension on the coverage/trace files.
 coverageExtension = @COVERAGE_EXTENSION@
 
<font color='#000088'>+# This is the path to file containing *.gcno list
+gcnosFile = @GCNOS_LIST@
+
</font> # This is the extension on the executable files.
 executableExtension = @EXECUTABLE_EXTENSION@
 
</pre>
<p> </p>

<p>--<br />
<small>Generated by <a href="http://www.codewiz.org/projects/index.html#loginfo">Deluxe Loginfo</a> 2.122 by Bernardo Innocenti <bernie@develer.com></small></p>
</body>
</html>