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

Method findInterpreterStateFromDebugOffsets

src/pystack/_pystack/process.cpp:1334–1362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1332}
1333
1334remote_addr_t
1335AbstractProcessManager::findInterpreterStateFromDebugOffsets() const
1336{
1337 if (!d_debug_offsets_addr) {
1338 LOG(DEBUG) << "Debug offsets were never found";
1339 return 0;
1340 }
1341
1342 LOG(INFO) << "Searching for PyInterpreterState based on PyRuntime address " << std::hex
1343 << std::showbase << d_debug_offsets_addr
1344 << " found when searching for 3.13+ debug offsets";
1345
1346 try {
1347 Structure<py_runtime_v> runtime(shared_from_this(), d_debug_offsets_addr);
1348 remote_addr_t interp_state = runtime.getField(&py_runtime_v::o_interp_head);
1349 LOG(DEBUG) << "Checking interpreter state at " << std::hex << std::showbase << interp_state
1350 << " found at address "
1351 << runtime.getFieldRemoteAddress(&py_runtime_v::o_interp_head);
1352 if (isValidInterpreterState(interp_state)) {
1353 LOG(DEBUG) << "Interpreter head reference from debug offsets dereferences successfully";
1354 return interp_state;
1355 }
1356 } catch (...) {
1357 // Swallow exceptions and fall through to return failure
1358 }
1359 LOG(INFO) << "Failed to resolve PyInterpreterState based on PyRuntime address " << std::hex
1360 << std::showbase << d_debug_offsets_addr;
1361 return 0;
1362}
1363
1364ProcessManager::ProcessManager(
1365 pid_t pid,

Callers

nothing calls this directly

Calls 2

LOGClass · 0.85
getFieldRemoteAddressMethod · 0.80

Tested by

no test coverage detected