Ghidra Decompiler Analysis Engine
|
A helper class for caching the active context blob to minimize database lookups. More...
#include <globalcontext.hh>
Public Member Functions | |
ContextCache (ContextDatabase *db) | |
Construct given a context database. More... | |
void | getContext (const Address &addr, uintm *buf) const |
Retrieve the context blob for the given address. More... | |
void | setContext (const Address &addr, int4 num, uintm mask, uintm value) |
Change the value of a context variable at the given address with no bound. More... | |
void | setContext (const Address &addr1, const Address &addr2, int4 num, uintm mask, uintm value) |
Change the value of a context variable across an explicit address range. More... | |
A helper class for caching the active context blob to minimize database lookups.
This merely caches the last retrieved context blob ("array of words") and the range of addresses over which the blob is valid. It encapsulates the ContextDatabase itself and exposes a minimal interface (getContext() and setContext()).
ContextCache::ContextCache | ( | ContextDatabase * | db | ) |
Construct given a context database.
db | is the context database that will be encapsulated |
void ContextCache::getContext | ( | const Address & | addr, |
uintm * | buf | ||
) | const |
Retrieve the context blob for the given address.
Check if the address is in the current valid range. If it is, return the cached blob. Otherwise, make a call to the database and cache a new block and valid range.
addr | is the given address |
buf | is where the blob should be stored |
void ContextCache::setContext | ( | const Address & | addr, |
int4 | num, | ||
uintm | mask, | ||
uintm | value | ||
) |
Change the value of a context variable at the given address with no bound.
The context value is set starting at the given address and paints memory up to the next explicit change point.
addr | is the given starting address |
num | is the word index of the context variable |
mask | is the mask delimiting the context variable |
value | is the (already shifted) value to set |
void ContextCache::setContext | ( | const Address & | addr1, |
const Address & | addr2, | ||
int4 | num, | ||
uintm | mask, | ||
uintm | value | ||
) |
Change the value of a context variable across an explicit address range.
The context value is painted across the range. The context variable is marked as explicitly changing at the starting address of the range.
addr1 | is the starting address of the given range |
addr2 | is the ending address of the given range |
num | is the word index of the context variable |
mask | is the mask delimiting the context variable |
value | is the (already shifted) value to set |