@Test
	public void testInject() throws Throwable {
		try (ToyDBTraceBuilder tb = new ToyDBTraceBuilder("Test", "x86:LE:64:default")) {
			final StringBuilder dumped = new StringBuilder();
			PcodeUseropLibrary<byte[]> hexLib = new AnnotatedPcodeUseropLibrary<byte[]>() {
				@Override
				protected Lookup getMethodLookup() {
					return MethodHandles.lookup();
				}

				@PcodeUserop
				public void hexdump(byte[] in) {
					dumped.append(NumericUtilities.convertBytesToString(in));
				}
			};
			TraceThread thread = initTrace(tb, """
					RIP = 0x00400000;
					RSP = 0x00110000;
					""",
				List.of(
					"PUSH 0x0dedbeef",
					"PUSH 0x0badf00d"));

			BytesTracePcodeEmulator emu = new BytesTracePcodeEmulator(tb.host, 0) {
				@Override
				protected PcodeUseropLibrary<byte[]> createUseropLibrary() {
					return hexLib;
				}
			};
			emu.inject(tb.addr(0x00400005), "hexdump(RSP);");
			PcodeThread<byte[]> emuThread = emu.newThread(thread.getPath());

			emuThread.stepInstruction();
			assertEquals("", dumped.toString());

			emuThread.stepInstruction();
			assertEquals("f8ff100000000000", dumped.toString()); // LE
		}
	}
Test the inject method

<p>
This tests that injects work, and that they can invoke a userop from a client-provided
library
Ghidra/Debug/Framework-TraceModeling/src/test/java/ghidra/pcode/exec/trace/BytesTracePcodeEmulatorTest.java