18 requires(MemoryReadSupported<T>)
27 std::uintptr_t
operator&()
const {
return address_; }
37 template <MemoryIOCompatible<T> U>
54 Program& get_program()
const {
return *prog_; }
59 std::uintptr_t address_;
63 requires(MemoryReadSupported<T>)
64template <MemoryIOCompatible<T> U>
65 requires(MemoryWriteSupported<U>)
67 auto prev =
TRY_OR_THROW(get_value(),
"could not read previous data value");
69 MemoryIOBase& mio = prog_->get_subproc().get_tracer().get_memory_io();
80 if constexpr (std::default_initializable<T>) {
81 return set_value(T{});
83 UNIMPLEMENTED(
"zero-initialization is not implemented for types that are not default initializable!");
90 MemoryIOBase& mio = prog_->get_subproc().get_tracer().get_memory_io();
92 return mio.
read<T>(address_);
98 auto value = get_value_impl();
100 std::string val_str =
"<unformattable>";
101 if constexpr (fmt::formattable<T>) {
102 val_str = fmt::format(
"{}", value);
104 LOG_DEBUG(
"Read value {} for @ 0x{:X}", val_str, address_);
113 , address_{address} {}
Definition asm_data.hpp:20
std::uintptr_t operator&() const
Definition asm_data.hpp:27
std::uintptr_t get_address() const
Definition asm_data.hpp:29
T zero() const
Zeros the object of type T residing in the asm program.
Definition asm_data.hpp:77
T set_value(const U &val) const
Set the value of type T in the asm program.
Definition asm_data.hpp:66
AsmData(Program &prog, std::uintptr_t address)
Definition asm_data.hpp:111
virtual ~AsmData()=default
Result< T > get_value() const
Get the value currently present in the asm program.
Definition asm_data.hpp:97
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
Result< std::size_t > write(std::uintptr_t address, const T &data)
Definition memory_io_base.hpp:87
Result< T > read(std::uintptr_t address)
Definition memory_io_base.hpp:32
Definition program.hpp:32
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:49
#define LOG_DEBUG(...)
Definition logging.hpp:41
#define TRY_OR_THROW(expr,...)
Definition macros.hpp:11
Definition asm_buffer.hpp:20