Merge remote-tracking branch 'origin/patch'

This commit is contained in:
ghidra1 2021-02-23 12:56:10 -05:00
commit 8e90dfda7e
5 changed files with 38 additions and 13 deletions

View file

@ -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;

View file

@ -240,6 +240,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
@ -258,7 +260,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
@ -303,7 +305,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 = "(.*)";

View file

@ -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));
}
}

View file

@ -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);

View file

@ -155,15 +155,25 @@ public class PIC30_ElfRelocationHandler extends ElfRelocationHandler {
if (elf.e_machine() == ElfConstants.EM_DSPIC30F) {
switch (type) {
case R_PIC30_16: // 2
newValue = (symbolValue + addend + oldShortValue) & 0xffff;
case R_PIC30_FILE_REG_WORD: // 6
newValue = (symbolValue + addend + oldShortValue);
memory.setShort(relocationAddress, (short) newValue);
break;
case R_PIC30_32: // 3
newValue = symbolValue + addend + oldValue;
memory.setInt(relocationAddress, newValue);
break;
case R_PIC30_FILE_REG_BYTE: // 4 short
case R_PIC30_FILE_REG: // 5 short
int reloc = symbolValue;
reloc += addend;
reloc += oldShortValue;
reloc &= 0x1fff;
newValue = reloc | (oldShortValue & ~0x1fff);
memory.setShort(relocationAddress, (short) newValue);
break;
case R_PIC30_FILE_REG_WORD_WITH_DST: // 7
int reloc = symbolValue >> 1;
reloc = symbolValue >> 1;
reloc += addend;
reloc += oldValue >> 4;
reloc &= 0x7fff;