public static DWARFSectionProvider createExternalSectionProviderFor(Program program,
			TaskMonitor monitor) {
		try {
			ExternalDebugInfo extDebugInfo = ExternalDebugInfo.fromProgram(program);
			if (extDebugInfo == null) {
				return null;
			}
			Msg.info(ExternalDebugFileSectionProvider.class,
				"DWARF external debug information found: " + extDebugInfo);
			ExternalDebugFilesService edfs =
				DWARFExternalDebugFilesPlugin.getExternalDebugFilesService(
					SearchLocationRegistry.getInstance().newContext(program));
			FSRL extDebugFile = edfs.findDebugFile(extDebugInfo, monitor);
			if (extDebugFile == null) {
				return null;
			}
			Msg.info(ExternalDebugFileSectionProvider.class,
				"DWARF External Debug File: found: " + extDebugFile);
			FileSystemService fsService = FileSystemService.getInstance();
			try (
					RefdFile refdDebugFile = fsService.getRefdFile(extDebugFile, monitor);
					ByteProvider debugFileByteProvider =
						fsService.getByteProvider(refdDebugFile.file.getFSRL(), false, monitor);) {
				Object consumer = new Object();
				Language lang = program.getLanguage();
				LoadSpec origLoadSpec = ImporterUtilities.getLoadSpec(program);
				if (origLoadSpec == null) {
					return null;
				}

				CompilerSpec compSpec = origLoadSpec.getLanguageCompilerSpec().getCompilerSpec();

				Program debugProgram =
					new ProgramDB("temp external debug info for " + program.getName(), lang,
						compSpec, consumer);

				Loader origLoader = origLoadSpec.getLoader();
				List<Option> defaultOptions = origLoader.getDefaultOptions(debugFileByteProvider,
					origLoadSpec, debugProgram, false);

				ElfLoader elfLoader = new ElfLoader();
				elfLoader.load(debugFileByteProvider, null, defaultOptions, debugProgram, monitor,
					new MessageLog());

				ExternalDebugFileSectionProvider result = new ExternalDebugFileSectionProvider(
					debugProgram, debugFileByteProvider.getFSRL());
				debugProgram.release(consumer);
				return result;
			}
		}
		catch (IOException | CancelledException e) {
			// fall thru
		}
		return null;
	}
A {@link DWARFSectionProvider} that reads .debug_info (and friends) sections from an external
ELF file that is referenced in the original ELF file's build-id or debuglink sections.
<p>
Creates a pinning reference from the temporary external ELF debug file to this SectionProvider
instance using the program's {@link Program#addConsumer(Object)}, and then releases the
consumer when this instance is closed, allowing the temporary Program to be destroyed.
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/sectionprovider/ExternalDebugFileSectionProvider.java