mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2024-11-21 19:42:14 +00:00
Merge remote-tracking branch 'origin/GP-705-dragonmacher-gnu-demangler-regex-fixes' into patch
This commit is contained in:
commit
d12d1ec739
@ -57,19 +57,38 @@ public abstract class AbstractDemanglerAnalyzer extends AbstractAnalyzer {
|
||||
public boolean added(Program program, AddressSetView set, TaskMonitor monitor, MessageLog log)
|
||||
throws CancelledException {
|
||||
|
||||
try {
|
||||
monitor.setIndeterminate(true);
|
||||
return doAdded(program, set, monitor, log);
|
||||
}
|
||||
finally {
|
||||
monitor.setIndeterminate(false);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean doAdded(Program program, AddressSetView set, TaskMonitor monitor,
|
||||
MessageLog log)
|
||||
throws CancelledException {
|
||||
|
||||
DemanglerOptions options = getOptions();
|
||||
if (!validateOptions(options, log)) {
|
||||
log.appendMsg(getName(), "Invalid demangler options--cannot demangle");
|
||||
return false;
|
||||
}
|
||||
|
||||
monitor.initialize(100);
|
||||
int count = 0;
|
||||
|
||||
String defaultMessage = monitor.getMessage();
|
||||
|
||||
SymbolTable symbolTable = program.getSymbolTable();
|
||||
SymbolIterator it = symbolTable.getPrimarySymbolIterator(set, true);
|
||||
while (it.hasNext()) {
|
||||
monitor.checkCanceled();
|
||||
|
||||
if (++count % 100 == 0) {
|
||||
monitor.setMessage(defaultMessage + " - " + count + " symbols");
|
||||
}
|
||||
|
||||
Symbol symbol = it.next();
|
||||
if (skipSymbol(symbol)) {
|
||||
continue;
|
||||
@ -81,12 +100,6 @@ public abstract class AbstractDemanglerAnalyzer extends AbstractAnalyzer {
|
||||
if (demangled != null) {
|
||||
apply(program, address, demangled, options, log, monitor);
|
||||
}
|
||||
|
||||
Address min = set.getMinAddress();
|
||||
Address max = set.getMaxAddress();
|
||||
int distance = (int) (address.getOffset() - min.getOffset());
|
||||
int percent = (int) ((distance / max.getOffset()) * 100);
|
||||
monitor.setProgress(percent);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -244,6 +244,8 @@ public class GnuDemanglerParser {
|
||||
*
|
||||
* Parts:
|
||||
* -required text (capture group 2)
|
||||
* --note: this uses '++', a possessive quantifier, to help keep the
|
||||
* backtracking to a minimum
|
||||
* -a space
|
||||
* -'for' or 'to' (capture group 3)
|
||||
* -a space
|
||||
@ -262,7 +264,7 @@ public class GnuDemanglerParser {
|
||||
* non-virtual thunk to
|
||||
*/
|
||||
private static final Pattern DESCRIPTIVE_PREFIX_PATTERN =
|
||||
Pattern.compile("((.+ )+(for|to) )(.+)");
|
||||
Pattern.compile("((.+ )(for|to) )(.+)");
|
||||
|
||||
/**
|
||||
* The c 'decltype' keyword pattern
|
||||
@ -307,7 +309,7 @@ public class GnuDemanglerParser {
|
||||
// note: this capture group seems to fail with excessive templating
|
||||
String operatorTemplates = "(<.+>){0,1}";
|
||||
String operatorPrefix =
|
||||
".*(.*" + OPERATOR + "(" + alternated + ")\\s*" + operatorTemplates + ".*)\\s*";
|
||||
"(.*" + OPERATOR + "(" + alternated + ")\\s*" + operatorTemplates + ")\\s*";
|
||||
String parameters = "(\\(.*\\))";
|
||||
String trailing = "(.*)";
|
||||
|
||||
|
@ -78,7 +78,7 @@ class ClassPackage extends ClassLocation {
|
||||
pkg = packageName + "." + pkg;
|
||||
}
|
||||
|
||||
monitor.setMessage("scanning package: " + pkg);
|
||||
monitor.setMessage("Scanning package: " + pkg);
|
||||
children.add(new ClassPackage(rootDir, pkg, monitor));
|
||||
}
|
||||
}
|
||||
|
@ -222,7 +222,7 @@ public final class LocalTreeNodeHandler
|
||||
|
||||
GTreeNode copyNode = toCopy.get(i);
|
||||
monitor.setMessage(
|
||||
"Processing file " + i + " of " + size + ": " + copyNode.getName());
|
||||
"Processing file " + (i + 1) + " of " + size + ": " + copyNode.getName());
|
||||
|
||||
add(destination, copyNode, dropAction, subMonitors[i]);
|
||||
monitor.setProgress(i);
|
||||
|
Loading…
Reference in New Issue
Block a user