private void dumpBytes(OutputStream debugStream) throws IOException {
		StringBuilder buf = new StringBuilder();
		Iterator<ByteChunk> iter = byteset.iterator();
		AddressSpace lastspace = null;
		long lastoffset = 0;
		boolean lastreadonly = false;
		boolean tagstarted = false;
		while (iter.hasNext()) {
			ByteChunk chunk = iter.next();
			AddressSpace space = chunk.addr.getAddressSpace();
			boolean readval = isReadOnly(chunk.addr);
			if (lastreadonly != readval) {
				lastspace = null;		// Force a break in chunk, so we can set new readonly value
				lastreadonly = readval;
			}

			if (tagstarted && ((chunk.min != 0) || (lastspace != space) ||
				(lastoffset != chunk.addr.getOffset()))) {
				buf.append("\n</bytechunk>\n");
				tagstarted = false;
			}
			if (!tagstarted) {
				buf.append("<bytechunk");
				SpecXmlUtils.encodeStringAttribute(buf, "space", space.getName());
				SpecXmlUtils.encodeUnsignedIntegerAttribute(buf, "offset",
					chunk.addr.getOffset() + chunk.min);
				if (lastreadonly) {
					SpecXmlUtils.encodeBooleanAttribute(buf, "readonly", lastreadonly);
				}
				buf.append(">\n");
				tagstarted = true;
			}
			for (int i = 0; i < chunk.min; ++i) {
				buf.append("  ");					// pad the hex display to 16 bytes
			}
			for (int i = chunk.min; i < chunk.max; ++i) {
				int hi = (chunk.val[i] >> 4) & 0xf;
				int lo = chunk.val[i] & 0xf;
				if (hi > 9) {
					hi += 'a' - 10;
				}
				else {
					hi += '0';
				}
				if (lo > 9) {
					lo += 'a' - 10;
				}
				else {
					lo += '0';
				}
				buf.append((char) hi);
				buf.append((char) lo);
			}
			buf.append('\n');
			if (chunk.max != 16) {
				buf.append("</bytechunk>\n");
				tagstarted = false;
			}
			else {
				lastoffset = chunk.addr.getOffset() + 16;
				lastspace = space;
			}
		}
		if (tagstarted) {
			buf.append("</bytechunk>\n");
		}
		debugStream.write(buf.toString().getBytes());
	}
A container for collecting communication between the decompiler and the Ghidra database,
as serviced through DecompileCallback during decompilation of a function.
The query results can then be dumped as an XML document.
The container is populated through methods that mirror the various methods in DecompileCallback.
Ghidra/Features/Decompiler/src/main/java/ghidra/app/decompiler/DecompileDebug.java