Class LanguagePostUpgradeInstructionHandler


  • public abstract class LanguagePostUpgradeInstructionHandler
    extends java.lang.Object
    LanguagePostUpgradeInstructionHandler provides an abstract implementation of a post language-upgrade instruction modification handler. The Simple Language Translator facilitates the specification of such a handler implementation within a language translator specification file using the post_upgrade_handler element. Following a major-version language upgrade, the last translator invoked is given an opportunity to perform additional instruction modifications on the entire program.
    • Field Detail

      • program

        protected final Program program
    • Constructor Detail

      • LanguagePostUpgradeInstructionHandler

        public LanguagePostUpgradeInstructionHandler​(Program program)
        Constructor
        Parameters:
        program -
    • Method Detail

      • getDisassembler

        protected Disassembler getDisassembler()
        Get disassembler for the current program
        Returns:
        disassembler instance
      • fixupInstructions

        public abstract void fixupInstructions​(Language oldLanguage,
                                               TaskMonitor monitor)
                                        throws CancelledException
        Invoked after Program language upgrade has completed. Implementation of this method permits the final re-disassembled program to be examined/modified to address more complex language upgrades. This method will only be invoked on the latest translator, which means all complex multi-version post-upgrade concerns must factor in the complete language transition. The program's language information will still reflect the original pre-upgrade state, and if the program is undergoing a schema version upgrade as well, certain complex upgrades may not have been completed (e.g., Function and Variable changes). Program modifications should be restricted to instruction and instruction context changes only.
        Parameters:
        oldLanguage - the oldest language involved in the current upgrade translation (this is passed since this is the only fixup invocation which must handle the any relevant fixup complexities when transitioning from the specified oldLanguage).
        monitor - task monitor
        Throws:
        CancelledException - if upgrade cancelled
      • modifySingleInstructionContext

        protected void modifySingleInstructionContext​(Address addr,
                                                      RegisterValue contextValue,
                                                      boolean mergeContext)
        Repair the context and re-disassemble the instruction at the specified address.
        Parameters:
        addr - instruction address
        contextValue - new context value
        mergeContext - if true, the specified context value will be merged with the existing context at the specified address, otherwise the existing value will be replaced.