Class CallDepthChangeInfo


  • public class CallDepthChangeInfo
    extends java.lang.Object
    Given a function in a program or the start of a function, record information about the change to a stack pointer from a subroutine call. The routine getCallChange() can be called with the address of a call instruction. If the stack could be tracked, the call instruction will return the change in the stack pointer that would result from a call to the function. The computation is based on a set of equations that are generated and solved. Each equation represents the stack change for a given basic flow block or call instruction within the function.
    • Constructor Detail

      • CallDepthChangeInfo

        public CallDepthChangeInfo​(Function func)
        Construct a new CallDepthChangeInfo object.
        Parameters:
        func - function to examine
      • CallDepthChangeInfo

        public CallDepthChangeInfo​(Function func,
                                   TaskMonitor monitor)
                            throws CancelledException
        Construct a new CallDepthChangeInfo object.
        Parameters:
        func - function to examine
        monitor - monitor used to cancel the operation
        Throws:
        CancelledException - if the operation was canceled
      • CallDepthChangeInfo

        public CallDepthChangeInfo​(Function function,
                                   AddressSetView restrictSet,
                                   Register frameReg,
                                   TaskMonitor monitor)
                            throws CancelledException
        Construct a new CallDepthChangeInfo object.
        Parameters:
        func - function to examine
        frameReg - register that is to have it's depth(value) change tracked
        monitor - monitor used to cancel the operation
        Throws:
        CancelledException - if the operation was canceled
      • CallDepthChangeInfo

        public CallDepthChangeInfo​(Program program,
                                   Address addr,
                                   AddressSetView restrictSet,
                                   Register frameReg,
                                   TaskMonitor monitor)
                            throws CancelledException
        Construct a new CallDepthChangeInfo object.
        Parameters:
        program - program containing the function to examime
        restrictedSet - set of addresses to restrict flow flowing to.
        addr - address within the function to examine
        frameReg - register that is to have it's depth(value) change tracked
        monitor - monitor used to cancel the operation
        Throws:
        CancelledException - if the operation was canceled
    • Method Detail

      • getCallChange

        public int getCallChange​(Address addr)
      • getDepth

        public int getDepth​(Address addr)
      • getInstructionStackDepthChange

        public int getInstructionStackDepthChange​(Instruction instr)
        Inspect the instruction and return how it affects the stack depth. If the depth cannot be determined, then return that the stack depth change is unknown.
        Parameters:
        instr - instruction to analyze
        Returns:
        int change to stack depth if it can be determined, Function.UNKNOWN_STACK_DEPTH_CHANGE otherwise.
      • getStackDepthChange

        public static java.lang.Integer getStackDepthChange​(Program program,
                                                            Address address)
        Gets the stack depth change value that has been set at the indicated address.
        Parameters:
        program - the program to be checked
        address - the program address
        Returns:
        the stack depth change value or null if value has not been set
      • setStackDepthChange

        public static void setStackDepthChange​(Program program,
                                               Address address,
                                               int stackDepthChange)
                                        throws DuplicateNameException
        Sets a new value for the stack depth change at the indicated address.
        Parameters:
        program - the program where the value will be set
        address - the program address
        stackDepthChange - the new stack depth change value
        Throws:
        DuplicateNameException - if the property name for stack depth changes conflicted with another property tha has the same name.
      • removeStackDepthChange

        public static boolean removeStackDepthChange​(Program program,
                                                     Address address)
        Removes the value for the stack depth change at the indicated address.
        Parameters:
        program - the program where the value will be removed
        address - the program address
        Returns:
        true if a stack depth change existed at the indicated at the address and it was removed.
      • getStackDepthChanges

        public static AddressIterator getStackDepthChanges​(Program program,
                                                           AddressSetView addressSet)
        Gets an iterator indicating all the addresses that have a stack depth change value specified within a program's indicated address set.
        Parameters:
        program - the program to be checked
        addressSet - the set of addresses to check for a stack depth change value
        Returns:
        the address iterator indicating where stack depth change values have been set
      • smoothDepth

        public int smoothDepth​(Program program1,
                               Function func,
                               TaskMonitor monitor)
        Do a better job of tracking the stack by attempting to follow the data flow of the stack pointer as it moves in and out of other variables.
        Parameters:
        program1 - - program containing the function to analyze
        func - - function to analyze stack pointer references
      • getStackPurge

        public int getStackPurge()
        Checks the indicated function in the program to determine if it is a jump thunk through a function pointer.
        Parameters:
        func - the function to check
        monitor - status monitor for indicating progress and allowing cancel.
      • getStackOffset

        public int getStackOffset​(Instruction cu,
                                  int opIndex)
      • getSPDepth

        public int getSPDepth​(Address addr)
        Parameters:
        minAddress -
        Returns:
      • getRegDepth

        public int getRegDepth​(Address addr,
                               Register reg)
        Parameters:
        minAddress -
        Returns:
      • getRegValueRepresentation

        public java.lang.String getRegValueRepresentation​(Address addr,
                                                          Register reg)
        Parameters:
        minAddress -
        Returns: