Beispiel #1
0
        /// <summary>
        /// Initializes all the quick-lookup arrays required for high-performance lookups.
        /// </summary>
        /// <param name="functions">Array of oFunction classes. This should be the complete list of functions.</param>
        /// /// <param name="displayPanel">The display panel.</param>
        public void initialize(List <HEAP_INFO> map, List <oFunction> functions, oVisMain displayPanel)
        {
            // Clear the dynamic buffer data
            reset();

            // Create the module manager
            moduleManager = new oVisModuleManager(map, 3);

            // Initialize the arrays
            directCallSourcesHash = new Hashtable();
            functionLocationsHash = new Hashtable();
            functionLocationsList = new ArrayList();
            vertexFunctions       = new CustomVertex.TransformedColored[0];
            executedVertexIndices = new ArrayList(1000);

            // Create the lookup tables
            foreach (oFunction function in functions)
            {
                // Add this function
                //functionLocationsHash.Add(function.address, -1);
                functionLocationsList.Add(function.address);
            }

            // Sort the list
            functionLocationsList.Sort();

            // Add the direct call sources
            foreach (oFunction function in functions)
            {
                foreach (uint source in function.normalCallers)
                {
                    // Add this lookup entry

                    // Find the function corresponding to this function source
                    int index = functionLocationsList.BinarySearch(source);
                    if (index < 0)
                    {
                        index = ~index - 1;
                    }
                    if (index < 0)
                    {
                        index = 0;
                    }

                    // Add this function address
                    directCallSourcesHash.Add(source, functionLocationsList[index]);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// Initializes all the quick-lookup arrays required for high-performance lookups.
        /// </summary>
        /// <param name="functions">Array of oFunction classes. This should be the complete list of functions.</param>
        /// /// <param name="displayPanel">The display panel.</param>
        public void initialize(List<HEAP_INFO> map, List<oFunction> functions, oVisMain displayPanel)
        {
            // Clear the dynamic buffer data
            reset();

            // Create the module manager
            moduleManager = new oVisModuleManager(map,3);

            // Initialize the arrays
            directCallSourcesHash = new Hashtable();
            functionLocationsHash = new Hashtable();
            functionLocationsList = new ArrayList();
            vertexFunctions = new CustomVertex.TransformedColored[0];
            executedVertexIndices = new ArrayList(1000);

            // Create the lookup tables
            foreach (oFunction function in functions)
            {
                // Add this function
                //functionLocationsHash.Add(function.address, -1);
                functionLocationsList.Add(function.address);
            }

            // Sort the list
            functionLocationsList.Sort();

            // Add the direct call sources
            foreach (oFunction function in functions)
            {
                foreach (uint source in function.normalCallers)
                {
                    // Add this lookup entry

                    // Find the function corresponding to this function source
                    int index = functionLocationsList.BinarySearch(source);
                    if (index < 0)
                        index = ~index-1;
                    if (index < 0)
                        index = 0;

                    // Add this function address
                    directCallSourcesHash.Add(source, functionLocationsList[index]);
                }
            }
        }