Merge remote-tracking branch 'origin/GP-3993_Dan_asmContextHint--SQUASHED'

This commit is contained in:
Ryan Kurtz 2024-04-03 13:04:07 -04:00
commit baaadc2143
7 changed files with 254 additions and 21 deletions

View file

@ -25,4 +25,5 @@ import ghidra.app.plugin.assembler.sleigh.sem.AssemblyResolvedPatterns;
* language.
*/
public interface Assembler extends GenericAssembler<AssemblyResolvedPatterns> {
}

View file

@ -21,11 +21,25 @@ import ghidra.app.plugin.assembler.sleigh.parse.AssemblyParseResult;
import ghidra.app.plugin.assembler.sleigh.sem.*;
import ghidra.program.model.address.Address;
import ghidra.program.model.address.AddressOverflowException;
import ghidra.program.model.listing.Instruction;
import ghidra.program.model.listing.InstructionIterator;
import ghidra.program.model.lang.Language;
import ghidra.program.model.listing.*;
import ghidra.program.model.mem.MemoryAccessException;
public interface GenericAssembler<RP extends AssemblyResolvedPatterns> {
/**
* Get the language of this assembler
*
* @return the processor language
*/
public Language getLanguage();
/**
* If the assembler is bound to a program, get that program
*
* @return the program, or null
*/
public Program getProgram();
/**
* Assemble a sequence of instructions and place them at the given address.
*

View file

@ -104,6 +104,16 @@ public abstract class AbstractSleighAssembler<RP extends AssemblyResolvedPattern
protected abstract AbstractAssemblyTreeResolver<RP> newResolver(Address at,
AssemblyParseBranch tree, AssemblyPatternBlock ctx);
@Override
public SleighLanguage getLanguage() {
return lang;
}
@Override
public Program getProgram() {
return program;
}
@Override
public Instruction patchProgram(AssemblyResolvedPatterns res, Address at)
throws MemoryAccessException {
@ -193,6 +203,7 @@ public abstract class AbstractSleighAssembler<RP extends AssemblyResolvedPattern
@Override
public AssemblyResolutionResults resolveTree(AssemblyParseResult parse, Address at) {
AssemblyPatternBlock ctx = getContextAt(at);
// ctx.fillMask()?
return resolveTree(parse, at, ctx);
}