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

Symbols Class Reference

Contain all info for API call (imports and exports). More...

#include <symbols.h>

List of all members.

Public Types

typedef t_symbols::const_iterator iterator

Public Methods

 Symbols ()
std::pair< iterator, iteratoroperator[] (vma_t address) const
 Return names at a given address. More...

void insert (const std::string &name, vma_t address)
 Add an api entry. More...

vma_t GetNextValid (vma_t address) const
 Return next valid address where an api is located. More...

bool IsValid (vma_t address) const
 Are there an api at given address. More...


Private Types

typedef std::set< Symbol,
std::less< Symbol > > 
t_symbols

Private Attributes

t_symbols symbols


Detailed Description

Contain all info for API call (imports and exports).

Definition at line 34 of file symbols.h.


Member Typedef Documentation

typedef t_symbols::const_iterator Symbols::iterator
 

Definition at line 55 of file symbols.h.

Referenced by GetNextValid(), and operator[]().

typedef std::set<Symbol,std::less<Symbol> > Symbols::t_symbols [private]
 

Definition at line 52 of file symbols.h.


Constructor & Destructor Documentation

Symbols::Symbols  
 

Definition at line 38 of file symbols.cpp.

00039 {
00040 }


Member Function Documentation

vma_t Symbols::GetNextValid vma_t    address const
 

Return next valid address where an api is located.

Parameters:
address  address to start searching for api

Definition at line 76 of file symbols.cpp.

References _PRG_ASSERT, iterator, symbols, and vma_t.

Referenced by CodeParser::Parse().

00077 {
00078   iterator i = symbols.lower_bound(Symbol(address+1,""));
00079   if ( i == symbols.end() )
00080     return 0;
00081   _PRG_ASSERT( (*i).address > address );
00082   return (*i).address;
00083 }

void Symbols::insert const std::string &    name,
vma_t    address
 

Add an api entry.

Definition at line 71 of file symbols.cpp.

References symbols, and vma_t.

Referenced by SymbolsAddImport().

00072 {
00073         symbols.insert(Symbol(address,name));
00074 }

bool Symbols::IsValid vma_t    address const
 

Are there an api at given address.

Parameters:
address  address to query

Definition at line 63 of file symbols.cpp.

References vma_t.

Referenced by CodeParser::IsApiReference().

00064 {
00065   pair<iterator,iterator> apis = (*this)[address];
00066   if ( apis.first != apis.second )
00067         return true;
00068   return false;
00069 }

pair< Symbols::iterator, Symbols::iterator > Symbols::operator[] vma_t    address const
 

Return names at a given address.

Parameters:
address  address
Returns:
a pair of iterator (begin, end) with all api infos

Definition at line 43 of file symbols.cpp.

References _DEBUG_, _PRG_ASSERT, iterator, symbols, and vma_t.

00044 {
00045   iterator begin = symbols.lower_bound(Symbol(address,""));
00046   iterator end   = begin;
00047   
00048   // usually do one loop, so do not use strange method
00049   for(; end != symbols.end() ; ++end)
00050     if ( (*end).address != address )
00051       break;
00052   _PRG_ASSERT( begin == symbols.end() || (*begin).address >= address );
00053   _DEBUG_(iterator tmp = begin);
00054   _PRG_ASSERT( tmp == symbols.begin() || (*--tmp).address < address );
00055   _PRG_ASSERT( end == symbols.end() || begin == end || (*end).address > address );
00056   if( end == symbols.end() || begin == end || (*end).address > address ) ;
00057     else { cerr << "Address=" << address << " end Address=" << (*end).address << " end Name=" << (*end).name << endl; _PRG_ASSERT(0); }
00058   _DEBUG_( tmp = end );
00059   _PRG_ASSERT( tmp == symbols.begin() || begin == end || (*--tmp).address == address );
00060   return pair<iterator,iterator>(begin,end);
00061 }


Member Data Documentation

t_symbols Symbols::symbols [private]
 

Definition at line 53 of file symbols.h.

Referenced by GetNextValid(), insert(), and operator[]().


The documentation for this class was generated from the following files:
Generated on Mon Jan 13 22:20:37 2003 for perdr by doxygen1.2.15