Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

MachoAnalyser Class Reference

#include <macho_analy.h>

Inheritance diagram for MachoAnalyser:

Analyser Object List of all members.

Public Member Functions

void init (ht_macho_shared_data *macho_shared, ht_streamfile *File)
int load (ht_object_stream *f)
virtual void done ()
virtual OBJECT_ID object_id () const
virtual void beginAnalysis ()
virtual UINT bufPtr (Address *Addr, byte *buf, int size)
bool convertAddressToMACHOAddress (Address *addr, MACHOAddress *r)
virtual AddresscreateAddress ()
AddresscreateAddress32 (dword addr)
AddresscreateAddress64 (qword addr)
virtual AssemblercreateAssembler ()
virtual const char * getName ()
virtual const char * getType ()
virtual void initCodeAnalyser ()
void initInsertSymbols (int shidx)
virtual void initUnasm ()
virtual void log (const char *msg)
virtual AddressnextValid (Address *Addr)
virtual void store (ht_object_stream *f)
virtual int queryConfig (int mode)
virtual bool validAddress (Address *Addr, tsectype action)
virtual AddressfileofsToAddress (FILEOFS fileofs)
virtual FILEOFS addressToFileofs (Address *Addr)
virtual char * getSegmentNameByAddress (Address *Addr)

Public Attributes

ht_macho_shared_datamacho_shared
ht_streamfilefile
Areavalidarea

Member Function Documentation

FILEOFS MachoAnalyser::addressToFileofs Address Addr  )  [virtual]
 

Implements Analyser.

Definition at line 300 of file macho_analy.cc.

References convertAddressToMACHOAddress(), FILEOFS, INVALID_FILE_OFS, macho_addr_to_ofs(), macho_shared, MACHOAddress, scinitialized, ht_macho_shared_data::sections, uint32, and validAddress().

Referenced by bufPtr().

void MachoAnalyser::beginAnalysis  )  [virtual]
 

Reimplemented from Analyser.

Definition at line 61 of file macho_analy.cc.

References Area::add(), Address::add(), Analyser::addComment(), AF_FUNCTION_END, assert, Analyser::assignSymbol(), Analyser::beginAnalysis(), macho_commands::cmds, ht_macho_shared_data::cmds, macho_commands::count, MACHO_HEADER::cputype, create_host_struct(), createAddress32(), Object::duplicate(), MACHO_I386_THREAD_STATE::eip, fgetstrz(), file, MACHO_SEGMENT_COMMAND::fileoff, MACHO_SEGMENT_COMMAND::filesize, Location::flags, getSegmentNameByAddress(), ht_macho_shared_data::header, ht_snprintf(), ht_macho_shared_data::image_endianess, label_func, LC_SEGMENT, LC_SYMTAB, LC_THREAD, LC_UNIXTHREAD, MACHO_CPU_TYPE_I386, MACHO_CPU_TYPE_POWERPC, macho_shared, MACHO_SYMBOL_N_TYPE, MACHO_SYMBOL_TYPE_N_SECT, MACHO_SYMTAB_NLIST_struct, make_valid_name(), Analyser::newLocation(), MACHO_SYMTAB_COMMAND::nsyms, NULL, Analyser::pushAddress(), random_permutation(), ht_stream::read(), scvalid, ht_streamfile::seek(), Analyser::setLocationTreeOptimizeThreshold(), Analyser::setSymbolTreeOptimizeThreshold(), MACHO_PPC_THREAD_STATE::srr0, MACHO_THREAD_COMMAND::state, MACHO_THREAD_STATE::state_i386, MACHO_THREAD_STATE::state_ppc, MACHO_SYMTAB_COMMAND::stroff, MACHO_SYMTAB_NLIST::strx, MACHO_SYMTAB_COMMAND::symoff, MACHO_SYMTAB_NLIST::type, UINT, validAddress(), validarea, MACHO_SYMTAB_NLIST::value, MACHO_SEGMENT_COMMAND::vmaddr, and MACHO_SEGMENT_COMMAND::vmsize.

UINT MachoAnalyser::bufPtr Address Addr,
byte *  buf,
int  size
[virtual]
 

Implements Analyser.

Definition at line 222 of file macho_analy.cc.

References addressToFileofs(), assert, buf, file, FILEOFS, INVALID_FILE_OFS, ht_stream::read(), ht_streamfile::seek(), size, and UINT.

bool MachoAnalyser::convertAddressToMACHOAddress Address addr,
MACHOAddress r
 

Definition at line 233 of file macho_analy.cc.

References ATOM_ADDRESS_FLAT_32, ATOM_ADDRESS_X86_FLAT_32, MACHOAddress, and Object::object_id().

Referenced by addressToFileofs(), getSegmentNameByAddress(), and validAddress().

Address * MachoAnalyser::createAddress  )  [virtual]
 

Implements Analyser.

Definition at line 255 of file macho_analy.cc.

References assert, MACHO_HEADER::cputype, ht_macho_shared_data::header, MACHO_CPU_TYPE_I386, MACHO_CPU_TYPE_POWERPC, macho_shared, and NULL.

Address * MachoAnalyser::createAddress32 dword  addr  ) 
 

Definition at line 269 of file macho_analy.cc.

References assert, MACHO_HEADER::cputype, ht_macho_shared_data::header, MACHO_CPU_TYPE_I386, MACHO_CPU_TYPE_POWERPC, macho_shared, and NULL.

Referenced by beginAnalysis(), and fileofsToAddress().

Address* MachoAnalyser::createAddress64 qword  addr  ) 
 

Assembler * MachoAnalyser::createAssembler  )  [virtual]
 

Reimplemented from Analyser.

Definition at line 286 of file macho_analy.cc.

References NULL.

void MachoAnalyser::done  )  [virtual]
 

Reimplemented from Analyser.

Definition at line 207 of file macho_analy.cc.

References Analyser::done(), Area::done(), and validarea.

Address * MachoAnalyser::fileofsToAddress FILEOFS  fileofs  )  [virtual]
 

converts |FILEOFS fileaddr| to |Address|

Reimplemented from Analyser.

Definition at line 426 of file macho_analy.cc.

References createAddress32(), FILEOFS, macho_ofs_to_addr(), macho_shared, MACHOAddress, and ht_macho_shared_data::sections.

const char * MachoAnalyser::getName  )  [virtual]
 

Reimplemented from Analyser.

Definition at line 332 of file macho_analy.cc.

References file, and ht_stream::get_desc().

char * MachoAnalyser::getSegmentNameByAddress Address Addr  )  [virtual]
 

Reimplemented from Analyser.

Definition at line 316 of file macho_analy.cc.

References convertAddressToMACHOAddress(), macho_addr_to_section(), macho_shared, MACHOAddress, NULL, macho_sections::sections, ht_macho_shared_data::sections, and MACHO_SECTION::sectname.

Referenced by beginAnalysis().

const char * MachoAnalyser::getType  )  [virtual]
 

Reimplemented from Analyser.

Definition at line 340 of file macho_analy.cc.

void MachoAnalyser::init ht_macho_shared_data macho_shared,
ht_streamfile File
 

Definition at line 50 of file macho_analy.cc.

References file, Analyser::init(), Area::init(), macho_shared, and validarea.

void MachoAnalyser::initCodeAnalyser  )  [virtual]
 

Reimplemented from Analyser.

Definition at line 348 of file macho_analy.cc.

References Analyser::initCodeAnalyser().

void MachoAnalyser::initInsertSymbols int  shidx  ) 
 

Definition at line 191 of file macho_analy.cc.

void MachoAnalyser::initUnasm  )  [virtual]
 

Implements Analyser.

Definition at line 356 of file macho_analy.cc.

References ANALYX86DISASSEMBLER_FLAGS_FLAT64, MACHO_HEADER::cputype, DPRINTF, ht_macho_shared_data::header, MACHO_CPU_TYPE_I386, MACHO_CPU_TYPE_POWERPC, macho_shared, UINT, and warnbox.

int MachoAnalyser::load ht_object_stream f  )  [virtual]
 

loads object from object stream.

Returns:
ht_stream errorcode

Reimplemented from Analyser.

Definition at line 198 of file macho_analy.cc.

References GET_OBJECT, Analyser::load(), and validarea.

void MachoAnalyser::log const char *  msg  )  [virtual]
 

Reimplemented from Analyser.

Definition at line 381 of file macho_analy.cc.

Address * MachoAnalyser::nextValid Address Addr  )  [virtual]
 

Implements Analyser.

Definition at line 394 of file macho_analy.cc.

References Area::findNext(), and validarea.

OBJECT_ID MachoAnalyser::object_id  )  const [virtual]
 

Returns:
unique object id.

Reimplemented from Object.

Definition at line 214 of file macho_analy.cc.

References ATOM_MACHO_ANALYSER.

int MachoAnalyser::queryConfig int  mode  )  [virtual]
 

Reimplemented from Analyser.

Definition at line 411 of file macho_analy.cc.

References Q_DO_ANALYSIS, Q_ENGAGE_CODE_ANALYSER, and Q_ENGAGE_DATA_ANALYSER.

void MachoAnalyser::store ht_object_stream f  )  [virtual]
 

stores object.

Reimplemented from Analyser.

Definition at line 402 of file macho_analy.cc.

References PUT_OBJECT, Analyser::store(), and validarea.

bool MachoAnalyser::validAddress Address Addr,
tsectype  action
[virtual]
 

Implements Analyser.

Definition at line 444 of file macho_analy.cc.

References byte, convertAddressToMACHOAddress(), MACHO_SECTION::flags, macho_addr_to_section(), MACHO_S_4BYTE_LITERALS, MACHO_S_8BYTE_LITERALS, MACHO_S_CSTRING_LITERALS, MACHO_S_REGULAR, MACHO_S_ZEROFILL, MACHO_SECTION_TYPE, macho_shared, MACHOAddress, sccode, scinitialized, scread, screadwrite, scvalid, scwrite, macho_sections::sections, and ht_macho_shared_data::sections.

Referenced by addressToFileofs(), and beginAnalysis().


Member Data Documentation

ht_streamfile* MachoAnalyser::file
 

Definition at line 33 of file macho_analy.h.

Referenced by beginAnalysis(), bufPtr(), getName(), and init().

ht_macho_shared_data* MachoAnalyser::macho_shared
 

Definition at line 32 of file macho_analy.h.

Referenced by addressToFileofs(), beginAnalysis(), createAddress(), createAddress32(), fileofsToAddress(), getSegmentNameByAddress(), init(), initUnasm(), and validAddress().

Area* MachoAnalyser::validarea
 

Definition at line 34 of file macho_analy.h.

Referenced by beginAnalysis(), done(), init(), load(), nextValid(), and store().


The documentation for this class was generated from the following files:
Generated on Fri May 7 21:16:08 2004 by doxygen 1.3.5