diff options
| author | Mark Rowe <mark@vector35.com> | 2025-12-19 11:12:20 -0800 |
|---|---|---|
| committer | Mark Rowe <mark@vector35.com> | 2025-12-20 21:34:49 -0800 |
| commit | ed0f3b1b8593f6b76fbb64c53a0885073c1c1979 (patch) | |
| tree | 5d22d77ccea8bffc0619a32ed886d79d14daccf1 /plugins | |
| parent | ba13f6ec7d0ce9a18a03a1c895fb72d18e03014a (diff) | |
Fix many of the warnings that show up when compiling with GCC 15.2
Diffstat (limited to 'plugins')
| -rw-r--r-- | plugins/efi_resolver/src/Resolver.cpp | 36 | ||||
| -rw-r--r-- | plugins/efi_resolver/src/TypePropagation.cpp | 4 | ||||
| -rw-r--r-- | plugins/rtti/itanium.cpp | 32 | ||||
| -rw-r--r-- | plugins/rtti/microsoft.cpp | 40 |
4 files changed, 56 insertions, 56 deletions
diff --git a/plugins/efi_resolver/src/Resolver.cpp b/plugins/efi_resolver/src/Resolver.cpp index 9699b043..e501f35b 100644 --- a/plugins/efi_resolver/src/Resolver.cpp +++ b/plugins/efi_resolver/src/Resolver.cpp @@ -177,7 +177,7 @@ bool Resolver::parseUserGuidIfExists(const string& filePath) auto guidBytes = element.value(); if (guidBytes.size() != 11) { - LogError("Error: GUID array size is incorrect for %s", guidName.c_str()); + LogErrorF("Error: GUID array size is incorrect for {}", guidName); return false; } EFI_GUID guid; @@ -208,7 +208,7 @@ void Resolver::initProtocolMapping() return; auto fileName = GetBundledEfiPath(); if (!parseProtocolMapping(fileName)) - LogAlert("Binary Ninja Version Too Low. Please upgrade to a new version."); + LogAlertF("Binary Ninja Version Too Low. Please upgrade to a new version."); fileName = GetUserGuidPath(); parseUserGuidIfExists(fileName); @@ -223,7 +223,7 @@ bool Resolver::setModuleEntry(EFIModuleType fileType) auto entryFunc = m_view->GetAnalysisFunction(m_view->GetDefaultPlatform(), entry); if (!entryFunc) { - LogDebug("Entry func Not found... "); + LogDebugF("Entry func Not found... "); return false; } @@ -232,14 +232,14 @@ bool Resolver::setModuleEntry(EFIModuleType fileType) // Note: we only adjust the callsite in entry function, this is just a temp fix and it cannot cover all cases auto callsites = entryFunc->GetCallSites(); - LogDebug("Checking callsites at 0x%llx", entryFunc->GetStart()); - LogDebug("callsite count : %zu", callsites.size()); + LogDebugF("Checking callsites at {:#x}", entryFunc->GetStart()); + LogDebugF("callsite count : {}", callsites.size()); for (auto callsite : entryFunc->GetCallSites()) { auto mlil = entryFunc->GetMediumLevelIL(); size_t mlilIdx = mlil->GetInstructionStart(m_view->GetDefaultArchitecture(), callsite.addr); auto instr = mlil->GetInstruction(mlilIdx); - LogDebug("Checking Callsite at 0x%llx", callsite.addr); + LogDebugF("Checking Callsite at {:#x}", callsite.addr); if (instr.operation == MLIL_CALL || instr.operation == MLIL_TAILCALL) { auto params = instr.GetParameterExprs(); @@ -255,16 +255,16 @@ bool Resolver::setModuleEntry(EFIModuleType fileType) m_view->UpdateAnalysisAndWait(); } else - LogDebug("Operation not ConstPtr: %d", constantPtr.operation); + LogDebugF("Operation not ConstPtr: {}", constantPtr.operation); } else - LogDebug("param size not zero"); + LogDebugF("param size not zero"); } } string errors; QualifiedNameAndType result; - bool ok; + bool ok = false; string typeString; switch (fileType) @@ -285,7 +285,7 @@ bool Resolver::setModuleEntry(EFIModuleType fileType) case UNKNOWN: { - LogAlert("Could not identify EFI module type"); + LogAlertF("Could not identify EFI module type"); return false; } } @@ -467,7 +467,7 @@ bool Resolver::resolveGuidInterface(Ref<Function> func, uint64_t addr, int guidP if (!found) continue; - LogInfo("Found EFI Protocol wrapper at 0x%llx, checking reference to this function", addr); + LogInfoF("Found EFI Protocol wrapper at {:#x}, checking reference to this function", addr); auto refs = m_view->GetCodeReferences(func->GetStart()); for (auto& ref : refs) @@ -503,7 +503,7 @@ bool Resolver::resolveGuidInterface(Ref<Function> func, uint64_t addr, int guidP else { // use UnknownProtocol as defult - LogWarn("Unknown EFI Protocol referenced at 0x%llx", addr); + LogWarnF("Unknown EFI Protocol referenced at {:#x}", addr); guidName = nonConflictingName("UnknownProtocolGuid"); } } @@ -524,7 +524,7 @@ bool Resolver::resolveGuidInterface(Ref<Function> func, uint64_t addr, int guidP if (protocol_name.empty()) { - LogWarn("Found unknown protocol at 0x%llx", addr); + LogWarnF("Found unknown protocol at {:#x}", addr); protocol_name = "VOID*"; } @@ -617,7 +617,7 @@ bool Resolver::defineTypeAtCallsite( ok = m_view->ParseTypeString(typeName, result, errors); if (!ok) { - LogError("Cannot parse type %s when trying to define type at 0x%llx", typeName.c_str(), addr); + LogErrorF("Cannot parse type {} when trying to define type at {:#x}", typeName, addr); return false; } @@ -721,9 +721,9 @@ pair<string, string> Resolver::defineAndLookupGuid(uint64_t addr) if (readSize != 16) return make_pair(string(), string()); } - catch (ReadException) + catch (const ReadException&) { - LogError("Read GUID failed at 0x%llx", addr); + LogErrorF("Read GUID failed at {:#x}", addr); return make_pair(string(), string()); } auto namePair = lookupGuid(guidBytes); @@ -741,12 +741,12 @@ pair<string, string> Resolver::defineAndLookupGuid(uint64_t addr) if (guidName.empty()) { m_view->DefineUserSymbol(new Symbol(DataSymbol, nonConflictingName("UnknownGuid"), addr)); - LogDebug("Found UnknownGuid at 0x%llx", addr); + LogDebugF("Found UnknownGuid at {:#x}", addr); } else { m_view->DefineUserSymbol(new Symbol(DataSymbol, guidName, addr)); - LogDebug("Define %s at 0x%llx", guidName.c_str(), addr); + LogDebugF("Define {} at {:#x}", guidName.c_str(), addr); } return namePair; diff --git a/plugins/efi_resolver/src/TypePropagation.cpp b/plugins/efi_resolver/src/TypePropagation.cpp index ff0d43b9..68bc06f2 100644 --- a/plugins/efi_resolver/src/TypePropagation.cpp +++ b/plugins/efi_resolver/src/TypePropagation.cpp @@ -16,7 +16,7 @@ bool TypePropagation::propagateFuncParamTypes(Function* func) { m_queue.push_back(func->GetStart()); - LogDebug("Start Type propagation from 0x%llx", func->GetStart()); + LogDebugF("Start Type propagation from {:#x}", func->GetStart()); while (!m_queue.empty()) { @@ -190,7 +190,7 @@ bool TypePropagation::propagateFuncParamTypes(Function* func, SSAVariable ssa_va } default: - LogInfo("Not handled case during type propagation. At %llx: %d", instr.address, instr.operation); + LogInfoF("Not handled case during type propagation. At {:#x}: {}", instr.address, instr.operation); break; } } diff --git a/plugins/rtti/itanium.cpp b/plugins/rtti/itanium.cpp index 34fd0f71..47525d65 100644 --- a/plugins/rtti/itanium.cpp +++ b/plugins/rtti/itanium.cpp @@ -480,7 +480,7 @@ std::optional<ClassInfo> ItaniumRTTIProcessor::ProcessRTTI(uint64_t objectAddr) auto externTypeName = nameFromTypeInfoSymbol(siClassTypeInfo.base_type); if (!externTypeName.has_value()) return std::nullopt; - m_logger->LogDebug("Non-backed external subtype for %llx", objectAddr); + m_logger->LogDebugF("Non-backed external subtype for {:#x}", objectAddr); subTypeName = externTypeName.value(); } else @@ -492,7 +492,7 @@ std::optional<ClassInfo> ItaniumRTTIProcessor::ProcessRTTI(uint64_t objectAddr) auto baseClassName = DemangleNameItanium(m_view, allowMangledClassNames, subTypeName); if (!baseClassName.has_value()) { - m_logger->LogWarn("Skipping base class with mangled name %llx", siClassTypeInfo.base_type); + m_logger->LogWarnF("Skipping base class with mangled name {:#x}", siClassTypeInfo.base_type); return std::nullopt; } // NOTE: The base class offset is not able to be resolved here. @@ -516,7 +516,7 @@ std::optional<ClassInfo> ItaniumRTTIProcessor::ProcessRTTI(uint64_t objectAddr) auto externTypeName = nameFromTypeInfoSymbol(baseInfo.base_type); if (!externTypeName.has_value()) return std::nullopt; - m_logger->LogDebug("Non-backed external subtype for %llx", objectAddr); + m_logger->LogDebugF("Non-backed external subtype for {:#x}", objectAddr); subTypeName = externTypeName.value(); } else @@ -527,7 +527,7 @@ std::optional<ClassInfo> ItaniumRTTIProcessor::ProcessRTTI(uint64_t objectAddr) auto baseClassName = DemangleNameItanium(m_view, allowMangledClassNames, subTypeName); if (!baseClassName.has_value()) { - m_logger->LogWarn("Skipping base class with mangled name %llx", baseInfo.base_type); + m_logger->LogWarnF("Skipping base class with mangled name {:#x}", baseInfo.base_type); continue; } // Shift off the flag bits. @@ -591,7 +591,7 @@ std::optional<VirtualFunctionTableInfo> ItaniumRTTIProcessor::ProcessVFT(uint64_ else { // TODO: Is likely a function check here? - m_logger->LogDebug("Discovered function from virtual function table... %llx", vFuncAddr); + m_logger->LogDebugF("Discovered function from virtual function table... {:#x}", vFuncAddr); auto vftPlatform = m_view->GetDefaultPlatform()->GetAssociatedPlatformByAddress(vFuncAddr); m_view->AddFunctionForAnalysis(vftPlatform, vFuncAddr, true); } @@ -602,7 +602,7 @@ std::optional<VirtualFunctionTableInfo> ItaniumRTTIProcessor::ProcessVFT(uint64_ if (virtualFunctions.empty()) { - m_logger->LogDebug("Skipping empty virtual function table... %llx", vftAddr); + m_logger->LogDebugF("Skipping empty virtual function table... {:#x}", vftAddr); return std::nullopt; } @@ -648,7 +648,7 @@ std::optional<VirtualFunctionTableInfo> ItaniumRTTIProcessor::ProcessVFT(uint64_ } else { - LogWarn("Skipping adjustments for base VFT with more functions than sub VFT... %llx", vftAddr); + LogWarnF("Skipping adjustments for base VFT with more functions than sub VFT... {:#x}", vftAddr); } } @@ -668,7 +668,7 @@ std::optional<VirtualFunctionTableInfo> ItaniumRTTIProcessor::ProcessVFT(uint64_ bool foundDv = m_view->GetDataVariableAtAddress(vFunc.funcAddr, dv); if (!foundDv) { - m_logger->LogWarn("Skipping vfunc with no type... %llx", vFunc.funcAddr); + m_logger->LogWarnF("Skipping vfunc with no type... {:#x}", vFunc.funcAddr); return std::nullopt; } vFuncType = dv.type.GetValue(); @@ -676,7 +676,7 @@ std::optional<VirtualFunctionTableInfo> ItaniumRTTIProcessor::ProcessVFT(uint64_ vFuncSym = m_view->GetSymbolByAddress(vFunc.funcAddr); if (vFuncSym == nullptr) { - m_logger->LogWarn("Skipping vfunc with no symbol... %llx", vFunc.funcAddr); + m_logger->LogWarnF("Skipping vfunc with no symbol... {:#x}", vFunc.funcAddr); return std::nullopt; } } @@ -752,12 +752,12 @@ void ItaniumRTTIProcessor::ProcessRTTI() { if (failedAttempts++; failedAttempts > MAX_FAILED_SCAN_ATTEMPTS) break; - m_logger->LogWarnForException(e, "Failed to process object at %llx... skipping", currAddr); + m_logger->LogWarnForExceptionF(e, "Failed to process object at {:#x}... skipping", currAddr); } } if (failedAttempts > MAX_FAILED_SCAN_ATTEMPTS) - m_logger->LogWarn("Too many failed scans for section %llx... skipping", section->GetStart()); + m_logger->LogWarnF("Too many failed scans for section {:#x}... skipping", section->GetStart()); }; BulkSymbolModification bulkSymbolModification(m_view); @@ -773,12 +773,12 @@ void ItaniumRTTIProcessor::ProcessRTTI() // If a malformed binary makes the binary view set up unbacked sections we should not attempt to read in them. if (m_view->ReadBuffer(section->GetStart(), 4).GetLength() == 4) { - m_logger->LogDebug("Attempting to find RTTI in section %llx", section->GetStart()); + m_logger->LogDebugF("Attempting to find RTTI in section {:#x}", section->GetStart()); scan(section); } else { - m_logger->LogDebug("Unbacked start for section %llx... skipping", section->GetStart()); + m_logger->LogDebugF("Unbacked start for section {:#x}... skipping", section->GetStart()); } } } @@ -829,7 +829,7 @@ void ItaniumRTTIProcessor::ProcessRTTI() bgTask->Finish(); auto end_time = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> elapsed_time = end_time - start_time; - m_logger->LogDebug("ProcessRTTI took %f seconds", elapsed_time.count()); + m_logger->LogDebugF("ProcessRTTI took {} seconds", elapsed_time.count()); } @@ -921,5 +921,5 @@ void ItaniumRTTIProcessor::ProcessVFT() bgTask->Finish(); auto end_time = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> elapsed_time = end_time - start_time; - m_logger->LogDebug("ProcessVFT took %f seconds", elapsed_time.count()); -}
\ No newline at end of file + m_logger->LogDebugF("ProcessVFT took {} seconds", elapsed_time.count()); +} diff --git a/plugins/rtti/microsoft.cpp b/plugins/rtti/microsoft.cpp index ad9eb2e4..beb333b9 100644 --- a/plugins/rtti/microsoft.cpp +++ b/plugins/rtti/microsoft.cpp @@ -362,14 +362,14 @@ std::vector<BaseClassInfo> MicrosoftRTTIProcessor::ProcessClassHierarchyDescript if (baseClassTypeDescAddr == 0) { // Fixes issue https://github.com/Vector35/binaryninja-api/issues/6837 - m_logger->LogWarn("Skipping BaseClassDescriptor with null pTypeDescriptor %llx", baseClassDescAddr); + m_logger->LogWarnF("Skipping BaseClassDescriptor with null pTypeDescriptor {:#x}", baseClassDescAddr); continue; } auto baseClassTypeDesc = TypeDescriptor(m_view, baseClassTypeDescAddr); auto baseClassName = DemangleNameMS(m_view, allowMangledClassNames, baseClassTypeDesc.name); if (!baseClassName.has_value()) { - m_logger->LogWarn("Skipping BaseClassDescriptor with mangled name %llx", baseClassTypeDescAddr); + m_logger->LogWarnF("Skipping BaseClassDescriptor with mangled name {:#x}", baseClassTypeDescAddr); continue; } @@ -422,7 +422,7 @@ std::optional<ClassInfo> MicrosoftRTTIProcessor::ProcessRTTI(uint64_t coLocatorA { if (!allowAnonymousClassNames) { - m_logger->LogDebug("Skipping CompleteObjectorLocator with anonymous name %llx", coLocatorAddr); + m_logger->LogDebugF("Skipping CompleteObjectorLocator with anonymous name {:#x}", coLocatorAddr); return std::nullopt; } className = fmt::format("anonymous_{:#x}", coLocatorAddr); @@ -437,7 +437,7 @@ std::optional<ClassInfo> MicrosoftRTTIProcessor::ProcessRTTI(uint64_t coLocatorA reader.Seek(classHierarchyDescAddr); if (auto signature = reader.Read32(); signature != 0) { - m_logger->LogWarn("Skipping CompleteObjectorLocator with non-zero hierarchy descriptor signature %llx", coLocatorAddr); + m_logger->LogWarnF("Skipping CompleteObjectorLocator with non-zero hierarchy descriptor signature {:#x}", coLocatorAddr); return std::nullopt; } @@ -501,7 +501,7 @@ std::optional<VirtualFunctionTableInfo> MicrosoftRTTIProcessor::ProcessVFT(uint6 break; } // TODO: Is likely a function check here? - m_logger->LogDebug("Discovered function from virtual function table... %llx", vFuncAddr); + m_logger->LogDebugF("Discovered function from virtual function table... {:#x}", vFuncAddr); auto vftPlatform = m_view->GetDefaultPlatform()->GetAssociatedPlatformByAddress(vFuncAddr); auto vFunc = m_view->AddFunctionForAnalysis(vftPlatform, vFuncAddr, true); virtualFunctions.emplace_back(vFuncAddr, vFunc ? std::optional(vFunc) : std::nullopt); @@ -515,7 +515,7 @@ std::optional<VirtualFunctionTableInfo> MicrosoftRTTIProcessor::ProcessVFT(uint6 if (virtualFunctions.empty()) { - m_logger->LogDebug("Skipping empty virtual function table... %llx", vftAddr); + m_logger->LogDebugF("Skipping empty virtual function table... {:#x}", vftAddr); return std::nullopt; } @@ -563,10 +563,10 @@ std::optional<VirtualFunctionTableInfo> MicrosoftRTTIProcessor::ProcessVFT(uint6 } else { - LogWarn("Skipping adjustments for base VFT with more functions than sub VFT... %llx", vftAddr); + LogWarnF("Skipping adjustments for base VFT with more functions than sub VFT... {:#x}", vftAddr); } } - + for (auto &&[_, vFunc]: virtualFunctions) { auto vFuncName = fmt::format("vFunc_{}", vFuncIdx); @@ -697,22 +697,22 @@ void MicrosoftRTTIProcessor::ProcessRTTI() // If a malformed binary makes the binary view set up unbacked segments we should not attempt to read in them. if (m_view->ReadBuffer(segment->GetStart(), 4).GetLength() != 4) { - m_logger->LogInfo("Unbacked start for segment %llx... skipping", segment->GetStart()); + m_logger->LogInfoF("Unbacked start for segment {:#x}... skipping", segment->GetStart()); continue; } - m_logger->LogDebug("Attempting to find RTTI in segment %llx", segment->GetStart()); + m_logger->LogDebugF("Attempting to find RTTI in segment {:#x}", segment->GetStart()); try { scan(segment); } catch (std::exception &e) { - m_logger->LogWarn("Unhandled exception in segment scan %llx %s", segment->GetStart(), e.what()); + m_logger->LogWarnF("Unhandled exception in segment scan {:#x} {}", segment->GetStart(), e.what()); } } else if (checkWritableRData && rdataSection && rdataSection->GetStart() == segment->GetStart()) { - m_logger->LogDebug("Attempting to find RTTI in writable rdata segment %llx", + m_logger->LogDebugF("Attempting to find RTTI in writable rdata segment {:#x}", segment->GetStart()); try { @@ -720,7 +720,7 @@ void MicrosoftRTTIProcessor::ProcessRTTI() } catch (std::exception &e) { - m_logger->LogWarn("Unhandled exception in writable segment scan %llx %s", segment->GetStart(), e.what()); + m_logger->LogWarnF("Unhandled exception in writable segment scan {:#x} {}", segment->GetStart(), e.what()); } } } @@ -728,7 +728,7 @@ void MicrosoftRTTIProcessor::ProcessRTTI() bgTask->Finish(); auto end_time = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> elapsed_time = end_time - start_time; - m_logger->LogDebug("ProcessRTTI took %f seconds", elapsed_time.count()); + m_logger->LogDebugF("ProcessRTTI took {} seconds", elapsed_time.count()); } @@ -776,19 +776,19 @@ void MicrosoftRTTIProcessor::ProcessVFT() break; if (segment->GetFlags() == (SegmentReadable | SegmentContainsData)) { - m_logger->LogDebug("Attempting to find VirtualFunctionTables in segment %llx", segment->GetStart()); + m_logger->LogDebugF("Attempting to find VirtualFunctionTables in segment {:#x}", segment->GetStart()); try { scan(segment); } catch (std::exception &e) { - m_logger->LogWarn("Unhandled exception in vtable segment scan %llx %s", segment->GetStart(), e.what()); + m_logger->LogWarnF("Unhandled exception in vtable segment scan {:#x} {}", segment->GetStart(), e.what()); } } else if (checkWritableRData && rdataSection && rdataSection->GetStart() == segment->GetStart()) { - m_logger->LogDebug("Attempting to find VirtualFunctionTables in writable rdata segment %llx", + m_logger->LogDebugF("Attempting to find VirtualFunctionTables in writable rdata segment {:#x}", segment->GetStart()); try { @@ -796,7 +796,7 @@ void MicrosoftRTTIProcessor::ProcessVFT() } catch (std::exception &e) { - m_logger->LogWarn("Unhandled exception in vtable writable segment scan %llx %s", segment->GetStart(), e.what()); + m_logger->LogWarnF("Unhandled exception in vtable writable segment scan {:#x} {}", segment->GetStart(), e.what()); } } } @@ -860,5 +860,5 @@ void MicrosoftRTTIProcessor::ProcessVFT() bgTask->Finish(); auto end_time = std::chrono::high_resolution_clock::now(); std::chrono::duration<double> elapsed_time = end_time - start_time; - m_logger->LogDebug("ProcessVFT took %f seconds", elapsed_time.count()); -}
\ No newline at end of file + m_logger->LogDebugF("ProcessVFT took {} seconds", elapsed_time.count()); +} |
