private CodeBlock getCodeBlockAt(Instruction instr, TaskMonitor monitor)
			throws CancelledException {

		Address begin = instr.getMinAddress();
		Address end = instr.getMaxAddress();
		ArrayList<Address> additionalEntryPts = new ArrayList<>();

		// skip past fall-through instructions
		// stop if block start found or non-fall-through instruction
		SymbolTable symTable = program.getSymbolTable();
		while (instr.hasFallthrough() && !hasEndOfBlockFlow(instr)) {
			if (monitor != null && monitor.isCancelled()) {
				throw new CancelledException();
			}
			Address fallThru = instr.getFallThrough();
			if (fallThru == null) {
				break;
			}
			Instruction nextInstr = listing.getInstructionAt(fallThru);

			if (nextInstr == null || symTable.hasSymbol(fallThru)) {
				break;
			}
			instr = nextInstr;
			end = instr.getMaxAddress();
		}
		Address exitPt = instr.getMinAddress();

		// if last instruction has delay slots, include them in block too
		int slotCnt = instr.getDelaySlotDepth();
		if (slotCnt != 0) {
			while (slotCnt > 0) {
				instr = instr.getNext();
				if (instr == null) {
					break;
				}
				--slotCnt;
				end = instr.getMaxAddress();
				Address addr = instr.getMinAddress();
				if (symTable.hasSymbol(addr)) {
					// Add delay slot entry point if necessary
					additionalEntryPts.add(addr);
				}
			}
		}

		// Check for labeled offcut instructions within last instruction
		else {
			try {
				Address chkAddr = exitPt.addNoWrap(1);
				SymbolIterator iter = symTable.getSymbolIterator(chkAddr, true);
				while (iter.hasNext()) {
					Symbol sym = iter.next();
					Address addr = sym.getAddress();
					if (addr.compareTo(end) > 0) {
						break;
					}
					Instruction ocInstr = listing.getInstructionAt(addr);
					if (ocInstr != null && ocInstr.getMaxAddress().compareTo(end) > 0) {
						additionalEntryPts.add(addr);
						end = ocInstr.getMaxAddress();
					}
				}
			}
			catch (AddressOverflowException e) {
			}
		}

		// Create and return block - keep min address as first entry point
		int cnt = additionalEntryPts.size();
		Address[] entryPts = new Address[cnt + 1];
		entryPts[0] = begin;
		for (int i = 0; i < cnt; i++) {
			entryPts[i + 1] = additionalEntryPts.get(i);
		}
		return createSimpleBlock(entryPts, begin, end);
	}
Get the basic code block starting at the specified instruction.
@param instr first instruction of basic block
@param monitor task monitor which allows user to cancel operation.
@return null if there is no codeblock starting at the specified instruction
@throws CancelledException if the monitor cancels the operation.
Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/program/model/block/SimpleBlockModel.java