summaryrefslogtreecommitdiff
path: root/view
diff options
context:
space:
mode:
authorkat <kat@vector35.com>2025-07-28 08:49:18 -0400
committerkat <kat@vector35.com>2025-07-28 08:52:47 -0400
commitecfc947a39aa8be76b5f378c77b845622bca8b5f (patch)
tree8dd9cd7d76df935bd7799c87c4748ec1adcbde2c /view
parent0d031494987b6e1f36ebaaf3b0b92c278cd8ca6b (diff)
Improve and migrate to fmt logging functions in Mach-O/KernelCache/SharedCache
Diffstat (limited to 'view')
-rw-r--r--view/kernelcache/core/KernelCache.cpp2
-rw-r--r--view/kernelcache/core/KernelCacheController.cpp4
-rw-r--r--view/kernelcache/core/KernelCacheView.cpp10
-rw-r--r--view/kernelcache/core/MachO.cpp22
-rw-r--r--view/kernelcache/core/MachOProcessor.cpp2
-rw-r--r--view/kernelcache/core/Utility.cpp2
-rw-r--r--view/macho/machoview.cpp108
-rw-r--r--view/sharedcache/core/MachO.cpp12
-rw-r--r--view/sharedcache/core/MachOProcessor.cpp2
-rw-r--r--view/sharedcache/core/MappedFile.cpp2
-rw-r--r--view/sharedcache/core/SharedCache.cpp2
-rw-r--r--view/sharedcache/core/SharedCacheController.cpp10
-rw-r--r--view/sharedcache/core/SharedCacheView.cpp28
-rw-r--r--view/sharedcache/core/SlideInfo.cpp16
-rw-r--r--view/sharedcache/core/Utility.cpp2
-rw-r--r--view/sharedcache/core/VirtualMemory.cpp2
16 files changed, 112 insertions, 114 deletions
diff --git a/view/kernelcache/core/KernelCache.cpp b/view/kernelcache/core/KernelCache.cpp
index cf3be5c7..3750e795 100644
--- a/view/kernelcache/core/KernelCache.cpp
+++ b/view/kernelcache/core/KernelCache.cpp
@@ -131,7 +131,7 @@ void KernelCache::ProcessRelocations(Ref<BinaryView> view, linkedit_data_command
fixupsHeader.imports_format = parentReader.Read32();
fixupsHeader.symbols_format = parentReader.Read32();
- LogDebugF("Chained Fixups: Header @ 0x{:x}// Fixups version 0x{:x}", fixupHeaderAddress, fixupsHeader.fixups_version);
+ LogDebugF("Chained Fixups: Header @ {:#x} // Fixups version {:#x}", fixupHeaderAddress, fixupsHeader.fixups_version);
if (fixupsHeader.fixups_version > 0)
{
diff --git a/view/kernelcache/core/KernelCacheController.cpp b/view/kernelcache/core/KernelCacheController.cpp
index ef2fbd04..015f4217 100644
--- a/view/kernelcache/core/KernelCacheController.cpp
+++ b/view/kernelcache/core/KernelCacheController.cpp
@@ -33,11 +33,11 @@ void DeleteController(const FileMetadata& file)
// Someone is still holding the controller, lets warn about this.
// 2 is expected here because we have one held in `controllers` and one held by `controller`.
if (controller->m_refs > 2)
- LogWarn("Deleting KernelCacheController for view %llx, but there are still %d references", id,
+ LogWarnF("Deleting KernelCacheController for view {:#x}, but there are still {} references", id,
controller->m_refs.load());
controllers.erase(it);
- LogDebug("Deleted KernelCacheController for view %s", file.GetFilename().c_str());
+ LogDebugF("Deleted KernelCacheController for view {:?}", file.GetFilename());
}
}
diff --git a/view/kernelcache/core/KernelCacheView.cpp b/view/kernelcache/core/KernelCacheView.cpp
index 7ac00529..03e8bd68 100644
--- a/view/kernelcache/core/KernelCacheView.cpp
+++ b/view/kernelcache/core/KernelCacheView.cpp
@@ -114,7 +114,7 @@ Ref<Settings> KernelCacheViewType::GetLoadSettingsForData(BinaryView* data)
Ref<BinaryView> viewRef = Parse(data);
if (!viewRef || !viewRef->Init())
{
- LogWarn("Failed to initialize view of type '%s'. Generating default load settings.", GetName().c_str());
+ LogWarnF("Failed to initialize view of type {:?}. Generating default load settings.", GetName());
viewRef = data;
}
@@ -882,7 +882,7 @@ bool KernelCacheView::Init()
}
catch (ReadException&)
{
- LogError("Error when applying Mach-O header types at %" PRIx64, textSegOffset);
+ LogErrorF("Error when applying Mach-O header types at {:#x}", textSegOffset);
}
return InitController();
@@ -943,7 +943,7 @@ bool KernelCacheView::InitController()
kernelCache.ProcessSymbols();
auto endTime = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = endTime - startTime;
- logger->LogInfo("Processing %zu symbols took %.3f seconds (separate thread)", kernelCache.GetSymbols().size(), elapsed.count());
+ logger->LogInfoF("Processing {} symbols took {:.3f} seconds (separate thread)", kernelCache.GetSymbols().size(), elapsed.count());
});
}
@@ -952,7 +952,7 @@ bool KernelCacheView::InitController()
std::string autoLoadPattern = ".*libsystem_c.dylib";
if (settings && settings->Contains("loader.kc.autoLoadPattern"))
autoLoadPattern = settings->Get<std::string>("loader.kc.autoLoadPattern", this);
- m_logger->LogDebug("Loading images using pattern: %s", autoLoadPattern.c_str());
+ m_logger->LogDebugF("Loading images using pattern: {:?}", autoLoadPattern);
{
// TODO: Refusing to add undo action "Added section libsystem_c.dylib::__macho_header", there is literally
@@ -969,7 +969,7 @@ bool KernelCacheView::InitController()
++loadedImages;
auto endTime = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = endTime - startTime;
- m_logger->LogInfo("Automatically loading %zu images took %.3f seconds", loadedImages, elapsed.count());
+ m_logger->LogInfoF("Automatically loading {} images took {:.3f} seconds", loadedImages, elapsed.count());
}
if (auto loadedImageMetadata = GetParentView()->QueryMetadata("KernelCacheLoadedImages"))
diff --git a/view/kernelcache/core/MachO.cpp b/view/kernelcache/core/MachO.cpp
index d3486b67..9eabf086 100644
--- a/view/kernelcache/core/MachO.cpp
+++ b/view/kernelcache/core/MachO.cpp
@@ -76,7 +76,7 @@ std::optional<KernelCacheMachOHeader> KernelCacheMachOHeader::ParseHeaderForAddr
{
for (size_t i = 0; i < header.ident.ncmds; i++)
{
- // BNLogInfo("of 0x%llx", reader.GetOffset());
+ // BNLogInfoF("of {:#x}", reader.GetOffset());
load_command load;
segment_command_64 segment64;
section_64 sect = {};
@@ -367,7 +367,7 @@ std::optional<KernelCacheMachOHeader> KernelCacheMachOHeader::ParseHeaderForAddr
(void)reader.Read(&thread.stateppc64.r1, sizeof(thread.stateppc64) - (3 * 8));
break;
default:
- m_logger->LogError("Unknown archid: %x", m_archId);
+ m_logger->LogErrorF("Unknown archid: {:#x}", m_archId);
}
}*/
@@ -390,16 +390,16 @@ std::optional<KernelCacheMachOHeader> KernelCacheMachOHeader::ParseHeaderForAddr
header.buildVersion.minos = reader.Read32();
header.buildVersion.sdk = reader.Read32();
header.buildVersion.ntools = reader.Read32();
- // m_logger->LogDebug("Platform: %s", BuildPlatformToString(header.buildVersion.platform).c_str());
- // m_logger->LogDebug("MinOS: %s", BuildToolVersionToString(header.buildVersion.minos).c_str());
- // m_logger->LogDebug("SDK: %s", BuildToolVersionToString(header.buildVersion.sdk).c_str());
+ // m_logger->LogDebugF("Platform: {}", BuildPlatformToString(header.buildVersion.platform));
+ // m_logger->LogDebugF("MinOS: {}", BuildToolVersionToString(header.buildVersion.minos));
+ // m_logger->LogDebugF("SDK: {}", BuildToolVersionToString(header.buildVersion.sdk));
for (uint32_t j = 0; (i < header.buildVersion.ntools) && (j < 10); j++)
{
uint32_t tool = reader.Read32();
uint32_t version = reader.Read32();
header.buildToolVersions.push_back({tool, version});
- // m_logger->LogDebug("Build Tool: %s: %s", BuildToolToString(tool).c_str(),
- // BuildToolVersionToString(version).c_str());
+ // m_logger->LogDebugF("Build Tool: {}: {}", BuildToolToString(tool),
+ // BuildToolVersionToString(version));
}
break;
}
@@ -506,7 +506,7 @@ std::vector<CacheSymbol> KernelCacheMachOHeader::ReadSymbolTable(Ref<BinaryView>
if (!symbolType.has_value())
{
// TODO: Where logger?
- LogError("Symbol %s at address %llx has unknown symbol type", symbolName.c_str(), symbolAddress);
+ LogErrorF("Symbol {:?} at address {:#x} has unknown symbol type", symbolName, symbolAddress);
continue;
}
@@ -526,7 +526,7 @@ std::vector<CacheSymbol> KernelCacheMachOHeader::ReadSymbolTable(Ref<BinaryView>
if (!flags.has_value())
{
// TODO: where logger?
- LogError("Symbol %s at address %llx is not in any section", symbolName.c_str(), symbolAddress);
+ LogErrorF("Symbol {} at address {:#x} is not in any section", symbolName, symbolAddress);
continue;
}
@@ -549,7 +549,7 @@ std::vector<CacheSymbol> KernelCacheMachOHeader::ReadSymbolTable(Ref<BinaryView>
return symbolList;
}
catch (ReadException& ex) {
- LogError("Failed to read symbol table: %s", ex.what());
+ LogErrorF("Failed to read symbol table: {}", ex.what());
return {};
}
@@ -600,7 +600,7 @@ bool KernelCacheMachOHeader::AddExportTerminalSymbol(
symbols.emplace_back(DataSymbol, symbolAddress, symbolName);
break;
default:
- LogWarn("Unhandled export symbol kind: %llx", symbolFlags & EXPORT_SYMBOL_FLAGS_KIND_MASK);
+ LogWarnF("Unhandled export symbol kind: {:#x}", symbolFlags & EXPORT_SYMBOL_FLAGS_KIND_MASK);
return false;
}
diff --git a/view/kernelcache/core/MachOProcessor.cpp b/view/kernelcache/core/MachOProcessor.cpp
index e22ce853..42faba24 100644
--- a/view/kernelcache/core/MachOProcessor.cpp
+++ b/view/kernelcache/core/MachOProcessor.cpp
@@ -327,6 +327,6 @@ void KernelCacheMachOProcessor::ApplyHeaderDataVariables(KernelCacheMachOHeader&
}
catch (ReadException&)
{
- m_logger->LogError("Error when applying Mach-O header types at %llx", header.textBase);
+ m_logger->LogErrorF("Error when applying Mach-O header types at {:#x}", header.textBase);
}
}
diff --git a/view/kernelcache/core/Utility.cpp b/view/kernelcache/core/Utility.cpp
index 6f8323bf..515d62c7 100644
--- a/view/kernelcache/core/Utility.cpp
+++ b/view/kernelcache/core/Utility.cpp
@@ -126,7 +126,7 @@ void ApplySymbol(Ref<BinaryView> view, Ref<TypeLibrary> typeLib, Ref<Symbol> sym
}
else
{
- LogWarn("Failed to find id type for %llx, objective-c processor not ran?", func->GetStart());
+ LogWarnF("Failed to find id type for {:#x}, objective-c processor not ran?", func->GetStart());
}
}
}
diff --git a/view/macho/machoview.cpp b/view/macho/machoview.cpp
index 339d9e06..4e45b362 100644
--- a/view/macho/machoview.cpp
+++ b/view/macho/machoview.cpp
@@ -332,7 +332,7 @@ MachOHeader MachoView::HeaderForAddress(BinaryView* data, uint64_t address, bool
// Parse segment commands
try
{
- m_logger->LogDebug("ident.ncmds: %d\n", header.ident.ncmds);
+ m_logger->LogDebugF("ident.ncmds: {}", header.ident.ncmds);
for (size_t i = 0; i < header.ident.ncmds; i++)
{
load_command load;
@@ -343,7 +343,7 @@ MachOHeader MachoView::HeaderForAddress(BinaryView* data, uint64_t address, bool
load.cmd = reader.Read32();
load.cmdsize = reader.Read32();
size_t nextOffset = curOffset + load.cmdsize;
- m_logger->LogDebug("Segment cmd: %08x - cmdsize: %08x - ", load.cmd, load.cmdsize);
+ m_logger->LogDebugF("Segment cmd: {:08x} - cmdsize: {:08x} - ", load.cmd, load.cmdsize);
if (load.cmdsize < sizeof(load_command))
throw MachoFormatException("unable to read header");
@@ -785,7 +785,7 @@ MachOHeader MachoView::HeaderForAddress(BinaryView* data, uint64_t address, bool
(void)reader.Read(&thread.stateppc64.r1, sizeof(thread.stateppc64) - (3 * 8));
break;
default:
- m_logger->LogError("Unknown archid: %x", m_archId);
+ m_logger->LogErrorF("Unknown archid: {:#x}", m_archId);
}
}
break;
@@ -810,15 +810,15 @@ MachOHeader MachoView::HeaderForAddress(BinaryView* data, uint64_t address, bool
header.buildVersion.minos = reader.Read32();
header.buildVersion.sdk = reader.Read32();
header.buildVersion.ntools = reader.Read32();
- m_logger->LogDebug("Platform: %s", BuildPlatformToString(header.buildVersion.platform).c_str());
- m_logger->LogDebug("MinOS: %s", BuildToolVersionToString(header.buildVersion.minos).c_str());
- m_logger->LogDebug("SDK: %s", BuildToolVersionToString(header.buildVersion.sdk).c_str());
+ m_logger->LogDebugF("Platform: {}", BuildPlatformToString(header.buildVersion.platform));
+ m_logger->LogDebugF("MinOS: {}", BuildToolVersionToString(header.buildVersion.minos));
+ m_logger->LogDebugF("SDK: {}", BuildToolVersionToString(header.buildVersion.sdk));
for (uint32_t i = 0; (i < header.buildVersion.ntools) && (i < 10); i++)
{
uint32_t tool = reader.Read32();
uint32_t version = reader.Read32();
header.buildToolVersions.push_back({tool, version});
- m_logger->LogDebug("Build Tool: %s: %s", BuildToolToString(tool).c_str(), BuildToolVersionToString(version).c_str());
+ m_logger->LogDebugF("Build Tool: {}: {}", BuildToolToString(tool), BuildToolVersionToString(version));
}
break;
}
@@ -879,7 +879,7 @@ void MachoView::RebaseThreadStarts(BinaryReader& virtualReader, vector<uint32_t>
if (threadStart == 0xffffffff)
break;
- m_logger->LogDebug("Rebasing thread chain start: 0x%x", threadStart);
+ m_logger->LogDebugF("Rebasing thread chain start: {:#x}", threadStart);
try
{
uint64_t curAddr = imageBase + threadStart;
@@ -931,7 +931,7 @@ void MachoView::RebaseThreadStarts(BinaryReader& virtualReader, vector<uint32_t>
}
catch (ReadException&)
{
- m_logger->LogError("Failed rebasing thread start at: 0x%x", threadStart);
+ m_logger->LogErrorF("Failed rebasing thread start at: {:#x}", threadStart);
}
}
@@ -1545,7 +1545,7 @@ bool MachoView::Init()
std::chrono::steady_clock::time_point endTime = std::chrono::steady_clock::now();
double t = std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count() / 1000.0;
- m_logger->LogInfo("Mach-O parsing took %.3f seconds\n", t);
+ m_logger->LogInfoF("Mach-O parsing took {:.3f} seconds", t);
return true;
}
@@ -1980,8 +1980,7 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_
typeLib = typeLibs[0];
AddTypeLibrary(typeLib);
- m_logger->LogDebug("mach-o: adding type library for '%s': %s (%s)",
- libName.c_str(), typeLib->GetName().c_str(), typeLib->GetGuid().c_str());
+ m_logger->LogDebugF("mach-o: adding type library for {:?}: {} ({})", libName, typeLib->GetName(), typeLib->GetGuid());
}
}
if (!typeLib)
@@ -1995,8 +1994,7 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_
typeLib = typeLibs[0];
AddTypeLibrary(typeLib);
- m_logger->LogDebug("mach-o: adding type library for '%s': %s (%s)",
- libName.c_str(), typeLib->GetName().c_str(), typeLib->GetGuid().c_str());
+ m_logger->LogDebugF("mach-o: adding type library for {}: {} ({})", libName, typeLib->GetName(), typeLib->GetGuid());
}
}
}
@@ -2159,7 +2157,7 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_
}
if (!handled)
- m_logger->LogError("Failed to find external symbol '%s', couldn't bind symbol at 0x%llx", name.c_str(), relocation.address);
+ m_logger->LogErrorF("Failed to find external symbol {:?}, couldn't bind symbol at {:#x}", name, relocation.address);
}
auto relocationHandler = m_arch->GetRelocationHandler("Mach-O");
@@ -2180,11 +2178,11 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_
memcpy(sectionName, section.sectname, sizeof(section.sectname));
sectionName[16] = 0;
- m_logger->LogDebug("Relocations for section %s", sectionName);
+ m_logger->LogDebugF("Relocations for section {:?}", sectionName);
auto sec = GetSectionByName(sectionName);
if (!sec)
{
- m_logger->LogError("Can't find section for %s", sectionName);
+ m_logger->LogErrorF("Can't find section for {:?}", sectionName);
continue;
}
for (size_t i = 0; i < section.nreloc; i++)
@@ -2439,7 +2437,7 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_
catch (std::exception& ex)
{
m_logger->LogError("Failed to process CFStrings. Binary may be malformed");
- m_logger->LogError("Error: %s", ex.what());
+ m_logger->LogErrorF("Error: {:?}", ex.what());
}
}
@@ -2451,7 +2449,7 @@ bool MachoView::InitializeHeader(MachOHeader& header, bool isMainHeader, uint64_
catch (std::exception& ex)
{
m_logger->LogError("Failed to process Objective-C Metadata. Binary may be malformed");
- m_logger->LogError("Error: %s", ex.what());
+ m_logger->LogErrorF("Error: {:?}", ex.what());
}
}
@@ -2501,7 +2499,7 @@ Ref<Symbol> MachoView::DefineMachoSymbol(
symbolTypeRef = ImportTypeLibraryObject(appliedLib, n);
if (symbolTypeRef)
{
- m_logger->LogDebug("mach-o: type Library '%s' found hit for '%s'", appliedLib->GetName().c_str(), name.c_str());
+ m_logger->LogDebugF("mach-o: type Library {:?} found hit for {:?}", appliedLib->GetName(), name);
RecordImportedObjectLibrary(GetDefaultPlatform(), addr, appliedLib, n);
}
@@ -2596,14 +2594,14 @@ bool MachoView::AddExportTerminalSymbol(
{
if (symbolFlags & EXPORT_SYMBOL_FLAGS_REEXPORT)
{
- m_logger->LogTrace("Export symbol is a re-export, not supported: %s", symbolName.c_str());
+ m_logger->LogTraceF("Export symbol is a re-export, not supported: {:?}", symbolName);
return false;
}
uint64_t symbolAddress = GetStart() + imageOffset;
if (symbolName.empty() || symbolAddress == 0)
{
- m_logger->LogTrace("Export symbol is malformed: %s", symbolName.c_str());
+ m_logger->LogTraceF("Export symbol is malformed: {:?}", symbolName);
return false;
}
@@ -2635,19 +2633,19 @@ bool MachoView::AddExportTerminalSymbol(
{
case EXPORT_SYMBOL_FLAGS_KIND_REGULAR:
case EXPORT_SYMBOL_FLAGS_KIND_THREAD_LOCAL:
- m_logger->LogTrace("Export symbol is a regular or thread local symbol: %d %s", sectionSymbolType(), symbolName.c_str());
+ m_logger->LogTraceF("Export symbol is a regular or thread local symbol: {} {:?}", sectionSymbolType(), symbolName);
DefineMachoSymbol(sectionSymbolType(), symbolName, symbolAddress, GlobalBinding, false);
break;
case EXPORT_SYMBOL_FLAGS_KIND_ABSOLUTE:
- m_logger->LogTrace("Export symbol is an absolute symbol: %s", symbolName.c_str());
+ m_logger->LogTraceF("Export symbol is an absolute symbol: {:?}", symbolName);
DefineMachoSymbol(DataSymbol, symbolName, symbolAddress, GlobalBinding, false);
break;
default:
- m_logger->LogWarn("Unhandled export symbol kind: %llx", symbolFlags & EXPORT_SYMBOL_FLAGS_KIND_MASK);
+ m_logger->LogWarnF("Unhandled export symbol kind: {:#x}", symbolFlags & EXPORT_SYMBOL_FLAGS_KIND_MASK);
return false;
}
- m_logger->LogTrace("Successfully added export symbol: %s", symbolName.c_str());
+ m_logger->LogTraceF("Successfully added export symbol: {:?}", symbolName);
return true;
}
@@ -2670,7 +2668,7 @@ void MachoView::ParseExportTrie(BinaryReader& reader, linkedit_data_command expo
while (!stack.empty())
{
- m_logger->LogTrace("Export Trie: Processing node %s with cursor %llu", stack.back().text.c_str(), stack.back().cursor);
+ m_logger->LogTraceF("Export Trie: Processing node {:?} with cursor {:#x}", stack.back().text, stack.back().cursor);
Node node = std::move(stack.back());
stack.pop_back();
@@ -2692,7 +2690,7 @@ void MachoView::ParseExportTrie(BinaryReader& reader, linkedit_data_command expo
{
uint64_t flags = readValidULEB128(buffer, localCursor);
uint64_t imageOffset = readValidULEB128(buffer, localCursor);
- m_logger->LogTrace("Export Trie: Found terminal node %s with flags %llx and image offset %llx", currentText.c_str(), flags, imageOffset);
+ m_logger->LogTraceF("Export Trie: Found terminal node {:?} with flags {:#x} and image offset {:#x}", currentText, flags, imageOffset);
AddExportTerminalSymbol(currentText, flags, imageOffset);
}
@@ -2790,7 +2788,7 @@ void MachoView::ParseRebaseTable(BinaryReader& reader, MachOHeader& header, uint
uint8_t opAndIm = table[i];
uint8_t opcode = opAndIm & RebaseOpcodeMask;
uint64_t immediate = opAndIm & RebaseImmediateMask;
- m_logger->LogDebug("Rebase opcode 0x%llx (im: 0x%llx)", opcode, immediate);
+ m_logger->LogTraceF("Rebase opcode {:#x} (im: {:#x})", opcode, immediate);
i++;
switch (opcode)
{
@@ -2815,7 +2813,7 @@ void MachoView::ParseRebaseTable(BinaryReader& reader, MachOHeader& header, uint
count = immediate;
for (uint64_t j = 0; j < count; ++j)
{
- m_logger->LogDebug("Rebasing address %llx", address);
+ m_logger->LogTraceF("Rebasing address {:#x}", address);
if (address < segmentStartAddress || address >= segmentEndAddress)
{
m_logger->LogError("Rebase address out of segment bounds");
@@ -2835,7 +2833,7 @@ void MachoView::ParseRebaseTable(BinaryReader& reader, MachOHeader& header, uint
count = readLEB128(table, tableSize, i);
for (uint64_t j = 0; j < count; ++j)
{
- m_logger->LogDebug("Rebasing address %llx", address);
+ m_logger->LogTraceF("Rebasing address {:#x}", address);
if (address < segmentStartAddress || address >= segmentEndAddress)
{
m_logger->LogError("Rebase address out of segment bounds");
@@ -2852,7 +2850,7 @@ void MachoView::ParseRebaseTable(BinaryReader& reader, MachOHeader& header, uint
}
break;
case RebaseOpcodeDoRebaseAddAddressUleb:
- m_logger->LogDebug("Rebasing address %llx", address);
+ m_logger->LogTraceF("Rebasing address {:#x}", address);
if (address < segmentStartAddress || address >= segmentEndAddress)
{
m_logger->LogError("Rebase address out of segment bounds");
@@ -2872,7 +2870,7 @@ void MachoView::ParseRebaseTable(BinaryReader& reader, MachOHeader& header, uint
skip = readLEB128(table, tableSize, i);
for (uint64_t j = 0; j < count; ++j)
{
- m_logger->LogDebug("Rebasing address %llx", address);
+ m_logger->LogTraceF("Rebasing address {:#x}", address);
if (address < segmentStartAddress || address >= segmentEndAddress)
{
m_logger->LogError("Rebase address out of segment bounds");
@@ -2889,7 +2887,7 @@ void MachoView::ParseRebaseTable(BinaryReader& reader, MachOHeader& header, uint
}
break;
default:
- m_logger->LogError("Unknown rebase opcode %d", opcode);
+ m_logger->LogErrorF("Unknown rebase opcode {}", opcode);
throw ReadException();
break;
}
@@ -3137,7 +3135,7 @@ void MachoView::ParseSymbolTable(BinaryReader& reader, MachOHeader& header, cons
(symbol.length() > 2 && symbol.substr(symbol.length()-2, 2) == ".o") ||
(symbol.length() > 4 && symbol.substr(0, 4) == "ltmp"))
{
- m_logger->LogDebug("Skipping symbol: %s.", symbol.c_str());
+ m_logger->LogDebugF("Skipping symbol: {:?}", symbol);
continue;
}
//N_TYPE is only set when N_SECT is the integer count of the section the symbol is in
@@ -3222,7 +3220,7 @@ void MachoView::ParseSymbolTable(BinaryReader& reader, MachOHeader& header, cons
{
for (auto& j : stubSymbolIter->second)
{
- // m_logger->LogError("STUB [%d] %llx - %s", i, j.first->addr + (j * j.first->reserved2), symbol.c_str());
+ // m_logger->LogErrorF("STUB [{}] {:x} - {}", i, j.first->addr + (j * j.first->reserved2), symbol);
BNRelocationInfo info;
memset(&info, 0, sizeof(info));
info.nativeType = -1;
@@ -3238,8 +3236,8 @@ void MachoView::ParseSymbolTable(BinaryReader& reader, MachOHeader& header, cons
{
for (auto& j : pointerSymbolIter->second)
{
- // m_logger->LogError("POINTER [%d] %llx - %s", i, j.first->addr + (j.second * m_addressSize),
- // symbol.c_str());
+ // m_logger->LogErrorF("POINTER [{}] {:x} - {}", i, j.first->addr + (j.second * m_addressSize),
+ // symbol);
BNRelocationInfo info;
memset(&info, 0, sizeof(info));
info.nativeType = BINARYNINJA_MANUAL_RELOCATION;
@@ -3291,7 +3289,7 @@ void MachoView::ParseChainedFixups(
fixupsHeader.symbols_format = parentReader.Read32();
m_logger->LogDebugF(
- "Chained Fixups: Header @ 0x{:x} // Fixups version {}", fixupHeaderAddress, fixupsHeader.fixups_version);
+ "Chained Fixups: Header @ {:#x} // Fixups version {}", fixupHeaderAddress, fixupsHeader.fixups_version);
size_t importsAddress = fixupHeaderAddress + fixupsHeader.imports_offset;
size_t importTableSize = sizeof(dyld_chained_import) * fixupsHeader.imports_count;
@@ -3380,7 +3378,7 @@ void MachoView::ParseChainedFixups(
}
}
- m_logger->LogDebugF("Chained Fixups: 0x{:x} import table entries", importTable.size());
+ m_logger->LogDebugF("Chained Fixups: {:#x} import table entries", importTable.size());
uint64_t fixupStartsAddress = fixupHeaderAddress + fixupsHeader.starts_offset;
parentReader.Seek(fixupStartsAddress);
@@ -3448,13 +3446,13 @@ void MachoView::ParseChainedFixups(
default:
{
m_logger->LogErrorF("Chained Fixups: Unknown or unsupported pointer format {}, "
- "unable to process chains for segment at @ 0x{:x}", starts.pointer_format, starts.segment_offset);
+ "unable to process chains for segment at @ {:#x}", starts.pointer_format, starts.segment_offset);
continue;
}
}
uint16_t fmt = starts.pointer_format;
- m_logger->LogDebugF("Chained Fixups: Segment start @ 0x{:x}, fmt {}", starts.segment_offset, fmt);
+ m_logger->LogDebugF("Chained Fixups: Segment start @ {:#x}, fmt {}", starts.segment_offset, fmt);
uint64_t pageStartsTableStartAddress = parentReader.GetOffset();
vector<vector<uint16_t>> pageStartOffsets {};
@@ -3544,7 +3542,7 @@ void MachoView::ParseChainedFixups(
break;
}
- m_logger->LogTraceF("Chained Fixups: @ 0x{:x} ( 0x{:x} ) - {} 0x{:x}", chainEntryAddress,
+ m_logger->LogTraceF("Chained Fixups: @ {:#x} ( {:#x} ) - {} {:#x}", chainEntryAddress,
GetStart() + (chainEntryAddress - m_universalImageOffset),
bind, nextEntryStrideCount);
@@ -3575,13 +3573,13 @@ void MachoView::ParseChainedFixups(
case DYLD_CHAINED_PTR_64_KERNEL_CACHE: // no binding
case DYLD_CHAINED_PTR_X86_64_KERNEL_CACHE: // ''
default:
- m_logger->LogWarnF("Chained Fixups: Unknown Bind Pointer Format at 0x{:x}",
+ m_logger->LogWarnF("Chained Fixups: Unknown Bind Pointer Format at {:#x}",
GetStart() + (chainEntryAddress - m_universalImageOffset));
chainEntryAddress += (nextEntryStrideCount * strideSize);
if (chainEntryAddress > pageAddress + starts.page_size)
{
- m_logger->LogErrorF("Chained Fixups: Pointer at 0x{:x} left page",
+ m_logger->LogErrorF("Chained Fixups: Pointer at {:#x} left page",
GetStart() + ((chainEntryAddress - (nextEntryStrideCount * strideSize))) - m_universalImageOffset);
fixupsDone = true;
}
@@ -3611,8 +3609,8 @@ void MachoView::ParseChainedFixups(
}
else
{
- m_logger->LogWarnF("Chained Fixups: Import Table entry 0x{:x} has no symbol; "
- "Unable to bind item at 0x{:x}", ordinal, targetAddress);
+ m_logger->LogWarnF("Chained Fixups: Import Table entry {:#x} has no symbol; "
+ "Unable to bind item at {:#x}", ordinal, targetAddress);
}
}
}
@@ -3670,7 +3668,7 @@ void MachoView::ParseChainedFixups(
{
// Something is seriously wrong here. likely malformed binary, or our parsing failed elsewhere.
// This will log the pointer in mapped memory.
- m_logger->LogErrorF("Chained Fixups: Pointer at 0x{:x} left page",
+ m_logger->LogErrorF("Chained Fixups: Pointer at {:#x} left page",
GetStart() + ((chainEntryAddress - (nextEntryStrideCount * strideSize))) - m_universalImageOffset);
fixupsDone = true;
}
@@ -3758,7 +3756,7 @@ void MachoView::ParseChainedStarts(MachOHeader& header, section_64 chainedStarts
break;
default:
{
- m_logger->LogError("Chained Starts: Unknown or unsupported pointer format %d, "
+ m_logger->LogErrorF("Chained Starts: Unknown or unsupported pointer format {}, "
"unable to process chain starts", pointerFormat);
return;
}
@@ -3806,7 +3804,7 @@ void MachoView::ParseChainedStarts(MachOHeader& header, section_64 chainedStarts
bind = false;
}
- m_logger->LogTrace("Chained Starts: @ 0x%llx ( 0x%llx ) - %d 0x%llx", chainEntryAddress,
+ m_logger->LogTraceF("Chained Starts: @ {:#x} ( {:#x} ) - {} {:#x}", chainEntryAddress,
GetStart() + (chainEntryAddress - m_universalImageOffset),
bind, nextEntryStrideCount);
@@ -3859,7 +3857,7 @@ void MachoView::ParseChainedStarts(MachOHeader& header, section_64 chainedStarts
reloc.address = GetStart() + (chainEntryAddress - m_universalImageOffset);
DefineRelocation(m_arch, reloc, entryOffset, reloc.address);
- m_logger->LogDebug("Chained Starts: Adding relocated pointer %llx -> %llx", reloc.address, entryOffset);
+ m_logger->LogTraceF("Chained Starts: Adding relocated pointer {:#x} -> {:#x}", reloc.address, entryOffset);
if (objcProcessor)
{
@@ -3922,7 +3920,7 @@ Ref<BinaryView> MachoViewType::Create(BinaryView* data)
}
catch (std::exception& e)
{
- m_logger->LogError("%s<BinaryViewType> failed to create view! '%s'", GetName().c_str(), e.what());
+ m_logger->LogErrorF("{}<BinaryViewType> failed to create view! {:?}", GetName(), e.what());
return nullptr;
}
}
@@ -3936,7 +3934,7 @@ Ref<BinaryView> MachoViewType::Parse(BinaryView* data)
}
catch (std::exception& e)
{
- m_logger->LogError("%s<BinaryViewType> failed to create view! '%s'", GetName().c_str(), e.what());
+ m_logger->LogErrorF("{}<BinaryViewType> failed to create view! {:?}", GetName(), e.what());
return nullptr;
}
}
@@ -4032,7 +4030,7 @@ uint64_t MachoViewType::ParseHeaders(BinaryView* data, uint64_t imageOffset, mac
ident.filetype == MH_DSYM ||
ident.filetype == MH_FILESET))
{
- m_logger->LogError("Unhandled Macho file class: 0x%x", ident.filetype);
+ m_logger->LogErrorF("Unhandled Macho file class: {:#x}", ident.filetype);
errorMsg = "invalid file class";
return 0;
}
@@ -4109,7 +4107,7 @@ Ref<Settings> MachoViewType::GetLoadSettingsForData(BinaryView* data)
Ref<BinaryView> viewRef = Parse(data);
if (!viewRef || !viewRef->Init())
{
- m_logger->LogWarn("Failed to initialize view of type '%s'. Generating default load settings.", GetName().c_str());
+ m_logger->LogWarnF("Failed to initialize view of type '{}'. Generating default load settings.", GetName());
viewRef = data;
}
diff --git a/view/sharedcache/core/MachO.cpp b/view/sharedcache/core/MachO.cpp
index 969591a0..1c1224db 100644
--- a/view/sharedcache/core/MachO.cpp
+++ b/view/sharedcache/core/MachO.cpp
@@ -489,9 +489,9 @@ std::vector<CacheSymbol> SharedCacheMachOHeader::ReadSymbolTable(VirtualMemory&
if (nlist.n_strx >= stringInfo.entries)
{
// TODO: where logger?
- LogError(
- "Symbol entry at index %llu has a string offset of %u which is outside the strings buffer of size %llu "
- "for symbol table %x",
+ LogErrorF(
+ "Symbol entry at index {} has a string offset of {:#x} which is outside the strings buffer of size {:#x} "
+ "for symbol table {:#x}",
entryIndex, nlist.n_strx, stringInfo.address, stringInfo.entries);
continue;
}
@@ -511,7 +511,7 @@ std::vector<CacheSymbol> SharedCacheMachOHeader::ReadSymbolTable(VirtualMemory&
if (!symbolType.has_value())
{
// TODO: Where logger?
- LogError("Symbol %s at address %llx has unknown symbol type", symbolName.c_str(), symbolAddress);
+ LogErrorF("Symbol {:?} at address {:#x} has unknown symbol type", symbolName.c_str(), symbolAddress);
continue;
}
@@ -531,7 +531,7 @@ std::vector<CacheSymbol> SharedCacheMachOHeader::ReadSymbolTable(VirtualMemory&
if (!flags.has_value())
{
// TODO: where logger?
- LogError("Symbol %s at address %llx is not in any section", symbolName.c_str(), symbolAddress);
+ LogErrorF("Symbol {:?} at address {:#x} is not in any section", symbolName.c_str(), symbolAddress);
continue;
}
@@ -599,7 +599,7 @@ bool SharedCacheMachOHeader::AddExportTerminalSymbol(
symbols.emplace_back(DataSymbol, symbolAddress, symbolName);
break;
default:
- LogWarn("Unhandled export symbol kind: %llx", symbolFlags & EXPORT_SYMBOL_FLAGS_KIND_MASK);
+ LogWarnF("Unhandled export symbol kind: {:#x}", symbolFlags & EXPORT_SYMBOL_FLAGS_KIND_MASK);
return false;
}
diff --git a/view/sharedcache/core/MachOProcessor.cpp b/view/sharedcache/core/MachOProcessor.cpp
index c6e2c288..df2fcfde 100644
--- a/view/sharedcache/core/MachOProcessor.cpp
+++ b/view/sharedcache/core/MachOProcessor.cpp
@@ -377,6 +377,6 @@ void SharedCacheMachOProcessor::ApplyHeaderDataVariables(SharedCacheMachOHeader&
}
catch (ReadException&)
{
- m_logger->LogError("Error when applying Mach-O header types at %llx", header.textBase);
+ m_logger->LogErrorF("Error when applying Mach-O header types at {:#x}", header.textBase);
}
}
diff --git a/view/sharedcache/core/MappedFile.cpp b/view/sharedcache/core/MappedFile.cpp
index e0b805bc..21bda4f8 100644
--- a/view/sharedcache/core/MappedFile.cpp
+++ b/view/sharedcache/core/MappedFile.cpp
@@ -89,7 +89,7 @@ MapStatus MappedFile::Map()
void* result = mmap(nullptr, len, PROT_READ | PROT_WRITE, MAP_PRIVATE, fileno(fd), 0u);
if (result == MAP_FAILED)
{
- BinaryNinja::LogError("mmap failed: %s", strerror(errno)); // Use errno to log the reason
+ BinaryNinja::LogErrorF("mmap failed: {}", strerror(errno)); // Use errno to log the reason
return MapStatus::Error;
}
_mmap = static_cast<uint8_t*>(result);
diff --git a/view/sharedcache/core/SharedCache.cpp b/view/sharedcache/core/SharedCache.cpp
index c36c9ede..0a14cfaf 100644
--- a/view/sharedcache/core/SharedCache.cpp
+++ b/view/sharedcache/core/SharedCache.cpp
@@ -444,7 +444,7 @@ void SharedCache::ProcessEntrySlideInfo(const CacheEntry& entry) const
}
}
- LogWarn("Failed to register revive callback for slide mapping %llx in entry '%s'", mapping.address, entry.GetFileName().c_str());
+ LogWarnF("Failed to register revive callback for slide mapping {:#x} in entry {:?}", mapping.address, entry.GetFileName().c_str());
}
}
diff --git a/view/sharedcache/core/SharedCacheController.cpp b/view/sharedcache/core/SharedCacheController.cpp
index a9e0937c..ce3fde2c 100644
--- a/view/sharedcache/core/SharedCacheController.cpp
+++ b/view/sharedcache/core/SharedCacheController.cpp
@@ -35,7 +35,7 @@ void DeleteController(const FileMetadata& file)
// Someone is still holding the controller, lets warn about this.
// 2 is expected here because we have one held in `controllers` and one held by `controller`.
if (controller->m_refs > 2)
- LogWarn("Deleting SharedCacheController for view %llx, but there are still %d references", id,
+ LogWarnF("Deleting SharedCacheController for view {:#x}, but there are still {} references", id,
controller->m_refs.load());
// Go through the file accessor cache and remove the entries we reference.
@@ -47,7 +47,7 @@ void DeleteController(const FileMetadata& file)
}
controllers.erase(it);
- LogDebug("Deleted SharedCacheController for view %s", file.GetFilename().c_str());
+ LogDebugF("Deleted SharedCacheController for view {:?}", file.GetFilename().c_str());
}
}
@@ -135,7 +135,7 @@ bool SharedCacheController::ApplyRegion(BinaryView& view, const CacheRegion& reg
// Skip filtered regions, this defaults to just LINKEDIT regions.
if (std::regex_match(region.name, m_regionFilter))
{
- m_logger->LogDebug("Skipping filtered region at %llx", region.start);
+ m_logger->LogDebugF("Skipping filtered region at {:#x}", region.start);
return false;
}
@@ -148,7 +148,7 @@ bool SharedCacheController::ApplyRegion(BinaryView& view, const CacheRegion& reg
catch (std::exception& e)
{
// This happens if we have not mapped in all the relevant entries.
- m_logger->LogError("Failed to read region: %s", e.what());
+ m_logger->LogErrorF("Failed to read region: {}", e.what());
return false;
}
@@ -239,7 +239,7 @@ bool SharedCacheController::ApplyImage(BinaryView& view, const CacheImage& image
{
// Let the user know there was an error in processing the objc stuff but let the image load
// regardless, as its non-critical.
- m_logger->LogError("Failed to process ObjC information: %s", e.what());
+ m_logger->LogErrorF("Failed to process ObjC information: {}", e.what());
}
}
diff --git a/view/sharedcache/core/SharedCacheView.cpp b/view/sharedcache/core/SharedCacheView.cpp
index e9699ab1..8277f887 100644
--- a/view/sharedcache/core/SharedCacheView.cpp
+++ b/view/sharedcache/core/SharedCacheView.cpp
@@ -16,7 +16,7 @@ SharedCacheViewType::SharedCacheViewType() : BinaryViewType(VIEW_NAME, VIEW_NAME
void SharedCacheViewType::Register()
{
auto fdLimit = AdjustFileDescriptorLimit();
- LogDebug("Shared Cache processing initialized with a max file descriptor limit of %lld", fdLimit);
+ LogDebugF("Shared Cache processing initialized with a max file descriptor limit of {}", fdLimit);
// Adjust the global accessor cache to the fdlimit.
FileAccessorCache::Global().SetCacheSize(fdLimit);
@@ -37,7 +37,7 @@ Ref<Settings> SharedCacheViewType::GetLoadSettingsForData(BinaryView* data)
Ref<BinaryView> viewRef = Parse(data);
if (!viewRef || !viewRef->Init())
{
- LogWarn("Failed to initialize view of type '%s'. Generating default load settings.", GetName().c_str());
+ LogWarnF("Failed to initialize view of type '{}'. Generating default load settings.", GetName().c_str());
viewRef = data;
}
@@ -190,7 +190,7 @@ bool SharedCacheView::Init()
}
else
{
- m_logger->LogError("Unknown magic: %s", magic);
+ m_logger->LogErrorF("Unknown magic: {:?}", magic);
return false;
}
@@ -224,10 +224,10 @@ bool SharedCacheView::Init()
case DSCPlatformWatchOS:
case DSCPlatformWatchOSSimulator:
case DSCPlatformBridgeOS:
- m_logger->LogError("Unsupported platform: %d", platform);
+ m_logger->LogErrorF("Unsupported platform: {}", platform);
return false;
default:
- m_logger->LogWarn("Unknown platform: %d", platform);
+ m_logger->LogWarnF("Unknown platform: {}", platform);
return false;
}
@@ -353,7 +353,7 @@ bool SharedCacheView::Init()
if (!err.empty() || !headerType.type)
{
- m_logger->LogError("Failed to parse header type: %s", err.c_str());
+ m_logger->LogErrorF("Failed to parse header type: {}", err);
return false;
}
@@ -783,7 +783,7 @@ bool SharedCacheView::Init()
GetParentView()->Read(&primaryBase, basePointer, 8);
if (primaryBase == 0)
{
- m_logger->LogError("Failed to read primary base at 0x%llx", basePointer);
+ m_logger->LogErrorF("Failed to read primary base at {:#x}", basePointer);
return false;
}
@@ -855,7 +855,7 @@ bool SharedCacheView::InitController()
auto totalEntries = sharedCacheBuilder.GetCache().GetEntries().size();
auto endTime = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = endTime - startTime;
- m_logger->LogInfo("Processing %zu entries took %.3f seconds", totalEntries, elapsed.count());
+ m_logger->LogInfoF("Processing {} entries took {:.3f} seconds", totalEntries, elapsed.count());
// If we can't store all of our files for this cache in the accessor cache we might run into issues, warn the user.
if (totalEntries > FileAccessorCache::Global().GetCacheSize())
@@ -900,7 +900,7 @@ bool SharedCacheView::InitController()
sharedCache.ProcessEntrySlideInfo(entry);
auto endTime = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = endTime - startTime;
- m_logger->LogInfo("Processing slide info took %.3f seconds", elapsed.count());
+ m_logger->LogInfoF("Processing slide info took {:.3f} seconds", elapsed.count());
}
{
@@ -913,7 +913,7 @@ bool SharedCacheView::InitController()
auto endTime = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = endTime - startTime;
const auto& images = sharedCache.GetImages();
- m_logger->LogInfo("Processing %zu images took %.3f seconds", images.size(), elapsed.count());
+ m_logger->LogInfoF("Processing {} images took {:.3f} seconds", images.size(), elapsed.count());
// Warn if we found no images, and provide the likely explanation
if (images.empty())
m_logger->LogWarn("Failed to process any images, likely missing cache files.");
@@ -926,7 +926,7 @@ bool SharedCacheView::InitController()
sharedCache.ProcessEntryRegions(entry);
auto endTime = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = endTime - startTime;
- m_logger->LogInfo("Processing %zu regions took %.3f seconds", sharedCache.GetRegions().size(), elapsed.count());
+ m_logger->LogInfoF("Processing {} regions took {:.3f} seconds", sharedCache.GetRegions().size(), elapsed.count());
}
// TODO: Here we should have all the regions and what not for the virtual memory populated, I think it might be a good idea
@@ -944,7 +944,7 @@ bool SharedCacheView::InitController()
sharedCache.ProcessSymbols();
auto endTime = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = endTime - startTime;
- logger->LogInfo("Processing %zu symbols took %.3f seconds (separate thread)", sharedCache.GetSymbols().size(), elapsed.count());
+ logger->LogInfoF("Processing {} symbols took {:.3f} seconds (separate thread)", sharedCache.GetSymbols().size(), elapsed.count());
});
}
@@ -953,7 +953,7 @@ bool SharedCacheView::InitController()
std::string autoLoadPattern = ".*libsystem_c.dylib";
if (settings && settings->Contains("loader.dsc.autoLoadPattern"))
autoLoadPattern = settings->Get<std::string>("loader.dsc.autoLoadPattern", this);
- m_logger->LogDebug("Loading images using pattern: %s", autoLoadPattern.c_str());
+ m_logger->LogDebugF("Loading images using pattern: {:?}", autoLoadPattern);
{
// TODO: Refusing to add undo action "Added section libsystem_c.dylib::__macho_header", there is literally
@@ -970,7 +970,7 @@ bool SharedCacheView::InitController()
++loadedImages;
auto endTime = std::chrono::high_resolution_clock::now();
std::chrono::duration<double> elapsed = endTime - startTime;
- m_logger->LogInfo("Automatically loading %zu images took %.3f seconds", loadedImages, elapsed.count());
+ m_logger->LogInfoF("Automatically loading {} images took {:.3f} seconds", loadedImages, elapsed.count());
}
return true;
diff --git a/view/sharedcache/core/SlideInfo.cpp b/view/sharedcache/core/SlideInfo.cpp
index cedb4ab8..d1352ff7 100644
--- a/view/sharedcache/core/SlideInfo.cpp
+++ b/view/sharedcache/core/SlideInfo.cpp
@@ -167,7 +167,7 @@ std::vector<SlideMappingInfo> SlideInfoProcessor::ReadEntryInfo(const MappedFile
auto slideInfoVersion = accessor.ReadUInt32(slideInfoAddress);
if (slideInfoVersion != 2 && slideInfoVersion != 3)
{
- m_logger->LogError("Unsupported slide info version %d", slideInfoVersion);
+ m_logger->LogErrorF("Unsupported slide info version {}", slideInfoVersion);
return {};
}
@@ -216,15 +216,15 @@ std::vector<SlideMappingInfo> SlideInfoProcessor::ReadEntryInfo(const MappedFile
}
else
{
- m_logger->LogError("Unknown slide info version: %d", map.slideInfoVersion);
+ m_logger->LogErrorF("Unknown slide info version: {}", map.slideInfoVersion);
continue;
}
mappings.emplace_back(map);
- m_logger->LogDebug("File: %s", entry.GetFilePath().c_str());
- m_logger->LogDebug("Slide Info Address: 0x%llx", map.address);
- m_logger->LogDebug("Mapping Address: 0x%llx", map.mappingInfo.address);
- m_logger->LogDebug("Slide Info Version: %d", map.slideInfoVersion);
+ m_logger->LogDebugF("File: {:?}", entry.GetFilePath().c_str());
+ m_logger->LogDebugF("Slide Info Address: {:#x}", map.address);
+ m_logger->LogDebugF("Mapping Address: {:#x}", map.mappingInfo.address);
+ m_logger->LogDebugF("Slide Info Version: {}", map.slideInfoVersion);
}
return mappings;
@@ -255,7 +255,7 @@ void SlideInfoProcessor::ApplyMappings(MappedFileAccessor& accessor, const std::
break;
default:
m_logger->LogError(
- "Cannot apply slide info version: %d @ %llx", mapping.slideInfoVersion, mapping.mappingInfo.address);
+ "Cannot apply slide info version: {} @ {:#x}", mapping.slideInfoVersion, mapping.mappingInfo.address);
break;
}
}
@@ -273,7 +273,7 @@ std::vector<SlideMappingInfo> SlideInfoProcessor::ProcessEntry(MappedFileAccesso
{
// Just log an error, we technically can continue as if the slide info is not applied for a given entry it does
// not necessarily mean we cannot do analysis on others.
- m_logger->LogError("Error processing slide info for entry `%s`: %s", entry.GetFileName().c_str(), e.what());
+ m_logger->LogErrorF("Error processing slide info for entry {:?}: {}", entry.GetFileName().c_str(), e.what());
return {};
}
}
diff --git a/view/sharedcache/core/Utility.cpp b/view/sharedcache/core/Utility.cpp
index 6f8323bf..515d62c7 100644
--- a/view/sharedcache/core/Utility.cpp
+++ b/view/sharedcache/core/Utility.cpp
@@ -126,7 +126,7 @@ void ApplySymbol(Ref<BinaryView> view, Ref<TypeLibrary> typeLib, Ref<Symbol> sym
}
else
{
- LogWarn("Failed to find id type for %llx, objective-c processor not ran?", func->GetStart());
+ LogWarnF("Failed to find id type for {:#x}, objective-c processor not ran?", func->GetStart());
}
}
}
diff --git a/view/sharedcache/core/VirtualMemory.cpp b/view/sharedcache/core/VirtualMemory.cpp
index dc52bf0f..475d0430 100644
--- a/view/sharedcache/core/VirtualMemory.cpp
+++ b/view/sharedcache/core/VirtualMemory.cpp
@@ -11,7 +11,7 @@ void VirtualMemory::MapRegion(WeakFileAccessor fileAccessor, AddressRange mapped
if (existingRange.Overlaps(mappedRange))
{
// Handle overlapping regions, e.g., throw an exception or skip the mapping
- BinaryNinja::LogError("Overlapping memory region %llx", existingRange.start);
+ BinaryNinja::LogErrorF("Overlapping memory region {:#x}", existingRange.start);
}
}