Package ghidra.program.database
Class ProgramAddressFactory
java.lang.Object
ghidra.program.model.address.DefaultAddressFactory
ghidra.program.database.ProgramAddressFactory
- All Implemented Interfaces:
AddressFactory
-
Field Summary
-
Constructor Summary
ConstructorDescriptionProgramAddressFactory
(Language language, CompilerSpec compilerSpec, OverlayRegionSupplier overlayRegionSupplier) Construct a Program address factory which augments theDefaultAddressFactory
supplied by aLanguage
. -
Method Summary
Modifier and TypeMethodDescriptionprotected ProgramOverlayAddressSpace
addOverlaySpace
(long key, String overlayName, AddressSpace baseSpace) Create a new ProgramOverlayAddressSpace based upon the given overlay blockName and base AddressSpaceprotected void
Add an overlay address space to this factoryvoid
getAddress
(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.boolean
Determine if this address factory contains a stale overlay address space whose name was recently changed.void
protected boolean
isValidOverlayBaseSpace
(AddressSpace baseSpace) Determine whether the given space can have an overlayprotected void
overlaySpaceRenamed
(String oldOverlaySpaceName, String newName, boolean refreshStatusIfNeeded) protected void
Examine all overlay spaces and update the stale status indicator (seehasStaleOverlays
).protected void
removeOverlaySpace
(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 theDefaultAddressFactory
supplied by aLanguage
. The following additional address spaces are added:AddressSpace.OTHER_SPACE
AddressSpace.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:AddressFactory
Returns the "stack" address space.- Specified by:
getStackSpace
in interfaceAddressFactory
- Overrides:
getStackSpace
in 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: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
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:AddressFactory
Determine if this address factory contains a stale overlay address space whose name was recently changed. When this condition occurs, issues may arise when comparingAddress
andAddressSpace
-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.
-