GP-2504,GP-2494 Arm switch patterns moved into pattern matching, adding additional pattern, fixed issues in function start patterns and validcode precondition. Added after='ptr'.

This commit is contained in:
emteere 2022-10-03 22:02:19 -04:00
parent 183a487363
commit b9496de7f5
21 changed files with 784 additions and 449 deletions

View file

@ -324,10 +324,11 @@ public class EHDataTypeUtilities {
public static boolean createFunctionIfNeeded(Program program, Address functionAddress) {
// If there isn't an instruction at the function address yet, then disassemble there.
Listing listing = program.getListing();
functionAddress =
Address normalizedFunctionAddress =
PseudoDisassembler.getNormalizedDisassemblyAddress(program, functionAddress);
Instruction inst = listing.getInstructionAt(functionAddress);
Instruction inst = listing.getInstructionAt(normalizedFunctionAddress);
if (inst == null) {
functionAddress = PseudoDisassembler.setTargeContextForDisassembly(program, functionAddress);
DisassembleCommand cmd = new DisassembleCommand(functionAddress, null, true);
if (!cmd.applyTo(program) || cmd.getDisassembledAddressSet().isEmpty()) {
Msg.error(EHDataTypeUtilities.class, "Failed to disassemble at " + functionAddress);
@ -337,12 +338,12 @@ public class EHDataTypeUtilities {
// If there isn't a function at the function address yet, then try to create one there.
FunctionManager functionManager = program.getFunctionManager();
Function function = functionManager.getFunctionAt(functionAddress);
Function function = functionManager.getFunctionAt(normalizedFunctionAddress);
if (function == null) {
CreateFunctionCmd cmd = new CreateFunctionCmd(functionAddress);
CreateFunctionCmd cmd = new CreateFunctionCmd(normalizedFunctionAddress);
if (!cmd.applyTo(program)) {
Msg.error(EHDataTypeUtilities.class,
"Failed to create function at " + functionAddress);
"Failed to create function at " + normalizedFunctionAddress);
return false;
}
}