diff options
author | Alex White <alex.white@oarcorp.com> | 2021-03-03 09:37:47 -0600 |
---|---|---|
committer | Joel Sherrill <joel@rtems.org> | 2021-03-30 13:15:58 -0500 |
commit | a7802e376adb7f99772a8c9b92fbd1c6c3f93a9b (patch) | |
tree | deae9168232841912c357fdb99423d6dbf3d22b4 /tester/covoar/ExecutableInfo.cc | |
parent | covoar/TargetBase: Fix QEMU branch info (diff) | |
download | rtems-tools-a7802e376adb7f99772a8c9b92fbd1c6c3f93a9b.tar.bz2 |
covoar: Fix DWARF reading
There were a couple of issues with the way the DWARF info was being
read. The first issue was that it inefficiently included all symbols,
even symbols that were not desired. The second issue is that it did
not handle inline functions correctly. These have been fixed.
Diffstat (limited to 'tester/covoar/ExecutableInfo.cc')
-rw-r--r-- | tester/covoar/ExecutableInfo.cc | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/tester/covoar/ExecutableInfo.cc b/tester/covoar/ExecutableInfo.cc index ddd2987..c996d75 100644 --- a/tester/covoar/ExecutableInfo.cc +++ b/tester/covoar/ExecutableInfo.cc @@ -45,10 +45,34 @@ namespace Coverage { 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() - 1); + if (!func.has_machine_code()) { + continue; } + + if (!SymbolsToAnalyze->isDesired(func.name())) { + continue; + } + + if (func.is_inlined()) { + if (func.is_external()) { + // Flag it + std::cerr << "Function is both external and inlined: " + << func.name() << std::endl; + } + + if (func.has_entry_pc()) { + continue; + } + + // If the low PC address is zero, the symbol does not appear in + // this executable. + if (func.pc_low() == 0) { + continue; + } + } + + createCoverageMap (cu.name(), func.name(), + func.pc_low(), func.pc_high() - 1); } } } catch (...) { |