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

Function thread_callback_for_frames

src/pystack/_pystack/unwinder.cpp:479–506  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

477};
478
479static int
480thread_callback_for_frames(Dwfl_Thread* thread, void* arg)
481{
482 auto* thread_arg = static_cast<ThreadArg*>(arg);
483 pid_t tid = dwfl_thread_tid(thread);
484 if (tid != thread_arg->tid) {
485 return DWARF_CB_OK;
486 }
487
488 switch (dwfl_thread_getframes(thread, frameCallback, (void*)(&(thread_arg->frames)))) {
489 case DWARF_CB_OK:
490 case DWARF_CB_ABORT:
491 break;
492 case -1:
493 // This may or may not be an error, as it can signal the end of the stack
494 // unwinding.
495 if (thread_arg->frames.empty()) {
496 int dwfl_err = dwfl_errno();
497 std::string error(
498 dwfl_err ? dwfl_errmsg(dwfl_err) : "unwinding failed with no error reported");
499 throw UnwinderError("Unknown error happened when gathering thread frames: " + error);
500 }
501 break;
502 default:
503 throw UnwinderError("Unknown error happened when gathering thread frames");
504 }
505 return DWARF_CB_OK;
506}
507
508std::vector<NativeFrame>
509CoreFileUnwinder::unwindThread(pid_t tid) const

Callers

nothing calls this directly

Calls 1

UnwinderErrorClass · 0.85

Tested by

no test coverage detected