AuxvParser Class Reference

#include <parseauxv.h>

Public Member Functions

void deleteAuxvParser ()
 ~AuxvParser ()
Address getInterpreterBase ()
bool parsedVsyscall ()
Address getVsyscallBase ()
Address getVsyscallText ()
Address getVsyscallEnd ()
Address getProgramBase ()
Address getPageSize ()

Static Public Member Functions

static AuxvParsercreateAuxvParser (int pid, unsigned asize)

Private Member Functions

bool readAuxvInfo ()
void * readAuxvFromProc ()
void * readAuxvFromStack ()
Address getStackTop (bool &err)
 AuxvParser (int pid, unsigned asize)

Private Attributes

int pid
unsigned ref_count
bool create_err
Address interpreter_base
Address vsyscall_base
Address vsyscall_text
Address vsyscall_end
bool found_vsyscall
Address phdr
unsigned page_size
unsigned addr_size

Static Private Attributes

static std::map< int,
AuxvParser * > 
pid_to_parser

Detailed Description

Definition at line 37 of file parseauxv.h.


Constructor & Destructor Documentation

AuxvParser::AuxvParser ( int  pid,
unsigned  asize 
) [private]

Definition at line 85 of file parseauxv.C.

References create_err, and readAuxvInfo().

Referenced by createAuxvParser().

AuxvParser::~AuxvParser (  ) 

Definition at line 80 of file parseauxv.C.

References pid, and pid_to_parser.


Member Function Documentation

AuxvParser * AuxvParser::createAuxvParser ( int  pid,
unsigned  asize 
) [static]
void AuxvParser::deleteAuxvParser (  ) 

Definition at line 70 of file parseauxv.C.

References ref_count.

Address AuxvParser::getInterpreterBase (  ) 

Definition at line 100 of file parseauxv.C.

References interpreter_base.

Referenced by Dyninst::AddressTranslateSysV::setInterpreterBase().

Address AuxvParser::getPageSize (  ) 

Definition at line 130 of file parseauxv.C.

References page_size.

Referenced by Dyninst::AddressTranslateSysV::setInterpreterBase().

Address AuxvParser::getProgramBase (  ) 

Definition at line 125 of file parseauxv.C.

References phdr.

Referenced by Dyninst::AddressTranslateSysV::setInterpreterBase().

Address AuxvParser::getStackTop ( bool &  err  )  [private]
Address AuxvParser::getVsyscallBase (  ) 

Definition at line 110 of file parseauxv.C.

References vsyscall_base.

Address AuxvParser::getVsyscallEnd (  ) 

Definition at line 120 of file parseauxv.C.

References vsyscall_end.

Address AuxvParser::getVsyscallText (  ) 

Definition at line 115 of file parseauxv.C.

References vsyscall_text.

bool AuxvParser::parsedVsyscall (  ) 

Definition at line 105 of file parseauxv.C.

References found_vsyscall.

void * AuxvParser::readAuxvFromProc (  )  [private]

Definition at line 862 of file linuxKludges.C.

References fprintf, pid, and READ_BLOCK_SIZE.

void * AuxvParser::readAuxvFromStack (  )  [private]

Disabled, for now. Re-enable if /proc/pid/auxv doesn't exist.

Definition at line 852 of file linuxKludges.C.

bool AuxvParser::readAuxvInfo (  )  [private]

The location of the vsyscall is stored in /proc/PID/auxv in Linux 2.6. auxv consists of a list of name/value pairs, ending with the AT_NULL name. There isn't a direct way to get the vsyscall info on Linux 2.4

Try to read from /proc/d/auxv. On Linux 2.4 systems auxv doesn't exist, which is okay because vsyscall isn't used. On latter 2.6 kernels the AT_SYSINFO field isn't present, so we have to resort to more "extreme" measures.

Fill in the auxv_entry structure. We may have to do different size reads depending on the address space. No matter which size we read, we'll fill the data in to auxv_entry, which may involve a size shift up.

Even if we found dso_start in /proc/pid/auxv, the vsyscall 'page' can be larger than a single page. Thus we look through /proc/pid/maps for known, default, or guessed start address(es).

We'll make several educatbed attempts at guessing an address for the vsyscall page. After deciding on a guess, we'll try to verify that using /proc/pid/maps.

Look through every entry in /proc/maps, and compare it to every entry in guessed_addrs. If a guessed_addr looks like the right thing, then we'll go ahead and call it the vsyscall page.

There were no hits using our guessed_addrs scheme. Let's try to look at every entry in the maps table (not just the guessed addresses), and see if any of those look like a vsyscall page.

Return any secondary possiblitiy pages we found in our earlier search.

Time to give up. Sigh.

Definition at line 63 of file bluegeneKludges.C.

Referenced by AuxvParser().


Field Documentation

unsigned AuxvParser::addr_size [private]

Definition at line 51 of file parseauxv.h.

bool AuxvParser::create_err [private]

Definition at line 42 of file parseauxv.h.

Referenced by AuxvParser(), and createAuxvParser().

Definition at line 47 of file parseauxv.h.

Referenced by parsedVsyscall().

Definition at line 43 of file parseauxv.h.

Referenced by getInterpreterBase().

unsigned AuxvParser::page_size [private]

Definition at line 50 of file parseauxv.h.

Referenced by getPageSize().

Definition at line 48 of file parseauxv.h.

Referenced by getProgramBase().

int AuxvParser::pid [private]

Definition at line 40 of file parseauxv.h.

Referenced by readAuxvFromProc(), and ~AuxvParser().

std::map< int, AuxvParser * > AuxvParser::pid_to_parser [static, private]

Definition at line 59 of file parseauxv.h.

Referenced by createAuxvParser(), and ~AuxvParser().

unsigned AuxvParser::ref_count [private]

Definition at line 41 of file parseauxv.h.

Referenced by createAuxvParser(), and deleteAuxvParser().

Definition at line 44 of file parseauxv.h.

Referenced by getVsyscallBase().

Definition at line 46 of file parseauxv.h.

Referenced by getVsyscallEnd().

Definition at line 45 of file parseauxv.h.

Referenced by getVsyscallText().


The documentation for this class was generated from the following files:
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 12 Jul 2013 for SymtabAPI by  doxygen 1.6.1