Package ghidra.program.database.symbol

# Class VariableStorageManagerDB

java.lang.Object
ghidra.program.database.symbol.VariableStorageManagerDB

All Implemented Interfaces:
  `VariableStorageManager`

public class VariableStorageManagerDB extends Object implements VariableStorageManager

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `VariableStorageManagerDB(DBHandle handle, AddressMap addrMap, int openMode, ErrorHandler errorHandler, Lock lock, TaskMonitor monitor)`
  Construct a new variable manager.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static void`
  `delete(DBHandle dbHandle)`
  Delete the DB table which correspnds to this variable storage implementation
  `static boolean`
  `exists(DBHandle dbHandle)`
  Determine if the variable storage manager table already exists
  `Address`
  `getVariableStorageAddress(VariableStorage storage, boolean create)`
  Get a variable address for the given storage specification.
  `void`
  `setLanguage(LanguageTranslator translator, TaskMonitor monitor)`
  Perform language translation.
  `void`
  `setProgramArchitecture(ProgramArchitecture arch)`
  Set program architecture.

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

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

- ## Constructor Details

  - ### VariableStorageManagerDB

    public VariableStorageManagerDB(DBHandle handle, AddressMap addrMap, int openMode, ErrorHandler errorHandler, Lock lock, TaskMonitor monitor) throws VersionException, IOException, CancelledException
    Construct a new variable manager.
    Parameters:
      `handle` - the database handle.
      `addrMap` - the address map (required for legacy adpter use only)
      `openMode` - the open mode
      `errorHandler` - database error handler
      `lock` - the program synchronization lock
      `monitor` - the task monitor.
    Throws:
      `IOException` - if a database error occurs.
      `VersionException` - if the table version is different from this adapter.
      `IOException` - if an IO error occurs
      `CancelledException` - if the user cancels the upgrade.

- ## Method Details

  - ### setProgramArchitecture

    public void setProgramArchitecture(ProgramArchitecture arch)
    Set program architecture.
    Parameters:
      `arch` - program architecture

  - ### delete

    public static void delete(DBHandle dbHandle) throws IOException
    Delete the DB table which correspnds to this variable storage implementation
    Parameters:
      `dbHandle` - database handle
    Throws:
      `IOException` - if an IO error occurs

  - ### exists

    public static boolean exists(DBHandle dbHandle)
    Determine if the variable storage manager table already exists
    Parameters:
      `dbHandle` - database handle
    Returns:
      true if storage table exists

  - ### getVariableStorageAddress

    public Address getVariableStorageAddress(VariableStorage storage, boolean create) throws IOException
    Get a variable address for the given storage specification. NOTE: The program architecture and error handler must be set appropriately prior to invocation of this method (see `setProgramArchitecture(ProgramArchitecture)`.
    Specified by:
      `getVariableStorageAddress` in interface `VariableStorageManager`
    Parameters:
      `storage` - variable storage specification
      `create` - if true a new variable address will be allocated if needed
    Returns:
      variable address which corresponds to the storage specification or null if not found and create is false.
    Throws:
      `IOException` - if an IO error occurs

  - ### setLanguage

    public void setLanguage(LanguageTranslator translator, TaskMonitor monitor) throws CancelledException
    Perform language translation. Following the invocation of this method it is important to ensure that the program architecure is adjusted if neccessary. Update variable storage specifications to reflect address space and register mappings
    Parameters:
      `translator` - language translator to be used for mapping storage varnodes to new architecture.
      `monitor` - task monitor
    Throws:
      `CancelledException` - if task is cancelled