Class CreateFunctionCmd

  • All Implemented Interfaces:
    Command

    public class CreateFunctionCmd
    extends BackgroundCommand
    Command for Creating a function at an address. It will copy off the parameters used to create the function (Selection or just an address) and create the function on redo and clear on undo.
    • Constructor Detail

      • CreateFunctionCmd

        public CreateFunctionCmd​(java.lang.String name,
                                 AddressSetView entries,
                                 AddressSetView body,
                                 SourceType source,
                                 boolean findEntryPoint,
                                 boolean recreateFunction)
        Constructs a new command for creating a function. The default name for a function is the name associated with the current primary symbol which will be removed.
        Parameters:
        name - function name or null for default name.
        entries - the entry points at which to create functions.
        body - set of addresses to associated with the function to be created. The addresses must not already be included in the body of any existing function.
        source - the source of this function
        findEntryPoint - true if the entry point should be computed (entry could be in the middle of a function)
        recreateFunction - true if the function body should be recreated even if the function exists.
      • CreateFunctionCmd

        public CreateFunctionCmd​(java.lang.String name,
                                 Address entry,
                                 AddressSetView body,
                                 SourceType source,
                                 boolean findEntryPoint,
                                 boolean recreateFunction)
        Constructs a new command for creating a function. The default name for a function is the name associated with the current primary symbol which will be removed.
        Parameters:
        name - function name or null for default name.
        entry - entry point address for the function to be created.
        body - set of addresses to associated with the function to be created. The addresses must not already be included in the body of any existing function.
        source - the source of this function
        findEntryPoint - true if the entry point should be computed (entry could be in the middle of a function)
        recreateFunction - true if the function body should be recreated even if the function exists.
      • CreateFunctionCmd

        public CreateFunctionCmd​(AddressSetView entries,
                                 boolean findEntryPoint)
        Constructs a new command for creating functions that automatically computes the body of each function.
        Parameters:
        entries - the entry points at which to create functions.
      • CreateFunctionCmd

        public CreateFunctionCmd​(AddressSetView entries)
        Constructs a new command for creating functions that automatically computes the body of each function.
        Parameters:
        entries - the entry points at which to create functions.
      • CreateFunctionCmd

        public CreateFunctionCmd​(AddressSetView entries,
                                 SourceType source)
        Constructs a new command for creating functions that automatically computes the body of each function.
        Parameters:
        entries - the entry points at which to create functions.
      • CreateFunctionCmd

        public CreateFunctionCmd​(Address entry)
        Constructs a new command for creating a function that automatically computes the body of the function.
        Parameters:
        entry - the entry point at which to create a function.
      • CreateFunctionCmd

        public CreateFunctionCmd​(Address entry,
                                 boolean findEntryPoint)
    • Method Detail

      • getFunction

        public Function getFunction()
        Returns function if create command was successful
      • getFunctionBody

        public static AddressSetView getFunctionBody​(TaskMonitor monitor,
                                                     Program program,
                                                     Address entry)
                                              throws CancelledException
        Find the function body by following all flows other than a call from the entry point.
        Parameters:
        program - the program where the function is being created.
        entry - entry point to start tracing flow
        Returns:
        AddressSetView address set representing the body of the function
        Throws:
        CancelledException
      • getFunctionBody

        public static AddressSetView getFunctionBody​(Program program,
                                                     Address entry)
        Find the function body by following all flows other than a call from the entry point.
        Parameters:
        program - the program where the function is being created.
        entry - entry point to start tracing flow
        Returns:
        AddressSetView address set representing the body of the function
      • fixupFunctionBody

        public static boolean fixupFunctionBody​(Program program,
                                                Instruction start_inst,
                                                TaskMonitor monitor)
                                         throws CancelledException
        Recompute function body. An open transaction must already exist.
        Parameters:
        program - the program the function is in.
        start_inst - instruction that is within the function to be fixed up.
        monitor - task monitor
        Returns:
        true if successful, false if cancelled or unable to fixup function or no function found containing the start address of the indicated instruction
        Throws:
        CancelledException
      • fixupFunctionBody

        public static boolean fixupFunctionBody​(Program program,
                                                Function func,
                                                TaskMonitor monitor)
                                         throws CancelledException
        Recompute function body. An open transaction must already exist.
        Parameters:
        program - the program the function is in.
        function - the function to be fixed up. A null function will return false.
        monitor - task monitor
        Returns:
        true if successful, false if cancelled or unable to fixup function or no function found containing the start address of the indicated instruction
        Throws:
        CancelledException