18 requires(MemoryReadSupported<T>)
34 template <MemoryIOCompatible<T> U>
51 Program& get_program()
const {
return *prog_; }
56 std::uintptr_t address_;
60 requires(MemoryReadSupported<T>)
61template <MemoryIOCompatible<T> U>
62 requires(MemoryWriteSupported<U>)
64 auto prev =
TRY_OR_THROW(get_value(),
"could not read previous data value");
66 MemoryIOBase& mio = prog_->get_subproc().get_tracer().get_memory_io();
77 if constexpr (std::default_initializable<T>) {
78 return set_value(T{});
80 UNIMPLEMENTED(
"zero-initialization is not implemented for types that are not default initializable!");
87 MemoryIOBase& mio = prog_->get_subproc().get_tracer().get_memory_io();
89 return mio.
read<T>(address_);
95 auto value = get_value_impl();
97 std::string val_str =
"<unformattable>";
98 if constexpr (fmt::formattable<T>) {
99 val_str = fmt::format(
"{}", value);
101 LOG_DEBUG(
"Read value {} for @ 0x{:X}", val_str, address_);
110 , address_{address} {}
Definition asm_data.hpp:20
std::uintptr_t get_address() const
Definition asm_data.hpp:26
T zero() const
Zeros the object of type T residing in the asm program.
Definition asm_data.hpp:74
T set_value(const U &val) const
Set the value of type T in the asm program.
Definition asm_data.hpp:63
AsmData(Program &prog, std::uintptr_t address)
Definition asm_data.hpp:108
virtual ~AsmData()=default
virtual Result< T > get_value() const
Get the value currently present in the asm program.
Definition asm_data.hpp:94
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:23
Result< std::size_t > write(std::uintptr_t address, const T &data)
Definition memory_io_base.hpp:85
Result< T > read(std::uintptr_t address)
Definition memory_io_base.hpp:30
Definition program.hpp:31
#define TRY_OR_THROW(expr,...)
Definition macros.hpp:11
Definition concepts.hpp:23
Definition concepts.hpp:27
#define UNIMPLEMENTED(msg,...)
For features that have not yet / are not planned to be implemented, so that I don't bang my head agai...
Definition logging.hpp:52
#define LOG_DEBUG(...)
Definition logging.hpp:44
Definition asm_buffer.hpp:19