diff --git a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/util/SymbolPathParser.java b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/util/SymbolPathParser.java index 17b855a6a4..ede72c9508 100644 --- a/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/util/SymbolPathParser.java +++ b/Ghidra/Framework/SoftwareModeling/src/main/java/ghidra/app/util/SymbolPathParser.java @@ -32,6 +32,8 @@ import ghidra.program.model.symbol.Namespace; */ public class SymbolPathParser { + private static String ANONYMOUS_NAMESPACE = "(anonymous_namespace)"; + /** * Parses a String pathname into its constituent namespace and name components. * The list does not contain the global namespace, which is implied, but then @@ -45,11 +47,8 @@ public class SymbolPathParser { throw new IllegalArgumentException( "Symbol list must contain at least one symbol name!"); } -// if (name.indexOf(Namespace.DELIMITER) == -1) { - // following is temporary kludge due to struct (blah). TODO: figure/fix - // This particular test for starting with the open parenthesis is to work around a type - // seen in "Rust." - if (name.startsWith("(") || name.indexOf(Namespace.DELIMITER) == -1) { + + if (skipParsing(name)) { List list = new ArrayList<>(); list.add(name); return list; @@ -57,6 +56,22 @@ public class SymbolPathParser { return naiveParse(name); } + private static boolean skipParsing(String name) { + + // if (name.indexOf(Namespace.DELIMITER) == -1) { + // following is temporary kludge due to struct (blah). TODO: figure/fix + // This particular test for starting with the open parenthesis is to work around a type + // seen in "Rust." + if (name.startsWith("(")) { + // anonymous namespace is a gnu c++ construct. We do not have any way of modeling + // this yet, but still wish not to lose this information, so we do not strip it out of + // the name when parsing gnu demangled symbols. + return !name.startsWith(ANONYMOUS_NAMESPACE); + } + + return !name.contains(Namespace.DELIMITER); + } + /** * Naive parsing that assumes evenly matched angle brackets (templates) with no operator * overloading that contains these and no other rule breakers.