Package ghidra.app.util
Class SymbolInspector
java.lang.Object
ghidra.app.util.SymbolInspector
- All Implemented Interfaces:
OptionsChangeListener
Class for coloring symbols.
-
Constructor Summary
ConstructorDescriptionSymbolInspector
(ToolOptions options, Component repaintComp) Constructs a new symbol inspectorSymbolInspector
(ServiceProvider serviceProvider, Component repaintComp) Constructs a new symbol inspector It uses the tool to get the CATEGORY_BROWSER_DISPLAY options -
Method Summary
Modifier and TypeMethodDescriptionvoid
dispose()
Call this when you are done with this inspector and will not use it again.Get the color used to render the given symbol.Gets the color and style used to render the given symbol.int
Returns the program in use by this inspector; may be null;Get the ScreenElement corresponding to the type of the symbolint
Get the style used to render the given symbolboolean
Returns true if symbol is at a non-existent addressboolean
Returns true if the symbol is on a data item.boolean
Returns true if the symbol is on "dead" codeboolean
Checks if the given symbol is at an external entry pointboolean
boolean
Checks if the symbol is at a functionboolean
Checks if the symbol is global or localboolean
Checks if the symbol is at or inside an instructionboolean
Checks if the symbol is localboolean
Checks if the symbol is not a primary symbolboolean
Checks if the symbol is offcutboolean
returns true if the symbol is primaryboolean
Checks if the symbol is at the beginning of a subroutine.boolean
Checks if the symbol is a function variablevoid
optionsChanged
(ToolOptions options, String name, Object oldValue, Object newValue) Notification that an option changed.void
Associates a program with this symbol inspector
-
Constructor Details
-
SymbolInspector
Constructs a new symbol inspector It uses the tool to get the CATEGORY_BROWSER_DISPLAY options- Parameters:
serviceProvider
- a service provider for getting servicesrepaintComp
- the component to repaint when the options change
-
SymbolInspector
Constructs a new symbol inspector- Parameters:
options
- the options from which to get colorsrepaintComp
- the component to repaint when the options change
-
-
Method Details
-
optionsChanged
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 interfaceOptionsChangeListener
- Parameters:
options
- options object containing the property that changedname
- name of option that changedoldValue
- old value of the optionnewValue
- new value of the option
-
setProgram
Associates a program with this symbol inspector- Parameters:
p
- the program for inspecting symbols
-
getProgram
Returns the program in use by this inspector; may be null;- Returns:
- the program in use by this inspector; may be null;
-
dispose
public void dispose()Call this when you are done with this inspector and will not use it again. Cleans up listeners, etc. -
isBadReferenceSymbol
Returns true if symbol is at a non-existent address- Parameters:
s
- the symbol to check- Returns:
- boolean true if symbol is bad
-
isDataSymbol
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
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
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
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
Checks if the symbol is a function variable- Parameters:
s
- the symbol to check- Returns:
- true if s is a function variable symbol
-
isGlobalSymbol
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
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
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
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
Checks if the symbol is offcut- Parameters:
s
- the symbol to check- Returns:
- boolean true if the symbol is offcut
-
isPrimarySymbol
returns true if the symbol is primary- Parameters:
s
- the symbol to check- Returns:
- boolean true if the symbol is primary
-
isSubroutineSymbol
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
-
getColorAndStyle
Gets the color and style used to render the given symbol. Calling this method is faster than callinggetColor(Symbol)
andgetStyle(Symbol)
separately.- Parameters:
s
- the symbol- Returns:
- the color and style
-
getColor
Get the color used to render the given symbol.- Parameters:
s
- symbol to inspect- Returns:
- Color for the symbol
-
getStyle
Get the style used to render the given symbol- Parameters:
s
- symbol to inspect- Returns:
- the style for the symbol
-
getScreenElement
Get the ScreenElement corresponding to the type of the symbol- Parameters:
s
- symbol to inspect- Returns:
- the screen element
-
getOffcutSymbolColor
-
getOffcutSymbolStyle
public int getOffcutSymbolStyle()
-