| 706 | } |
| 707 | |
| 708 | std::vector<DebugThread> DbgEngAdapter::GetThreadList() |
| 709 | { |
| 710 | if (!m_debugSystemObjects) |
| 711 | return {}; |
| 712 | |
| 713 | unsigned long number_threads {}; |
| 714 | if (this->m_debugSystemObjects->GetNumberThreads(&number_threads) != S_OK) |
| 715 | return {}; |
| 716 | |
| 717 | auto tids = std::make_unique<unsigned long[]>(number_threads); |
| 718 | auto sysids = std::make_unique<unsigned long[]>(number_threads); |
| 719 | if (this->m_debugSystemObjects->GetThreadIdsByIndex(0, number_threads, tids.get(), sysids.get()) != S_OK) |
| 720 | return {}; |
| 721 | |
| 722 | std::vector<DebugThread> debug_threads {}; |
| 723 | DebugThread activeThead = GetActiveThread(); |
| 724 | for (std::size_t index {}; index < number_threads; index++) |
| 725 | { |
| 726 | SetActiveThreadId(tids[index]); |
| 727 | uint64_t pc = GetInstructionOffset(); |
| 728 | debug_threads.emplace_back(tids[index], pc); |
| 729 | } |
| 730 | SetActiveThread(activeThead); |
| 731 | |
| 732 | return debug_threads; |
| 733 | } |
| 734 | |
| 735 | // Note, on Windows, we use engine thread ID, but on Linux/macOS, we use system thread ID. |
| 736 | // System thread ID is also available on Windows, We should later add a new field to the DebugThread struct |
nothing calls this directly
no outgoing calls
no test coverage detected