Class AddressObjectMap
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 id ID
then -ID
will be placed as the property value at
addr1
and ID
will be placed at addr2
.
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
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Associates the given object with the given range of addressesvoid
addObject
(Object obj, AddressSetView set) Associates the given object with the given set of addressesObject[]
getObjects
(Address addr) Get the objs associated with the given address.void
removeObject
(Object obj, Address startAddr, Address endAddr) Removes any association with the given object and the given range of addresses.void
removeObject
(Object obj, AddressSetView set) Removes any association with the object and the addresses in the given address set.
-
Constructor Details
-
AddressObjectMap
public AddressObjectMap()Creates a newAddressObjectMap
object.
-
-
Method Details
-
getObjects
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
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
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
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
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.
-