mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 19:00:14 -05:00
debugger: add host fastmem pointer fetch command
This commit is contained in:
parent
0e8f98a441
commit
e9c3d16f6f
1 changed files with 23 additions and 3 deletions
|
@ -11,6 +11,7 @@
|
||||||
#include "common/hex_util.h"
|
#include "common/hex_util.h"
|
||||||
#include "common/logging/log.h"
|
#include "common/logging/log.h"
|
||||||
#include "common/scope_exit.h"
|
#include "common/scope_exit.h"
|
||||||
|
#include "common/settings.h"
|
||||||
#include "core/arm/arm_interface.h"
|
#include "core/arm/arm_interface.h"
|
||||||
#include "core/core.h"
|
#include "core/core.h"
|
||||||
#include "core/debugger/gdbstub.h"
|
#include "core/debugger/gdbstub.h"
|
||||||
|
@ -731,7 +732,25 @@ void GDBStub::HandleRcmd(const std::vector<u8>& command) {
|
||||||
auto* process = system.CurrentProcess();
|
auto* process = system.CurrentProcess();
|
||||||
auto& page_table = process->PageTable();
|
auto& page_table = process->PageTable();
|
||||||
|
|
||||||
if (command_str == "get info") {
|
const char* commands = "Commands:\n"
|
||||||
|
" get fastmem\n"
|
||||||
|
" get info\n"
|
||||||
|
" get mappings\n";
|
||||||
|
|
||||||
|
if (command_str == "get fastmem") {
|
||||||
|
if (Settings::IsFastmemEnabled()) {
|
||||||
|
const auto& impl = page_table.PageTableImpl();
|
||||||
|
const auto region = reinterpret_cast<uintptr_t>(impl.fastmem_arena);
|
||||||
|
const auto region_bits = impl.current_address_space_width_in_bits;
|
||||||
|
const auto region_size = 1ULL << region_bits;
|
||||||
|
|
||||||
|
reply = fmt::format("Region bits: {}\n"
|
||||||
|
"Host address: {:#x} - {:#x}\n",
|
||||||
|
region_bits, region, region + region_size - 1);
|
||||||
|
} else {
|
||||||
|
reply = "Fastmem is not enabled.\n";
|
||||||
|
}
|
||||||
|
} else if (command_str == "get info") {
|
||||||
Loader::AppLoader::Modules modules;
|
Loader::AppLoader::Modules modules;
|
||||||
system.GetAppLoader().ReadNSOModules(modules);
|
system.GetAppLoader().ReadNSOModules(modules);
|
||||||
|
|
||||||
|
@ -787,9 +806,10 @@ void GDBStub::HandleRcmd(const std::vector<u8>& command) {
|
||||||
cur_addr = next_address;
|
cur_addr = next_address;
|
||||||
}
|
}
|
||||||
} else if (command_str == "help") {
|
} else if (command_str == "help") {
|
||||||
reply = "Commands:\n get info\n get mappings\n";
|
reply = commands;
|
||||||
} else {
|
} else {
|
||||||
reply = "Unknown command.\nCommands:\n get info\n get mappings\n";
|
reply = "Unknown command.\n";
|
||||||
|
reply += commands;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::span<const u8> reply_span{reinterpret_cast<u8*>(&reply.front()), reply.size()};
|
std::span<const u8> reply_span{reinterpret_cast<u8*>(&reply.front()), reply.size()};
|
||||||
|
|
Loading…
Reference in a new issue