Class AddressObjectMap
- java.lang.Object
-
- ghidra.program.model.address.AddressObjectMap
-
public class AddressObjectMap extends java.lang.Object
AddressObjectMap
maintains a mapping between addresses in the program and Objects that have been discovered.AddressObjectMap uses an ObjectPropertySet to track which addresses belong to which Objects. If a range
[addr1,addr2]
is assigned to a Object with idID
then-ID
will be placed as the property value ataddr1
andID
will be placed ataddr2
. In other words AddressObjectMap marks the beginning of a range belonging to an Object with its id (a positive number) and the end with its id (a negative number). A single address "range" will just have one entry which will contain-objID
. It is important to realize that the current implementation of this cache, an address can only belong in one Object. This could have bad effects for BlockModels where code can exist in more than one Object. If this is to be used in that case, one must not just clear an area before adding in a range of addresses. You would need to check if there is anything already defined and store a new index in those places that would represent a multi-block location. An AddressObjectMap instance should only be used to map to addresses contained within a single program. The map should be discard if any changes are made to that programs address map (e.g., removing or renaming overlay spaces).
-
-
Constructor Summary
Constructors Constructor Description AddressObjectMap()
Creates a newAddressObjectMap
object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addObject(java.lang.Object obj, Address startAddr, Address endAddr)
Associates the given object with the given range of addressesvoid
addObject(java.lang.Object obj, AddressSetView set)
Associates the given object with the given set of addressesjava.lang.Object[]
getObjects(Address addr)
Get the objs associated with the given address.void
removeObject(java.lang.Object obj, Address startAddr, Address endAddr)
Removes any association with the given object and the given range of addresses.void
removeObject(java.lang.Object obj, AddressSetView set)
Removes any association with the object and the addresses in the given address set.
-
-
-
Method Detail
-
getObjects
public java.lang.Object[] getObjects(Address addr)
Get the objs associated with the given address.- Parameters:
addr
- the address at which to get objects.- Returns:
- an array of objects at the given address.
-
addObject
public void addObject(java.lang.Object obj, AddressSetView set)
Associates the given object with the given set of addresses- Parameters:
obj
- the object to associateset
- the set of address to be associated with the object.
-
addObject
public void addObject(java.lang.Object obj, Address startAddr, Address endAddr)
Associates the given object with the given range of addresses- Parameters:
obj
- the object to associatestartAddr
- the first address in the rangeendAddr
- the last address in the range
-
removeObject
public void removeObject(java.lang.Object obj, AddressSetView set)
Removes any association with the object and the addresses in the given address set.- Parameters:
obj
- the object to removeset
- the set of address from which to remove the object.
-
removeObject
public void removeObject(java.lang.Object obj, Address startAddr, Address endAddr)
Removes any association with the given object and the given range of addresses.- Parameters:
obj
- the object to remove from associations in the given range.startAddr
- the first address in the range.endAddr
- the last address in the range.
-
-