public static DWARFRegisterMappings readMappingForLang(Language lang) throws IOException {
		ResourceFile dwarfFile =
			DWARFUtil.getLanguageExternalFile(lang, DWARF_REGISTER_MAPPING_NAME);
		if (dwarfFile == null) {
			throw new IOException("Missing DWARF register mapping file for language " +
				lang.getLanguageID().getIdAsString());
		}
		if (!dwarfFile.exists()) {
			throw new IOException("Missing DWARF register mapping file " + dwarfFile +
				" for language " + lang.getLanguageID().getIdAsString());
		}

		SAXBuilder sax = XmlUtilities.createSecureSAXBuilder(false, false);
		try (InputStream fis = dwarfFile.getInputStream()) {
			Document doc = sax.build(fis);
			Element rootElem = doc.getRootElement();
			return readMappingFrom(rootElem, lang);
		}
		catch (JDOMException | IOException e) {
			Msg.error(DWARFRegisterMappingsManager.class,
				"Bad DWARF register mapping file " + dwarfFile, e);
			throw new IOException("Failed to read DWARF register mapping file " + dwarfFile, e);
		}
	}
Finds the DWARF register mapping information file specified in the
specified language's LDEF file and returns a new
{@link DWARFRegisterMappings} object containing the data read from that
file.
<p>
Throws {@link IOException} if the lang does not have a mapping or it is
invalid.

@param lang {@link Language} to read the matching DWARF register mappings
           for
@return a new {@link DWARFRegisterMappings} instance, created from
        information read from the {@link #DWARF_REGISTER_MAPPING_NAME}
        xml file referenced in the language's LDEF, never null.
@throws IOException if there is no DWARF register mapping file associated
            with the specified {@link Language} or if there was an error
            in the register mapping data.
Ghidra/Features/Base/src/main/java/ghidra/app/util/bin/format/dwarf/DWARFRegisterMappingsManager.java