Class MemorySymbol

All Implemented Interfaces:
Symbol
Direct Known Subclasses:
CodeSymbol, FunctionSymbol

public abstract class MemorySymbol extends SymbolDB
MemorySymbol corresponds to any symbol that resides at a memory location. The corresponding address may be either a memory address or a fake external address. While an external address is not a memory address it corresponds to an ExternalLocation which may identify a specific memory address if known.
  • Constructor Details

    • MemorySymbol

      protected MemorySymbol(SymbolManager mgr, DBObjectCache<SymbolDB> cache, Address addr, DBRecord record)
      Constructs a new MemorySymbol which corresponds to the specified symbol record,
      Parameters:
      mgr - the symbol manager
      cache - symbol object cache
      addr - the address associated with the symbol
      record - the record for this symbol
    • MemorySymbol

      protected MemorySymbol(SymbolManager mgr, DBObjectCache<SymbolDB> cache, Address addr, long key)
      Constructs a new MemorySymbol which corresponds to the specified symbol key and has no record. This is intended to support dynamic label cases which do not have a record and do not support an external address.
      Parameters:
      mgr - the symbol manager
      cache - symbol object cache
      addr - the address associated with the symbol
      key - this must be the absolute encoding of addr
  • Method Details

    • isExternalEntryPoint

      public final boolean isExternalEntryPoint()
      Returns:
      true if the symbol is at an address set as a external entry point.
    • isExternal

      public final boolean isExternal()
      Description copied from interface: Symbol
      Returns true if this an external symbol.
      Returns:
      true if this an external symbol.
      See Also:
    • isPinned

      public final boolean isPinned()
      Description copied from interface: Symbol
      Returns true if the symbol is pinned to its current address. If it is pinned, then moving or removing the memory associated with that address will not affect this symbol.
      Returns:
      true if the symbol is pinned to its current address.
    • setPinned

      public final void setPinned(boolean pinned)
      Description copied from interface: Symbol

      Sets whether or not this symbol is pinned to its associated address.

      If the symbol is pinned then moving or removing the memory associated with its address will not cause this symbol to be removed and will not cause its address to change. If the symbol is not pinned, then removing the memory at its address will also remove this symbol.

      Likewise, moving a memory block containing a symbol that is not anchored will change the address for that symbol to keep it associated with the same byte in the memory block.

      Parameters:
      pinned - true indicates this symbol is anchored to its address. false indicates this symbol is not anchored to its address.
    • moveLowLevel

      protected void moveLowLevel(Address newAddress, String newName, Namespace newNamespace, SourceType newSource, boolean pinned)
      low level record adjustment to move a symbol. Used only when moving a memory block or changing the image base.
      Parameters:
      newAddress - the new address for the symbol
      newName - the new name for the symbol (or null if the name should stay the same)
      newNamespace - the new namespace for the symbol (or null if it should stay the same)
      newSource - the new SourceType for the symbol (or null if it should stay the same)
      pinned - the new pinned state
    • getReferenceCount

      public int getReferenceCount()
      Description copied from interface: Symbol
      Get the number of References to this symbol or its address.

      NOTE: this method differ from Symbol.hasReferences() behavior for memory symbols since this method will return ReferenceManager.getReferenceCountTo(Address) if this is the only symbol at its address.

      Returns:
      the number of References to this symbol or its address.
    • hasReferences

      public boolean hasReferences()
      Returns:
      true if this symbol has at least one reference to it. Explicit references to other symbols at the same address are not considered (see Reference.getSymbolID() which indicates a specific symbol reference).
    • getReferences

      public Reference[] getReferences(TaskMonitor monitor)
      Description copied from interface: Symbol
      Returns all memory references to the address of this symbol. If you do not have a TaskMonitor instance, then you can pass TaskMonitor.DUMMY or null.
      Parameters:
      monitor - the monitor that is used to report progress and to cancel this potentially long-running call
      Returns:
      all memory references to the address of this symbol.
    • getExternalOriginalImportedName

      public final String getExternalOriginalImportedName()
      Gets the optional field which is intended to store the original mangled name for an external SymbolType.LABEL or SymbolType.FUNCTION which has an external address. These symbol types correspond to CodeSymbol and FunctionSymbol DB symbol implementations respectively. This is generally set when an ExternalLocationDB is renamed which generally corresponds the external symbol being demangled.
      Returns:
      original imported external name or null if not external or symbol has not been demangled or renamed.
    • setExternalOriginalImportedName

      public final void setExternalOriginalImportedName(String originalImportedName, boolean notify)
      Sets the symbol's original imported external name field for an external SymbolType.LABEL or SymbolType.FUNCTION which has an external address. These symbol types correspond to CodeSymbol and FunctionSymbol DB symbol implementations respectively. This is generally set when an ExternalLocationDB is renamed which generally corresponds the external symbol being demangled.
      Parameters:
      originalImportedName - the original import name or null
      notify - if true, a program change notification will be generated
      Throws:
      UnsupportedOperationException - if symbol is neither an external SymbolType.LABEL or SymbolType.FUNCTION.
    • getExternalProgramAddress

      public final Address getExternalProgramAddress()
      Gets the optional field which is intended to store the original mangled name for an external SymbolType.LABEL or SymbolType.FUNCTION which has an external address. These symbol types correspond to CodeSymbol and FunctionSymbol DB symbol implementations respectively. This is generally set when an ExternalLocationDB is renamed which generally corresponds the external symbol being demangled.
      Returns:
      external Program address or null if not external or unknown
    • setExternalProgramAddress

      public final void setExternalProgramAddress(Address externalProgramAddress, boolean notify)
      Sets the symbol's external Program Address field for an external SymbolType.LABEL or SymbolType.FUNCTION which has an external address. These symbol types correspond to CodeSymbol and FunctionSymbol DB symbol implementations respectively.
      Parameters:
      externalProgramAddress - the external Program Address which corresponds to the externally linked location (may be null).
      notify - if true, a program change notification will be generated
      Throws:
      UnsupportedOperationException - if symbol is neither an external SymbolType.LABEL or SymbolType.FUNCTION.