summaryrefslogtreecommitdiff
path: root/src/core/debugger/gdbstub.h
diff options
context:
space:
mode:
authorGravatar Mai M2022-06-01 00:19:49 -0400
committerGravatar GitHub2022-06-01 00:19:49 -0400
commitde2f2e5140eb85311e0fd844c580d6726adf7e03 (patch)
tree10f0e96a0689b2edb823f5833ff388ac9c645229 /src/core/debugger/gdbstub.h
parentMerge pull request #8401 from zhaobot/tx-update-20220601034505 (diff)
parentcore/debugger: Implement new GDB stub debugger (diff)
downloadyuzu-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.h47
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
15namespace Core {
16
17class System;
18
19class GDBStub : public DebuggerFrontend {
20public:
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
28private:
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
40private:
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