FrontEnd Class Reference

#include <include/frontend.h>

Inheritance diagram for FrontEnd:

PentiumFrontEnd PPCFrontEnd SparcFrontEnd ST20FrontEnd List of all members.

Detailed Description

Definition at line 108 of file frontend.h.

Public Member Functions

void addDecodedRtl (ADDRESS a, RTL *rtl)
void addRefHint (ADDRESS addr, const char *nam)
void AddSymbol (ADDRESS addr, const char *nam)
void appendSyntheticReturn (PBB pCallBB, UserProc *pProc, RTL *pRtl)
PBB createReturnBlock (UserProc *pProc, std::list< RTL * > *BB_rtls, RTL *pRtl)
void decode (Prog *prog, ADDRESS a)
void decode (Prog *prog, bool decodeMain=true, const char *pname=NULL)
void decodeFragment (UserProc *proc, ADDRESS a)
virtual DecodeResultdecodeInstruction (ADDRESS pc)
void decodeOnly (Prog *prog, ADDRESS a)
virtual void extraProcessCall (CallStatement *call, std::list< RTL * > *BB_rtls)
 FrontEnd (BinaryFile *pBF, Prog *prog, BinaryFileFactory *pbff)
BinaryFilegetBinaryFile ()
NJMCDecodergetDecoder ()
virtual std::vector< Exp * > & getDefaultParams ()=0
virtual std::vector< Exp * > & getDefaultReturns ()=0
SignaturegetDefaultSignature (const char *name)
std::vector< ADDRESSgetEntryPoints ()
virtual platform getFrontEndId ()=0
virtual int getInst (int addr)
SignaturegetLibSignature (const char *name)
virtual ADDRESS getMainEntryPoint (bool &gotMain)=0
ProggetProg ()
const char * getRegName (int idx)
int getRegSize (int idx)
virtual bool helperFunc (ADDRESS dest, ADDRESS addr, std::list< RTL * > *lrtl)
bool isWin32 ()
virtual bool processProc (ADDRESS uAddr, UserProc *pProc, std::ofstream &os, bool frag=false, bool spec=false)
void readLibraryCatalog ()
void readLibraryCatalog (const char *sPath)
void readLibrarySignatures (const char *sPath, callconv cc)
virtual ~FrontEnd ()
 Destructor.

Static Public Member Functions

static void closeInstance (void *dlHandle)
static FrontEndcreateById (std::string &str, BinaryFile *pBFi, Prog *prog)
static FrontEndgetInstanceFor (const char *sName, void *&dlHandle, BinaryFile *pBF, NJMCDecoder *&decoder)
static FrontEndinstantiate (BinaryFile *pBF, Prog *prog, BinaryFileFactory *pbff)
static FrontEndLoad (const char *fname, Prog *prog)
static bool noReturnCallDest (const char *name)

Protected Attributes

NJMCDecoderdecoder
std::map< std::string, Signature * > librarySignatures
BinaryFilepBF
BinaryFileFactorypbff
std::map< ADDRESS, RTL * > previouslyDecoded
Progprog
std::map< ADDRESS, std::string > refHints
TargetQueue targetQueue


Constructor & Destructor Documentation

FrontEnd::FrontEnd BinaryFile pBF,
Prog prog,
BinaryFileFactory pbff
 

Definition at line 68 of file frontend.cpp.

FrontEnd::~FrontEnd  )  [virtual]
 

Destructor.

Virtual to mute a warning

Definition at line 42 of file testStmtStubs.cpp.


Member Function Documentation

void FrontEnd::addDecodedRtl ADDRESS  a,
RTL rtl
[inline]
 

Definition at line 272 of file frontend.h.

References previouslyDecoded.

Referenced by Prog::addDecodedRtl().

void FrontEnd::addRefHint ADDRESS  addr,
const char *  nam
[inline]
 

Definition at line 138 of file frontend.h.

References refHints.

void FrontEnd::AddSymbol ADDRESS  addr,
const char *  nam
[inline]
 

Definition at line 135 of file frontend.h.

References BinaryFile::AddSymbol(), and pBF.

Referenced by Decompiler::addEntryPoint(), and Boomerang::loadAndDecode().

void FrontEnd::appendSyntheticReturn PBB  pCallBB,
UserProc pProc,
RTL pRtl
 

Definition at line 1182 of file frontend.cpp.

References BasicBlock::addInEdge(), createReturnBlock(), RTL::getAddress(), and BasicBlock::setOutEdge().

static void FrontEnd::closeInstance void *  dlHandle  )  [static]
 

FrontEnd * FrontEnd::createById std::string &  str,
BinaryFile pBFi,
Prog prog
[static]
 

Definition at line 126 of file frontend.cpp.

References NULL, pBF, and prog.

PBB FrontEnd::createReturnBlock UserProc pProc,
std::list< RTL * > *  BB_rtls,
RTL pRtl
 

Definition at line 1136 of file frontend.cpp.

References Cfg::addOutEdge(), RTL::appendStmt(), RTL::clear(), RTL::deleteLastStmt(), Cfg::findRetNode(), RTL::getAddress(), UserProc::getCFG(), BasicBlock::getFirstStmt(), RTL::getList(), UserProc::getTheReturnAddr(), Statement::isReturn(), LOG, Cfg::newBB(), NO_ADDRESS, NULL, ONEWAY, RET, UserProc::setTheReturnAddr(), targetQueue, VERBOSE, and TargetQueue::visit().

Referenced by appendSyntheticReturn(), SparcFrontEnd::case_DD(), and SparcFrontEnd::optimise_CallReturn().

void FrontEnd::decode Prog prog,
ADDRESS  a
 

Definition at line 39 of file testExpStubs.cpp.

void FrontEnd::decode Prog prog,
bool  decodeMain = true,
const char *  pname = NULL
 

Definition at line 244 of file frontend.cpp.

References Boomerang::alert_start_decode(), Signature::clone(), Prog::findProc(), Boomerang::get(), getEntryPoints(), BinaryFile::getLimitTextHigh(), BinaryFile::getLimitTextLow(), getMainEntryPoint(), Type::getNamedType(), FuncType::getSignature(), LOG, NO_ADDRESS, NULL, pBF, prog, Prog::setEntryPoint(), Prog::setName(), BinaryFile::SymbolByAddress(), and VERBOSE.

Referenced by Decompiler::decode(), Prog::decodeEntryPoint(), Prog::decodeEverythingUndecoded(), StatementTest::testBypass(), FrontSparcTest::testDelaySlot(), CfgTest::testDominators(), CfgTest::testPlacePhi(), CfgTest::testPlacePhi2(), CfgTest::testRenameVars(), and CfgTest::testSemiDominators().

void FrontEnd::decodeFragment UserProc proc,
ADDRESS  a
 

Definition at line 356 of file frontend.cpp.

References Boomerang::get(), LOG, and processProc().

Referenced by Prog::decodeFragment().

DecodeResult & FrontEnd::decodeInstruction ADDRESS  pc  )  [virtual]
 

Reimplemented in PentiumFrontEnd.

Definition at line 363 of file frontend.cpp.

References BinaryFile::GetSectionInfoByAddr(), LOG, NULL, pBF, DecodeResult::reset(), and DecodeResult::valid.

Referenced by SparcFrontEnd::processProc(), processProc(), FrontSparcTest::test1(), FrontPentTest::test1(), FrontSparcTest::test2(), FrontPentTest::test2(), FrontSparcTest::test3(), FrontPentTest::test3(), FrontSparcTest::testBranch(), FrontPentTest::testBranch(), and RtlTest::testIsCompare().

void FrontEnd::decodeOnly Prog prog,
ADDRESS  a
 

Definition at line 346 of file frontend.cpp.

References Proc::getNativeAddress(), Proc::isLib(), processProc(), prog, UserProc::setDecoded(), Prog::setNewProc(), and Prog::wellForm().

virtual void FrontEnd::extraProcessCall CallStatement call,
std::list< RTL * > *  BB_rtls
[inline, virtual]
 

Reimplemented in PentiumFrontEnd.

Definition at line 168 of file frontend.h.

BinaryFile* FrontEnd::getBinaryFile  )  [inline]
 

Definition at line 159 of file frontend.h.

References pBF.

Referenced by Prog::setFrontEnd().

NJMCDecoder* FrontEnd::getDecoder  )  [inline]
 

Definition at line 173 of file frontend.h.

References decoder.

virtual std::vector<Exp*>& FrontEnd::getDefaultParams  )  [pure virtual]
 

Implemented in PentiumFrontEnd, PPCFrontEnd, SparcFrontEnd, and ST20FrontEnd.

Referenced by Prog::getDefaultParams().

virtual std::vector<Exp*>& FrontEnd::getDefaultReturns  )  [pure virtual]
 

Implemented in PentiumFrontEnd, PPCFrontEnd, SparcFrontEnd, and ST20FrontEnd.

Referenced by Prog::getDefaultReturns().

Signature * FrontEnd::getDefaultSignature const char *  name  ) 
 

Definition at line 408 of file frontend.cpp.

References CONV_C, CONV_PASCAL, getFrontEndId(), Signature::instantiate(), isWin32(), NULL, and PLAT_PENTIUM.

Referenced by Prog::getDefaultSignature(), and getLibSignature().

std::vector< ADDRESS > FrontEnd::getEntryPoints  ) 
 

Definition at line 176 of file frontend.cpp.

References Type::asFunc(), Signature::clone(), BinaryFile::GetAddressByName(), BinaryFile::getFilename(), getMainEntryPoint(), Type::getNamedType(), FuncType::getSignature(), Type::isFunc(), NO_ADDRESS, pBF, prog, BinaryFile::readNative4(), Signature::setForced(), Signature::setName(), Prog::setNewProc(), and BinaryFile::SymbolByAddress().

Referenced by decode().

virtual platform FrontEnd::getFrontEndId  )  [pure virtual]
 

Implemented in PentiumFrontEnd, PPCFrontEnd, SparcFrontEnd, and ST20FrontEnd.

Referenced by getDefaultSignature(), Prog::getFrontEndId(), and readLibraryCatalog().

int FrontEnd::getInst int  addr  )  [virtual]
 

Definition at line 43 of file testStmtStubs.cpp.

static FrontEnd* FrontEnd::getInstanceFor const char *  sName,
void *&  dlHandle,
BinaryFile pBF,
NJMCDecoder *&  decoder
[static]
 

Signature * FrontEnd::getLibSignature const char *  name  ) 
 

Definition at line 421 of file frontend.cpp.

References getDefaultSignature(), librarySignatures, and LOG.

Referenced by Prog::getLibSignature(), and TypeTest::testCompound().

virtual ADDRESS FrontEnd::getMainEntryPoint bool &  gotMain  )  [pure virtual]
 

Implemented in PentiumFrontEnd, PPCFrontEnd, SparcFrontEnd, and ST20FrontEnd.

Referenced by decode(), Decompiler::decode(), getEntryPoints(), FrontSparcTest::test1(), FrontPentTest::test1(), StatementTest::testBypass(), FrontSparcTest::testDelaySlot(), CfgTest::testDominators(), FrontPentTest::testFindMain(), and CfgTest::testSemiDominators().

Prog * FrontEnd::getProg  ) 
 

Definition at line 1123 of file frontend.cpp.

References prog.

const char * FrontEnd::getRegName int  idx  ) 
 

Definition at line 102 of file frontend.cpp.

References decoder, NJMCDecoder::getRTLDict(), NULL, and RTLInstDict::RegMap.

Referenced by Prog::getRegName().

int FrontEnd::getRegSize int  idx  ) 
 

Definition at line 110 of file frontend.cpp.

References decoder, RTLInstDict::DetRegMap, and NJMCDecoder::getRTLDict().

Referenced by Prog::getRegSize().

virtual bool FrontEnd::helperFunc ADDRESS  dest,
ADDRESS  addr,
std::list< RTL * > *  lrtl
[inline, virtual]
 

Reimplemented in PentiumFrontEnd, and SparcFrontEnd.

Definition at line 220 of file frontend.h.

FrontEnd * FrontEnd::instantiate BinaryFile pBF,
Prog prog,
BinaryFileFactory pbff
[static]
 

Definition at line 72 of file frontend.cpp.

References BinaryFile::GetMachine(), MACHINE_PENTIUM, MACHINE_PPC, MACHINE_SPARC, MACHINE_ST20, pBF, pbff, and prog.

Referenced by Load().

bool FrontEnd::isWin32  ) 
 

Definition at line 116 of file frontend.cpp.

References BinaryFile::GetFormat(), LOADFMT_PE, and pBF.

Referenced by getDefaultSignature(), Prog::isWin32(), and readLibraryCatalog().

FrontEnd * FrontEnd::Load const char *  fname,
Prog prog
[static]
 

Definition at line 88 of file frontend.cpp.

References instantiate(), BinaryFileFactory::Load(), NULL, pBF, pbff, and prog.

Referenced by Decompiler::load(), and Boomerang::loadAndDecode().

bool FrontEnd::noReturnCallDest const char *  name  )  [static]
 

Definition at line 120 of file frontend.cpp.

Referenced by LibProc::isNoReturn(), and ReturnStatement::updateModifieds().

bool FrontEnd::processProc ADDRESS  uAddr,
UserProc pProc,
std::ofstream &  os,
bool  frag = false,
bool  spec = false
[virtual]
 

Reimplemented in PentiumFrontEnd, PPCFrontEnd, SparcFrontEnd, and ST20FrontEnd.

Definition at line 450 of file frontend.cpp.

References Boomerang::alert_baddecode(), Boomerang::alert_decode(), Boomerang::alert_new(), decodeInstruction(), Prog::findProc(), Boomerang::get(), UserProc::getCFG(), GotoStatement::getFixedDest(), Prog::getGlobalAddr(), Location::global(), TargetQueue::initial(), INVALID, BinaryFile::IsDynamicLinkedProc(), LOG, Cfg::newBB(), TargetQueue::nextAddress(), NO_ADDRESS, NULL, ONEWAY, opAddrOf, pBF, previouslyDecoded, prog, BinaryFile::readNative1(), refHints, GotoStatement::setDest(), CallStatement::setDestProc(), Prog::setNewProc(), CallStatement::setReturnAfterCall(), STMT_GOTO, targetQueue, Boomerang::traceDecoder, VERBOSE, and TargetQueue::visit().

Referenced by decodeFragment(), decodeOnly(), ST20FrontEnd::processProc(), Prog::processProc(), PPCFrontEnd::processProc(), PentiumFrontEnd::processProc(), Prog::reDecode(), and FrontSparcTest::testDelaySlot().

void FrontEnd::readLibraryCatalog  ) 
 

Definition at line 163 of file frontend.cpp.

References Boomerang::get(), getFrontEndId(), Boomerang::getProgPath(), isWin32(), librarySignatures, and Signature::platformName().

void FrontEnd::readLibraryCatalog const char *  sPath  ) 
 

Definition at line 138 of file frontend.cpp.

Referenced by Decompiler::load(), Prog::rereadLibSignatures(), TypeTest::testCompound(), and ProcTest::testName().

void FrontEnd::readLibrarySignatures const char *  sPath,
callconv  cc
 

Definition at line 381 of file frontend.cpp.


Member Data Documentation

NJMCDecoder* FrontEnd::decoder [protected]
 

Definition at line 112 of file frontend.h.

Referenced by PentiumFrontEnd::decodeInstruction(), getDecoder(), getRegName(), getRegSize(), PentiumFrontEnd::PentiumFrontEnd(), PPCFrontEnd::PPCFrontEnd(), and ST20FrontEnd::ST20FrontEnd().

std::map<std::string, Signature*> FrontEnd::librarySignatures [protected]
 

Definition at line 119 of file frontend.h.

Referenced by getLibSignature(), and readLibraryCatalog().

BinaryFile* FrontEnd::pBF [protected]
 

Definition at line 113 of file frontend.h.

Referenced by AddSymbol(), createById(), decode(), PentiumFrontEnd::decodeInstruction(), decodeInstruction(), getBinaryFile(), getEntryPoints(), ST20FrontEnd::getMainEntryPoint(), SparcFrontEnd::getMainEntryPoint(), PPCFrontEnd::getMainEntryPoint(), SparcFrontEnd::helperFunc(), PentiumFrontEnd::helperFunc(), instantiate(), isWin32(), Load(), SparcFrontEnd::processProc(), and processProc().

BinaryFileFactory* FrontEnd::pbff [protected]
 

Definition at line 114 of file frontend.h.

Referenced by instantiate(), and Load().

std::map<ADDRESS, RTL*> FrontEnd::previouslyDecoded [protected]
 

Definition at line 123 of file frontend.h.

Referenced by addDecodedRtl(), SparcFrontEnd::processProc(), and processProc().

Prog* FrontEnd::prog [protected]
 

Definition at line 115 of file frontend.h.

Referenced by createById(), decode(), PentiumFrontEnd::decodeInstruction(), decodeOnly(), getEntryPoints(), getProg(), PentiumFrontEnd::helperFunc(), instantiate(), Load(), PentiumFrontEnd::PentiumFrontEnd(), PPCFrontEnd::PPCFrontEnd(), processProc(), and SparcFrontEnd::SparcFrontEnd().

std::map<ADDRESS, std::string> FrontEnd::refHints [protected]
 

Definition at line 121 of file frontend.h.

Referenced by addRefHint(), and processProc().

TargetQueue FrontEnd::targetQueue [protected]
 

Definition at line 117 of file frontend.h.

Referenced by createReturnBlock(), SparcFrontEnd::processProc(), and processProc().


The documentation for this class was generated from the following files:
Generated on Tue Sep 19 21:18:42 2006 for Boomerang by  doxygen 1.4.6