@Test
	public void testWriteEmuMemoryTwice() throws Throwable {
		createAndOpenTrace();
		controlService.setCurrentMode(tb.trace, ControlMode.RW_EMULATOR);

		try (Transaction tx = tb.startTransaction()) {
			// NB. TraceManager should automatically activate the first thread
			TraceObjectThread thread = tb.createObjectsProcessAndThreads();
			tb.createObjectsFramesAndRegs(thread, Lifespan.nowOn(0), getPlatform(), 1);
		}
		activateTrace();
		waitForSwing();

		StateEditor editor = createStateEditor();
		assertTrue(editor.isVariableEditable(tb.addr(0x00400000), 4));
		waitOn(editor.setVariable(tb.addr(0x00400000), tb.arr(1, 2, 3, 4)));
		assertTrue(editor.isVariableEditable(tb.addr(0x00400002), 4));
		waitOn(editor.setVariable(tb.addr(0x00400002), tb.arr(5, 6, 7, 8)));
		waitForSwing();

		DebuggerCoordinates current = traceManager.getCurrent();
		long snap = current.getViewSnap();
		assertTrue(Lifespan.isScratch(snap));
		assertEquals(1, current.getTime().patchCount()); // Check coalesced

		ByteBuffer buf = ByteBuffer.allocate(6);
		tb.trace.getMemoryManager().getBytes(snap, tb.addr(0x00400000), buf);
		assertArrayEquals(tb.arr(1, 2, 5, 6, 7, 8), buf.array());
	}
TODO: It'd be nice if this worked, since memory edits don't really require a thread
context. That would require some changes in the TraceSchedule and its execution. IINM,
each step currently requires a thread. We'd have to relax that for patch steps, and it'd
only work if they don't refer to any register.
Ghidra/Test/DebuggerIntegrationTest/src/test/java/ghidra/app/plugin/core/debug/service/control/DebuggerControlServiceTest.java