[rtems-tools commit] covoar: Close the ELF and DWARF handles once the data is loaded.

Chris Johns chrisj at rtems.org
Tue Aug 21 04:45:43 UTC 2018


Module:    rtems-tools
Branch:    master
Commit:    a3a136411515a83a24cfd67e4c7210057ace4bd2
Changeset: http://git.rtems.org/rtems-tools/commit/?id=a3a136411515a83a24cfd67e4c7210057ace4bd2

Author:    Chris Johns <chrisj at rtems.org>
Date:      Tue Aug 21 14:43:28 2018 +1000

covoar: Close the ELF and DWARF handles once the data is loaded.

This avoids the processing being killed with to many file handles
open.

---

 tester/covoar/ExecutableInfo.cc | 25 +++++++++++++++++--------
 1 file changed, 17 insertions(+), 8 deletions(-)

diff --git a/tester/covoar/ExecutableInfo.cc b/tester/covoar/ExecutableInfo.cc
index 0a629b7..d93860b 100644
--- a/tester/covoar/ExecutableInfo.cc
+++ b/tester/covoar/ExecutableInfo.cc
@@ -37,27 +37,36 @@ namespace Coverage {
     executable.open();
     executable.begin();
     executable.load_symbols(symbols);
+
     debug.begin(executable.elf());
     debug.load_debug();
     debug.load_functions();
 
-    for (auto& cu : debug.get_cus()) {
-      for (auto& func : cu.get_functions()) {
-        if (func.has_machine_code() && (!func.is_inlined() || func.is_external())) {
-          createCoverageMap (cu.name(), func.name(),
-                             func.pc_low(), func.pc_high());
+    try {
+      for (auto& cu : debug.get_cus()) {
+        for (auto& func : cu.get_functions()) {
+          if (func.has_machine_code() && (!func.is_inlined() || func.is_external())) {
+            createCoverageMap (cu.name(), func.name(),
+                               func.pc_low(), func.pc_high());
+          }
         }
       }
+    } catch (...) {
+      debug.end();
+      executable.end();
+      executable.close();
+      throw;
     }
-  }
 
-  ExecutableInfo::~ExecutableInfo()
-  {
     debug.end();
     executable.end();
     executable.close();
   }
 
+  ExecutableInfo::~ExecutableInfo()
+  {
+  }
+
   void ExecutableInfo::dumpCoverageMaps( void ) {
     ExecutableInfo::CoverageMaps::iterator  itr;
 



More information about the vc mailing list