class Elf

Elf class - permits the dynamic interning of Elf DSOs More...

Definition#include <elf.hh>
InheritsQMemory
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Members

Protected Members


Detailed Description

Elf class - permits the dynamic interning of Elf DSOs

Elf instances have Csyms Q'd off them, one for each interned symbol.

Symbols may be requested to be interned, by using addSym to associate the Csym with the Elf, or may be added automatically (if they represent vtables, for example.)

Qh<Elf> all

persistent header of Elf Q

enum Policy {COLDSTORE, STL, DEFAULT_P }

modifies the Elf symbol snarfing process

COLDSTORE snarf ColdStore constructors in addition to DEFAULT_P

STL snarf all global functional symbols in addition to DEFAULT_P

DEFAULT_P snarf only requested symbols and vtables

mutable Qh<Csym> symbols

Q of all the symbols defined

char [257] elf
[protected]

.so name implementing the Elf

const int functSize
[protected]

size set aside trampolining functions

const char *const elf_target
[protected]

Elf target for BFD

const char *const elf_arch
[protected]

Elf architecture for BFD

void reset ()
[protected]

run through all Elfs and reset them to a clean state persistent references to .so handles must be NULLed

link_map * _so

dlopen handle for main Elf

Elf (const char *name)

create an Elf

Parameters:
namefilename of elf DSO

void intern (Policy policy)

intern an Elf and all its Csyms

Parameters:
policyElf::Policy for interning

void forallElf (void (fn)
[static]

iterate over all Elf, calling a function on each instance

Parameters:
fnfunction to call on each Elf instance

void forallSym (void (fn)

iterate over all Csym in this Elf, calling a function on each instance

Parameters:
fnfunction to call on each (Elf, Csym) pair

const Csym * symQ ()
[const]

Q of all Csyms interned by this Elf

Returns: the Q of all Csyms for this

void initialize (ElfExe *_exe)
[static]

called once on startup to reset Elfs

Parameters:
_exean ElfExe instance to enable new symbol definition

void close ()

close this Elf

Elf * findElf (const char *elf)
[static]

find an Elf by name

Parameters:
elffile name of elf

Returns: the Elf with this name, or NULL

Csym * findSym (const char *symname)
[const]

find a Csym by name

Parameters:
symnamesymbol name

Returns: the Csym with this name, or NULL

bool addSym (const char *sym)

add an undefined Csym if it doesn't already exist used to request the interning of symbols

Parameters:
symsymbol name

Returns: a Csym with this name

bool isLoaded ()
[const]

predicate: has this Elf been loaded?

Returns: true iff this Elf has been loaded

Csym * csym (const char *mangled, Csym::Type type, int size)

create a Csym interned by this Elf

Parameters:
mangledsymbol name
typesymbol type
sizesize of symbol's allocation

Returns: a Csym with this name

const char * name ()
[const]

Elf's .so name

Returns: elf's DSO file name

void * getSym (const char *name)
[const]

find a simple C symbol in Elf

Parameters:
nameC symbol name

Returns: symbol's value