diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp index a7de6f1c36..68f2f30073 100644 --- a/src/core/loader/deconstructed_rom_directory.cpp +++ b/src/core/loader/deconstructed_rom_directory.cpp @@ -134,7 +134,8 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load( next_load_addr = AppLoader_NSO::LoadModule(path, load_addr); if (next_load_addr) { LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", module, load_addr); - GDBStub::RegisterModule(module, load_addr, next_load_addr); + // Register module with GDBStub + GDBStub::RegisterModule(module, load_addr, next_load_addr - 1); } else { next_load_addr = load_addr; } diff --git a/src/core/loader/nca.cpp b/src/core/loader/nca.cpp index da064f8e39..e530f1d4b3 100644 --- a/src/core/loader/nca.cpp +++ b/src/core/loader/nca.cpp @@ -11,6 +11,7 @@ #include "core/core.h" #include "core/file_sys/program_metadata.h" #include "core/file_sys/romfs_factory.h" +#include "core/gdbstub/gdbstub.h" #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" #include "core/hle/service/filesystem/filesystem.h" @@ -259,6 +260,8 @@ ResultStatus AppLoader_NCA::Load(Kernel::SharedPtr& process) { next_load_addr = AppLoader_NSO::LoadModule(module, nca->GetExeFsFile(module), load_addr); if (next_load_addr) { LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", module, load_addr); + // Register module with GDBStub + GDBStub::RegisterModule(module, load_addr, next_load_addr - 1); } else { next_load_addr = load_addr; } diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp index 6326bd4900..f8172819ac 100644 --- a/src/core/loader/nro.cpp +++ b/src/core/loader/nro.cpp @@ -116,6 +116,7 @@ bool AppLoader_NRO::LoadNro(const std::string& path, VAddr load_base) { codeset->memory = std::make_shared>(std::move(program_image)); Core::CurrentProcess()->LoadModule(codeset, load_base); + // Register module with GDBStub std::string filename; Common::SplitPath(codeset->name, nullptr, &filename, nullptr); GDBStub::RegisterModule((filename + ".elf").c_str(), load_base, load_base); diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp index 7f84e4b1be..6a8fecd37e 100644 --- a/src/core/loader/nso.cpp +++ b/src/core/loader/nso.cpp @@ -10,6 +10,7 @@ #include "common/logging/log.h" #include "common/swap.h" #include "core/core.h" +#include "core/gdbstub/gdbstub.h" #include "core/hle/kernel/process.h" #include "core/hle/kernel/resource_limit.h" #include "core/loader/nso.h" @@ -147,6 +148,11 @@ VAddr AppLoader_NSO::LoadModule(const std::string& name, const std::vector& codeset->memory = std::make_shared>(std::move(program_image)); Core::CurrentProcess()->LoadModule(codeset, load_base); + // Register module with GDBStub + std::string filename; + Common::SplitPath(codeset->name, nullptr, &filename, nullptr); + GDBStub::RegisterModule((filename + ".elf").c_str(), load_base, load_base); + return load_base + image_size; }