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

Function module_callback

src/pystack/_pystack/elf_common.cpp:490–521  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

488}
489
490static int
491module_callback(
492 Dwfl_Module* mod,
493 void** userdata __attribute__((unused)),
494 const char* name __attribute__((unused)),
495 Dwarf_Addr starty __attribute__((unused)),
496 void* arg)
497{
498 auto args = static_cast<std::pair<uintptr_t, const std::string&>*>(arg);
499 if (args->first != 0) {
500 return DWARF_CB_OK;
501 }
502
503 Dwarf_Addr start;
504 Dwarf_Addr end;
505 const char* mainfile;
506 const char* debugfile;
507 const char* modname =
508 dwfl_module_info(mod, nullptr, &start, &end, nullptr, nullptr, &mainfile, &debugfile);
509 if (mainfile != nullptr) {
510 modname = mainfile;
511 } else if (debugfile != nullptr) {
512 modname = debugfile;
513 }
514
515 if (args->second == modname) {
516 args->first = start;
517 return DWARF_CB_ABORT;
518 }
519
520 return DWARF_CB_OK;
521}
522
523uintptr_t
524getLoadPointOfModule(const dwfl_unique_ptr& dwfl, const std::string& mod)

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected