Merge remote-tracking branch 'origin/GT-0-dragonmacher-test-fixes-9-22-20'

This commit is contained in:
ghidra1 2020-09-22 17:47:59 -04:00
commit ad1a0107e5

View file

@ -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<String> 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.