From 7fe051d2cfad71b587352e818d30d7531f6f38bf Mon Sep 17 00:00:00 2001 From: Maschell Date: Wed, 29 Apr 2020 12:06:47 +0200 Subject: [PATCH] Added some logging --- relocator/src/entry.cpp | 3 ++- source/main.cpp | 3 +++ source/module/ModuleDataPersistence.cpp | 3 +++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/relocator/src/entry.cpp b/relocator/src/entry.cpp index ec3a659..c9db158 100644 --- a/relocator/src/entry.cpp +++ b/relocator/src/entry.cpp @@ -88,8 +88,9 @@ bool ResolveRelocations() { } extern "C" void doStart(int argc, char **argv) { + DEBUG_FUNCTION_LINE("Resolve relocations\n"); + DEBUG_FUNCTION_LINE("Number of modules %d\n", gModuleData->number_used_modules); ResolveRelocations(); - for(int i = 0; inumber_used_modules; i++) { DEBUG_FUNCTION_LINE("About to call %08X\n",gModuleData->module_data[i].entrypoint); int ret = ( (int (*)(int, char **))(gModuleData->module_data[i].entrypoint) )(argc, argv); diff --git a/source/main.cpp b/source/main.cpp index ef1f813..c68a137 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -127,8 +127,11 @@ int main(int argc, char **argv) { ModuleData * moduleData = ModuleDataFactory::load(modules.GetFilepath(i), 0x00900000, 0x01000000 - textSectionStart, gModuleData->trampolines, DYN_LINK_TRAMPOLIN_LIST_LENGTH); if(moduleData != NULL) { + DEBUG_FUNCTION_LINE("Successfully loaded %s", modules.GetFilepath(i)); ModuleDataPersistence::saveModuleData(gModuleData, moduleData); delete moduleData; + }else{ + DEBUG_FUNCTION_LINE("Failed to load %s", modules.GetFilepath(i)); } } diff --git a/source/module/ModuleDataPersistence.cpp b/source/module/ModuleDataPersistence.cpp index 4048a49..b4990b1 100644 --- a/source/module/ModuleDataPersistence.cpp +++ b/source/module/ModuleDataPersistence.cpp @@ -10,15 +10,18 @@ bool ModuleDataPersistence::saveModuleData(module_information_t * moduleInformat int32_t module_count = moduleInformation->number_used_modules; if(module_count >= MAXIMUM_MODULES) { + DEBUG_FUNCTION_LINE("Reached maximum module count of %d", MAXIMUM_MODULES); return false; } // Copy data to global struct. module_information_single_t * module_data = &(moduleInformation->module_data[module_count]); + DEBUG_FUNCTION_LINE("Saving reloation data for module at %08X", module->getEntrypoint()); // Relocation std::vector relocationData = module->getRelocationDataList(); for (auto const& reloc : relocationData) { if(!DynamicLinkingHelper::addReloationEntry(&(moduleInformation->linking_data), module_data->linking_entries, DYN_LINK_RELOCATION_LIST_LENGTH, reloc)) { + DEBUG_FUNCTION_LINE("Failed to add relocation entry\n"); return false; } }