| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
#pragma once |
| 5 |
|
| 6 |
#include <array> |
| 7 |
#include <memory> |
| 8 |
#include <optional> |
| 9 |
#include <string> |
| 10 |
#include <vector> |
| 11 |
|
| 12 |
#include "Common/CommonTypes.h" |
| 13 |
|
| 14 |
namespace Core |
| 15 |
{ |
| 16 |
class CPUThreadGuard; |
| 17 |
} |
| 18 |
|
| 19 |
namespace Common::Debug |
| 20 |
{ |
| 21 |
struct PartialContext |
| 22 |
{ |
| 23 |
std::optional<std::array<u32, 32>> gpr; |
| 24 |
std::optional<u32> cr; |
| 25 |
std::optional<u32> lr; |
| 26 |
std::optional<u32> ctr; |
| 27 |
std::optional<u32> xer; |
| 28 |
std::optional<std::array<double, 32>> fpr; |
| 29 |
std::optional<u64> fpscr; |
| 30 |
std::optional<u32> srr0; |
| 31 |
std::optional<u32> srr1; |
| 32 |
std::optional<u16> dummy; |
| 33 |
std::optional<u16> state; |
| 34 |
std::optional<std::array<u32, 8>> gqr; |
| 35 |
std::optional<std::array<double, 32>> psf; |
| 36 |
}; |
| 37 |
|
| 38 |
class ThreadView |
| 39 |
{ |
| 40 |
public: |
| 41 |
virtual ~ThreadView() = default; |
| 42 |
|
| 43 |
enum class API |
| 44 |
{ |
| 45 |
OSThread, |
| 46 |
LWPThread, |
| 47 |
}; |
| 48 |
|
| 49 |
virtual PartialContext GetContext(const Core::CPUThreadGuard& guard) const = 0; |
| 50 |
virtual u32 GetAddress() const = 0; |
| 51 |
virtual u16 GetState() const = 0; |
| 52 |
virtual bool IsSuspended() const = 0; |
| 53 |
virtual bool IsDetached() const = 0; |
| 54 |
virtual s32 GetBasePriority() const = 0; |
| 55 |
virtual s32 GetEffectivePriority() const = 0; |
| 56 |
virtual u32 GetStackStart() const = 0; |
| 57 |
virtual u32 GetStackEnd() const = 0; |
| 58 |
virtual std::size_t GetStackSize() const = 0; |
| 59 |
virtual s32 GetErrno() const = 0; |
| 60 |
|
| 61 |
virtual std::string GetSpecific(const Core::CPUThreadGuard& guard) const = 0; |
| 62 |
virtual bool IsValid(const Core::CPUThreadGuard& guard) const = 0; |
| 63 |
}; |
| 64 |
|
| 65 |
using Threads = std::vector<std::unique_ptr<ThreadView>>; |
| 66 |
|
| 67 |
} |