Fix logging in serveral spots

This commit is contained in:
Maschell 2022-05-13 15:41:50 +02:00
parent 4ec26f2b99
commit d367d27313
2 changed files with 6 additions and 5 deletions

View File

@ -157,7 +157,7 @@ std::vector<std::shared_ptr<ModuleData>> OrderModulesByDependencies(const std::v
continue; continue;
} }
canBreak = false; canBreak = false;
DEBUG_FUNCTION_LINE_VERBOSE("Check if we can load %s", curModule->getExportName()); DEBUG_FUNCTION_LINE_VERBOSE("Check if we can load %s", curModule->getExportName().c_str());
std::vector<std::string_view> importsFromOtherModules; std::vector<std::string_view> importsFromOtherModules;
for (const auto &curReloc : curModule->getRelocationDataList()) { for (const auto &curReloc : curModule->getRelocationDataList()) {
std::string_view curRPL = curReloc->getImportRPLInformation()->getRPLName(); std::string_view curRPL = curReloc->getImportRPLInformation()->getRPLName();
@ -166,7 +166,7 @@ std::vector<std::shared_ptr<ModuleData>> OrderModulesByDependencies(const std::v
} }
if (curRPL.starts_with("homebrew")) { if (curRPL.starts_with("homebrew")) {
if (std::find(importsFromOtherModules.begin(), importsFromOtherModules.end(), curRPL) == importsFromOtherModules.end()) { if (std::find(importsFromOtherModules.begin(), importsFromOtherModules.end(), curRPL) == importsFromOtherModules.end()) {
DEBUG_FUNCTION_LINE_VERBOSE("%s is importing from %s", curModule->getExportName(), curRPL.begin()); DEBUG_FUNCTION_LINE_VERBOSE("%s is importing from %s", curModule->getExportName().c_str(), curRPL.begin());
importsFromOtherModules.push_back(curRPL); importsFromOtherModules.push_back(curRPL);
} }
} }
@ -181,7 +181,7 @@ std::vector<std::shared_ptr<ModuleData>> OrderModulesByDependencies(const std::v
} }
if (canLoad) { if (canLoad) {
weDidSomething = true; weDidSomething = true;
DEBUG_FUNCTION_LINE_VERBOSE("We can load: %s", curModule->getExportName()); DEBUG_FUNCTION_LINE_VERBOSE("We can load: %s", curModule->getExportName().c_str());
finalOrder.push_back(curModule); finalOrder.push_back(curModule);
loadedModulesExportNames.emplace_back(curModule->getExportName()); loadedModulesExportNames.emplace_back(curModule->getExportName());
loadedModulesEntrypoints.push_back(curModule->getEntrypoint()); loadedModulesEntrypoints.push_back(curModule->getEntrypoint());

View File

@ -304,12 +304,13 @@ std::optional<std::shared_ptr<ModuleData>> ModuleDataFactory::load(const std::st
return std::nullopt; return std::nullopt;
} }
moduleData->setDataPtr(std::move(data), totalSize);
moduleData->setEntrypoint(entrypoint);
DEBUG_FUNCTION_LINE("Saved entrypoint as %08X", entrypoint); DEBUG_FUNCTION_LINE("Saved entrypoint as %08X", entrypoint);
DEBUG_FUNCTION_LINE("Saved startAddress as %08X", (uint32_t) data.get()); DEBUG_FUNCTION_LINE("Saved startAddress as %08X", (uint32_t) data.get());
DEBUG_FUNCTION_LINE("Saved endAddress as %08X", (uint32_t) data.get() + totalSize); DEBUG_FUNCTION_LINE("Saved endAddress as %08X", (uint32_t) data.get() + totalSize);
moduleData->setEntrypoint(entrypoint);
moduleData->setDataPtr(std::move(data), totalSize);
DEBUG_FUNCTION_LINE("Loaded %s size: %d kilobytes", path.c_str(), totalSize / 1024); DEBUG_FUNCTION_LINE("Loaded %s size: %d kilobytes", path.c_str(), totalSize / 1024);
return moduleData; return moduleData;