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

Function getThreadFromInterpreterState

src/pystack/_pystack/pythread.cpp:360–373  ·  view source on GitHub ↗

Create a similar funciton which does not pass the pointer to thread state, only the manager and the tid

Source from the content-addressed store, hash-verified

358// Create a similar funciton which does not pass the pointer to thread state, only the manager and the
359// tid
360std::shared_ptr<PyThread>
361getThreadFromInterpreterState(
362 const std::shared_ptr<const AbstractProcessManager>& manager,
363 remote_addr_t addr)
364{
365 if (tid_offset_in_pthread_struct == 0) {
366 tid_offset_in_pthread_struct = findPthreadTidOffset(manager, addr);
367 }
368
369 LOG(DEBUG) << std::hex << std::showbase << "Copying PyInterpreterState struct from address " << addr;
370 Structure<py_is_v> is(manager, addr);
371 auto thread_addr = is.getField(&py_is_v::o_tstate_head);
372 return std::make_shared<PyThread>(manager, thread_addr);
373}
374
375} // namespace pystack

Callers

nothing calls this directly

Calls 2

findPthreadTidOffsetFunction · 0.85
LOGClass · 0.85

Tested by

no test coverage detected