Package ghidra.trace.database.program

# Class DBTraceProgramViewFunctionManager

java.lang.Object
ghidra.trace.database.program.DBTraceProgramViewFunctionManager

All Implemented Interfaces:
  `ManagerDB`, `FunctionManager`

public class DBTraceProgramViewFunctionManager extends Object implements FunctionManager

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `protected final DBTraceNamespaceSymbol`
  `global`
  `protected final DBTraceProgramView`
  `program`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DBTraceProgramViewFunctionManager(DBTraceProgramView program)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Function`
  `createFunction(String name, Address entryPoint, AddressSetView body, SourceType source)`
  Create a function with the given body at entry point within the global namespace.
  `Function`
  `createFunction(String name, Namespace nameSpace, Address entryPoint, AddressSetView body, SourceType source)`
  Create a function with the given body at entry point.
  `Function`
  `createThunkFunction(String name, Namespace nameSpace, Address entryPoint, AddressSetView body, Function thunkedFunction, SourceType source)`
  Create a thunk function with the given body at entry point.
  `void`
  `deleteAddressRange(Address startAddr, Address endAddr, TaskMonitor monitor)`
  Delete all objects which have been applied to the address range startAddr to endAddr and update the database accordingly.
  `PrototypeModel`
  `getCallingConvention(String name)`
  Gets the prototype model of the calling convention with the specified name in this program
  `Collection<String>`
  `getCallingConventionNames()`
  Get the ordered list of defined calling convention names.
  `PrototypeModel`
  `getDefaultCallingConvention()`
  Gets the default calling convention's prototype model in this program.
  `FunctionIterator`
  `getExternalFunctions()`
  Get an iterator over all external functions.
  `Function`
  `getFunction(long key)`
  Get a Function object by its key
  `Function`
  `getFunctionAt(Address entryPoint)`
  Get the function at entryPoint
  `Function`
  `getFunctionContaining(Address addr)`
  Get a function containing an address.
  `int`
  `getFunctionCount()`
  Returns the total number of functions in the program including external functions
  `FunctionIterator`
  `getFunctions(boolean forward)`
  Returns an iterator over all non-external functions in address (entry point) order
  `FunctionIterator`
  `getFunctions(Address start, boolean forward)`
  Get an iterator over non-external functions starting at an address and ordered by entry address
  `FunctionIterator`
  `getFunctions(AddressSetView asv, boolean forward)`
  Get an iterator over functions with entry points in the specified address set.
  `FunctionIterator`
  `getFunctionsNoStubs(boolean forward)`
  Returns an iterator over all REAL functions in address (entry point) order (real functions have instructions, and aren't stubs)
  `FunctionIterator`
  `getFunctionsNoStubs(Address start, boolean forward)`
  Get an iterator over REAL functions starting at an address and ordered by entry address (real functions have instructions, and aren't stubs).
  `FunctionIterator`
  `getFunctionsNoStubs(AddressSetView asv, boolean forward)`
  Get an iterator over REAL functions with entry points in the specified address set (real functions have instructions, and aren't stubs).
  `Iterator<Function>`
  `getFunctionsOverlapping(AddressSetView set)`
  Return an iterator over functions that overlap the given address set.
  `FunctionTagManager`
  `getFunctionTagManager()`
  Returns the function tag manager
  `Program`
  `getProgram()`
  Returns this manager's program
  `Function`
  `getReferencedFunction(Address address)`
  Get the function which resides at the specified address or is referenced from the specified address
  `Variable`
  `getReferencedVariable(Address instrAddr, Address storageAddr, int size, boolean isRead)`
  Attempts to determine which if any of the local functions variables are referenced by the specified reference.
  `void`
  `invalidateCache(boolean all)`
  Clears all data caches
  `boolean`
  `isInFunction(Address addr)`
  Check if this address contains a function.
  `void`
  `moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor)`
  Move all objects within an address range to a new location
  `void`
  `programReady(OpenMode openMode, int currentRevision, TaskMonitor monitor)`
  Callback from program made to each manager after the program has completed initialization.
  `boolean`
  `removeFunction(Address entryPoint)`
  Remove a function defined at entryPoint
  `void`
  `setProgram(ProgramDB program)`
  Callback from program used to indicate all manager have been created.

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

  ### Methods inherited from interface ghidra.program.database.ManagerDB

  `dispose`

- ## Field Details

  - ### program

    protected final DBTraceProgramView program

  - ### global

    protected final DBTraceNamespaceSymbol global

- ## Constructor Details

  - ### DBTraceProgramViewFunctionManager

    public DBTraceProgramViewFunctionManager(DBTraceProgramView program)

- ## Method Details

  - ### getProgram

    public Program getProgram()
    Description copied from interface: `FunctionManager`
    Returns this manager's program
    Specified by:
      `getProgram` in interface `FunctionManager`
    Returns:
      the program

  - ### getFunctionTagManager

    public FunctionTagManager getFunctionTagManager()
    Description copied from interface: `FunctionManager`
    Returns the function tag manager
    Specified by:
      `getFunctionTagManager` in interface `FunctionManager`
    Returns:
      the function tag manager

  - ### getCallingConventionNames

    public Collection<String> getCallingConventionNames()
    Description copied from interface: `FunctionManager`
    Get the ordered list of defined calling convention names. The reserved names "unknown" and "default" are not included. The returned collection may not include all names referenced by various functions and function-definitions. This set is limited to those defined by the associated compiler specification. See `DataTypeManager.getDefinedCallingConventionNames()`.

    For a set of all known names (including those that are not defined by compiler spec) see `DataTypeManager.getKnownCallingConventionNames()`.

    Specified by:
      `getCallingConventionNames` in interface `FunctionManager`
    Returns:
      the calling convention names.

  - ### getDefaultCallingConvention

    public PrototypeModel getDefaultCallingConvention()
    Description copied from interface: `FunctionManager`
    Gets the default calling convention's prototype model in this program.
    Specified by:
      `getDefaultCallingConvention` in interface `FunctionManager`
    Returns:
      the default calling convention prototype model or null.

  - ### getCallingConvention

    public PrototypeModel getCallingConvention(String name)
    Description copied from interface: `FunctionManager`
    Gets the prototype model of the calling convention with the specified name in this program
    Specified by:
      `getCallingConvention` in interface `FunctionManager`
    Parameters:
      `name` - the calling convention name
    Returns:
      the named function calling convention prototype model or null.

  - ### createFunction

    public Function createFunction(String name, Address entryPoint, AddressSetView body, SourceType source) throws InvalidInputException, OverlappingFunctionException
    Description copied from interface: `FunctionManager`
    Create a function with the given body at entry point within the global namespace.
    Specified by:
      `createFunction` in interface `FunctionManager`
    Parameters:
      `name` - the name of the new function or null for default name
      `entryPoint` - entry point of function
      `body` - addresses contained in the function body
      `source` - the source of this function
    Returns:
      new function or null if one or more functions overlap the specified body address set.
    Throws:
      `InvalidInputException` - if the name has invalid characters
      `OverlappingFunctionException` - if the address set of the body overlaps an existing function

  - ### createFunction

    public Function createFunction(String name, Namespace nameSpace, Address entryPoint, AddressSetView body, SourceType source) throws InvalidInputException, OverlappingFunctionException
    Description copied from interface: `FunctionManager`
    Create a function with the given body at entry point.
    Specified by:
      `createFunction` in interface `FunctionManager`
    Parameters:
      `name` - the name of the new function or null for default name
      `nameSpace` - the nameSpace in which to create the function
      `entryPoint` - entry point of function
      `body` - addresses contained in the function body
      `source` - the source of this function
    Returns:
      new function or null if one or more functions overlap the specified body address set.
    Throws:
      `InvalidInputException` - if the name has invalid characters
      `OverlappingFunctionException` - if the address set of the body overlaps an existing function

  - ### createThunkFunction

    public Function createThunkFunction(String name, Namespace nameSpace, Address entryPoint, AddressSetView body, Function thunkedFunction, SourceType source) throws OverlappingFunctionException
    Description copied from interface: `FunctionManager`
    Create a thunk function with the given body at entry point.
    Specified by:
      `createThunkFunction` in interface `FunctionManager`
    Parameters:
      `name` - the name of the new function or null for default name
      `nameSpace` - the nameSpace in which to create the function
      `entryPoint` - entry point of function
      `body` - addresses contained in the function body
      `thunkedFunction` - referenced function (required is creating a thunk function)
      `source` - the source of this function
    Returns:
      new function or null if one or more functions overlap the specified body address set.
    Throws:
      `OverlappingFunctionException` - if the address set of the body overlaps an existing function

  - ### getFunctionCount

    public int getFunctionCount()
    Description copied from interface: `FunctionManager`
    Returns the total number of functions in the program including external functions
    Specified by:
      `getFunctionCount` in interface `FunctionManager`
    Returns:
      the count

  - ### removeFunction

    public boolean removeFunction(Address entryPoint)
    Description copied from interface: `FunctionManager`
    Remove a function defined at entryPoint
    Specified by:
      `removeFunction` in interface `FunctionManager`
    Parameters:
      `entryPoint` - the entry point
    Returns:
      true if the function was removed

  - ### getFunctionAt

    public Function getFunctionAt(Address entryPoint)
    Description copied from interface: `FunctionManager`
    Get the function at entryPoint
    Specified by:
      `getFunctionAt` in interface `FunctionManager`
    Parameters:
      `entryPoint` - the entry point
    Returns:
      null if there is no function at entryPoint

  - ### getReferencedFunction

    public Function getReferencedFunction(Address address)
    Description copied from interface: `FunctionManager`
    Get the function which resides at the specified address or is referenced from the specified address
    Specified by:
      `getReferencedFunction` in interface `FunctionManager`
    Parameters:
      `address` - function address or address of pointer to a function.
    Returns:
      referenced function or null

  - ### getFunctionContaining

    public Function getFunctionContaining(Address addr)
    Description copied from interface: `FunctionManager`
    Get a function containing an address.
    Specified by:
      `getFunctionContaining` in interface `FunctionManager`
    Parameters:
      `addr` - address within the function
    Returns:
      function containing this address, null otherwise

  - ### getFunctions

    public FunctionIterator getFunctions(boolean forward)
    Description copied from interface: `FunctionManager`
    Returns an iterator over all non-external functions in address (entry point) order
    Specified by:
      `getFunctions` in interface `FunctionManager`
    Parameters:
      `forward` - true means to iterate in ascending address order
    Returns:
      the iterator

  - ### getFunctions

    public FunctionIterator getFunctions(Address start, boolean forward)
    Description copied from interface: `FunctionManager`
    Get an iterator over non-external functions starting at an address and ordered by entry address
    Specified by:
      `getFunctions` in interface `FunctionManager`
    Parameters:
      `start` - starting address
      `forward` - true means to iterate in ascending address order
    Returns:
      an iterator over functions.

  - ### getFunctions

    public FunctionIterator getFunctions(AddressSetView asv, boolean forward)
    Description copied from interface: `FunctionManager`
    Get an iterator over functions with entry points in the specified address set. Function are ordered based upon entry address.
    Specified by:
      `getFunctions` in interface `FunctionManager`
    Parameters:
      `asv` - address set to iterate over
      `forward` - true means to iterate in ascending address order
    Returns:
      an iterator over functions.

  - ### getFunctionsNoStubs

    public FunctionIterator getFunctionsNoStubs(boolean forward)
    Description copied from interface: `FunctionManager`
    Returns an iterator over all REAL functions in address (entry point) order (real functions have instructions, and aren't stubs)
    Specified by:
      `getFunctionsNoStubs` in interface `FunctionManager`
    Parameters:
      `forward` - true means to iterate in ascending address order
    Returns:
      the iterator

  - ### getFunctionsNoStubs

    public FunctionIterator getFunctionsNoStubs(Address start, boolean forward)
    Description copied from interface: `FunctionManager`
    Get an iterator over REAL functions starting at an address and ordered by entry address (real functions have instructions, and aren't stubs).
    Specified by:
      `getFunctionsNoStubs` in interface `FunctionManager`
    Parameters:
      `start` - starting address
      `forward` - true means to iterate in ascending address order
    Returns:
      an iterator over functions.

  - ### getFunctionsNoStubs

    public FunctionIterator getFunctionsNoStubs(AddressSetView asv, boolean forward)
    Description copied from interface: `FunctionManager`
    Get an iterator over REAL functions with entry points in the specified address set (real functions have instructions, and aren't stubs). Functions are ordered based upon entry address.
    Specified by:
      `getFunctionsNoStubs` in interface `FunctionManager`
    Parameters:
      `asv` - address set to iterate over
      `forward` - true means to iterate in ascending address order
    Returns:
      an iterator over functions.

  - ### getExternalFunctions

    public FunctionIterator getExternalFunctions()
    Description copied from interface: `FunctionManager`
    Get an iterator over all external functions. Functions returned have no particular order.
    Specified by:
      `getExternalFunctions` in interface `FunctionManager`
    Returns:
      an iterator over external functions

  - ### isInFunction

    public boolean isInFunction(Address addr)
    Description copied from interface: `FunctionManager`
    Check if this address contains a function.
    Specified by:
      `isInFunction` in interface `FunctionManager`
    Parameters:
      `addr` - address to check
    Returns:
      true if this address is contained in a function.

  - ### moveAddressRange

    public void moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor) throws CancelledException
    Description copied from interface: `FunctionManager`
    Move all objects within an address range to a new location
    Specified by:
      `moveAddressRange` in interface `FunctionManager`
    Specified by:
      `moveAddressRange` in interface `ManagerDB`
    Parameters:
      `fromAddr` - the first address of the range to be moved
      `toAddr` - the address where to the range is to be moved
      `length` - the number of addresses to move
      `monitor` - the task monitor to use in any upgrade operations
    Throws:
      `CancelledException` - if the user cancelled the operation via the task monitor

  - ### deleteAddressRange

    public void deleteAddressRange(Address startAddr, Address endAddr, TaskMonitor monitor) throws CancelledException
    Description copied from interface: `ManagerDB`
    Delete all objects which have been applied to the address range startAddr to endAddr and update the database accordingly. The specified start and end addresses must form a valid range within a single `AddressSpace`.
    Specified by:
      `deleteAddressRange` in interface `ManagerDB`
    Parameters:
      `startAddr` - the first address in the range.
      `endAddr` - the last address in the range.
      `monitor` - the task monitor to use in any upgrade operations.
    Throws:
      `CancelledException` - if the user cancelled the operation via the task monitor.

  - ### setProgram

    public void setProgram(ProgramDB program)
    Description copied from interface: `ManagerDB`
    Callback from program used to indicate all manager have been created. When this method is invoked, all managers have been instantiated but may not be fully initialized.
    Specified by:
      `setProgram` in interface `ManagerDB`
    Parameters:
      `program` - the program is set when all the initializations have been completed.

  - ### programReady

    public void programReady(OpenMode openMode, int currentRevision, TaskMonitor monitor) throws IOException, CancelledException
    Description copied from interface: `ManagerDB`
    Callback from program made to each manager after the program has completed initialization. This method may be used by managers to perform additional upgrading which may have been deferred.
    Specified by:
      `programReady` in interface `ManagerDB`
    Parameters:
      `openMode` - the mode that the program is being opened.
      `currentRevision` - current program revision. If openMode is UPGRADE, this value reflects the pre-upgrade value.
      `monitor` - the task monitor to use in any upgrade operations.
    Throws:
      `IOException` - if a database io error occurs.
      `CancelledException` - if the user cancelled the operation via the task monitor.

  - ### invalidateCache

    public void invalidateCache(boolean all)
    Description copied from interface: `FunctionManager`
    Clears all data caches
    Specified by:
      `invalidateCache` in interface `FunctionManager`
    Specified by:
      `invalidateCache` in interface `ManagerDB`
    Parameters:
      `all` - if false, some managers may not need to update their cache if they can tell that its not necessary. If this flag is true, then all managers should clear their cache no matter what.

  - ### getFunctionsOverlapping

    public Iterator<Function> getFunctionsOverlapping(AddressSetView set)
    Description copied from interface: `FunctionManager`
    Return an iterator over functions that overlap the given address set.
    Specified by:
      `getFunctionsOverlapping` in interface `FunctionManager`
    Parameters:
      `set` - address set of interest
    Returns:
      iterator over Functions

  - ### getReferencedVariable

    public Variable getReferencedVariable(Address instrAddr, Address storageAddr, int size, boolean isRead)
    Description copied from interface: `FunctionManager`
    Attempts to determine which if any of the local functions variables are referenced by the specified reference. In utilizing the firstUseOffset scoping model, negative offsets (relative to the functions entry) are shifted beyond the maximum positive offset within the function. While this does not account for the actual instruction flow, it is hopefully accurate enough for most situations.
    Specified by:
      `getReferencedVariable` in interface `FunctionManager`
    Parameters:
      `instrAddr` - the instruction address
      `storageAddr` - the storage address
      `size` - varnode size in bytes (1 is assumed if value <= 0)
      `isRead` - true if the reference is a read reference
    Returns:
      referenced variable or null if one not found

  - ### getFunction

    public Function getFunction(long key)
    Description copied from interface: `FunctionManager`
    Get a Function object by its key
    Specified by:
      `getFunction` in interface `FunctionManager`
    Parameters:
      `key` - function symbol key
    Returns:
      function object or null if not found