[PATCH rtems-tools] TraceConverter.cc: Add catch for exception

Ryan Long ryan.long at oarcorp.com
Thu Oct 28 17:01:24 UTC 2021


CID 1471639: Add catch for exception

Closes #4501
---
 tester/covoar/TraceConverter.cc | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)

diff --git a/tester/covoar/TraceConverter.cc b/tester/covoar/TraceConverter.cc
index 4a24bd4..7770b11 100644
--- a/tester/covoar/TraceConverter.cc
+++ b/tester/covoar/TraceConverter.cc
@@ -174,10 +174,24 @@ int main(
   }
 
   // If a dynamic library was specified, determine the load address.
-  if ( !dynamicLibrary.empty() )
-    executableInfo->setLoadAddress(
-      objdumpProcessor.determineLoadAddress( executableInfo )
-    );
+  if ( !dynamicLibrary.empty() ) {
+    try
+    {
+      executableInfo->setLoadAddress(
+        objdumpProcessor.determineLoadAddress( executableInfo )
+      );
+    }
+    catch ( rld::error re )
+    {
+      std::cerr << "error: "
+                << re.where << ": " << re.what
+                << std::endl;
+      ec = 10;
+
+      return ec;
+    }
+  }
+
   objdumpProcessor.loadAddressTable( executableInfo, objdumpFile, err );
   log.processFile( logname, objdumpProcessor );
   trace.writeFile( tracefile, &log, verbose );
-- 
1.8.3.1



More information about the devel mailing list