[PATCH rtems-tools v1 1/2] TraceConverter.cc: Add catch for exception

Ryan Long ryan.long at oarcorp.com
Thu Oct 7 13:40:37 UTC 2021


CID 1471639: Uncaught exception

Closes #4501
---
 tester/covoar/TraceConverter.cc | 28 +++++++++++++++++++++-------
 1 file changed, 21 insertions(+), 7 deletions(-)

diff --git a/tester/covoar/TraceConverter.cc b/tester/covoar/TraceConverter.cc
index 0f32efb..16c69d4 100644
--- a/tester/covoar/TraceConverter.cc
+++ b/tester/covoar/TraceConverter.cc
@@ -91,6 +91,7 @@ int main(
   Coverage::DesiredSymbols     symbolsToAnalyze;
   bool                         verbose = false;
   std::string                  dynamicLibrary;
+  int                          ec = 0;
 
   setup_signals();
 
@@ -140,13 +141,24 @@ int main(
       false,
       symbolsToAnalyze
     );
-  else
-    executableInfo = new Coverage::ExecutableInfo(
-      executable,
-      "",
-      false,
-      symbolsToAnalyze
-    );
+  else {
+    try
+    {
+      executableInfo = new Coverage::ExecutableInfo(
+        executable,
+        "",
+        false,
+        symbolsToAnalyze
+      );
+    }
+    catch ( rld::error re )
+    {
+      std::cerr << "error: "
+                << re.where << ": " << re.what
+                << std::endl;
+      ec = 10;
+    }
+  }
 
   // If a dynamic library was specified, determine the load address.
   if ( !dynamicLibrary.empty() )
@@ -156,4 +168,6 @@ int main(
   objdumpProcessor.loadAddressTable( executableInfo, objdumpFile, err );
   log.processFile( logname, objdumpProcessor );
   trace.writeFile( tracefile, &log, verbose );
+
+  return ec;
 }
-- 
1.8.3.1



More information about the devel mailing list