Here is a final fix that also corrects the coverage computations. The parsing 
of the symbol table made all symbols 2 bytes too large, hence the wrong 
annotations. I have manually verified the correlation between sis coverage 
output and the covoar coverage calculations and annotations for a couple of 
RTEMS tests programs, and there is now a 100% match.

Please review and let me know if I can push this.

Jiri.


From 919cc2dbb9faf1c2ce8ba659e27f3335dbdf014c Mon Sep 17 00:00:00 2001
From: Jiri Gaisler <j...@gaisler.se>
Date: Thu, 24 Jan 2019 09:44:48 +0100
Subject: [PATCH] rtems-tools/covoar: Wrong coverage computed

	* Symbols from object files assigned wrong length
	* Could not select other coverage format except QEMU
	* Debug print-out of hex addresses used decimal format
---
 tester/covoar/DesiredSymbols.cc   | 1 +
 tester/covoar/ObjdumpProcessor.cc | 2 +-
 tester/covoar/covoar.cc           | 3 ++-
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/tester/covoar/DesiredSymbols.cc b/tester/covoar/DesiredSymbols.cc
index 7def2ce..b9a5bb7 100644
--- a/tester/covoar/DesiredSymbols.cc
+++ b/tester/covoar/DesiredSymbols.cc
@@ -296,6 +296,7 @@ namespace Coverage {
                 );
               if (Verbose)
                 std::cerr << "Branch never taken found in " << s.first
+                          << std::hex
                           << " (0x" << s.second.baseAddress + la
                           << " - 0x" << s.second.baseAddress + ha
                           << ")"
diff --git a/tester/covoar/ObjdumpProcessor.cc b/tester/covoar/ObjdumpProcessor.cc
index 05507de..44e06d3 100644
--- a/tester/covoar/ObjdumpProcessor.cc
+++ b/tester/covoar/ObjdumpProcessor.cc
@@ -49,7 +49,7 @@ namespace Coverage {
     // Add the symbol to this executable's symbol table.
     SymbolTable* theSymbolTable = executableInfo->getSymbolTable();
     theSymbolTable->addSymbol(
-      symbolName, lowAddress, highAddress - lowAddress + 1
+      symbolName, lowAddress, highAddress - lowAddress - 1
     );
 
     // Mark the start of each instruction in the coverage map.
diff --git a/tester/covoar/covoar.cc b/tester/covoar/covoar.cc
index 36c24c3..cbb0e4f 100644
--- a/tester/covoar/covoar.cc
+++ b/tester/covoar/covoar.cc
@@ -163,7 +163,7 @@ int covoar(
   char                          gcdaFileName[FILE_NAME_LENGTH];
   char                          gcovBashCommand[256];
   std::string                   target;
-  const char*                   format = "html";
+  const char*                   format = "QEMU";
   FILE*                         gcnosFile = NULL;
   Gcov::GcovData*               gcovFile;
   const char*                   singleExecutable = NULL;
@@ -359,6 +359,7 @@ int covoar(
     AllExplanations->load( explanations );
 
   // Create coverage map reader.
+  coverageFormat = Coverage::CoverageFormatToEnum(format);
   coverageReader = Coverage::CreateCoverageReader(coverageFormat);
   if (!coverageReader)
     throw rld::error( "Unable to create coverage file reader", "covoar" );
-- 
2.17.1

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to