// Copyright 2020 Dolphin Emulator Project // SPDX-License-Identifier: GPL-2.0-or-later #pragma once #include #include #include #include #include #include "Common/CommonTypes.h" namespace Core { class CPUThreadGuard; } namespace Common::Debug { struct PartialContext { std::optional> gpr; std::optional cr; std::optional lr; std::optional ctr; std::optional xer; std::optional> fpr; std::optional fpscr; std::optional srr0; std::optional srr1; std::optional dummy; std::optional state; std::optional> gqr; std::optional> psf; }; class ThreadView { public: virtual ~ThreadView() = default; enum class API { OSThread, // Nintendo SDK thread LWPThread, // devkitPro libogc thread }; virtual PartialContext GetContext(const Core::CPUThreadGuard& guard) const = 0; virtual u32 GetAddress() const = 0; virtual u16 GetState() const = 0; virtual bool IsSuspended() const = 0; virtual bool IsDetached() const = 0; virtual s32 GetBasePriority() const = 0; virtual s32 GetEffectivePriority() const = 0; virtual u32 GetStackStart() const = 0; virtual u32 GetStackEnd() const = 0; virtual std::size_t GetStackSize() const = 0; virtual s32 GetErrno() const = 0; // Implementation specific, used to store arbitrary data virtual std::string GetSpecific(const Core::CPUThreadGuard& guard) const = 0; virtual bool IsValid(const Core::CPUThreadGuard& guard) const = 0; }; using Threads = std::vector>; } // namespace Common::Debug