decompiler  1.0.0
Public Types | Public Member Functions | Private Attributes | List of all members
ghidra::LocationMap Class Reference

Map object for keeping track of which address ranges have been heritaged. More...

#include <heritage.hh>

Public Types

typedef map< Address, SizePass >::iterator iterator
 Iterator into the main map.
 

Public Member Functions

iterator add (Address addr, int4 size, int4 pass, int4 &intersect)
 Mark new address as heritaged. More...
 
iterator find (const Address &addr)
 Look up if/how given address was heritaged. More...
 
int4 findPass (const Address &addr) const
 Look up if/how given address was heritaged. More...
 
void erase (iterator iter)
 Remove a particular entry from the map.
 
iterator begin (void)
 Get starting iterator over heritaged ranges.
 
iterator end (void)
 Get ending iterator over heritaged ranges.
 
void clear (void)
 Clear the map of heritaged ranges.
 

Private Attributes

map< Address, SizePassthemap
 Heritaged addresses mapped to range size and pass number.
 

Detailed Description

Map object for keeping track of which address ranges have been heritaged.

We keep track of a fairly fine grained description of when each address range was entered in SSA form, referred to as heritaged or, for Varnode objects, no longer free. An address range is added using the add() method, which includes the particular pass when it was entered. The map can be queried using findPass() that informs the caller whether the address has been heritaged and if so in which pass.

Member Function Documentation

◆ add()

LocationMap::iterator ghidra::LocationMap::add ( Address  addr,
int4  size,
int4  pass,
int4 &  intersect 
)

Mark new address as heritaged.

Update disjoint cover making sure (addr,size) is contained in a single element and return an iterator to this element. The element's pass number is set to be the smallest value of any previous intersecting element. Additionally an intersect code is passed back:

  • 0 if the only intersection is with range from the same pass
  • 1 if there is a partial intersection with something old
  • 2 if the range is contained in an old range
    Parameters
    addris the starting address of the range to add
    sizeis the number of bytes in the range
    passis the pass number when the range was heritaged
    intersectis a reference for passing back the intersect code
    Returns
    the iterator to the map element containing the added range

References ghidra::Address::overlap(), and themap.

◆ find()

LocationMap::iterator ghidra::LocationMap::find ( const Address addr)

Look up if/how given address was heritaged.

If the given address was heritaged, return (the iterator to) the SizeMap entry describing the associated range and when it was heritaged.

Parameters
addris the given address
Returns
the iterator to the SizeMap entry or the end iterator is the address is unheritaged

References ghidra::Address::overlap(), and themap.

◆ findPass()

int4 ghidra::LocationMap::findPass ( const Address addr) const

Look up if/how given address was heritaged.

Return the pass number when the given address was heritaged, or -1 if it was not heritaged

Parameters
addris the given address
Returns
the pass number of -1

References ghidra::Address::overlap(), and themap.

Referenced by ghidra::Heritage::heritagePass().


The documentation for this class was generated from the following files: