summaryrefslogtreecommitdiff
path: root/src/core/loader
diff options
context:
space:
mode:
authorGravatar Hedges2018-07-13 04:22:59 +0100
committerGravatar bunnei2018-07-12 20:22:59 -0700
commite066bc75b9443ffe39adc44a113eca8e899c6e80 (patch)
tree78bd4a46cfa69c678ae7518260b0a91cc4227adf /src/core/loader
parentMerge pull request #656 from ogniK5377/audren-mem-init (diff)
downloadyuzu-e066bc75b9443ffe39adc44a113eca8e899c6e80.tar.gz
yuzu-e066bc75b9443ffe39adc44a113eca8e899c6e80.tar.xz
yuzu-e066bc75b9443ffe39adc44a113eca8e899c6e80.zip
More improvements to GDBStub (#653)
* More improvements to GDBStub - Debugging of threads should work correctly with source and assembly level stepping and modifying registers and memory, meaning threads and callstacks are fully clickable in VS. - List of modules is available to the client, with assumption that .nro and .nso are backed up by an .elf with symbols, while deconstructed ROMs keep N names. - Initial support for floating point registers. * Tidy up as requested in PR feedback * Tidy up as requested in PR feedback
Diffstat (limited to 'src/core/loader')
-rw-r--r--src/core/loader/deconstructed_rom_directory.cpp3
-rw-r--r--src/core/loader/nca.cpp4
-rw-r--r--src/core/loader/nro.cpp4
-rw-r--r--src/core/loader/nso.cpp4
4 files changed, 15 insertions, 0 deletions
diff --git a/src/core/loader/deconstructed_rom_directory.cpp b/src/core/loader/deconstructed_rom_directory.cpp
index eb7feb617..5fdb1d289 100644
--- a/src/core/loader/deconstructed_rom_directory.cpp
+++ b/src/core/loader/deconstructed_rom_directory.cpp
@@ -9,6 +9,7 @@
9#include "common/logging/log.h" 9#include "common/logging/log.h"
10#include "common/string_util.h" 10#include "common/string_util.h"
11#include "core/file_sys/romfs_factory.h" 11#include "core/file_sys/romfs_factory.h"
12#include "core/gdbstub/gdbstub.h"
12#include "core/hle/kernel/process.h" 13#include "core/hle/kernel/process.h"
13#include "core/hle/kernel/resource_limit.h" 14#include "core/hle/kernel/resource_limit.h"
14#include "core/hle/service/filesystem/filesystem.h" 15#include "core/hle/service/filesystem/filesystem.h"
@@ -133,6 +134,8 @@ ResultStatus AppLoader_DeconstructedRomDirectory::Load(
133 next_load_addr = AppLoader_NSO::LoadModule(path, load_addr); 134 next_load_addr = AppLoader_NSO::LoadModule(path, load_addr);
134 if (next_load_addr) { 135 if (next_load_addr) {
135 LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", module, load_addr); 136 LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", module, load_addr);
137 // Register module with GDBStub
138 GDBStub::RegisterModule(module, load_addr, next_load_addr - 1, false);
136 } else { 139 } else {
137 next_load_addr = load_addr; 140 next_load_addr = load_addr;
138 } 141 }
diff --git a/src/core/loader/nca.cpp b/src/core/loader/nca.cpp
index da064f8e3..0fd930ae2 100644
--- a/src/core/loader/nca.cpp
+++ b/src/core/loader/nca.cpp
@@ -7,10 +7,12 @@
7#include "common/common_funcs.h" 7#include "common/common_funcs.h"
8#include "common/file_util.h" 8#include "common/file_util.h"
9#include "common/logging/log.h" 9#include "common/logging/log.h"
10#include "common/string_util.h"
10#include "common/swap.h" 11#include "common/swap.h"
11#include "core/core.h" 12#include "core/core.h"
12#include "core/file_sys/program_metadata.h" 13#include "core/file_sys/program_metadata.h"
13#include "core/file_sys/romfs_factory.h" 14#include "core/file_sys/romfs_factory.h"
15#include "core/gdbstub/gdbstub.h"
14#include "core/hle/kernel/process.h" 16#include "core/hle/kernel/process.h"
15#include "core/hle/kernel/resource_limit.h" 17#include "core/hle/kernel/resource_limit.h"
16#include "core/hle/service/filesystem/filesystem.h" 18#include "core/hle/service/filesystem/filesystem.h"
@@ -259,6 +261,8 @@ ResultStatus AppLoader_NCA::Load(Kernel::SharedPtr<Kernel::Process>& process) {
259 next_load_addr = AppLoader_NSO::LoadModule(module, nca->GetExeFsFile(module), load_addr); 261 next_load_addr = AppLoader_NSO::LoadModule(module, nca->GetExeFsFile(module), load_addr);
260 if (next_load_addr) { 262 if (next_load_addr) {
261 LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", module, load_addr); 263 LOG_DEBUG(Loader, "loaded module {} @ 0x{:X}", module, load_addr);
264 // Register module with GDBStub
265 GDBStub::RegisterModule(module, load_addr, next_load_addr - 1, false);
262 } else { 266 } else {
263 next_load_addr = load_addr; 267 next_load_addr = load_addr;
264 } 268 }
diff --git a/src/core/loader/nro.cpp b/src/core/loader/nro.cpp
index 3853cfa1a..4d7c69a22 100644
--- a/src/core/loader/nro.cpp
+++ b/src/core/loader/nro.cpp
@@ -9,6 +9,7 @@
9#include "common/logging/log.h" 9#include "common/logging/log.h"
10#include "common/swap.h" 10#include "common/swap.h"
11#include "core/core.h" 11#include "core/core.h"
12#include "core/gdbstub/gdbstub.h"
12#include "core/hle/kernel/process.h" 13#include "core/hle/kernel/process.h"
13#include "core/hle/kernel/resource_limit.h" 14#include "core/hle/kernel/resource_limit.h"
14#include "core/loader/nro.h" 15#include "core/loader/nro.h"
@@ -115,6 +116,9 @@ bool AppLoader_NRO::LoadNro(const std::string& path, VAddr load_base) {
115 codeset->memory = std::make_shared<std::vector<u8>>(std::move(program_image)); 116 codeset->memory = std::make_shared<std::vector<u8>>(std::move(program_image));
116 Core::CurrentProcess()->LoadModule(codeset, load_base); 117 Core::CurrentProcess()->LoadModule(codeset, load_base);
117 118
119 // Register module with GDBStub
120 GDBStub::RegisterModule(codeset->name, load_base, load_base);
121
118 return true; 122 return true;
119} 123}
120 124
diff --git a/src/core/loader/nso.cpp b/src/core/loader/nso.cpp
index 7f84e4b1b..1c629e21f 100644
--- a/src/core/loader/nso.cpp
+++ b/src/core/loader/nso.cpp
@@ -10,6 +10,7 @@
10#include "common/logging/log.h" 10#include "common/logging/log.h"
11#include "common/swap.h" 11#include "common/swap.h"
12#include "core/core.h" 12#include "core/core.h"
13#include "core/gdbstub/gdbstub.h"
13#include "core/hle/kernel/process.h" 14#include "core/hle/kernel/process.h"
14#include "core/hle/kernel/resource_limit.h" 15#include "core/hle/kernel/resource_limit.h"
15#include "core/loader/nso.h" 16#include "core/loader/nso.h"
@@ -147,6 +148,9 @@ VAddr AppLoader_NSO::LoadModule(const std::string& name, const std::vector<u8>&
147 codeset->memory = std::make_shared<std::vector<u8>>(std::move(program_image)); 148 codeset->memory = std::make_shared<std::vector<u8>>(std::move(program_image));
148 Core::CurrentProcess()->LoadModule(codeset, load_base); 149 Core::CurrentProcess()->LoadModule(codeset, load_base);
149 150
151 // Register module with GDBStub
152 GDBStub::RegisterModule(codeset->name, load_base, load_base);
153
150 return load_base + image_size; 154 return load_base + image_size;
151} 155}
152 156