HPCToolkit
BinUtil::LM Class Reference

#include <LM.hpp>

Inheritance diagram for BinUtil::LM:
Collaboration diagram for BinUtil::LM:

Public Types

enum  Type { TypeNULL = 0, TypeExe, TypeDSO }
 
enum  ReadFlg {
  ReadFlg_NULL = 0, ReadFlg_fSeg = 0x0001, ReadFlg_fProc = 0x0010, ReadFlg_fInsn = 0x0100,
  ReadFlg_ALL = ReadFlg_fSeg | ReadFlg_fProc | ReadFlg_fInsn, ReadFlg_Proc = ReadFlg_fSeg | ReadFlg_fProc, ReadFlg_Seg = ReadFlg_fSeg
}
 
enum  DumpTy {
  DUMP_Short = 0x00000000, DUMP_Mid = 0x00000110, DUMP_Mid_decode = 0x00000130, DUMP_Long = 0x11111111,
  DUMP_Long_decode = 0x11111131, DUMP_Flg_SymTab = 0x00000001, DUMP_Flg_Insn_ty = 0x00000010, DUMP_Flg_Insn_decode = 0x00000020,
  DUMP_Flg_Sym = 0x00000100
}
 
typedef VMAIntervalMap< Seg * > SegMap
 
typedef VMAIntervalMap< Proc * > ProcMap
 
typedef std::map< VMA, Insn * > InsnMap
 

Public Member Functions

 LM (bool useBinutils=false)
 
virtual ~LM ()
 
virtual void open (const char *filenm)
 
virtual void read (const std::set< std::string > &directorySet, ReadFlg readflg)
 
const std::string & name () const
 
Type type () const
 
ReadFlg readFlags ()
 
VMA textBeg () const
 
VMA textEnd () const
 
void textBeg (VMA x)
 
void textEnd (VMA x)
 
VMA firstVMA () const
 
void firstVMA (VMA x)
 
void textBegEndVMA (VMA *begVMA, VMA *endVMA)
 
void relocate (VMA textBegReloc)
 
bool isRelocated () const
 
bool doUnrelocate (VMA loadAddr) const
 
SegMapsegs ()
 
const SegMapsegs () const
 
SegfindSeg (VMA vma) const
 
bool insertSeg (VMAInterval ival, Seg *seg)
 
uint numSegs () const
 
ProcMapprocs ()
 
const ProcMapprocs () const
 
ProcfindProc (VMA vma) const
 
bool insertProc (VMAInterval ival, Proc *proc)
 
MachInsnfindMachInsn (VMA vma, ushort &size) const
 
InsnMapinsns ()
 
const InsnMapinsns () const
 
InsnfindInsn (VMA vma, ushort opIndex) const
 
InsnfindInsnNear (VMA vma, ushort opIndex) const
 
void insertInsn (VMA vma, ushort opIndex, Insn *insn)
 
bool isPseudolLoadModule ()
 
const char * getPseudoLoadModuleName ()
 
bool functionNeverReturns (VMA addr)
 
bool findSrcCodeInfo (VMA vma, ushort opIndex, std::string &func, std::string &file, SrcFile::ln &line)
 
bool findSrcCodeInfo (VMA begVMA, ushort bOpIndex, VMA endVMA, ushort eOpIndex, std::string &func, std::string &file, SrcFile::ln &begLine, SrcFile::ln &endLine, unsigned flags=1)
 
bool findProcSrcCodeInfo (VMA vma, ushort opIndex, SrcFile::ln &line) const
 
bool realpath (std::string &filenm)
 
bfd * abfd () const
 
asymbol ** bfdSymTab () const
 
uint bfdSymTabSz () const
 
std::string toString (int flags=DUMP_Short, const char *pre="") const
 
virtual void dump (std::ostream &o=std::cerr, int flags=DUMP_Short, const char *pre="") const
 
void ddump (int code=DUMP_Long_decode) const
 
virtual void dumpme (std::ostream &o=std::cerr, const char *pre="") const
 
virtual void dumpProcMap (std::ostream &o=std::cerr, unsigned flag=0, const char *pre="") const
 
void ddumpProcMap (unsigned flag) const
 

Static Public Attributes

static ISAisa = NULL
 

Protected Member Functions

 LM (const LM &GCC_ATTR_UNUSED lm)
 
LMoperator= (const LM &GCC_ATTR_UNUSED lm)
 

Private Member Functions

void readSymbolTables ()
 
void readSegs ()
 
void computeNoReturns ()
 
VMA unrelocate (VMA relocVMA) const
 
void dumpModuleInfo (std::ostream &o=std::cerr, const char *pre="") const
 
void dumpSymTab (std::ostream &o=std::cerr, const char *pre="") const
 
BinUtil::Dbg::LMgetDebugInfo ()
 

Static Private Member Functions

static int cmpBFDSymByVMA (const void *s1, const void *s2)
 

Private Attributes

std::string m_name
 
Type m_type
 
ReadFlg m_readFlags
 
VMA m_txtBeg
 
VMA m_txtEnd
 
VMA m_begVMA
 
VMA m_textBegReloc
 
VMASigned m_unrelocDelta
 
SegMap m_segMap
 
ProcMap m_procMap
 
InsnMap m_insnMap
 
BinUtil::Dbg::LM m_dbgInfo
 
bfd * m_bfd
 
asymbol ** m_bfdSymTab
 
asymbol ** m_bfdDynSymTab
 
asymbol * m_bfdSynthTab
 
asymbol ** m_bfdSymTabSort
 
long m_bfdSymTabSz
 
long m_bfdDynSymTabSz
 
long m_bfdSymTabSortSz
 
long m_bfdSynthTabSz
 
NoReturnsm_noreturns
 
RealPathMgrm_realpathMgr
 
bool m_useBinutils
 
SimpleSymbolsm_simpleSymbols
 

Friends

class ProcInsnIterator
 
class TextSeg
 

Detailed Description

Definition at line 116 of file LM.hpp.

Member Typedef Documentation

◆ InsnMap

typedef std::map<VMA, Insn*> BinUtil::LM::InsnMap

Definition at line 139 of file LM.hpp.

◆ ProcMap

Definition at line 138 of file LM.hpp.

◆ SegMap

Definition at line 137 of file LM.hpp.

Member Enumeration Documentation

◆ DumpTy

Enumerator
DUMP_Short 
DUMP_Mid 
DUMP_Mid_decode 
DUMP_Long 
DUMP_Long_decode 
DUMP_Flg_SymTab 
DUMP_Flg_Insn_ty 
DUMP_Flg_Insn_decode 
DUMP_Flg_Sym 

Definition at line 447 of file LM.hpp.

◆ ReadFlg

Enumerator
ReadFlg_NULL 
ReadFlg_fSeg 
ReadFlg_fProc 
ReadFlg_fInsn 
ReadFlg_ALL 
ReadFlg_Proc 
ReadFlg_Seg 

Definition at line 123 of file LM.hpp.

◆ Type

Enumerator
TypeNULL 
TypeExe 
TypeDSO 

Definition at line 118 of file LM.hpp.

Constructor & Destructor Documentation

◆ LM() [1/2]

BinUtil::LM::LM ( bool  useBinutils = false)

Definition at line 340 of file LM.cpp.

◆ ~LM()

BinUtil::LM::~LM ( )
virtual

Definition at line 354 of file LM.cpp.

Here is the call graph for this function:

◆ LM() [2/2]

BinUtil::LM::LM ( const LM &GCC_ATTR_UNUSED  lm)
inlineprotected

Definition at line 499 of file LM.hpp.

Member Function Documentation

◆ abfd()

bfd* BinUtil::LM::abfd ( ) const
inline

Definition at line 432 of file LM.hpp.

Here is the caller graph for this function:

◆ bfdSymTab()

asymbol** BinUtil::LM::bfdSymTab ( ) const
inline

Definition at line 436 of file LM.hpp.

◆ bfdSymTabSz()

uint BinUtil::LM::bfdSymTabSz ( ) const
inline

Definition at line 440 of file LM.hpp.

◆ cmpBFDSymByVMA()

int BinUtil::LM::cmpBFDSymByVMA ( const void *  s1,
const void *  s2 
)
staticprivate

Definition at line 789 of file LM.cpp.

Here is the caller graph for this function:

◆ computeNoReturns()

void BinUtil::LM::computeNoReturns ( )
private

Definition at line 916 of file LM.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ ddump()

void BinUtil::LM::ddump ( int  code = DUMP_Long_decode) const

Definition at line 751 of file LM.cpp.

Here is the call graph for this function:

◆ ddumpProcMap()

void BinUtil::LM::ddumpProcMap ( unsigned  flag) const

Definition at line 781 of file LM.cpp.

Here is the call graph for this function:

◆ doUnrelocate()

bool BinUtil::LM::doUnrelocate ( VMA  loadAddr) const
inline

Definition at line 227 of file LM.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dump()

void BinUtil::LM::dump ( std::ostream &  o = std::cerr,
int  flags = DUMP_Short,
const char *  pre = "" 
) const
virtual

Reimplemented in BinUtil::Exe.

Definition at line 715 of file LM.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dumpme()

virtual void BinUtil::LM::dumpme ( std::ostream &  o = std::cerr,
const char *  pre = "" 
) const
virtual

Reimplemented in BinUtil::Exe.

Here is the caller graph for this function:

◆ dumpModuleInfo()

void BinUtil::LM::dumpModuleInfo ( std::ostream &  o = std::cerr,
const char *  pre = "" 
) const
private

Definition at line 936 of file LM.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ dumpProcMap()

void BinUtil::LM::dumpProcMap ( std::ostream &  o = std::cerr,
unsigned  flag = 0,
const char *  pre = "" 
) const
virtual

Definition at line 766 of file LM.cpp.

Here is the caller graph for this function:

◆ dumpSymTab()

void BinUtil::LM::dumpSymTab ( std::ostream &  o = std::cerr,
const char *  pre = "" 
) const
private

Definition at line 1082 of file LM.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findInsn()

Insn* BinUtil::LM::findInsn ( VMA  vma,
ushort  opIndex 
) const
inline

Definition at line 335 of file LM.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findInsnNear()

Insn* BinUtil::LM::findInsnNear ( VMA  vma,
ushort  opIndex 
) const
inline

Definition at line 347 of file LM.hpp.

Here is the call graph for this function:

◆ findMachInsn()

MachInsn * BinUtil::LM::findMachInsn ( VMA  vma,
ushort size 
) const

Definition at line 503 of file LM.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findProc()

Proc* BinUtil::LM::findProc ( VMA  vma) const
inline

Definition at line 281 of file LM.hpp.

Here is the call graph for this function:

◆ findProcSrcCodeInfo()

bool BinUtil::LM::findProcSrcCodeInfo ( VMA  vma,
ushort  opIndex,
SrcFile::ln line 
) const

Definition at line 651 of file LM.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findSeg()

Seg* BinUtil::LM::findSeg ( VMA  vma) const
inline

Definition at line 244 of file LM.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ findSrcCodeInfo() [1/2]

bool BinUtil::LM::findSrcCodeInfo ( VMA  vma,
ushort  opIndex,
std::string &  func,
std::string &  file,
SrcFile::ln line 
)
Here is the caller graph for this function:

◆ findSrcCodeInfo() [2/2]

bool BinUtil::LM::findSrcCodeInfo ( VMA  begVMA,
ushort  bOpIndex,
VMA  endVMA,
ushort  eOpIndex,
std::string &  func,
std::string &  file,
SrcFile::ln begLine,
SrcFile::ln endLine,
unsigned  flags = 1 
)

◆ firstVMA() [1/2]

VMA BinUtil::LM::firstVMA ( ) const
inline

Definition at line 202 of file LM.hpp.

◆ firstVMA() [2/2]

void BinUtil::LM::firstVMA ( VMA  x)
inline

Definition at line 206 of file LM.hpp.

Here is the call graph for this function:

◆ functionNeverReturns()

bool BinUtil::LM::functionNeverReturns ( VMA  addr)

Definition at line 929 of file LM.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getDebugInfo()

BinUtil::Dbg::LM* BinUtil::LM::getDebugInfo ( )
inlineprivate

Definition at line 537 of file LM.hpp.

◆ getPseudoLoadModuleName()

const char* BinUtil::LM::getPseudoLoadModuleName ( )
Here is the caller graph for this function:

◆ insertInsn()

void BinUtil::LM::insertInsn ( VMA  vma,
ushort  opIndex,
Insn insn 
)
inline

Definition at line 359 of file LM.hpp.

Here is the call graph for this function:

◆ insertProc()

bool BinUtil::LM::insertProc ( VMAInterval  ival,
Proc proc 
)
inline

Definition at line 291 of file LM.hpp.

Here is the call graph for this function:

◆ insertSeg()

bool BinUtil::LM::insertSeg ( VMAInterval  ival,
Seg seg 
)
inline

Definition at line 255 of file LM.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ insns() [1/2]

InsnMap& BinUtil::LM::insns ( )
inline

Definition at line 327 of file LM.hpp.

◆ insns() [2/2]

const InsnMap& BinUtil::LM::insns ( ) const
inline

Definition at line 331 of file LM.hpp.

◆ isPseudolLoadModule()

bool BinUtil::LM::isPseudolLoadModule ( )
Here is the caller graph for this function:

◆ isRelocated()

bool BinUtil::LM::isRelocated ( ) const
inline

Definition at line 222 of file LM.hpp.

◆ name()

const std::string& BinUtil::LM::name ( ) const
inline

Definition at line 170 of file LM.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ numSegs()

uint BinUtil::LM::numSegs ( ) const
inline

Definition at line 264 of file LM.hpp.

Here is the caller graph for this function:

◆ open()

void BinUtil::LM::open ( const char *  filenm)
virtual

Reimplemented in BinUtil::Exe.

Definition at line 395 of file LM.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ operator=()

LM& BinUtil::LM::operator= ( const LM &GCC_ATTR_UNUSED  lm)
inlineprotected

Definition at line 504 of file LM.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ procs() [1/2]

ProcMap& BinUtil::LM::procs ( )
inline

Definition at line 273 of file LM.hpp.

Here is the caller graph for this function:

◆ procs() [2/2]

const ProcMap& BinUtil::LM::procs ( ) const
inline

Definition at line 277 of file LM.hpp.

◆ read()

void BinUtil::LM::read ( const std::set< std::string > &  directorySet,
LM::ReadFlg  readflg 
)
virtual

Definition at line 460 of file LM.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readFlags()

ReadFlg BinUtil::LM::readFlags ( )
inline

Definition at line 179 of file LM.hpp.

◆ readSegs()

void BinUtil::LM::readSegs ( )
private

Definition at line 880 of file LM.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ readSymbolTables()

void BinUtil::LM::readSymbolTables ( )
private

Definition at line 808 of file LM.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ realpath()

bool BinUtil::LM::realpath ( std::string &  filenm)
inline

Definition at line 422 of file LM.hpp.

Here is the call graph for this function:

◆ relocate()

void BinUtil::LM::relocate ( VMA  textBegReloc)

Definition at line 487 of file LM.cpp.

Here is the caller graph for this function:

◆ segs() [1/2]

SegMap& BinUtil::LM::segs ( )
inline

Definition at line 236 of file LM.hpp.

Here is the caller graph for this function:

◆ segs() [2/2]

const SegMap& BinUtil::LM::segs ( ) const
inline

Definition at line 240 of file LM.hpp.

◆ textBeg() [1/2]

VMA BinUtil::LM::textBeg ( ) const
inline

Definition at line 185 of file LM.hpp.

Here is the caller graph for this function:

◆ textBeg() [2/2]

void BinUtil::LM::textBeg ( VMA  x)
inline

Definition at line 194 of file LM.hpp.

◆ textBegEndVMA()

void BinUtil::LM::textBegEndVMA ( VMA begVMA,
VMA endVMA 
)

Definition at line 676 of file LM.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textEnd() [1/2]

VMA BinUtil::LM::textEnd ( ) const
inline

Definition at line 189 of file LM.hpp.

Here is the caller graph for this function:

◆ textEnd() [2/2]

void BinUtil::LM::textEnd ( VMA  x)
inline

Definition at line 198 of file LM.hpp.

◆ toString()

string BinUtil::LM::toString ( int  flags = DUMP_Short,
const char *  pre = "" 
) const

Definition at line 706 of file LM.cpp.

Here is the call graph for this function:

◆ type()

Type BinUtil::LM::type ( ) const
inline

Definition at line 175 of file LM.hpp.

Here is the caller graph for this function:

◆ unrelocate()

VMA BinUtil::LM::unrelocate ( VMA  relocVMA) const
inlineprivate

Definition at line 520 of file LM.hpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Friends And Related Function Documentation

◆ ProcInsnIterator

friend class ProcInsnIterator
friend

Definition at line 495 of file LM.hpp.

◆ TextSeg

friend class TextSeg
friend

Definition at line 534 of file LM.hpp.

Member Data Documentation

◆ isa

ISA * BinUtil::LM::isa = NULL
static

Definition at line 493 of file LM.hpp.

◆ m_begVMA

VMA BinUtil::LM::m_begVMA
private

Definition at line 547 of file LM.hpp.

◆ m_bfd

bfd* BinUtil::LM::m_bfd
private

Definition at line 570 of file LM.hpp.

◆ m_bfdDynSymTab

asymbol** BinUtil::LM::m_bfdDynSymTab
private

Definition at line 572 of file LM.hpp.

◆ m_bfdDynSymTabSz

long BinUtil::LM::m_bfdDynSymTabSz
private

Definition at line 576 of file LM.hpp.

◆ m_bfdSymTab

asymbol** BinUtil::LM::m_bfdSymTab
private

Definition at line 571 of file LM.hpp.

◆ m_bfdSymTabSort

asymbol** BinUtil::LM::m_bfdSymTabSort
private

Definition at line 574 of file LM.hpp.

◆ m_bfdSymTabSortSz

long BinUtil::LM::m_bfdSymTabSortSz
private

Definition at line 577 of file LM.hpp.

◆ m_bfdSymTabSz

long BinUtil::LM::m_bfdSymTabSz
private

Definition at line 575 of file LM.hpp.

◆ m_bfdSynthTab

asymbol* BinUtil::LM::m_bfdSynthTab
private

Definition at line 573 of file LM.hpp.

◆ m_bfdSynthTabSz

long BinUtil::LM::m_bfdSynthTabSz
private

Definition at line 578 of file LM.hpp.

◆ m_dbgInfo

BinUtil::Dbg::LM BinUtil::LM::m_dbgInfo
private

Definition at line 563 of file LM.hpp.

◆ m_insnMap

InsnMap BinUtil::LM::m_insnMap
private

Definition at line 560 of file LM.hpp.

◆ m_name

std::string BinUtil::LM::m_name
private

Definition at line 541 of file LM.hpp.

◆ m_noreturns

NoReturns* BinUtil::LM::m_noreturns
private

Definition at line 580 of file LM.hpp.

◆ m_procMap

ProcMap BinUtil::LM::m_procMap
private

Definition at line 559 of file LM.hpp.

◆ m_readFlags

ReadFlg BinUtil::LM::m_readFlags
private

Definition at line 544 of file LM.hpp.

◆ m_realpathMgr

RealPathMgr& BinUtil::LM::m_realpathMgr
private

Definition at line 582 of file LM.hpp.

◆ m_segMap

SegMap BinUtil::LM::m_segMap
private

Definition at line 558 of file LM.hpp.

◆ m_simpleSymbols

SimpleSymbols* BinUtil::LM::m_simpleSymbols
private

Definition at line 585 of file LM.hpp.

◆ m_textBegReloc

VMA BinUtil::LM::m_textBegReloc
private

Definition at line 549 of file LM.hpp.

◆ m_txtBeg

VMA BinUtil::LM::m_txtBeg
private

Definition at line 546 of file LM.hpp.

◆ m_txtEnd

VMA BinUtil::LM::m_txtEnd
private

Definition at line 546 of file LM.hpp.

◆ m_type

Type BinUtil::LM::m_type
private

Definition at line 543 of file LM.hpp.

◆ m_unrelocDelta

VMASigned BinUtil::LM::m_unrelocDelta
private

Definition at line 550 of file LM.hpp.

◆ m_useBinutils

bool BinUtil::LM::m_useBinutils
private

Definition at line 584 of file LM.hpp.


The documentation for this class was generated from the following files: