| 429 | } |
| 430 | |
| 431 | std::vector<NativeFrame> |
| 432 | Unwinder::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 | |
| 460 | CoreFileUnwinder::CoreFileUnwinder(std::shared_ptr<CoreFileAnalyzer> analyzer) |
| 461 | : d_analyzer(std::move(analyzer)) |
nothing calls this directly
no test coverage detected