diff --git a/x64_dbg_dbg/BasicBlock.h b/x64_dbg_dbg/BasicBlock.h index 314b27ac..f866207f 100644 --- a/x64_dbg_dbg/BasicBlock.h +++ b/x64_dbg_dbg/BasicBlock.h @@ -16,8 +16,8 @@ enum BasicBlockFlags : uint struct BasicBlock { - uint VirtualStart; // Inclusive byte - uint VirtualEnd; // Exclusive byte + uint VirtualStart; // Inclusive + uint VirtualEnd; // Exclusive uint Flags; uint Target; @@ -40,4 +40,6 @@ struct BasicBlock { return VirtualStart == b.VirtualStart; } -}; \ No newline at end of file +}; + +typedef std::vector BBlockArray; \ No newline at end of file diff --git a/x64_dbg_dbg/CodeFollowPass.cpp b/x64_dbg_dbg/CodeFollowPass.cpp index 83ae2872..a84a6923 100644 --- a/x64_dbg_dbg/CodeFollowPass.cpp +++ b/x64_dbg_dbg/CodeFollowPass.cpp @@ -1,8 +1,8 @@ #include "AnalysisPass.h" #include "CodeFollowPass.h" -CodeFollowPass::CodeFollowPass(uint VirtualStart, uint VirtualEnd) - : AnalysisPass(VirtualStart, VirtualEnd) +CodeFollowPass::CodeFollowPass(uint VirtualStart, uint VirtualEnd, BBlockArray & MainBlocks) + : AnalysisPass(VirtualStart, VirtualEnd, MainBlocks) { } diff --git a/x64_dbg_dbg/CodeFollowPass.h b/x64_dbg_dbg/CodeFollowPass.h index 42fd5871..1454b8b3 100644 --- a/x64_dbg_dbg/CodeFollowPass.h +++ b/x64_dbg_dbg/CodeFollowPass.h @@ -7,7 +7,7 @@ class CodeFollowPass : public AnalysisPass { public: - CodeFollowPass(uint VirtualStart, uint VirtualEnd); + CodeFollowPass(uint VirtualStart, uint VirtualEnd, BBlockArray & MainBlocks); virtual ~CodeFollowPass(); virtual bool Analyse() override; diff --git a/x64_dbg_dbg/FunctionPass.cpp b/x64_dbg_dbg/FunctionPass.cpp index 406ff58d..38b5d26b 100644 --- a/x64_dbg_dbg/FunctionPass.cpp +++ b/x64_dbg_dbg/FunctionPass.cpp @@ -1,7 +1,7 @@ #include "FunctionPass.h" -FunctionPass::FunctionPass(uint VirtualStart, uint VirtualEnd) - : AnalysisPass(VirtualStart, VirtualEnd) +FunctionPass::FunctionPass(uint VirtualStart, uint VirtualEnd, BBlockArray & MainBlocks) + : AnalysisPass(VirtualStart, VirtualEnd, MainBlocks) { } diff --git a/x64_dbg_dbg/FunctionPass.h b/x64_dbg_dbg/FunctionPass.h index 67003c43..3e6f4491 100644 --- a/x64_dbg_dbg/FunctionPass.h +++ b/x64_dbg_dbg/FunctionPass.h @@ -6,7 +6,7 @@ class FunctionPass : public AnalysisPass { public: - FunctionPass(uint VirtualStart, uint VirtualEnd); + FunctionPass(uint VirtualStart, uint VirtualEnd, BBlockArray & MainBlocks); virtual ~FunctionPass(); virtual bool Analyse() override; diff --git a/x64_dbg_dbg/Int3CoagulatorPass.h b/x64_dbg_dbg/Int3CoagulatorPass.h index 3087c970..6eff3176 100644 --- a/x64_dbg_dbg/Int3CoagulatorPass.h +++ b/x64_dbg_dbg/Int3CoagulatorPass.h @@ -1,15 +1,21 @@ #pragma once +#include +#include + #include "AnalysisPass.h" #include "BasicBlock.h" class Int3CoagulatorPass : public AnalysisPass { public: - Int3CoagulatorPass(uint VirtualStart, uint VirtualEnd); + Int3CoagulatorPass(uint VirtualStart, uint VirtualEnd, BBlockArray & MainBlocks); virtual ~Int3CoagulatorPass(); virtual bool Analyse() override; + virtual const char* GetName() override; + private: + void AnalysisWorker(uint Start, uint End, std::vector* Blocks); }; \ No newline at end of file diff --git a/x64_dbg_dbg/LinearPass.h b/x64_dbg_dbg/LinearPass.h index 4250e230..e67e7253 100644 --- a/x64_dbg_dbg/LinearPass.h +++ b/x64_dbg_dbg/LinearPass.h @@ -10,15 +10,15 @@ class LinearPass : public AnalysisPass { public: - LinearPass(uint VirtualStart, uint VirtualEnd); + LinearPass(uint VirtualStart, uint VirtualEnd, BBlockArray & MainBlocks); virtual ~LinearPass(); virtual bool Analyse() override; - virtual std::vector & GetModifiedBlocks() override; + + virtual const char* GetName() override; private: uint m_MaximumThreads; - std::vector m_InitialBlocks; void AnalysisWorker(uint Start, uint End, std::vector* Blocks); BasicBlock* CreateBlockWorker(std::vector* Blocks, uint Start, uint End, bool Call, bool Jmp, bool Ret, bool Intr); diff --git a/x64_dbg_dbg/functionanalysis.cpp b/x64_dbg_dbg/functionanalysis.cpp index a42507ea..bf205be0 100644 --- a/x64_dbg_dbg/functionanalysis.cpp +++ b/x64_dbg_dbg/functionanalysis.cpp @@ -24,23 +24,10 @@ const unsigned char* FunctionAnalysis::TranslateAddress(uint addr) return (addr >= _base && addr < _base + _size) ? _data + (addr - _base) : nullptr; } +void Derp(uint _base); void FunctionAnalysis::Analyse() { - dputs("Starting analysis..."); - DWORD ticks = GetTickCount(); - - uint modBase = ModBaseFromAddr(_base); - uint modSize = ModSizeFromAddr(_base); - - LinearPass* pass = new LinearPass(modBase, modBase + modSize); - pass->Analyse(); - /* - - PopulateReferences(); - dprintf("%u called functions populated\n", _functions.size()); - AnalyseFunctions(); - */ - dprintf("Analysis finished in %ums!\n", GetTickCount() - ticks); + Derp(_base); } void FunctionAnalysis::SetMarkers()