Class LoopAndroidModel

  • Direct Known Subclasses:
    LoopKillAndroidModel

    public class LoopAndroidModel
    extends SingleStartAndroidModel
    Builds an Android Model incorporating two loops. Functions are inserted in sequence until ExecutionOrder.START_OF_LOOP is reached. This loop is closed later when AFTER_LOOP gets stepped over. Functions in MULTIPLE_TIMES_IN_LOOP are in a single inner loop. This structure may be used to model an Application where no state is kept over the restart of the Application (instance-state) or when the potential restart of the App shall be ignored. Builds an Android Model incorporating a single loop. This class models a single run of an Andoird-Component: E.g. The view of an Activity gets shown only once. The incorporated loop is wrapped around user-interaction methods. These are in the section MULTIPLE_TIMES_IN_LOOP. Aids in handling code to be inserted at given points into the model. Overload this class to change the structure of the model. When the model is being built the enterLABEL-functions are called when ever a label gets stepped over.

    You can then add instructions to the body using the insts-Instruction factory. Instructions don't have to be in ascending order. Instead they will be sorted by their IIndex once the model gets finished. If you want to add loops to the model you might want to have a look at AndroidModelParameterManager which aids in keeping track of SSA-Variables and adding Phi-Functions.

    • Method Detail

      • enterSTART_OF_LOOP

        protected int enterSTART_OF_LOOP​(int PC)
        Prepares the PC to get looped to. Thus it tries to assure a new basic block starts here. Additionally it reserves some space for the insertion of Phi-Functions. Gets called when Label ExecutionOrder.START_OF_LOOP got stepped over. In most cases you don't want to invoke this function directly but to use #enter(ExecutionOrder.START_OF_LOOP, int) instead Sideeffects: currentSection is updated, instructions are inserted into the body
        Overrides:
        enterSTART_OF_LOOP in class AbstractAndroidModel
        Parameters:
        PC - Program Counter instructions shall be placed at. In most cases you'll simply pass body.getNextProgramCounter()
        Returns:
        Program Counter after insertion of the code
      • enterAFTER_LOOP

        protected int enterAFTER_LOOP​(int PC)
        Loops to START_OF_LOOP. It inserts a gotoInstruction and fills the space reserved before with actual PhiInstructions Gets called when Label ExecutionOrder.AFTER_LOOP got stepped over. In most cases you don't want to invoke this function directly but to use #enter(ExecutionOrder.AFTER_LOOP, int) instead Sideeffects: currentSection is updated, instructions are inserted into the body
        Overrides:
        enterAFTER_LOOP in class AbstractAndroidModel
        Parameters:
        PC - Program Counter instructions shall be placed at. In most cases you'll simply pass body.getNextProgramCounter()
        Returns:
        Program Counter after insertion of the code
      • leaveAT_LAST

        protected int leaveAT_LAST​(int PC)
        Does not insert any special handling. Gets called when the model gets finished. In most cases you don't want to invoke this function directly but to use AbstractAndroidModel.finish(int) instead Sideeffects: instructions are inserted into the body
        Overrides:
        leaveAT_LAST in class AbstractAndroidModel
        Parameters:
        PC - Program Counter instructions shall be placed at. In most cases you'll simply pass body.getNextProgramCounter()
        Returns:
        Program Counter after insertion of the code