[PATCH rtems-tools v1] TraceConverter.cc: Add catch for exception
Ryan Long
ryan.long at oarcorp.com
Tue Oct 12 19:52:25 UTC 2021
CID 1471639: Add catch for exception
Closes #4501
---
tester/covoar/TraceConverter.cc | 45 ++++++++++++++++++++++++++---------------
1 file changed, 29 insertions(+), 16 deletions(-)
diff --git a/tester/covoar/TraceConverter.cc b/tester/covoar/TraceConverter.cc
index 16c69d4..4a24bd4 100644
--- a/tester/covoar/TraceConverter.cc
+++ b/tester/covoar/TraceConverter.cc
@@ -78,20 +78,21 @@ int main(
char** argv
)
{
- int opt;
- Trace::TraceReaderLogQEMU log;
- Trace::TraceWriterQEMU trace;
- const char *cpuname = "";
- const char *executable = "";
- const char *tracefile = "";
- const char *logname = "/tmp/qemu.log";
- Coverage::ExecutableInfo* executableInfo;
- rld::process::tempfile objdumpFile( ".dmp" );
- rld::process::tempfile err( ".err" );
- Coverage::DesiredSymbols symbolsToAnalyze;
- bool verbose = false;
- std::string dynamicLibrary;
- int ec = 0;
+ int opt;
+ Trace::TraceReaderLogQEMU log;
+ Trace::TraceWriterQEMU trace;
+ const char *cpuname = "";
+ const char *executable = "";
+ const char *tracefile = "";
+ const char *logname = "/tmp/qemu.log";
+ Coverage::ExecutableInfo* executableInfo;
+ rld::process::tempfile objdumpFile( ".dmp" );
+ rld::process::tempfile err( ".err" );
+ Coverage::DesiredSymbols symbolsToAnalyze;
+ bool verbose = false;
+ std::string dynamicLibrary;
+ int ec = 0;
+ std::shared_ptr<Target::TargetBase> targetInfo;
setup_signals();
@@ -128,9 +129,21 @@ int main(
usage();
}
+
// Create toolnames.
- std::shared_ptr<Target::TargetBase>
- targetInfo( Target::TargetFactory( cpuname ) );
+ try
+ {
+ targetInfo.reset( Target::TargetFactory( cpuname ) );
+ }
+ catch ( rld::error re )
+ {
+ std::cerr << "error: "
+ << re.where << ": " << re.what
+ << std::endl;
+ ec = 10;
+
+ return ec;
+ }
Coverage::ObjdumpProcessor objdumpProcessor( symbolsToAnalyze, targetInfo );
--
1.8.3.1
More information about the devel
mailing list