Class XReferenceUtils

java.lang.Object
ghidra.app.util.XReferenceUtils

public class XReferenceUtils extends Object
  • Constructor Details

    • XReferenceUtils

      public XReferenceUtils()
  • Method Details

    • getXReferences

      public static final List<Reference> getXReferences(CodeUnit cu, int max)
      Returns an array containing the first max direct xref references to the specified code unit.
      Parameters:
      cu - the code unit to generate the xrefs
      max - max number of xrefs to get, or -1 to get all references
      Returns:
      array first max xrefs to the code unit
    • getOffcutXReferences

      public static 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 xrefs
      max - 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, List<Reference> xrefs, List<Reference> offcuts)
      Populates the provided lists with the direct and offcut xrefs to the specified variable
      Parameters:
      var - variable to get references
      xrefs - list to put direct references in
      offcuts - list to put offcut references in
    • getVariableRefs

      public static void getVariableRefs(Variable var, List<Reference> xrefs, List<Reference> offcuts, int max)
      Populates the provided lists with the direct and offcut xrefs to the specified variable
      Parameters:
      var - variable to get references
      xrefs - list to put direct references in
      offcuts - list to put offcut references in
      max - max number of xrefs to get, or -1 to get all references
    • getAllXrefs

      public static 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, Collection<Reference> xrefs)
      Shows all xrefs to the given location in a new table.
      Parameters:
      navigatable - the navigatable used for navigation from the table
      serviceProvider - the service provider needed to wire navigation
      service - the service needed to show the table
      location - the location for which to find references
      xrefs - the xrefs to show