maat::MemSegment class

This class is a wrapper that represents a mapped memory area. It can be used transparently to write and read both abstract and concrete values. To do so, it uses a concrete buffer, an abstract buffer, and a memory status bitmap to keep track of what is abstract and what is concrete

❱   Base classes

class Serializable
Virtual interface that serializable classes must implement.

❱   Constructors, destructors, conversion operators

MemSegment(addr_t start, addr_t end, const std::string& name = "", bool is_engine_special_segment = false)
Constructor.

❱   Public functions

auto size() -> addr_t
Number of bytes.

void extend_after(addr_t nb_bytes)
Extend the buffer to make it represent 'nb_bytes' more bytes of memory. The new bytes are inserted at the end of the buffer.

void extend_before(addr_t nb_bytes)
Extend the buffer to make it represent 'nb_bytes' more bytes of memory. The new bytes are inserted at the beginning of the segment.

auto read(addr_t addr, unsigned int nb_bytes) -> Value
Read memory.

void read(Value& res, addr_t addr, unsigned int nb_bytes)
Read memory.

void write(addr_t addr, const Value& val, VarContext& ctx)
Write value.

void write(addr_t addr, cst_t val, unsigned int nb_bytes)
Write concrete value.

void write(addr_t addr, uint8_t* src, int nb_bytes)
Write concrete buffer.

void write(addr_t addr, const std::vector<Value>& buf, VarContext& ctx)
Write buffer of values.

void symbolic_ptr_read(Value& res, const Expr& addr, ValueSet& addr_value_set, unsigned int nb_bytes, const Expr& base)
Read memory at the address pointed by a symbolic pointer.

void abstract_snapshot(addr_t& addr, int& nb_bytes, abstract_mem_chunk_t& snap)
(Internal) Takes an abstract snapshot. If the segment finishes before 'nb_bytes', 'addr' and 'nb_bytes' are updated to finish the snapshot in the next segment

auto concrete_snapshot(addr_t& addr, int& nb_bytes) -> cst_t
(Internal) Takes a concrete snapshot. If the segment finishes before 'nb_bytes', 'addr' and 'nb_bytes' are updated to finish the snapshot in the next segment. Shouldn't be called with nb_bytes > 8

auto raw_mem_at(addr_t addr) -> uint8_t*
Returns a raw pointer to the concrete memory buffer at address 'addr'.

auto is_abstract_until(addr_t start, addr_t max) -> addr_t
Returns the first address holding a non-abstract value starting from 'start' and before address 'start+max'.

auto is_concrete_until(addr_t start, addr_t max) -> addr_t
Returns the first address holding an abstract value starting from 'start' and before address 'start+max'.

auto is_identical_until(addr_t start, cst_t byte) -> addr_t
Finds the first address holding a value different that 'byte' starting from 'start'.

auto class_uid() const -> uid_t virtual
Return the class uid (see ClassId enum)

void dump(serial::Serializer&) const virtual
Dump the object contents in a serializer stream.

void load(serial::Deserializer&) virtual
Restore an object from a deserializer stream.

❱   Public variables

addr_t start
Beginning of the memory segment.

addr_t end
End of the memory segment (included in the segment)

std::string name
Optional. Name of the segment.