mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-06-01 04:24:47 +08:00
Merge remote-tracking branch 'origin/Ghidra_11.4'
This commit is contained in:
+7
@@ -44,6 +44,13 @@ public class AnyToAnyFunctionComparisonModel extends AbstractFunctionComparisonM
|
||||
}
|
||||
}
|
||||
|
||||
public AnyToAnyFunctionComparisonModel(Function left, Function right) {
|
||||
this.functions.add(left);
|
||||
this.functions.add(right);
|
||||
setActiveFunction(LEFT, left);
|
||||
setActiveFunction(RIGHT, right);
|
||||
}
|
||||
|
||||
public AnyToAnyFunctionComparisonModel(Function... functions) {
|
||||
this(Arrays.asList(functions));
|
||||
}
|
||||
|
||||
@@ -24,7 +24,8 @@ import org.apache.commons.lang3.ArrayUtils;
|
||||
|
||||
import ghidra.app.plugin.processors.sleigh.SleighLanguage;
|
||||
import ghidra.program.model.address.*;
|
||||
import ghidra.program.model.data.*;
|
||||
import ghidra.program.model.data.DataType;
|
||||
import ghidra.program.model.data.Undefined;
|
||||
import ghidra.program.model.lang.*;
|
||||
import ghidra.program.model.listing.*;
|
||||
import ghidra.program.model.mem.MemoryAccessException;
|
||||
@@ -35,7 +36,8 @@ import ghidra.program.model.scalar.Scalar;
|
||||
import ghidra.program.model.symbol.Reference;
|
||||
import ghidra.program.model.symbol.ReferenceIterator;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.exception.*;
|
||||
import ghidra.util.exception.AssertException;
|
||||
import ghidra.util.exception.DuplicateNameException;
|
||||
|
||||
|
||||
public class VarnodeContext implements ProcessorContext {
|
||||
@@ -1863,7 +1865,7 @@ public class VarnodeContext implements ProcessorContext {
|
||||
/**
|
||||
* Check if this is a bad address, or offset from a bad address
|
||||
*
|
||||
* @param varnode to check
|
||||
* @param v to check
|
||||
* @return true if should be treated as a constant for most purposes
|
||||
*/
|
||||
public boolean isBadAddress(Varnode v) {
|
||||
|
||||
+22
-2
@@ -25,8 +25,6 @@ import org.junit.Test;
|
||||
|
||||
import generic.test.AbstractGenericTest;
|
||||
import ghidra.app.services.FunctionComparisonService;
|
||||
import ghidra.features.base.codecompare.model.AnyToAnyFunctionComparisonModel;
|
||||
import ghidra.features.base.codecompare.model.FunctionComparisonModelListener;
|
||||
import ghidra.program.database.ProgramBuilder;
|
||||
import ghidra.program.model.data.ByteDataType;
|
||||
import ghidra.program.model.data.DataType;
|
||||
@@ -97,6 +95,28 @@ public class AnyToAnyFunctionComparisonModelTest extends AbstractGhidraHeadedInt
|
||||
assertEquals(b2, model.getActiveFunction(RIGHT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPairOfFunctionsInNaturalOrder() throws Exception {
|
||||
|
||||
model = new AnyToAnyFunctionComparisonModel(b1, b2);
|
||||
|
||||
assertEquals(List.of(b1, b2), model.getFunctions(LEFT));
|
||||
assertEquals(List.of(b1, b2), model.getFunctions(RIGHT));
|
||||
assertEquals(b1, model.getActiveFunction(LEFT));
|
||||
assertEquals(b2, model.getActiveFunction(RIGHT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testPairOfFunctionsOutOfNaturalOrder() throws Exception {
|
||||
|
||||
model = new AnyToAnyFunctionComparisonModel(b2, b1);
|
||||
|
||||
assertEquals(List.of(b1, b2), model.getFunctions(LEFT));
|
||||
assertEquals(List.of(b1, b2), model.getFunctions(RIGHT));
|
||||
assertEquals(b2, model.getActiveFunction(LEFT));
|
||||
assertEquals(b1, model.getActiveFunction(RIGHT));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleFunctions() throws Exception {
|
||||
assertEquals(List.of(a1, a2, b1, b2), model.getFunctions(LEFT));
|
||||
|
||||
Reference in New Issue
Block a user