Package ghidra.program.util
Class AddressEvaluator
- java.lang.Object
-
- ghidra.program.util.AddressEvaluator
-
public class AddressEvaluator extends java.lang.Object
TheAddressEvaluator
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
All Methods Static Methods Concrete Methods 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, java.lang.String s)
Gets a legitimate address for the specified program as indicated by the string.static Address
evaluate(Program p, java.lang.String s)
Gets a legitimate address for the specified program as indicated by the string.static java.lang.Long
evaluateToLong(java.lang.String s)
-
-
-
Method Detail
-
evaluate
public static Address evaluate(Program p, Address baseAddr, java.lang.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 java.lang.Long evaluateToLong(java.lang.String s)
-
evaluate
public static Address evaluate(Program p, java.lang.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.
-
-