public static String normalizeDwarfPath(String path, String baseDir) {
		if (StringUtils.isEmpty(baseDir)) {
			throw new IllegalArgumentException("baseDir cannot be empty");
		}
		Matcher matcher = dirNameValidator.matcher(baseDir);
		if (matcher.find()) {
			throw new IllegalArgumentException(
				"baseDir must consist of alphanumeric characters or underscores");
		}
		boolean based = false;
		if (path.startsWith("./")) {
			path = "/" + baseDir + path.substring(1);
			based = true;
		}
		path = FSUtilities.normalizeNativePath(path);
		try {
			URI uri = new URI("file", null, path, null).normalize();
			path = uri.getPath();
		}
		catch (URISyntaxException e) {
			throw new IllegalArgumentException("path not valid: " + e.getMessage());
		}
		int numDotDots = 0;
		while (path.startsWith("/..")) {
			path = path.substring(3);
			numDotDots += 1;
		}
		if (numDotDots == 0) {
			if (!based) {
				return path; // baseDir not necessary: path normalizes to absolute path without it 
			}
			if (path.startsWith("/" + baseDir)) {
				return path; // adding initial /baseDir was sufficient
			}
		}
		if (based) {
			numDotDots += 1; //initial baseDir was consumed by interior /../ during normalization
		}
		String count = numDotDots == 0 ? "" : "_" + Integer.toString(numDotDots);
		return "/" + baseDir + count + path;
	}
Normalizes paths encountered in DWARF debug info.
Relative paths are made absolute with base /{@code baseDir}/.  If normalization of "/../" 
subpaths results in a path "above" /{@code baseDir}/, the returned path will be based at 
"baseDir_i" where i is the count of initial "/../" in the normalized path.
Additionally, any backslashes are converted to forward slashes (backslashes can occur in
files produced by MinGW).
@param path path to normalize
@param baseDir name of artificial root directory
@return normalized path
@throws IllegalArgumentException if the path is not valid or if baseDir contains a
non-alphanumeric, non-underscore character
Ghidra/Features/Base/src/main/java/ghidra/util/SourceFileUtils.java