Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

codeglob.h File Reference

#include <list>
#include <stack>
#include "x86dasm.h"
#include "symbols.h"
#include "module.h"
#include "utils/range.hpp"
#include "utils/fixvect.hpp"
#include "utils/f77auto_ptr"
#include "code.h"
#include "codescan.h"
#include "byteinfo.h"
#include "references.h"

Go to the source code of this file.

Compounds

struct  BitStat
class  CodeInfo
class  CodeParser
struct  PointerArrayStat
struct  TempReference

Defines

#define FOR_EACH_SECTION_CODE_BEGIN(module, iter)
#define FOR_EACH_SECTION_CODE_END(module, iter)
#define FOR_EACH_SECTION_BEGIN(module, iter)   FOR_EACH_CONST_BEGIN(ObjectModule::TSections,module->GetSections(),iter)
#define FOR_EACH_SECTION_END(module, iter)   FOR_EACH_CONST_END(ObjectModule::TSections,module->GetSections(),iter)

Typedefs

typedef std::stack< TempReference,
std::list< TempReference > > 
TTempRefs
typedef std::set< vma_t, std::less<
vma_t > > 
TAddresses
typedef std::map< vma_t, vma_t,
std::less< vma_t > > 
TApiAlias
typedef std::map< vma_t, vma_t,
std::less< vma_t > > 
TApiCalls
typedef std::set< vma_t, std::less<
vma_t > > 
TTempComplexReference

Functions

template<class C, class Item> bool IsPresent (const C &c, const Item &item)
void WriteInstruction (const Instruction &instruction, FILE *file=stdout)
int GetInstruction (ObjectModule &module, vma_t address, Instruction &instruction)
bool IsNullAddress (vma_t address)
void ParseCode (CSignFile &file, uint32_t imageBase, vma_t entryPoint, const RVAFileTranslator &rva, const Symbols &symbols, const Symbols &exportedSymbols)


Define Documentation

#define FOR_EACH_SECTION_BEGIN module,
iter       FOR_EACH_CONST_BEGIN(ObjectModule::TSections,module->GetSections(),iter)
 

Definition at line 74 of file codeglob.h.

#define FOR_EACH_SECTION_CODE_BEGIN module,
iter   
 

Value:

FOR_EACH_CONST_BEGIN(ObjectModule::TSections,module->GetSections(),iter) \
  if ((*iter).IsCode()) {

Definition at line 67 of file codeglob.h.

Referenced by CodeParser::Parse(), THeuristicMotor::THeuristicMotor(), and CodeParser::WriteCode().

#define FOR_EACH_SECTION_CODE_END module,
iter   
 

Value:

} \
  FOR_EACH_CONST_END(ObjectModule::TSections,module->GetSections(),iter)

Definition at line 70 of file codeglob.h.

Referenced by CodeParser::Parse(), THeuristicMotor::THeuristicMotor(), and CodeParser::WriteCode().

#define FOR_EACH_SECTION_END module,
iter       FOR_EACH_CONST_END(ObjectModule::TSections,module->GetSections(),iter)
 

Definition at line 76 of file codeglob.h.


Typedef Documentation

typedef std::set< vma_t,std::less<vma_t> > TAddresses
 

Definition at line 54 of file codeglob.h.

Referenced by CodeParser::CheckCodeRecursively().

typedef std::map< vma_t,vma_t,std::less<vma_t> > TApiAlias
 

Definition at line 55 of file codeglob.h.

typedef std::map< vma_t,vma_t,std::less<vma_t> > TApiCalls
 

Definition at line 57 of file codeglob.h.

typedef std::set< vma_t,std::less<vma_t> > TTempComplexReference
 

Definition at line 58 of file codeglob.h.

typedef std::stack< TempReference,std::list<TempReference> > TTempRefs
 

Definition at line 53 of file codeglob.h.

Referenced by CodeParser::Parse().


Function Documentation

int GetInstruction ObjectModule   module,
vma_t    address,
Instruction   instruction
 

Definition at line 634 of file code.cpp.

References InstructionDecoder::Decode(), ObjectModule::GetDataReader(), ObjectModule::GetRelocationInfos(), and vma_t.

Referenced by CodeParser::_ReverseScan(), CodeParser::ExecuteComplexReference(), CodeParser::ExecuteComplexReferenceMemory(), CodeParser::Parse(), ScanningComplexReg::ProcessInstruction(), and THeuristicMotor::THeuristicMotor().

00635 {
00636   // legge l'istruzione
00637   InstructionDecoder decoder(module.GetRelocationInfos());
00638         ObjectModule::DataReader reader = module.GetDataReader(address);
00639   return decoder.Decode(instruction,reader);
00640 }

bool IsNullAddress vma_t    address [inline]
 

Definition at line 80 of file codeglob.h.

References vma_t.

Referenced by CodeParser::ExecuteComplexReferenceMemory(), CodeParser::GetPointerArrayStats(), CodeParser::Parse(), and ScanningComplexReg::ProcessInstruction().

00081 { return address == 0; }

template<class C, class Item>
bool IsPresent const C &    c,
const Item &    item
[inline]
 

Definition at line 42 of file codeglob.h.

Referenced by CodeParser::CheckJumpReference(), and ScanningComplexReg::CheckLoop().

00043 {
00044   return ( c.find(item) != c.end() );
00045 }

void ParseCode CSignFile   file,
uint32_t    imageBase,
vma_t    entryPoint,
const RVAFileTranslator   rva,
const Symbols   symbols,
const Symbols   exportedSymbols
 

Referenced by main().

void WriteInstruction const Instruction   instruction,
FILE *    file = stdout
 

Definition at line 52 of file code.cpp.

References Instruction::Write().

Referenced by CodeParser::AddTempFlow(), CodeParser::ScanCode(), and CodeParser::WriteCode().

00053 {
00054   char buffer[80];
00055   instruction.Write(buffer);
00056   fprintf(file,"%s\n",buffer);
00057 }


Generated on Mon Jan 13 22:20:35 2003 for perdr by doxygen1.2.15