Class SymbolInspector

java.lang.Object
ghidra.app.util.SymbolInspector
All Implemented Interfaces:
OptionsChangeListener

public class SymbolInspector extends Object implements OptionsChangeListener
Class for coloring symbols.
  • Constructor Details

    • SymbolInspector

      public SymbolInspector(ServiceProvider serviceProvider, Component repaintComp)
      Constructs a new symbol inspector It uses the tool to get the CATEGORY_BROWSER_DISPLAY options
      Parameters:
      serviceProvider - a service provider for getting services
      repaintComp - the component to repaint when the options change
    • SymbolInspector

      public SymbolInspector(ToolOptions options, Component repaintComp)
      Constructs a new symbol inspector
      Parameters:
      options - the options from which to get colors
      repaintComp - the component to repaint when the options change
  • Method Details

    • optionsChanged

      public void optionsChanged(ToolOptions options, String name, Object oldValue, Object newValue)
      Description copied from interface: OptionsChangeListener
      Notification that an option changed.

      Note: to reject an options change, you can throw a OptionsVetoException.

      Specified by:
      optionsChanged in interface OptionsChangeListener
      Parameters:
      options - options object containing the property that changed
      name - name of option that changed
      oldValue - old value of the option
      newValue - new value of the option
    • dispose

      public void dispose()
      Call this when you are done with this inspector and will not use it again. Cleans up listeners, etc.
    • setProgram

      @Deprecated(since="11.3", forRemoval=true) public void setProgram(Program p)
      Deprecated, for removal: This API element is subject to removal in a future version.
      this method does nothing
      Does nothing
      Parameters:
      p - the program
    • getProgram

      @Deprecated(since="11.3", forRemoval=true) public Program getProgram()
      Deprecated, for removal: This API element is subject to removal in a future version.
      returns null
      Returns null.
      Returns:
      null
    • isBadReferenceSymbol

      public boolean isBadReferenceSymbol(Symbol s)
      Returns true if symbol is at a non-existent address
      Parameters:
      s - the symbol to check
      Returns:
      boolean true if symbol is bad
    • isDataSymbol

      public boolean isDataSymbol(Symbol s)
      Returns true if the symbol is on a data item.
      Parameters:
      s - the symbol to check
      Returns:
      boolean true if s is a data symbol
    • isDeadCodeSymbol

      public boolean isDeadCodeSymbol(Symbol s)
      Returns true if the symbol is on "dead" code
      Parameters:
      s - the symbol to check
      Returns:
      boolean true if the symbol is on dead code
    • isEntryPointSymbol

      public boolean isEntryPointSymbol(Symbol s)
      Checks if the given symbol is at an external entry point
      Parameters:
      s - the symbol to check
      Returns:
      boolean true if the symbol is at an external entry point address.
    • isFunctionSymbol

      public boolean isFunctionSymbol(Symbol s)
      Checks if the symbol is at a function
      Parameters:
      s - the symbol to check.
      Returns:
      boolean true if there is a function at the symbol's address.
    • isVariableSymbol

      public boolean isVariableSymbol(Symbol s)
      Checks if the symbol is a function variable
      Parameters:
      s - the symbol to check
      Returns:
      true if s is a function variable symbol
    • isGlobalSymbol

      public boolean isGlobalSymbol(Symbol s)
      Checks if the symbol is global or local
      Parameters:
      s - the symbol to check
      Returns:
      boolean true if the symbol is global, false if the symbol is local.
    • isInstructionSymbol

      public boolean isInstructionSymbol(Symbol s)
      Checks if the symbol is at or inside an instruction
      Parameters:
      s - the symbol to check
      Returns:
      boolean true if the symbol is on an instruction
    • isLocalSymbol

      public boolean isLocalSymbol(Symbol s)
      Checks if the symbol is local
      Parameters:
      s - the symbol to check
      Returns:
      boolean true if the symbol is local, false if it is global
    • isNonPrimarySymbol

      public boolean isNonPrimarySymbol(Symbol s)
      Checks if the symbol is not a primary symbol
      Parameters:
      s - the symbol to check.
      Returns:
      boolean true if the symbol is non-primary
    • isOffcutSymbol

      public boolean isOffcutSymbol(Symbol s)
      Checks if the symbol is offcut
      Parameters:
      s - the symbol to check
      Returns:
      boolean true if the symbol is offcut
    • isPrimarySymbol

      public boolean isPrimarySymbol(Symbol s)
      returns true if the symbol is primary
      Parameters:
      s - the symbol to check
      Returns:
      boolean true if the symbol is primary
    • isSubroutineSymbol

      public boolean isSubroutineSymbol(Symbol s)
      Checks if the symbol is at the beginning of a subroutine.
      Parameters:
      s - the symbol to check
      Returns:
      boolean true if the symbol is at the beginning of a subroutine.
    • isExternalSymbol

      public boolean isExternalSymbol(Symbol s)
    • getColorAndStyle

      public ColorAndStyle getColorAndStyle(Symbol s)
      Gets the color and style used to render the given symbol. Calling this method is faster than calling getColor(Symbol) and getStyle(Symbol) separately.
      Parameters:
      s - the symbol
      Returns:
      the color and style
    • getColorAndStyle NEW

      public ColorAndStyle getColorAndStyle(Program p, Reference r)
      Gets the color and style used to render the given reference. Calling this method is faster than calling getColor(Symbol) and getStyle(Symbol) separately.
      Parameters:
      p - the program
      r - the reference
      Returns:
      the color and style
    • getColor

      public Color getColor(Symbol s)
      Get the color used to render the given symbol.
      Parameters:
      s - symbol to inspect
      Returns:
      Color for the symbol
    • getStyle

      public int getStyle(Symbol s)
      Get the style used to render the given symbol
      Parameters:
      s - symbol to inspect
      Returns:
      the style for the symbol
    • getScreenElement

      public ScreenElement getScreenElement(Symbol s)
      Get the ScreenElement corresponding to the type of the symbol
      Parameters:
      s - the symbol to inspect
      Returns:
      the screen element
    • getScreenElement NEW

      public ScreenElement getScreenElement(Program p, Reference r)
      Get the ScreenElement corresponding to the type of the reference.
      Parameters:
      p - the program
      r - the reference to inspect
      Returns:
      the screen element
    • getOffcutSymbolColor

      public Color getOffcutSymbolColor()
    • getOffcutSymbolStyle

      public int getOffcutSymbolStyle()