Package ghidra.app.util
Class XReferenceUtils
- java.lang.Object
-
- ghidra.app.util.XReferenceUtils
-
public class XReferenceUtils extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description XReferenceUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.Set<Reference>
getAllXrefs(ProgramLocation location)
Returns all xrefs to the given location.static java.util.List<Reference>
getOffcutXReferences(CodeUnit cu, int max)
Returns an array containing all offcut xref references to the specified code unitstatic void
getVariableRefs(Variable var, java.util.List<Reference> xrefs, java.util.List<Reference> offcuts)
Populates the provided lists with the direct and offcut xrefs to the specified variablestatic void
getVariableRefs(Variable var, java.util.List<Reference> xrefs, java.util.List<Reference> offcuts, int max)
Populates the provided lists with the direct and offcut xrefs to the specified variablestatic java.util.List<Reference>
getXReferences(CodeUnit cu, int max)
Returns an array containing the firstmax
direct xref references to the specified code unit.static void
showXrefs(Navigatable navigatable, ServiceProvider serviceProvider, TableService service, ProgramLocation location, java.util.Collection<Reference> xrefs)
Shows all xrefs to the given location in a new table.
-
-
-
Method Detail
-
getXReferences
public static final java.util.List<Reference> getXReferences(CodeUnit cu, int max)
Returns an array containing the firstmax
direct xref references to the specified code unit.- Parameters:
cu
- the code unit to generate the xrefsmax
- max number of xrefs to get, or -1 to get all references- Returns:
- array first
max
xrefs to the code unit
-
getOffcutXReferences
public static java.util.List<Reference> getOffcutXReferences(CodeUnit cu, int max)
Returns an array containing all offcut xref references to the specified code unit- Parameters:
cu
- the code unit to generate the offcut xrefsmax
- max number of offcut xrefs to get, or -1 to get all offcut references- Returns:
- array of all offcut xrefs to the code unit
-
getVariableRefs
public static void getVariableRefs(Variable var, java.util.List<Reference> xrefs, java.util.List<Reference> offcuts)
Populates the provided lists with the direct and offcut xrefs to the specified variable- Parameters:
var
- variable to get referencesxrefs
- list to put direct references inoffcuts
- list to put offcut references in
-
getVariableRefs
public static void getVariableRefs(Variable var, java.util.List<Reference> xrefs, java.util.List<Reference> offcuts, int max)
Populates the provided lists with the direct and offcut xrefs to the specified variable- Parameters:
var
- variable to get referencesxrefs
- list to put direct references inoffcuts
- list to put offcut references inmax
- max number of xrefs to get, or -1 to get all references
-
getAllXrefs
public static java.util.Set<Reference> getAllXrefs(ProgramLocation location)
Returns all xrefs to the given location. If in data, then xrefs to the specific data component will be returned. Otherwise, the code unit containing the address of the given location will be used as the source of the xrefs.- Parameters:
location
- the location for which to get xrefs- Returns:
- the xrefs
-
showXrefs
public static void showXrefs(Navigatable navigatable, ServiceProvider serviceProvider, TableService service, ProgramLocation location, java.util.Collection<Reference> xrefs)
Shows all xrefs to the given location in a new table.- Parameters:
navigatable
- the navigatable used for navigation from the tableserviceProvider
- the service provider needed to wire navigationservice
- the service needed to show the tablelocation
- the location for which to find referencesxrefs
- the xrefs to show
-
-