summaryrefslogtreecommitdiff
path: root/Source/Core/Common/Debug/Threads.h
diff options
context:
space:
mode:
authorLéo Lam <leo@leolam.fr>2020-05-04 00:50:10 +0200
committerGitHub <noreply@github.com>2020-05-04 00:50:10 +0200
commitc53ecdd6897d882540292048e88cdc0131fa0686 (patch)
tree901335673ea1ae055045d14fbfbc16830bcbf08f /Source/Core/Common/Debug/Threads.h
parent947d6732a8570340835e02ce874c383243748ddf (diff)
parent39d34e133f0fe6a11db11e523cfbeaf9faf9b2a1 (diff)
Merge pull request #8686 from sepalani/thread-tab
Debugger: Add a Thread widget
Diffstat (limited to 'Source/Core/Common/Debug/Threads.h')
-rw-r--r--Source/Core/Common/Debug/Threads.h63
1 files changed, 63 insertions, 0 deletions
diff --git a/Source/Core/Common/Debug/Threads.h b/Source/Core/Common/Debug/Threads.h
new file mode 100644
index 0000000000..a4f84ab058
--- /dev/null
+++ b/Source/Core/Common/Debug/Threads.h
@@ -0,0 +1,63 @@
+// Copyright 2020 Dolphin Emulator Project
+// Licensed under GPLv2+
+// Refer to the license.txt file included.
+
+#pragma once
+
+#include <array>
+#include <memory>
+#include <optional>
+#include <string>
+#include <vector>
+
+#include "Common/CommonTypes.h"
+
+namespace Common::Debug
+{
+struct PartialContext
+{
+ std::optional<std::array<u32, 32>> gpr;
+ std::optional<u32> cr;
+ std::optional<u32> lr;
+ std::optional<u32> ctr;
+ std::optional<u32> xer;
+ std::optional<std::array<double, 32>> fpr;
+ std::optional<u64> fpscr;
+ std::optional<u32> srr0;
+ std::optional<u32> srr1;
+ std::optional<u16> dummy;
+ std::optional<u16> state;
+ std::optional<std::array<u32, 8>> gqr;
+ std::optional<std::array<double, 32>> psf;
+};
+
+class ThreadView
+{
+public:
+ virtual ~ThreadView() = default;
+
+ enum class API
+ {
+ OSThread, // Nintendo SDK thread
+ LWPThread, // devkitPro libogc thread
+ };
+
+ virtual PartialContext GetContext() 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 = 0;
+ virtual bool IsValid() const = 0;
+};
+
+using Threads = std::vector<std::unique_ptr<ThreadView>>;
+
+} // namespace Common::Debug