public static boolean createFunctionIfNeeded(Program program, Address functionAddress) {
		// If there isn't an instruction at the function address yet, then disassemble there.
		Listing listing = program.getListing();
		Address normalizedFunctionAddress =
			PseudoDisassembler.getNormalizedDisassemblyAddress(program, functionAddress);
		Instruction inst = listing.getInstructionAt(normalizedFunctionAddress);
		if (inst == null) {
			functionAddress =
				PseudoDisassembler.setTargetContextForDisassembly(program, functionAddress);
			DisassembleCommand cmd = new DisassembleCommand(functionAddress, null, true);
			if (!cmd.applyTo(program) || cmd.getDisassembledAddressSet().isEmpty()) {
				Msg.error(EHDataTypeUtilities.class, "Failed to disassemble at " + functionAddress);
				return false;
			}
		}

		// If there isn't a function at the function address yet, then try to create one there.
		FunctionManager functionManager = program.getFunctionManager();
		Function function = functionManager.getFunctionAt(normalizedFunctionAddress);
		if (function == null) {
			CreateFunctionCmd cmd = new CreateFunctionCmd(normalizedFunctionAddress);
			if (!cmd.applyTo(program)) {
				Msg.error(EHDataTypeUtilities.class,
					"Failed to create function at " + normalizedFunctionAddress);
				return false;
			}
		}
		return true;
	}
Creates a function at the specified address in the program if there isn't already one there
and if it can be created.
@param program the program
@param functionAddress the entry point address.
@return true if function was created or already exists.
Ghidra/Features/MicrosoftCodeAnalyzer/src/main/java/ghidra/app/cmd/data/EHDataTypeUtilities.java