diff options
author | Chris Johns <chrisj@rtems.org> | 2018-05-11 14:24:11 +1200 |
---|---|---|
committer | Chris Johns <chrisj@rtems.org> | 2018-06-18 12:26:16 +1000 |
commit | 881824f766937a47fb494f97f4ebcd44c99135cc (patch) | |
tree | 0af3d9422ba8e0eae6df8458cc08d4aafacff301 /tester/covoar/ObjdumpProcessor.cc | |
parent | linkers/exe-info: Add DWARF support to gather and check producer details. (diff) | |
download | rtems-tools-881824f766937a47fb494f97f4ebcd44c99135cc.tar.bz2 |
tester/covoar: Remove all exit() calls and throw an rld::error exception.
Add a suitable catch to covoar's main.
Diffstat (limited to 'tester/covoar/ObjdumpProcessor.cc')
-rw-r--r-- | tester/covoar/ObjdumpProcessor.cc | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/tester/covoar/ObjdumpProcessor.cc b/tester/covoar/ObjdumpProcessor.cc index d41906c..c98dad7 100644 --- a/tester/covoar/ObjdumpProcessor.cc +++ b/tester/covoar/ObjdumpProcessor.cc @@ -149,26 +149,23 @@ namespace Coverage { dlinfoName += ".dlinfo"; // Read load address. - loadAddressFile = fopen( dlinfoName.c_str(), "r" ); + loadAddressFile = ::fopen( dlinfoName.c_str(), "r" ); if (!loadAddressFile) { - fprintf( stderr, METHOD "unable to open %s\n", dlinfoName.c_str() ); - exit( -1 ); + std::ostringstream what; + what << "Unable to open " << dlinfoName; + throw rld::error( what, METHOD ); } // Process the dlinfo file. while ( 1 ) { // Get a line. - cStatus = fgets( inputBuffer, MAX_LINE_LENGTH, loadAddressFile ); + cStatus = ::fgets( inputBuffer, MAX_LINE_LENGTH, loadAddressFile ); if (cStatus == NULL) { - fprintf( - stderr, - METHOD "library %s not found in %s\n", - Library.c_str(), - dlinfoName.c_str() - ); - fclose( loadAddressFile ); - exit( -1 ); + ::fclose( loadAddressFile ); + std::ostringstream what; + what << "library " << Library << " not found in " << dlinfoName; + throw rld::error( what, METHOD ); } sscanf( inputBuffer, "%s %x", inLibName, &offset ); std::string tmp = inLibName; @@ -179,7 +176,7 @@ namespace Coverage { } } - fclose( loadAddressFile ); + ::fclose( loadAddressFile ); return address; #undef METHOD |