Class LocalSymbolMap


  • public class LocalSymbolMap
    extends java.lang.Object
    A container for local symbols within the decompiler's model of a function. It contains HighSymbol objects for any symbol within the scope of the function, including parameters. The container is populated either from the underlying Function object (when sending information to the decompiler) or read in from an XML description (when receiving a function model from the decompiler). HighSymbols can be obtained via Address using findLocal() or by id using getSymbol(). Parameters can be accessed specifically using getParamSymbol().
    • Constructor Detail

      • LocalSymbolMap

        public LocalSymbolMap​(HighFunction highFunc,
                              java.lang.String spcname)
        Parameters:
        highFunc - HighFunction the local variables are defined within.
        spcname - space name the local variables are defined within.
    • Method Detail

      • getHighFunction

        public HighFunction getHighFunction()
        Get the decompiler's function model owning this container
        Returns:
        the owning HighFunction
      • getNameToSymbolMap

        public java.util.Map<java.lang.String,​HighSymbol> getNameToSymbolMap()
        Construct and return a map from a HighSymbol's name to the HighSymbol object
        Returns:
        the new name to symbol map
      • grabFromFunction

        public void grabFromFunction​(boolean includeDefaultNames)
        Populate the local variable map from information attached to the Program DB's function.
        Parameters:
        includeDefaultNames - is true if default symbol names should be considered locked
      • parseScopeXML

        public void parseScopeXML​(XmlPullParser parser)
                           throws PcodeXMLException
        Parse a local symbol scope in XML from the <localdb> tag.
        Parameters:
        parser - is the XML parser
        Throws:
        PcodeXMLException - for problems parsing individual tags
      • parseSymbolList

        public void parseSymbolList​(XmlPullParser parser)
                             throws PcodeXMLException
        Add mapped symbols to this LocalVariableMap, by parsing the <symbollist> and <mapsym> tags.
        Parameters:
        parser - is the XML parser
        Throws:
        PcodeXMLException - for problems parsing a tag
      • buildLocalDbXML

        public void buildLocalDbXML​(java.lang.StringBuilder resBuf,
                                    Namespace namespace)
        Output an XML document representing this local variable map.
        Parameters:
        resBuf - is the buffer to write to
        namespace - if the namespace of the function
      • getSymbols

        public java.util.Iterator<HighSymbol> getSymbols()
        Get all the symbols mapped for this program, Param, Locals. The HighSymbol can either be a HighParam, or HighLocal
        Returns:
        an iterator over all mapped symbols.
      • findLocal

        public HighSymbol findLocal​(VariableStorage store,
                                    Address pc)
        Find any local variable (including input params) by address
        Parameters:
        store - - variable storage
        pc - = Address of first use, or null if address is valid throughout the entire scope
        Returns:
        HighLocal or null
      • findLocal

        public HighSymbol findLocal​(Address addr,
                                    Address pc)
        Find any local variable (including input params) by address
        Parameters:
        addr - - variable storage address
        pc - = Address of first use, or null if address is valid throughout the entire scope
        Returns:
        HighLocal or null
      • getSymbol

        public HighSymbol getSymbol​(long id)
        Lookup high variable based upon its symbol-id
        Parameters:
        id - symbol-id
        Returns:
        variable or null if not found
      • getNumParams

        public int getNumParams()
        Get the number of parameter symbols in this scope
        Returns:
        the number of parameters
      • getParamSymbol

        public HighSymbol getParamSymbol​(int i)
        Parameters:
        i - is the desired parameter position
        Returns:
        the i-th parameter HighSymbol
      • getParam

        public HighParam getParam​(int i)
        Parameters:
        i - is the desired parameter position
        Returns:
        the i-th parameter variable
      • containsVariableWithName

        public boolean containsVariableWithName​(java.lang.String name)
      • newDynamicSymbol

        protected HighSymbol newDynamicSymbol​(long id,
                                              java.lang.String nm,
                                              DataType dt,
                                              long hash,
                                              Address pcaddr)