Package ghidra.program.util
Class RegisterValueStore
java.lang.Object
ghidra.program.util.RegisterValueStore
This is a generalized class for storing register values over ranges.  The values include mask bits
 to indicate which bits within the register are being set.  The mask is stored along with the
 value so the getValue method can indicate back which bits in the value are valid.  If existing
 values already exist at an address, the values are combined according to the masks.  Any new value
 bits that have their associated mask bits on will overwrite any existing bits and the new mask will
 be anded to the existing mask.  Other bits will not be affected.
 
 This class takes a RangeMapAdapter that will adapt to some lower level storage.  There are current
 two implementations - one that uses an ObjectRangeMap for storing register values in memory and
 the other that uses RangeMapDB for storing register values in the database.
- 
Constructor SummaryConstructorsConstructorDescriptionRegisterValueStore(Register register, RangeMapAdapter rangeMap, boolean enableRangeWriteCache) Constructs a new RegisterValueStore.
- 
Method SummaryModifier and TypeMethodDescriptionvoidclearAll()Delete all stored values and free/delete underlying storage.voidclearValue(Address start, Address end, Register register) Clears the address range of any set bits using the mask from the given register value.Returns an AddressRangeIterator that will return address ranges everywhere that register values have been set.getAddressRangeIterator(Address startAddress, Address endAddress) Returns an AddressRangeIterator that will return address ranges everywhere that register values have been set within the given range.Returns the RegisterValue (value and mask) associated with the given address.Returns the bounding address-range containing addr and the same value throughout.voidNotifies that something changed, may need to invalidate any cachesbooleanisEmpty()Returns true if this store has no associated values for any address.voidmoveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor) Move all register values within an address range to a new range.booleansetLanguage(LanguageTranslator translator, TaskMonitor monitor) Preserve register values and handle register name/size change.voidsetValue(Address start, Address end, RegisterValue newValue) Sets the given register value (contains value and mask) across the given address range.
- 
Constructor Details- 
RegisterValueStorepublic RegisterValueStore(Register register, RangeMapAdapter rangeMap, boolean enableRangeWriteCache) Constructs a new RegisterValueStore.- Parameters:
- rangeMap- the rangeMapAdapter that handles the low level storage of byte arrays
 
 
- 
- 
Method Details- 
moveAddressRangepublic void moveAddressRange(Address fromAddr, Address toAddr, long length, TaskMonitor monitor) throws CancelledException Move all register values within an address range to a new range.- Parameters:
- fromAddr- the first address of the range to be moved.
- toAddr- the address where to the range is to be moved.
- length- the number of addresses to move.
- monitor- the task monitor.
- Throws:
- CancelledException- if the user canceled the operation via the task monitor.
 
- 
setValueSets the given register value (contains value and mask) across the given address range. Any existing values in the range that have values that are not part of the input mask are not changed.- Parameters:
- start- the start of the range to set the register value.
- end- the end of the range(inclusive) to set the register value.
- newValue- the new register value to set.
 
- 
clearAllpublic void clearAll()Delete all stored values and free/delete underlying storage.
- 
clearValueClears the address range of any set bits using the mask from the given register value. existing values in the range that have values that are not part of the input mask are not changed. If register is null, just clear all the values in range- Parameters:
- start- the start of the range to clear the register value bits.
- end- the end of the range(inclusive) to clear the register value bits.
- register- the register whos mask to use. If null, clear all values in the given range.
 
- 
getValueReturns the RegisterValue (value and mask) associated with the given address.- Parameters:
- register- register (base or child) for which context value should be returned
- address- the address at which to get the RegisterValue.
- Returns:
- the RegisterValue
 
- 
getAddressRangeIteratorReturns an AddressRangeIterator that will return address ranges everywhere that register values have been set within the given range.- Parameters:
- startAddress- the start address to get stored register values.
- endAddress- the end address to get stored register values.
- Returns:
- an AddressRangeIterator that will return address ranges everywhere that register values have been set within the given range.
 
- 
getAddressRangeIteratorReturns an AddressRangeIterator that will return address ranges everywhere that register values have been set.- Returns:
- an AddressRangeIterator that will return address ranges everywhere that register values have been set.
 
- 
isEmptypublic boolean isEmpty()Returns true if this store has no associated values for any address.- Returns:
- true if this store has no associated values for any address.
 
- 
setLanguagepublic boolean setLanguage(LanguageTranslator translator, TaskMonitor monitor) throws CancelledException Preserve register values and handle register name/size change.- Parameters:
- translator-
- monitor-
- Returns:
- true if translated successfully, false if register not mapped value storage should be discarded.
- Throws:
- CancelledException
 
- 
getValueRangeContainingReturns the bounding address-range containing addr and the same value throughout. This range will be limited by any value change associated with the base register.- Parameters:
- addr- the contained address
- Returns:
- single value address-range containing addr
 
- 
invalidatepublic void invalidate()Notifies that something changed, may need to invalidate any caches
 
-