[PATCH 20/22] covoar: Allow symbols from objdump to be skipped

Alex White alexanderjwhite at gmail.com
Mon Mar 1 20:01:27 UTC 2021


There is at least one symbol that is shown as having no machine code in
the DWARF info but obviously contains machine code if inspected using
objdump. This results in an exception being thrown when that symbol's
coverage map is looked up. That exception is now caught and a message
is printed to stderr rather than crashing the program.
---
 tester/covoar/ExecutableInfo.cc   | 8 ++++++--
 tester/covoar/ObjdumpProcessor.cc | 8 +++++++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/tester/covoar/ExecutableInfo.cc b/tester/covoar/ExecutableInfo.cc
index 5a730fd..30828a6 100644
--- a/tester/covoar/ExecutableInfo.cc
+++ b/tester/covoar/ExecutableInfo.cc
@@ -177,7 +177,9 @@ namespace Coverage {
 
     if (periodIndex == std::string::npos) {
       // Symbol name has no '.', can't do another lookup.
-      throw rld::error (symbolName, "ExecutableInfo::findCoverageMap");
+      std::ostringstream what;
+      what << "Could not find " << symbolName;
+      throw rld::error (what, "ExecutableInfo::findCoverageMap");
     }
 
     cmi = coverageMaps.find(
@@ -185,7 +187,9 @@ namespace Coverage {
     );
 
     if ( cmi == coverageMaps.end() ) {
-      throw rld::error (symbolName, "ExecutableInfo::findCoverageMap");
+      std::ostringstream what;
+      what << "Could not find " << symbolName;
+      throw rld::error (what, "ExecutableInfo::findCoverageMap");
     }
 
     return *(cmi->second);
diff --git a/tester/covoar/ObjdumpProcessor.cc b/tester/covoar/ObjdumpProcessor.cc
index f130819..23661be 100644
--- a/tester/covoar/ObjdumpProcessor.cc
+++ b/tester/covoar/ObjdumpProcessor.cc
@@ -119,7 +119,13 @@ namespace Coverage {
         executableInfo->getFileName().c_str(), symbolName, size, sizeWithoutNops
       );
     } catch (rld::error& e) {
-      throw rld::error( e.what, "Coverage::finalizeSymbol" );
+      if (e.where == "ExecutableInfo::findCoverageMap") {
+        // Allow execution to continue even if a coverage map could not be
+        // found.
+        std::cerr << e.where << ": " << e.what << std::endl;
+      } else {
+        throw rld::error( e.what, "Coverage::finalizeSymbol" );
+      }
     }
   }
 
-- 
2.27.0



More information about the devel mailing list