Merge remote-tracking branch 'origin/patch'

This commit is contained in:
Ryan Kurtz 2021-08-26 11:59:28 -04:00
commit 91aea06c98
7 changed files with 42 additions and 15 deletions

View file

@ -139,11 +139,9 @@ public class DBTraceInstructionsView extends AbstractBaseDBTraceDefinedUnitsView
lastInstruction = replaceIfNotNull(lastInstruction,
doAddInstructions(lifespan, delayed.iterator(), true));
}
else {
lastInstruction =
doCreateInstruction(lifespan, startAddress, prototype, protoInstr);
}
}
if (errorAddress != null && conflictCodeUnit == null &&
errorAddress.compareTo(startAddress) <= 0) {
// The disassembly error will be placed, but the remainder is skipped

View file

@ -29,6 +29,7 @@ import org.junit.runner.Description;
import com.google.common.collect.Range;
import ghidra.app.cmd.disassemble.ArmDisassembleCommand;
import ghidra.app.cmd.disassemble.MipsDisassembleCommand;
import ghidra.program.database.ProgramBuilder;
import ghidra.program.disassemble.Disassembler;
import ghidra.program.model.address.AddressOverflowException;
@ -209,10 +210,37 @@ public class DBTraceDisassemblerIntegrationTest extends AbstractGhidraHeadlessIn
new ArmDisassembleCommand(b.addr(0xb6fa2cdc), restricted, true);
thumbDis.applyTo(b.trace.getFixedProgramView(0), TaskMonitor.DUMMY);
CodeUnit cu1 = b.trace.getCodeManager().codeUnits().getAt(0, b.addr(0xb6fa2cdc));
DBTraceCodeUnitsMemoryView cuManager = b.trace.getCodeManager().codeUnits();
CodeUnit cu1 = cuManager.getAt(0, b.addr(0xb6fa2cdc));
assertEquals("push { r4, r5, r6, r7, r8, lr }", cu1.toString());
CodeUnit cu2 = b.trace.getCodeManager().codeUnits().getAt(0, b.addr(0xb6fa2ce0));
CodeUnit cu2 = cuManager.getAt(0, b.addr(0xb6fa2ce0));
assertEquals("sub sp,#0x1d8", cu2.toString());
}
}
@Test
@TestLanguage("MIPS:BE:64:default")
public void testDelaySlotSampleDBTrace() throws Exception {
try (UndoableTransaction tid = b.startTransaction()) {
DBTraceMemoryManager memory = b.trace.getMemoryManager();
memory.createRegion(".text", 0, b.range(0x120000000L, 0x120010000L),
Set.of(TraceMemoryFlag.READ, TraceMemoryFlag.EXECUTE));
memory.putBytes(0, b.addr(0x1200035b4L), b.buf(
// bal LAB_1200035bc
0x04, 0x11, 0x00, 0x01,
// _nop
0x00, 0x00, 0x00, 0x00));
AddressSet restricted = new AddressSet(b.addr(0x1200035b4L), b.addr(0x1200035bbL));
MipsDisassembleCommand mipsDis =
new MipsDisassembleCommand(b.addr(0x1200035b4L), restricted, false);
mipsDis.applyTo(b.trace.getFixedProgramView(0), TaskMonitor.DUMMY);
DBTraceCodeUnitsMemoryView cuManager = b.trace.getCodeManager().codeUnits();
CodeUnit cu1 = cuManager.getAt(0, b.addr(0x1200035b4L));
assertEquals("bal 0x1200035bc", cu1.toString());
CodeUnit cu2 = cuManager.getAt(0, b.addr(0x1200035b8L));
assertEquals("_nop", cu2.toString());
}
}
}

View file

@ -30,5 +30,5 @@
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="Framework Utility"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="ghidra.GhidraRun"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="Framework Utility"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+IgnoreUnrecognizedVMOptions -Djava.system.class.loader=ghidra.GhidraClassLoader -Xshare:off -Dfile.encoding=UTF8 -Duser.country=US -Duser.language=en -Dsun.java2d.pmoffscreen=false -Dsun.java2d.xrender=true -Dsun.java2d.d3d=false -Xdock:name=&quot;Ghidra&quot; -Dvisualvm.display.name=Ghidra -Dpython.console.encoding=UTF-8 -DContinuesInterceptor.disabled=true --illegal-access=permit"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-XX:+IgnoreUnrecognizedVMOptions -Djava.system.class.loader=ghidra.GhidraClassLoader -Xshare:off -Dfile.encoding=UTF8 -Duser.country=US -Duser.language=en -Dsun.java2d.pmoffscreen=false -Dsun.java2d.xrender=true -Dsun.java2d.d3d=false -Xdock:name=&quot;Ghidra&quot; -Dvisualvm.display.name=Ghidra -Dpython.console.encoding=UTF-8 --illegal-access=permit"/>
</launchConfiguration>

View file

@ -718,7 +718,7 @@ PARSER_END(CParser)
TOKEN_MGR_DECLS :
{
static int parenNesting = 0;
int parenNesting = 0;
}
SKIP :

View file

@ -437,7 +437,7 @@ public class PreProcessor {
private HashMap<String, Integer> alreadyDone;
// Toggle printing
private static int verboseLevel = 0;
private int verboseLevel = 0;
public int verboseLevel() {
int vl = verboseLevel;
@ -1125,6 +1125,7 @@ public class PreProcessor {
this.pathList = parent.pathList;
this.shift = parent.shift;
this.alreadyDone = parent.alreadyDone;
this.verboseLevel = parent.verboseLevel;
}
public PreProcessor(String[] args) throws ParseException {
@ -2174,7 +2175,7 @@ PPToken ValueExpression() :
// LEXICAL SCANNER SECTION
TOKEN_MGR_DECLS :
{
static int parenNesting = 0;
int parenNesting = 0;
}
<DEFAULT>

View file

@ -21,7 +21,7 @@ import net.sf.cglib.proxy.Enhancer;
public class ContinuesFactory implements GenericFactory {
private static final boolean disabled = Boolean.getBoolean("ContinuesInterceptor.disabled");
private static final boolean enabled = Boolean.getBoolean("ContinuesInterceptor.enabled");
private ExceptionHandler exceptionHandler;
@ -36,7 +36,7 @@ public class ContinuesFactory implements GenericFactory {
public Object create(Class<?> type, Object... args) {
try {
Object thing;
if (disabled) {
if (!enabled) {
Constructor<?> c = type.getConstructor(new Class<?>[0]);
thing = c.newInstance(args);
}

View file

@ -101,9 +101,9 @@ VMARGS=--illegal-access=permit
#VMARGS=-Ddisable.alternating.row.colors=true
# The ContinuesInterceptor allows the import process to proceed if parsing corrupted headers
# generates uncaught exceptions. Disabling it can be helpful when trying to debug what went
# wrong because the ContinuesIntercepter affects the usefulness of the stack trace.
#VMARGS=-DContinuesInterceptor.disabled=true
# generates uncaught exceptions. Its usage has been deprecated and will be removed in a future
# release of Ghidra. It is disabled by default.
#VMARGS=-DContinuesInterceptor.enabled=true
# Limit on XML parsing. See https://docs.oracle.com/javase/tutorial/jaxp/limits/limits.html
#VMARGS=-Djdk.xml.totalEntitySizeLimit=50000000