- uintptr_t temp;
- uintptr_t* res = (uintptr_t*) mc_snapshot_read((void*) address, state->snapshot, state->process_index, &temp, sizeof(uintptr_t));
- state->stack[state->stack_size - 1] = *res;
+ uintptr_t value;
+ if (state->address_space) {
+ uintptr_t temp;
+ const uintptr_t* res = (uintptr_t*) MC_address_space_read(
+ state->address_space, MC_ADDRESS_SPACE_READ_FLAGS_LAZY,
+ &temp, (const void*) address, sizeof(uintptr_t), state->process_index);
+ value = *res;
+ }
+ else {
+ // TODO, use a mc_process representing the current process instead of this
+ value = *(const uintptr_t*) address;
+ }
+ state->stack[state->stack_size - 1] = value;