@Test
	public void testRegisterSpace() throws Exception {
		TraceThread thread;
		DBTraceCodeSpace regCode;
		TraceData dR4;

		try (Transaction tx = b.startTransaction()) {
			thread = b.getOrAddThread("Thread 1", 0);
			regCode = manager.getCodeRegisterSpace(thread, true);
			dR4 = regCode.definedData()
					.create(Lifespan.nowOn(0), b.language.getRegister("r4"), LongDataType.dataType);
		}

		assertEquals(thread, regCode.codeUnits().getThread());
		assertEquals(thread, regCode.data().getThread());
		assertEquals(thread, regCode.definedUnits().getThread());
		assertEquals(thread, regCode.instructions().getThread());
		assertEquals(thread, regCode.definedData().getThread());
		assertEquals(thread, regCode.undefinedData().getThread());

		assertEquals(List.of(dR4), list(regCode.definedUnits().get(0, true)));

		DBTraceCodeSpace frameCode;
		TraceData dR5;

		try (Transaction tx = b.startTransaction()) {
			TraceStack stack = b.trace.getStackManager().getStack(thread, 0, true);
			stack.setDepth(0, 2, true);
			assertEquals(regCode, manager.getCodeRegisterSpace(stack.getFrame(0, 0, false), false));
			frameCode = manager.getCodeRegisterSpace(stack.getFrame(0, 1, false), true);
			assertNotEquals(regCode, frameCode);
			dR5 = frameCode.definedData()
					.create(Lifespan.nowOn(0), b.language.getRegister("r5"), LongDataType.dataType);
		}

		assertEquals(1, frameCode.getFrameLevel());
		assertEquals(thread, frameCode.codeUnits().getThread());
		assertEquals(List.of(dR5), list(frameCode.definedUnits().get(0, true)));
	}
This test is interesting because the pointer type def causes an update to the data type
settings <em>while the unit is still being created</em>. This will invalidate the trace's
caches. All of them, including the defined data units, which can become the cause of many
timing issues.
Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/trace/database/listing/DBTraceCodeManagerTest.java