Package ghidra.program.database
Class ProgramAddressFactory
java.lang.Object
ghidra.program.model.address.DefaultAddressFactory
ghidra.program.database.ProgramAddressFactory
- All Implemented Interfaces:
AddressFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected OverlayAddressSpace
addOverlayAddressSpace
(String name, boolean preserveName, AddressSpace originalSpace, long minOffset, long maxOffset) Create a new OverlayAddressSpace based upon the given overlay blockName and base AddressSpacegetAddress
(int spaceID, long offset) Get an address using the addressSpace with the given id and having the given offset.getAddress
(String addrString) Create an address from String.Returns the "stack" address space.protected void
removeOverlaySpace
(String name) protected String
renameOverlaySpace
(String oldOverlaySpaceName, String newName) Rename overlay with preferred newName.protected boolean
validateOriginalSpace
(AddressSpace originalSpace) Determine whether the given space can have an overlayMethods inherited from class ghidra.program.model.address.DefaultAddressFactory
addAddressSpace, equals, getAddressSet, getAddressSet, getAddressSpace, getAddressSpace, getAddressSpaces, getAllAddresses, getAllAddresses, getAllAddressSpaces, getConstantAddress, getConstantSpace, getDefaultAddressSpace, getIndex, getNumAddressSpaces, getPhysicalSpace, getPhysicalSpaces, getRegisterSpace, getUniqueSpace, hasMultipleMemorySpaces, isValidAddress, oldGetAddressFromLong, removeAddressSpace
-
Constructor Details
-
ProgramAddressFactory
-
-
Method Details
-
getStackSpace
Description copied from interface:AddressFactory
Returns the "stack" address space.- Specified by:
getStackSpace
in interfaceAddressFactory
- Overrides:
getStackSpace
in classDefaultAddressFactory
-
addOverlayAddressSpace
- Throws:
DuplicateNameException
-
validateOriginalSpace
Determine whether the given space can have an overlay- Parameters:
originalSpace
- the original space- Returns:
- true to allow, false to prohibit
-
addOverlayAddressSpace
protected OverlayAddressSpace addOverlayAddressSpace(String name, boolean preserveName, AddressSpace originalSpace, long minOffset, long maxOffset) Create a new OverlayAddressSpace based upon the given overlay blockName and base AddressSpace- Parameters:
name
- the preferred name of the overlay address space to be created. This name may be modified if preserveName is false to produce a valid overlay space name and avoid duplication.preserveName
- if true specified name will be preserved, if false an unique acceptable overlay space name will be generated from the specified name.originalSpace
- the base AddressSpace to overlayminOffset
- the min offset of the spacemaxOffset
- the max offset of the space- Returns:
- the new overlay space
- Throws:
IllegalArgumentException
- if originalSpace is not permitted or preserveName is true and a space with specified name already exists.
-
getAddress
Description copied from interface:AddressFactory
Get an address using the addressSpace with the given id and having the given offset.- Specified by:
getAddress
in interfaceAddressFactory
- Overrides:
getAddress
in classDefaultAddressFactory
- Parameters:
spaceID
- the id of the address space to use to create the new address.offset
- the offset of the new address to be created.- Returns:
- the new address.
-
getAddress
Description copied from interface:AddressFactory
Create an address from String. Attempts to use the "default" address space first. Otherwise loops through each addressSpace, returning the first valid address that any addressSpace creates from the string. Returns an Address if the string is valid, otherwise null.- Specified by:
getAddress
in interfaceAddressFactory
- Overrides:
getAddress
in classDefaultAddressFactory
- See Also:
-
removeOverlaySpace
-
renameOverlaySpace
Rename overlay with preferred newName. Actual name used will be returned and may differ from specified newName to ensure validity and avoid duplication.- Overrides:
renameOverlaySpace
in classDefaultAddressFactory
- Parameters:
oldOverlaySpaceName
- the existing overlay address space namenewName
- the preferred new name of the overlay address space. This name may be modified to produce a valid overlay space name to avoid duplication.- Returns:
- new name applied to existing overlay space
-