Package ghidra.program.util

# Class AddressEvaluator

java.lang.Object
ghidra.program.util.AddressEvaluator

public class AddressEvaluator extends Object
The `AddressEvaluator` class provides a way to evaluate a string that represents an address and resolve it to an address for a particular program.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `AddressEvaluator()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `static Address`
  `evaluate(Program p, byte[] addrBytes)`
  Utility method for creating an Address object from a byte array.
  `static Address`
  `evaluate(Program p, Address baseAddr, String s)`
  Gets a legitimate address for the specified program as indicated by the string.
  `static Address`
  `evaluate(Program p, String s)`
  Gets a legitimate address for the specified program as indicated by the string.
  `static Long`
  `evaluateToLong(String s)`
  `protected static boolean`
  `parseToList(String s, AddressFactory af, SymbolTable st, List<Object> list)`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### AddressEvaluator

    public AddressEvaluator()

- ## Method Details

  - ### evaluate

    public static Address evaluate(Program p, Address baseAddr, String s)
    Gets a legitimate address for the specified program as indicated by the string.
    Parameters:
      `p` - the program to use for determining the address.
      `baseAddr` - the base address to use for relative addressing.
      `s` - string representation of the address desired.
    Returns:
      the address. Otherwise, return null if the string fails to evaluate to a unique legitimate address.

  - ### evaluateToLong

    public static Long evaluateToLong(String s)

  - ### parseToList

    protected static boolean parseToList(String s, AddressFactory af, SymbolTable st, List<Object> list)

  - ### evaluate

    public static Address evaluate(Program p, String s)
    Gets a legitimate address for the specified program as indicated by the string.
    Parameters:
      `p` - the program to use for determining the address.
      `s` - string representation of the address desired.
    Returns:
      the address. Otherwise, return null if the string fails to evaluate to a legitimate address.

  - ### evaluate

    public static Address evaluate(Program p, byte[] addrBytes)
    Utility method for creating an Address object from a byte array. The Address object may or may not be a legitimate Address in the program's address space. This method is meant to provide a way of creating an Address object from a sequence of bytes that can be used for additional tests and comparisons.
    Parameters:
      `p` - - program being analyzed.
      `addrBytes` - - byte array to use containing the values the address will be constructed from.
    Returns:
      - Address object constructed from the addrBytes array. Returns null if the program is null, addrBytes is null, or the length of addrBytes does not match the default Pointer size or does not contain a valid offset.