diff options
| author | 2022-06-01 00:19:49 -0400 | |
|---|---|---|
| committer | 2022-06-01 00:19:49 -0400 | |
| commit | de2f2e5140eb85311e0fd844c580d6726adf7e03 (patch) | |
| tree | 10f0e96a0689b2edb823f5833ff388ac9c645229 /src/core/debugger/gdbstub.h | |
| parent | Merge pull request #8401 from zhaobot/tx-update-20220601034505 (diff) | |
| parent | core/debugger: Implement new GDB stub debugger (diff) | |
| download | yuzu-de2f2e5140eb85311e0fd844c580d6726adf7e03.tar.gz yuzu-de2f2e5140eb85311e0fd844c580d6726adf7e03.tar.xz yuzu-de2f2e5140eb85311e0fd844c580d6726adf7e03.zip | |
Merge pull request #8394 from liamwhite/debugger
core/debugger: Implement new GDB stub debugger
Diffstat (limited to 'src/core/debugger/gdbstub.h')
| -rw-r--r-- | src/core/debugger/gdbstub.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/core/debugger/gdbstub.h b/src/core/debugger/gdbstub.h new file mode 100644 index 000000000..b93a3a511 --- /dev/null +++ b/src/core/debugger/gdbstub.h | |||
| @@ -0,0 +1,47 @@ | |||
| 1 | // SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project | ||
| 2 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include <map> | ||
| 7 | #include <memory> | ||
| 8 | #include <optional> | ||
| 9 | #include <string_view> | ||
| 10 | #include <vector> | ||
| 11 | |||
| 12 | #include "core/debugger/debugger_interface.h" | ||
| 13 | #include "core/debugger/gdbstub_arch.h" | ||
| 14 | |||
| 15 | namespace Core { | ||
| 16 | |||
| 17 | class System; | ||
| 18 | |||
| 19 | class GDBStub : public DebuggerFrontend { | ||
| 20 | public: | ||
| 21 | explicit GDBStub(DebuggerBackend& backend, Core::System& system); | ||
| 22 | ~GDBStub(); | ||
| 23 | |||
| 24 | void Connected() override; | ||
| 25 | void Stopped(Kernel::KThread* thread) override; | ||
| 26 | std::vector<DebuggerAction> ClientData(std::span<const u8> data) override; | ||
| 27 | |||
| 28 | private: | ||
| 29 | void ProcessData(std::vector<DebuggerAction>& actions); | ||
| 30 | void ExecuteCommand(std::string_view packet, std::vector<DebuggerAction>& actions); | ||
| 31 | void HandleQuery(std::string_view command); | ||
| 32 | std::vector<char>::const_iterator CommandEnd() const; | ||
| 33 | std::optional<std::string> DetachCommand(); | ||
| 34 | Kernel::KThread* GetThreadByID(u64 thread_id); | ||
| 35 | |||
| 36 | static u8 CalculateChecksum(std::string_view data); | ||
| 37 | void SendReply(std::string_view data); | ||
| 38 | void SendStatus(char status); | ||
| 39 | |||
| 40 | private: | ||
| 41 | Core::System& system; | ||
| 42 | std::unique_ptr<GDBStubArch> arch; | ||
| 43 | std::vector<char> current_command; | ||
| 44 | std::map<VAddr, u32> replaced_instructions; | ||
| 45 | }; | ||
| 46 | |||
| 47 | } // namespace Core | ||