summaryrefslogtreecommitdiff
path: root/src/core/gdbstub/gdbstub.cpp
diff options
context:
space:
mode:
authorGravatar Lioncash2019-11-26 16:29:34 -0500
committerGravatar Lioncash2019-11-26 21:55:39 -0500
commitb05bfc603689419dc515a656b9fc711d79994f13 (patch)
treebc0937d11bbe31458785a69478edbf11a720b0ae /src/core/gdbstub/gdbstub.cpp
parentcore/memory: Migrate over ZeroBlock() and CopyBlock() to the Memory class (diff)
downloadyuzu-b05bfc603689419dc515a656b9fc711d79994f13.tar.gz
yuzu-b05bfc603689419dc515a656b9fc711d79994f13.tar.xz
yuzu-b05bfc603689419dc515a656b9fc711d79994f13.zip
core/memory: Migrate over Read{8, 16, 32, 64, Block} to the Memory class
With all of the trivial parts of the memory interface moved over, we can get right into moving over the bits that are used. Note that this does require the use of GetInstance from the global system instance to be used within hle_ipc.cpp and the gdbstub. This is fine for the time being, as they both already rely on the global system instance in other functions. These will be removed in a change directed at both of these respectively. For now, it's sufficient, as it still accomplishes the goal of de-globalizing the memory code.
Diffstat (limited to 'src/core/gdbstub/gdbstub.cpp')
-rw-r--r--src/core/gdbstub/gdbstub.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index 78e44f3bd..1c74a44d8 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -969,13 +969,13 @@ static void ReadMemory() {
969 SendReply("E01"); 969 SendReply("E01");
970 } 970 }
971 971
972 const auto& memory = Core::System::GetInstance().Memory(); 972 auto& memory = Core::System::GetInstance().Memory();
973 if (!memory.IsValidVirtualAddress(addr)) { 973 if (!memory.IsValidVirtualAddress(addr)) {
974 return SendReply("E00"); 974 return SendReply("E00");
975 } 975 }
976 976
977 std::vector<u8> data(len); 977 std::vector<u8> data(len);
978 Memory::ReadBlock(addr, data.data(), len); 978 memory.ReadBlock(addr, data.data(), len);
979 979
980 MemToGdbHex(reply, data.data(), len); 980 MemToGdbHex(reply, data.data(), len);
981 reply[len * 2] = '\0'; 981 reply[len * 2] = '\0';
@@ -1057,7 +1057,9 @@ static bool CommitBreakpoint(BreakpointType type, VAddr addr, u64 len) {
1057 breakpoint.active = true; 1057 breakpoint.active = true;
1058 breakpoint.addr = addr; 1058 breakpoint.addr = addr;
1059 breakpoint.len = len; 1059 breakpoint.len = len;
1060 Memory::ReadBlock(addr, breakpoint.inst.data(), breakpoint.inst.size()); 1060
1061 auto& memory = Core::System::GetInstance().Memory();
1062 memory.ReadBlock(addr, breakpoint.inst.data(), breakpoint.inst.size());
1061 1063
1062 static constexpr std::array<u8, 4> btrap{0x00, 0x7d, 0x20, 0xd4}; 1064 static constexpr std::array<u8, 4> btrap{0x00, 0x7d, 0x20, 0xd4};
1063 if (type == BreakpointType::Execute) { 1065 if (type == BreakpointType::Execute) {