@Test
	public void testWriteStateRegister() throws Throwable {
		try (ToyDBTraceBuilder tb = new ToyDBTraceBuilder("Test", "x86:LE:64:default")) {
			AddressSpace rs = tb.language.getAddressFactory().getRegisterSpace();
			TraceThread thread = initTrace(tb, "", List.of());

			TaintTracePcodeEmulator emu = new TaintTracePcodeEmulator(tb.host, 0);
			PcodeThread<Pair<byte[], TaintVec>> emuThread = emu.newThread(thread.getPath());
			TaintVec taintVal = TaintVec.empties(8);
			TaintSet testTaint = TaintSet.of(new TaintMark("test_0", Set.of()));
			for (int i = 0; i < 4; i++) {
				taintVal.set(i, testTaint);
			}
			emuThread.getState().setVar(tb.reg("EAX"), Pair.of(tb.arr(0, 0, 0, 0), taintVal));

			try (Transaction tx = tb.startTransaction()) {
				emu.writeDown(tb.host, 1, 0);
			}
			TracePropertyMap<String> taintMap =
				tb.trace.getAddressPropertyManager().getPropertyMap("Taint", String.class);
			TracePropertyMapSpace<String> mapSpace =
				taintMap.getPropertyMapRegisterSpace(thread, 0, false);
			// TODO: Might be nice to coalesce identical values
			//   Becomes the 2D cover optimization problem. Still could do some easy cases.
			assertEquals(
				makeTaintEntries(tb.trace, Lifespan.nowOn(1), rs, Set.of(0L, 1L, 2L, 3L), "test_0"),
				Set.copyOf(mapSpace.getEntries(Lifespan.at(1), tb.reg("RAX"))));
		}
	}
Test that state is properly read from trace memory

<p>
We isolate exactly a read by executing sleigh.
Ghidra/Debug/TaintAnalysis/src/test/java/ghidra/pcode/emu/taint/trace/TaintTracePcodeEmulatorTest.java