mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-20 20:23:57 +00:00
Fix reproducibility of unicorn context
This commit is contained in:
2
deps/unicorn
vendored
2
deps/unicorn
vendored
Submodule deps/unicorn updated: 35c15efcb4...62caeb2dce
@@ -112,6 +112,12 @@ namespace unicorn
|
||||
uc_context_serializer(uc_engine* uc, const bool in_place)
|
||||
: uc_(uc)
|
||||
{
|
||||
if (in_place)
|
||||
{
|
||||
// Unicorn stores pointers in the struct. The serialization here is broken
|
||||
throw std::runtime_error("Memory saving not supported atm");
|
||||
}
|
||||
|
||||
uc_ctl_context_mode(uc, UC_CTL_CONTEXT_CPU | (in_place ? UC_CTL_CONTEXT_MEMORY : 0));
|
||||
|
||||
this->size_ = uc_context_size(uc);
|
||||
|
||||
@@ -24,16 +24,7 @@ namespace test
|
||||
auto buffer1 = serializer1.move_buffer();
|
||||
auto buffer2 = serializer2.move_buffer();
|
||||
|
||||
// Unicorn context contains unpredictable data
|
||||
constexpr auto unicorn_offset = 30;
|
||||
|
||||
ASSERT_GT(buffer1.size(), unicorn_offset);
|
||||
ASSERT_EQ(buffer1.size(), buffer2.size());
|
||||
|
||||
buffer1.erase(buffer1.begin(), buffer1.begin() + unicorn_offset);
|
||||
buffer2.erase(buffer2.begin(), buffer2.begin() + unicorn_offset);
|
||||
|
||||
ASSERT_EQ(buffer1, buffer2);
|
||||
ASSERT_EQ(serializer1.get_buffer(), serializer2.get_buffer());
|
||||
}
|
||||
|
||||
TEST(SerializationTest, DISABLED_EmulationIsReproducible)
|
||||
|
||||
Reference in New Issue
Block a user