private String getBaseString(AbstractPdb pdb, MsTypeField baseType) {
		if (baseType instanceof AbstractBaseClassMsType base) {
			RecordNumber recordNumber = base.getBaseClassRecordNumber();
			AbstractMsType ut = pdb.getTypeRecord(recordNumber);
			if (!(ut instanceof AbstractCompositeMsType underlyingType)) {
				Msg.warn(this, "Composite not found for base class: " + ut);
				return "";
			}
			String underlyingName = underlyingType.getName();
			List<String> parts = SymbolPathParser.parse(underlyingName);
			String name = parts.getLast();
			return String.format(
				"struct.addDirectBaseClass(%s_struct.getComposite(), %s_struct, %s, %d);",
				name, name, getAttsString(base.getAttributes()), base.getOffset());
		}
		else if (baseType instanceof AbstractVirtualBaseClassMsType base) {
			RecordNumber recordNumber = base.getBaseClassRecordNumber();
			AbstractMsType ut = pdb.getTypeRecord(recordNumber);
			if (!(ut instanceof AbstractCompositeMsType underlyingType)) {
				Msg.warn(this, "Composite not found for base class: " + ut);
				return "";
			}
			String underlyingName = underlyingType.getName();
			List<String> parts = SymbolPathParser.parse(underlyingName);
			String name = parts.getLast();
			return String.format(
				"struct.addDirectVirtualBaseClass(%s_struct.getComposite()" +
					", %s_struct, %s, %d, ClassUtils.VXPTR_TYPE, %d);",
				name, name, getAttsString(base.getAttributes()),
				base.getBasePointerOffset().intValue(), base.getBaseOffsetFromVbt().intValue());
		}
		else if (baseType instanceof AbstractIndirectVirtualBaseClassMsType base) {
			RecordNumber recordNumber = base.getBaseClassRecordNumber();
			AbstractMsType ut = pdb.getTypeRecord(recordNumber);
			if (!(ut instanceof AbstractCompositeMsType underlyingType)) {
				Msg.warn(this, "Composite not found for base class: " + ut);
				return "";
			}
			String underlyingName = underlyingType.getName();
			List<String> parts = SymbolPathParser.parse(underlyingName);
			String name = parts.getLast();
			return String.format(
				"struct.addIndirectVirtualBaseClass(%s_struct.getComposite()" +
					", %s_struct, %s, %d, ClassUtils.VXPTR_TYPE, %d);",
				name, name, getAttsString(base.getAttributes()),
				base.getBasePointerOffset().intValue(), base.getBaseOffsetFromVbt().intValue());
		}
		else {
			throw new AssertException(
				"Unknown base class type: " + baseType.getClass().getSimpleName());
		}
	}
Developer script to capture items from Program and PDB for developing tests
Ghidra/Features/PDB/developer_scripts/CaptureHelperScript.java