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/rtti | |
| parent | ba13f6ec7d0ce9a18a03a1c895fb72d18e03014a (diff) | |
Fix many of the warnings that show up when compiling with GCC 15.2
Diffstat (limited to 'plugins/rtti')
| -rw-r--r-- | plugins/rtti/itanium.cpp | 32 | ||||
| -rw-r--r-- | plugins/rtti/microsoft.cpp | 40 |
2 files changed, 36 insertions, 36 deletions
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()); +} |
