mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
Fixed gnu parser test by updating recent temp fix for rust symbols
This commit is contained in:
parent
c50d32c792
commit
1d43c4139c
1 changed files with 20 additions and 5 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue