1
0
Fork 0

DBG: Analysis typedef changes

This commit is contained in:
Nukem 2015-06-30 00:53:44 -04:00
parent 76a92c3e44
commit 576b58e7c3
8 changed files with 23 additions and 28 deletions

View File

@ -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;
}
};
};
typedef std::vector<BasicBlock> BBlockArray;

View File

@ -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)
{
}

View File

@ -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;

View File

@ -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)
{
}

View File

@ -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;

View File

@ -1,15 +1,21 @@
#pragma once
#include <vector>
#include <thread>
#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<BasicBlock>* Blocks);
};

View File

@ -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<BasicBlock> & GetModifiedBlocks() override;
virtual const char* GetName() override;
private:
uint m_MaximumThreads;
std::vector<BasicBlock> m_InitialBlocks;
void AnalysisWorker(uint Start, uint End, std::vector<BasicBlock>* Blocks);
BasicBlock* CreateBlockWorker(std::vector<BasicBlock>* Blocks, uint Start, uint End, bool Call, bool Jmp, bool Ret, bool Intr);

View File

@ -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()