|
|
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 |
.so name implementing the Elf
const int functSize |
size set aside trampolining functions
const char *const elf_target |
Elf target for BFD
const char *const elf_arch |
Elf architecture for BFD
void reset () |
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:
name | filename of elf DSO |
void intern (Policy policy) |
intern an Elf and all its Csyms
Parameters:
policy | Elf::Policy for interning |
void forallElf (void (fn) |
iterate over all Elf, calling a function on each instance
Parameters:
fn | function to call on each Elf instance |
void forallSym (void (fn) |
iterate over all Csym in this Elf, calling a function on each instance
Parameters:
fn | function to call on each (Elf, Csym) pair |
const Csym * symQ () |
Q of all Csyms interned by this Elf
Returns: the Q of all Csyms for this
void initialize (ElfExe *_exe) |
called once on startup to reset Elfs
Parameters:
_exe | an ElfExe instance to enable new symbol definition |
void close () |
close this Elf
Elf * findElf (const char *elf) |
find an Elf by name
Parameters:
elf | file name of elf |
Returns: the Elf with this name, or NULL
Csym * findSym (const char *symname) |
find a Csym by name
Parameters:
symname | symbol 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:
sym | symbol name |
Returns: a Csym with this name
bool isLoaded () |
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:
mangled | symbol name |
type | symbol type |
size | size of symbol's allocation |
Returns: a Csym with this name
const char * name () |
Elf's .so name
Returns: elf's DSO file name
void * getSym (const char *name) |
find a simple C symbol in Elf
Parameters:
name | C symbol name |
Returns: symbol's value