| 122 | } |
| 123 | |
| 124 | void |
| 125 | CoreFileAnalyzer::removeModuleIf(std::function<bool(Dwfl_Module*)> predicate) const |
| 126 | { |
| 127 | using Predicate = decltype(predicate); |
| 128 | struct CallbackArgs |
| 129 | { |
| 130 | Dwfl* dwfl; |
| 131 | Predicate& predicate; |
| 132 | } callback_args = {d_dwfl.get(), predicate}; |
| 133 | |
| 134 | // Remove all modules, except for any that the callback re-adds. |
| 135 | dwfl_report_begin(d_dwfl.get()); |
| 136 | |
| 137 | int const rc = dwfl_report_end( |
| 138 | d_dwfl.get(), |
| 139 | [](Dwfl_Module* mod, void*, const char* name, Dwarf_Addr start, void* arg) -> int { |
| 140 | auto& callback_args = *static_cast<CallbackArgs*>(arg); |
| 141 | if (!callback_args.predicate(mod)) { |
| 142 | Dwarf_Addr end; |
| 143 | dwfl_module_info(mod, nullptr, nullptr, &end, nullptr, nullptr, nullptr, nullptr); |
| 144 | if (!dwfl_report_module(callback_args.dwfl, name, start, end)) { |
| 145 | throw ElfAnalyzerError( |
| 146 | std::string("Unexpected error retaining DWARF module: ") |
| 147 | + dwfl_errmsg(dwfl_errno())); |
| 148 | } |
| 149 | } |
| 150 | return 0; |
| 151 | }, |
| 152 | &callback_args); |
| 153 | |
| 154 | if (0 != rc) { |
| 155 | throw ElfAnalyzerError( |
| 156 | std::string("Unexpected error while filtering DWARF modules: ") |
| 157 | + dwfl_errmsg(dwfl_errno())); |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | void |
| 162 | CoreFileAnalyzer::resolveLibraries() |
nothing calls this directly
no test coverage detected