| 477 | }; |
| 478 | |
| 479 | static int |
| 480 | thread_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 | |
| 508 | std::vector<NativeFrame> |
| 509 | CoreFileUnwinder::unwindThread(pid_t tid) const |
nothing calls this directly
no test coverage detected