summaryrefslogtreecommitdiffstats
path: root/src/core/gdbstub
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2019-11-26 19:46:41 +0100
committerLioncash <mathew1800@gmail.com>2019-11-27 03:53:34 +0100
commite58748fd802dc069e90928d12d4db9ff994a869d (patch)
tree152c306a9a51f0ba49e2a34d1dc0db9eb2923013 /src/core/gdbstub
parentcore/memory: Migrate over memory mapping functions to the new Memory class (diff)
downloadyuzu-e58748fd802dc069e90928d12d4db9ff994a869d.tar
yuzu-e58748fd802dc069e90928d12d4db9ff994a869d.tar.gz
yuzu-e58748fd802dc069e90928d12d4db9ff994a869d.tar.bz2
yuzu-e58748fd802dc069e90928d12d4db9ff994a869d.tar.lz
yuzu-e58748fd802dc069e90928d12d4db9ff994a869d.tar.xz
yuzu-e58748fd802dc069e90928d12d4db9ff994a869d.tar.zst
yuzu-e58748fd802dc069e90928d12d4db9ff994a869d.zip
Diffstat (limited to 'src/core/gdbstub')
-rw-r--r--src/core/gdbstub/gdbstub.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index 54ed680db..78e44f3bd 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -969,7 +969,8 @@ static void ReadMemory() {
SendReply("E01");
}
- if (!Memory::IsValidVirtualAddress(addr)) {
+ const auto& memory = Core::System::GetInstance().Memory();
+ if (!memory.IsValidVirtualAddress(addr)) {
return SendReply("E00");
}
@@ -984,22 +985,23 @@ static void ReadMemory() {
/// Modify location in memory with data received from the gdb client.
static void WriteMemory() {
auto start_offset = command_buffer + 1;
- auto addr_pos = std::find(start_offset, command_buffer + command_length, ',');
- VAddr addr = HexToLong(start_offset, static_cast<u64>(addr_pos - start_offset));
+ const auto addr_pos = std::find(start_offset, command_buffer + command_length, ',');
+ const VAddr addr = HexToLong(start_offset, static_cast<u64>(addr_pos - start_offset));
start_offset = addr_pos + 1;
- auto len_pos = std::find(start_offset, command_buffer + command_length, ':');
- u64 len = HexToLong(start_offset, static_cast<u64>(len_pos - start_offset));
+ const auto len_pos = std::find(start_offset, command_buffer + command_length, ':');
+ const u64 len = HexToLong(start_offset, static_cast<u64>(len_pos - start_offset));
- if (!Memory::IsValidVirtualAddress(addr)) {
+ auto& system = Core::System::GetInstance();
+ const auto& memory = system.Memory();
+ if (!memory.IsValidVirtualAddress(addr)) {
return SendReply("E00");
}
std::vector<u8> data(len);
-
GdbHexToMem(data.data(), len_pos + 1, len);
Memory::WriteBlock(addr, data.data(), len);
- Core::System::GetInstance().InvalidateCpuInstructionCaches();
+ system.InvalidateCpuInstructionCaches();
SendReply("OK");
}