| 82 | } |
| 83 | |
| 84 | int CProcessThreadTable::ParseTableEntry(CString& s, char& mask, int& select, std::shared_ptr<WinSys::ThreadInfo>& info, int column) { |
| 85 | const auto& tx = GetThreadInfoEx(info.get()); |
| 86 | |
| 87 | switch (static_cast<ThreadColumn>(column)) |
| 88 | { |
| 89 | case ThreadColumn::State: |
| 90 | s = ThreadStateToString(info->ThreadState); |
| 91 | break; |
| 92 | case ThreadColumn::Id: |
| 93 | s.Format(L"%d (0x%05X)", info->Id, info->Id); |
| 94 | break; |
| 95 | case ThreadColumn::ProcessId: |
| 96 | s.Format(L"%d (0x%05X)", info->ProcessId, info->ProcessId); |
| 97 | break; |
| 98 | case ThreadColumn::ProcessName: |
| 99 | s = info->GetProcessImageName().c_str(); |
| 100 | break; |
| 101 | case ThreadColumn::CPUTime: |
| 102 | s = FormatHelper::TimeSpanToString(info->UserTime + info->KernelTime); |
| 103 | break; |
| 104 | case ThreadColumn::CreateTime: |
| 105 | s = info->CreateTime < (1LL << 32) ? CString() : FormatHelper::TimeToString(info->CreateTime); |
| 106 | break; |
| 107 | case ThreadColumn::Priority: |
| 108 | s.Format(L"%d", info->Priority); |
| 109 | break; |
| 110 | case ThreadColumn::BasePriority: |
| 111 | s.Format(L"%d", info->BasePriority); |
| 112 | break; |
| 113 | case ThreadColumn::Teb: |
| 114 | if (info->TebBase != nullptr) |
| 115 | s.Format(L"0x%p", info->TebBase); |
| 116 | break; |
| 117 | case ThreadColumn::WaitReason: |
| 118 | s = info->ThreadState == WinSys::ThreadState::Waiting ? WaitReasonToString(info->WaitReason) : L""; |
| 119 | break; |
| 120 | case ThreadColumn::StartAddress: |
| 121 | if (info->StartAddress) |
| 122 | s.Format(L"0x%p", info->StartAddress); |
| 123 | break; |
| 124 | case ThreadColumn::Win32StartAddress: |
| 125 | if (info->Win32StartAddress != info->StartAddress) |
| 126 | s.Format(L"0x%p", info->Win32StartAddress); |
| 127 | if (info->ProcessId == 4) { |
| 128 | DWORD64 offset = 0; |
| 129 | auto symbol = SymbolHelper::GetSymbolFromAddress((DWORD64)info->Win32StartAddress); |
| 130 | if (symbol) { |
| 131 | std::string name = symbol->GetSymbolInfo()->Name; |
| 132 | s += Helpers::StringToWstring(name).c_str(); |
| 133 | } |
| 134 | } |
| 135 | break; |
| 136 | case ThreadColumn::StackBase: |
| 137 | s.Format(L"0x%p", info->StackBase); |
| 138 | break; |
| 139 | case ThreadColumn::StackLimit: |
| 140 | s.Format(L"0x%p", info->StackLimit); |
| 141 | break; |
nothing calls this directly
no test coverage detected