Class ContextDatabase


  • public abstract class ContextDatabase
    extends java.lang.Object
    This is the interface and implementation for a database of memory locations which should be treated likeants. These come in two flavors:

    1) Low-level context variables These can affect instruction decoding. These can be as small as a single bit and need to be defined in the sleigh module (so that sleigh knows how they effect disassembly). These variables are not mapped to normal memory locations with a space and offset. (Although they often have a corresponding embedding into a normal memory location) The model to keep in mind is special bitfields within a control register.

    2) High-level tracked variables These are normal memory locations that are to be treated asants across some range of code. These are normally some register that is being kept track of be the compiler outside the domain of normal local and global variables. They have a specific value established by the compiler coming in to a function but are not supposed to be interpreted as a high-level variable. Typical examples are the String instruction direction flag and segment registers. These are all interpreted as aant value at the start of a function, but the function can recycle the memory location for other calculations once theant has been used.

    • Constructor Detail

      • ContextDatabase

        public ContextDatabase()
    • Method Detail

      • dispose

        public void dispose()
      • getContextSize

        public abstract int getContextSize()
      • registerVariable

        public abstract void registerVariable​(java.lang.String nm,
                                              int sbit,
                                              int ebit)
      • getVariable

        public abstract ContextBitRange getVariable​(java.lang.String nm)
      • getContext

        public abstract int[] getContext​(Address addr)
      • getDefaultValue

        public abstract int[] getDefaultValue()
      • createContext

        public abstract int[] createContext​(Address addr)
      • saveXml

        public abstract void saveXml​(java.io.PrintStream s)
      • restoreXml

        public abstract void restoreXml​(org.jdom.Element el,
                                        Translate translate)
      • restoreFromSpec

        public abstract void restoreFromSpec​(org.jdom.Element el,
                                             Translate translate)
      • setVariableDefault

        public void setVariableDefault​(java.lang.String nm,
                                       int val)
      • getDefaultValue

        public int getDefaultValue​(java.lang.String nm)
      • setVariable

        public void setVariable​(java.lang.String nm,
                                Address addr,
                                int value)
        Set value of context register, starting at addr
      • getVariable

        public int getVariable​(java.lang.String nm,
                               Address addr)
      • setContextRange

        public void setContextRange​(Address addr,
                                    int num,
                                    int mask,
                                    int value)
        Set specific bits in context
      • setVariableRegion

        public void setVariableRegion​(java.lang.String nm,
                                      Address begad,
                                      Address endad,
                                      int value)
        Set value of context register between begad and endad
      • getTrackedValue

        public long getTrackedValue​(VarnodeData mem,
                                    Address point)
        For a particular tracked memory location, get the value at a particular point.