31 template <MemoryReadSupported T>
36 template <MemoryReadSupported T>
37 requires std::is_trivial_v<T>
39 std::vector<T> result;
42 for (std::uintptr_t current_address = address; size > 0; current_address +=
sizeof(T), --size) {
49 template <MemoryReadSupported T>
50 requires std::is_trivial_v<T>
52 std::vector<T> result;
54 for (std::uintptr_t current_address = address;; current_address +=
sizeof(T)) {
57 if (!until_predicate(elem)) {
61 result.push_back(std::move(elem));
68 return this->read_block_impl(address, length);
72 template <MemoryReadSupported T>
74 if constexpr (std::is_pointer_v<T>) {
75 using NextType = std::remove_pointer_t<T>;
78 auto next_address =
reinterpret_cast<std::uintptr_t
>(
TRY(
read<T>(address)));
86 template <MemoryWriteSupported T>
89 TRY(this->write_block_impl(address, bytes));
103 const std::function<
bool(std::span<const Byte>)>& predicate,
104 std::size_t block_size);
Definition byte_vector.hpp:34
size_t size() const
Definition byte_vector.hpp:103
More user-friendly interface wrapper for a byte-like integral.
Definition byte.hpp:18
std::variant wrapper for a partial implementation of C++23's expected type
Definition expected.hpp:34
Base class for interacting with a tracee's memory in a variety of ways at a (relatively) high-level F...
Definition memory_io_base.hpp:25
pid_t get_pid() const
Definition memory_io_base.hpp:93
Result< std::size_t > write(std::uintptr_t address, const T &data)
Definition memory_io_base.hpp:87
Result< NativeByteVector > read_bytes(std::uintptr_t address, std::size_t length)
Definition memory_io_base.hpp:67
MemoryIOBase(pid_t pid)
Definition memory_io_base.hpp:27
Result< std::vector< T > > read_array(std::uintptr_t address, std::function< bool(const T &)> until_predicate)
Definition memory_io_base.hpp:51
Result< remove_all_pointers_t< T > > read_deref_all(std::uintptr_t address)
Definition memory_io_base.hpp:73
virtual ~MemoryIOBase()=default
Result< std::vector< T > > read_array(std::uintptr_t address, std::size_t size)
Definition memory_io_base.hpp:38
Result< T > read(std::uintptr_t address)
Definition memory_io_base.hpp:32
#define TRY(val)
If the supplied argument is an error (unexpected) type, then propegate it up the call stack....
Definition error_types.hpp:52
Definition asm_buffer.hpp:20
Example class implementation:
Definition memory_io_serde.hpp:34