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

Method unwindThread

src/pystack/_pystack/unwinder.cpp:431–458  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

429}
430
431std::vector<NativeFrame>
432Unwinder::unwindThread(pid_t tid) const
433{
434 LOG(DEBUG) << "Unwinding frames for tid: " << tid;
435 std::vector<Frame> frames;
436 if (!tid) {
437 LOG(ERROR) << "Cannot unwind thread due to invalid tid: " << tid;
438 return {};
439 }
440 switch (dwfl_getthread_frames(Dwfl(), tid, frameCallback, (void*)(&frames))) {
441 case DWARF_CB_OK:
442 case DWARF_CB_ABORT:
443 break;
444 case -1:
445 // This may or may not be an error, as it can signal the end of the stack
446 // unwinding.
447 if (frames.empty()) {
448 int dwfl_err = dwfl_errno();
449 std::string error(
450 dwfl_err ? dwfl_errmsg(dwfl_err) : "unwinding failed with no error reported");
451 throw UnwinderError("Unknown error happened when gathering thread frames: " + error);
452 }
453 break;
454 default:
455 throw UnwinderError("Unknown error happened when gathering thread frames");
456 }
457 return gatherFrames(frames);
458}
459
460CoreFileUnwinder::CoreFileUnwinder(std::shared_ptr<CoreFileAnalyzer> analyzer)
461: d_analyzer(std::move(analyzer))

Callers

nothing calls this directly

Calls 3

LOGClass · 0.85
UnwinderErrorClass · 0.85
DwflClass · 0.70

Tested by

no test coverage detected