GP-2099: Add Disassemble and Patch actions for polyglot traces.

This commit is contained in:
Dan 2022-06-24 13:06:20 -04:00
parent 78de8e6d49
commit bec99cd71e
66 changed files with 2214 additions and 774 deletions

View file

@ -702,6 +702,10 @@ public class AssemblyResolvedPatterns extends AssemblyResolution {
* @return the iterable
*/
public Iterable<byte[]> possibleInsVals(AssemblyPatternBlock forCtx) {
AssemblyPatternBlock ctxCompat = ctx.combine(forCtx);
if (ctxCompat == null) {
return List.of();
}
Predicate<byte[]> removeForbidden = (byte[] val) -> {
for (AssemblyResolvedPatterns f : forbids) {
// If the forbidden length is larger than us, we can ignore it

View file

@ -70,6 +70,11 @@ public class ARMAssemblyTest extends AbstractAssemblyTest {
assertOneCompatRestExact("ands r0,r5", "28:40", THUMB, 0x00400000, "ands r0,r5");
}
@Test
public void testAssemble_T_movs_r0_r0() {
assertOneCompatRestExact("movs r0,r0", "00:00", THUMB, 0x00400000, "movs r0,r0");
}
@Test
public void testAssemble_T_bl_0x00008000() {
// What makes this different from the above test is that it jumps backward

View file

@ -200,9 +200,8 @@ public abstract class AbstractAssemblyTest extends AbstractGenericTest {
*/
protected void checkAllExact(AssemblyResolutionResults rr, Collection<String> disassembly,
long addr, String ctxstr) {
final AssemblyPatternBlock ctx =
(ctxstr == null ? context.getDefault() : AssemblyPatternBlock.fromString(ctxstr))
.fillMask();
final AssemblyPatternBlock ctx = (ctxstr == null ? context.getDefault()
: AssemblyPatternBlock.fromString(ctxstr)).fillMask();
dbg.println("Checking each: " + disassembly + " ctx:" + ctx);
boolean gotOne = false;
boolean failedOne = false;