Package ghidra.program.database
Class ProgramAddressFactory
java.lang.Object
ghidra.program.model.address.DefaultAddressFactory
ghidra.program.database.ProgramAddressFactory
- All Implemented Interfaces:
AddressFactory
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionProgramAddressFactory(Language language, CompilerSpec compilerSpec, OverlayRegionSupplier overlayRegionSupplier) Construct a Program address factory which augments theDefaultAddressFactorysupplied by aLanguage. -
Method Summary
Modifier and TypeMethodDescriptionprotected ProgramOverlayAddressSpaceaddOverlaySpace(long key, String overlayName, AddressSpace baseSpace) Create a new ProgramOverlayAddressSpace based upon the given overlay blockName and base AddressSpaceprotected voidAdd an overlay address space to this factoryvoidgetAddress(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.booleanDetermine if this address factory contains a stale overlay address space whose name was recently changed.voidprotected booleanisValidOverlayBaseSpace(AddressSpace baseSpace) Determine whether the given space can have an overlayprotected voidoverlaySpaceRenamed(String oldOverlaySpaceName, String newName, boolean refreshStatusIfNeeded) protected voidExamine all overlay spaces and update the stale status indicator (seehasStaleOverlays).protected voidremoveOverlaySpace(String name) Remove an overlay space.Methods 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, overlaySpaceRenamed, removeAddressSpace
-
Field Details
-
overlayRegionSupplier
-
-
Constructor Details
-
ProgramAddressFactory
public ProgramAddressFactory(Language language, CompilerSpec compilerSpec, OverlayRegionSupplier overlayRegionSupplier) Construct a Program address factory which augments theDefaultAddressFactorysupplied by aLanguage. The following additional address spaces are added:AddressSpace.OTHER_SPACEAddressSpace.EXTERNAL_SPACE- A stack space (see
AddressSpace.TYPE_STACK) AddressSpace.HASH_SPACE- A join space (see
AddressSpace.TYPE_JOIN)
ProgramOverlayAddressSpace.- Parameters:
language- language specificationcompilerSpec- compiler specificationoverlayRegionSupplier- overlay space defined region supplier which will be invoked when specific queries are performed on overlay address spaces. If memory is not yet available a null AddressSet may be returned by the supplier.
-
-
Method Details
-
invalidateOverlayCache
public void invalidateOverlayCache() -
getStackSpace
Description copied from interface:AddressFactoryReturns the "stack" address space.- Specified by:
getStackSpacein interfaceAddressFactory- Overrides:
getStackSpacein classDefaultAddressFactory
-
isValidOverlayBaseSpace
Determine whether the given space can have an overlay- Parameters:
baseSpace- the overlay base address space- Returns:
- true to allow, false to prohibit
-
addOverlaySpace
Add an overlay address space to this factory- Parameters:
ovSpace- overlay space- Throws:
DuplicateNameException- if name of overlay space already exists in this factory
-
addOverlaySpace
protected ProgramOverlayAddressSpace addOverlaySpace(long key, String overlayName, AddressSpace baseSpace) throws DuplicateNameException Create a new ProgramOverlayAddressSpace based upon the given overlay blockName and base AddressSpace- Parameters:
key- overlay record keyoverlayName- overlay namebaseSpace- the base AddressSpace to overlay- Returns:
- the new overlay space
- Throws:
DuplicateNameException- if overlay name duplicates another address space nameIllegalArgumentException- if baseSpace is not permitted or not found.
-
checkValidOverlaySpaceName
public void checkValidOverlaySpaceName(String name) throws InvalidNameException, DuplicateNameException -
getAddress
Description copied from interface:AddressFactoryGet an address using the addressSpace with the given id and having the given offset.- Specified by:
getAddressin interfaceAddressFactory- Overrides:
getAddressin 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:AddressFactoryCreate 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:
getAddressin interfaceAddressFactory- Overrides:
getAddressin classDefaultAddressFactory- See Also:
-
removeOverlaySpace
Remove an overlay space. It may be neccessary to invokerefreshStaleOverlayStatus()when an overlay is removed.- Parameters:
name- overlay space name
-
overlaySpaceRenamed
-
refreshStaleOverlayStatus
protected void refreshStaleOverlayStatus()Examine all overlay spaces and update the stale status indicator (seehasStaleOverlays). -
hasStaleOverlayCondition
public boolean hasStaleOverlayCondition()Description copied from interface:AddressFactoryDetermine if this address factory contains a stale overlay address space whose name was recently changed. When this condition occurs, issues may arise when comparingAddressandAddressSpace-related objects when overlay address spaces are involved. A common case for this is a Diff type operation.- Returns:
- true if this factory contains one or more stale overlay address space instances.
-