MCPcopy Create free account
hub / github.com/bloomberg/pystack / module_callback

Function module_callback

src/pystack/_pystack/corefile.cpp:41–76  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

39};
40
41static int
42module_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
78void
79CoreFileExtractor::populateMaps()

Callers

nothing calls this directly

Calls 2

buildIdPtrToStringFunction · 0.85
LOGClass · 0.85

Tested by

no test coverage detected