Added some logging

This commit is contained in:
Maschell 2020-04-29 12:06:47 +02:00
parent 7b8a421d7a
commit 7fe051d2cf
3 changed files with 8 additions and 1 deletions

View File

@ -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; i<gModuleData->number_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);

View File

@ -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));
}
}

View File

@ -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 *> 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;
}
}