summaryrefslogtreecommitdiffstats
path: root/src/core/gdbstub
diff options
context:
space:
mode:
authorLioncash <mathew1800@gmail.com>2018-09-25 02:01:45 +0200
committerLioncash <mathew1800@gmail.com>2018-09-25 04:16:03 +0200
commit83377113bfe7791483a1b67e06dd0f51620c04ec (patch)
treed766a2d2f20d247e8663c1a76d5c41fcf7f643d4 /src/core/gdbstub
parentsvc: Report correct memory-related values within some of the cases in svcGetInfo() (diff)
downloadyuzu-83377113bfe7791483a1b67e06dd0f51620c04ec.tar
yuzu-83377113bfe7791483a1b67e06dd0f51620c04ec.tar.gz
yuzu-83377113bfe7791483a1b67e06dd0f51620c04ec.tar.bz2
yuzu-83377113bfe7791483a1b67e06dd0f51620c04ec.tar.lz
yuzu-83377113bfe7791483a1b67e06dd0f51620c04ec.tar.xz
yuzu-83377113bfe7791483a1b67e06dd0f51620c04ec.tar.zst
yuzu-83377113bfe7791483a1b67e06dd0f51620c04ec.zip
Diffstat (limited to 'src/core/gdbstub')
-rw-r--r--src/core/gdbstub/gdbstub.cpp15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/core/gdbstub/gdbstub.cpp b/src/core/gdbstub/gdbstub.cpp
index 0ecdd9f82..d8c7b3492 100644
--- a/src/core/gdbstub/gdbstub.cpp
+++ b/src/core/gdbstub/gdbstub.cpp
@@ -37,7 +37,9 @@
#include "core/core.h"
#include "core/core_cpu.h"
#include "core/gdbstub/gdbstub.h"
+#include "core/hle/kernel/process.h"
#include "core/hle/kernel/scheduler.h"
+#include "core/hle/kernel/vm_manager.h"
#include "core/loader/loader.h"
#include "core/memory.h"
@@ -585,7 +587,8 @@ static void HandleQuery() {
strlen("Xfer:features:read:target.xml:")) == 0) {
SendReply(target_xml);
} else if (strncmp(query, "Offsets", strlen("Offsets")) == 0) {
- std::string buffer = fmt::format("TextSeg={:0x}", Memory::PROCESS_IMAGE_VADDR);
+ const VAddr base_address = Core::CurrentProcess()->vm_manager.GetCodeRegionBaseAddress();
+ std::string buffer = fmt::format("TextSeg={:0x}", base_address);
SendReply(buffer.c_str());
} else if (strncmp(query, "fThreadInfo", strlen("fThreadInfo")) == 0) {
std::string val = "m";
@@ -893,11 +896,11 @@ static void ReadMemory() {
static u8 reply[GDB_BUFFER_SIZE - 4];
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;
- u64 len =
+ const u64 len =
HexToLong(start_offset, static_cast<u64>((command_buffer + command_length) - start_offset));
LOG_DEBUG(Debug_GDBStub, "gdb: addr: {:016X} len: {:016X}", addr, len);
@@ -906,7 +909,9 @@ static void ReadMemory() {
SendReply("E01");
}
- if (addr < Memory::PROCESS_IMAGE_VADDR || addr >= Memory::MAP_REGION_VADDR_END) {
+ const auto& vm_manager = Core::CurrentProcess()->vm_manager;
+ if (addr < vm_manager.GetCodeRegionBaseAddress() ||
+ addr >= vm_manager.GetMapRegionEndAddress()) {
return SendReply("E00");
}