Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Change LOG macro to use LogDebug
Browse files Browse the repository at this point in the history
  • Loading branch information
jonpalmisc committed Jan 15, 2022
1 parent ea46c33 commit 55c29b0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions source/StructureAnalyzer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@

using namespace BinaryNinja;

// One day there will be scoped logging in Binary Ninja...
#define LOG(...) LogInfo("ObjectiveNinja: " __VA_ARGS__)
#define LOG(...) LogDebug("ObjectiveNinja: " __VA_ARGS__)
#define LOG_BREAK() LOG("===------------------------------------------------------------------===")

StructureAnalyzer::StructureAnalyzer(BinaryViewRef bv)
: m_bv(bv)
Expand Down Expand Up @@ -300,7 +300,7 @@ void StructureAnalyzer::runPrivate()
size_t totalStrings = 0, totalMethods = 0;
size_t totalInvalidClasses = 0, totalInvalidClassRefs = 0;

LOG("===------------------------------------------------------------------===");
LOG_BREAK();

const auto cfStringsSection = m_bv->GetSectionByName(SectionName::CFString);
if (cfStringsSection) {
Expand All @@ -314,7 +314,7 @@ void StructureAnalyzer::runPrivate()
}
}

LOG("===------------------------------------------------------------------===");
LOG_BREAK();

const auto classRefsSection = m_bv->GetSectionByName(SectionName::ClassRefs);
if (classRefsSection) {
Expand All @@ -333,7 +333,7 @@ void StructureAnalyzer::runPrivate()
}
}

LOG("===------------------------------------------------------------------===");
LOG_BREAK();

const auto selRefsSection = m_bv->GetSectionByName(SectionName::SelectorRefs);
if (!selRefsSection) {
Expand All @@ -350,7 +350,7 @@ void StructureAnalyzer::runPrivate()
m_records.selectorRefs.insert({ address, selectorRef });
}

LOG("===------------------------------------------------------------------===");
LOG_BREAK();

const auto classListSection = m_bv->GetSectionByName(SectionName::ClassList);
if (!classListSection) {
Expand All @@ -377,7 +377,7 @@ void StructureAnalyzer::runPrivate()
m_records.classes.emplace_back(classRecord);
}

LOG("===------------------------------------------------------------------===");
LOG_BREAK();

// To keep the structure analysis code cleaner, symbols for structures,
// methods, etc. are not defined until after all structure analysis is
Expand Down Expand Up @@ -447,14 +447,14 @@ void StructureAnalyzer::runPrivate()
}
}

LOG("===------------------------------------------------------------------===");
LOG_BREAK();
LOG("Found %lu classes (%lu invalid)",
m_records.classes.size(), totalInvalidClasses);
LOG("Found %lu class references (%lu invalid)",
m_records.reverseClassRefs.size(), totalInvalidClassRefs);
LOG("Found %lu methods, %lu selectors", totalMethods, m_records.selectorRefs.size());
LOG("Found %lu CFString instances", totalStrings);
LOG("===------------------------------------------------------------------===");
LOG_BREAK();

// Write the implementation map to the database for future use.
std::stringstream stream;
Expand Down

0 comments on commit 55c29b0

Please sign in to comment.