Class 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 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

      Constructors 
      Constructor Description
      AddressObjectMap()
      Creates a new AddressObjectMap 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 addresses
      void addObject​(java.lang.Object obj, AddressSetView set)
      Associates the given object with the given set of addresses
      java.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.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AddressObjectMap

        public AddressObjectMap()
        Creates a new AddressObjectMap object.
    • 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 associate
        set - 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 associate
        startAddr - the first address in the range
        endAddr - 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 remove
        set - 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.