| 39 | }; |
| 40 | |
| 41 | static int |
| 42 | module_callback( |
| 43 | Dwfl_Module* mod, |
| 44 | void** userdata __attribute__((unused)), |
| 45 | const char* name __attribute__((unused)), |
| 46 | Dwarf_Addr starty __attribute__((unused)), |
| 47 | void* arg) |
| 48 | { |
| 49 | Dwarf_Addr start; |
| 50 | Dwarf_Addr end; |
| 51 | const char* mainfile; |
| 52 | const char* debugfile; |
| 53 | const char* modname = |
| 54 | dwfl_module_info(mod, nullptr, &start, &end, nullptr, nullptr, &mainfile, &debugfile); |
| 55 | if (mainfile != nullptr) { |
| 56 | modname = mainfile; |
| 57 | } else if (debugfile != nullptr) { |
| 58 | modname = debugfile; |
| 59 | } |
| 60 | const unsigned char* id; |
| 61 | GElf_Addr id_vaddr; |
| 62 | std::string buildid = ""; |
| 63 | int ret = dwfl_module_build_id(mod, &id, &id_vaddr); |
| 64 | if (ret > 0) { |
| 65 | buildid = buildIdPtrToString(id, ret); |
| 66 | } |
| 67 | |
| 68 | SimpleVirtualMap inf = {start, end, modname, buildid}; |
| 69 | auto module_info = static_cast<std::vector<SimpleVirtualMap>*>(arg); |
| 70 | |
| 71 | LOG(DEBUG) << "Found debug info for module " << (modname == nullptr ? "???" : modname) |
| 72 | << " spanning from " << std::hex << std::showbase << start << " to " << end; |
| 73 | module_info->push_back(inf); |
| 74 | |
| 75 | return DWARF_CB_OK; |
| 76 | } |
| 77 | |
| 78 | void |
| 79 | CoreFileExtractor::populateMaps() |
nothing calls this directly
no test coverage detected