示例#1
0
 public void clipCalls_addressStack(RANGE_PARSE_4BYTE range)
 {
     if (dataVis != null)
         dataVis = dataVis.clipCalls_addressStack(range);
 }
示例#2
0
        private void updatePredictedOutput()
        {
            // Parse the input parameters
            int minCallCount = getCallCountMin();
            int maxCallCount = getCallCountMax();

            // Validate input arguments again
            if (minCallCount < 0 | maxCallCount < 0 && maxCallCount >= minCallCount)
            {
                return;
            }

            // Load the time range selection radial menu
            int timeSelection = (radioTimeRangeAll.Checked ? 1 : 0) + (radioTimeRangeClip.Checked ? 2 : 0);

            // Load the arg filter type selection radial menu
            int argFilterSelection = (radioArgAny.Checked ? 1 : 0) + (radioArg1Byte.Checked ? 2 : 0) +
                                     (radioArg2Byte.Checked ? 3 : 0) + (radioArg4Byte.Checked ? 4 : 0) +
                                     (radioArgFloat.Checked ? 5 : 0);

            // Load the arg string selection radial menu
            int argStringSelection = (radioStringAny.Checked ? 1 : 0) + (radioStringYes.Checked ? 2 : 0) +
                                     (radioStringMatch.Checked ? 3 : 0);

            // Load the arg binary selection radial menu
            int argBinarySelection = (radioBinaryAny.Checked ? 1 : 0) + (radioBinaryPartial.Checked ? 2 : 0) +
                                     (radioBinaryStart.Checked ? 3 : 0);

            // Load the argument count filter
            int argMinCount;
            int argMaxCount;

            if (!getArgRange(out argMinCount, out argMaxCount))
            {
                return;
            }

            // Validate the input of the arg filter selection
            RANGE_PARSE args = null;

            switch (argFilterSelection)
            {
            case 2:
                args = new RANGE_PARSE_1BYTE(text1Byte);
                break;

            case 3:
                args = new RANGE_PARSE_2BYTE(text2Byte);
                break;

            case 4:
                args = new RANGE_PARSE_4BYTE(text4Byte);
                break;

            case 5:
                args = new RANGE_PARSE_FLOAT(textFloat);
                break;
            }
            if (args != null && !args.valid)
            {
                return;
            }

            // Create a copy of the original function list
            functionListOutput = functionList.Clone();

            // Perform the data clipping if required
            if (timeSelection == 2)
            {
                // Clip the data to the selected region

                // Firstly replace the function list output with the selected time series output
                functionListOutput = playBar.getSelectedFunctionList().Clone();

                // Now clip it to the selected range
                functionListOutput.clipCalls_timeRange(playBar.selectStart, playBar.selectEnd);
            }

            // Filter the data based on the source and destination if required
            if (checkAddressFunction.Checked)
            {
                // Filter based on the function address
                RANGE_PARSE_4BYTE range = new RANGE_PARSE_4BYTE(textAddressRangeFunction);
                if (range.valid)
                {
                    functionListOutput.clipCalls_addressDest(range);
                }
            }
            if (checkAddressSource.Checked)
            {
                // Filter based on the call source address
                RANGE_PARSE_4BYTE range = new RANGE_PARSE_4BYTE(textAddressRangeSource);
                if (range.valid)
                {
                    functionListOutput.clipCalls_addressSource(range);
                }
            }

            // Perform the argument count filtering
            functionListOutput.clipCalls_argumentCount(argMinCount, argMaxCount);

            // Perform the argument searching
            if (args != null)
            {
                functionListOutput.clipCalls_argument(args);
            }

            // Filter based on the string arguments
            switch (argStringSelection)
            {
            case 1:
                // Any call
                break;

            case 2:
                // Only calls with strings
                functionListOutput.clipCalls_hasStringArgument();
                break;

            case 3:
                // Calls with string match
                functionListOutput.clipCalls_hasStringArgumentMatch(textStringMatch.Text, checkStringCaseSensitive.Checked);
                break;
            }

            // Filter based on the binary dereference arguments

            // Validate the data
            byte[] binaryData;
            if (!readByteHexString(textBinaryMatch.Text, out binaryData))
            {
                // Invalid hex string
                textBinaryMatch.BackColor = Color.MediumVioletRed;
            }
            else
            {
                // Valid hex string
                textBinaryMatch.BackColor = Color.White;
            }

            switch (argBinarySelection)
            {
            case 1:
                // Any call
                break;

            case 2:
                // Only calls with a partial binary match
                functionListOutput.clipCalls_hasBinaryArgumentMatch(binaryData, false);
                break;

            case 3:
                // Only calls with a starts-with binary match
                functionListOutput.clipCalls_hasBinaryArgumentMatch(binaryData, true);
                break;
            }


            // Perform the call type filtering
            if (radioTypeInter.Checked || radioTypeIntra.Checked)
            {
                functionListOutput.clipCalls_type((radioTypeInter.Checked ? 1 : 2));
            }



            // Perform the call count filtering and clip the resulting functions
            functionListOutput.clipFunctions_CallCount(minCallCount, maxCallCount);

            // Update the displays
            functionGrid.Rows.Clear();
            functionGrid.RowCount = functionListOutput.getCount();
            functionGrid.Invalidate();
            this.Update();
            labelCallsBefore.Text = string.Concat(functionList.getCallCount().ToString(), " calls before filtering.");
            labelCallsAfter.Text  = string.Concat(functionListOutput.getCallCount().ToString(), " calls after filtering.");

            labelFunctionsBefore.Text = string.Concat(functionList.getCount().ToString(), " functions before filtering.");
            labelFunctionsAfter.Text  = string.Concat(functionListOutput.getCount().ToString(), " functions after filtering.");
        }
 /// <summary>
 /// Returns a new dataset clipped to stack pointers with the specified range of addresses.
 /// </summary>
 /// <param name="range"></param>
 /// <returns></returns>
 public oBufferTimeData clipCalls_addressStack(RANGE_PARSE_4BYTE range)
 {
     // Perform a FindAll search.
     oSingleDataAddressSelecter selecter = new oSingleDataAddressSelecter(range);
     return new oBufferTimeData(data.FindAll(selecter.isStackGood), startTime, timeStart, timeEnd);
 }
示例#4
0
        private void updatePredictedOutput()
        {
            // Parse the input parameters
            int minCallCount = getCallCountMin();
            int maxCallCount = getCallCountMax();

            // Validate input arguments again
            if (minCallCount < 0 | maxCallCount < 0 && maxCallCount >= minCallCount )
                return;

            // Load the time range selection radial menu
            int timeSelection = (radioTimeRangeAll.Checked ? 1 : 0) + (radioTimeRangeClip.Checked ? 2 : 0);

            // Load the arg filter type selection radial menu
            int argFilterSelection = (radioArgAny.Checked ? 1 : 0) + (radioArg1Byte.Checked ? 2 : 0) +
                                     (radioArg2Byte.Checked ? 3 : 0) + (radioArg4Byte.Checked ? 4 : 0) +
                                     (radioArgFloat.Checked ? 5 : 0);

            // Load the arg string selection radial menu
            int argStringSelection = (radioStringAny.Checked ? 1 : 0) + (radioStringYes.Checked ? 2 : 0) +
                                     (radioStringMatch.Checked ? 3 : 0);

            // Load the arg binary selection radial menu
            int argBinarySelection = (radioBinaryAny.Checked ? 1 : 0) + (radioBinaryPartial.Checked ? 2 : 0) +
                                     (radioBinaryStart.Checked ? 3 : 0);

            // Load the argument count filter
            int argMinCount;
            int argMaxCount;
            if (!getArgRange(out argMinCount, out argMaxCount))
                return;

            // Validate the input of the arg filter selection
            RANGE_PARSE args = null;
            switch(argFilterSelection)
            {
                case 2:
                    args = new RANGE_PARSE_1BYTE(text1Byte);
                    break;
                case 3:
                    args = new RANGE_PARSE_2BYTE(text2Byte);
                    break;
                case 4:
                    args = new RANGE_PARSE_4BYTE(text4Byte);
                    break;
                case 5:
                    args = new RANGE_PARSE_FLOAT(textFloat);
                    break;
            }
            if (args != null && !args.valid)
                return;

            // Create a copy of the original function list
            functionListOutput = functionList.Clone();

            // Perform the data clipping if required
            if( timeSelection == 2 )
            {
                // Clip the data to the selected region

                // Firstly replace the function list output with the selected time series output
                functionListOutput = playBar.getSelectedFunctionList().Clone();

                // Now clip it to the selected range
                functionListOutput.clipCalls_timeRange(playBar.selectStart, playBar.selectEnd);
            }

            // Filter the data based on the source and destination if required
            if( checkAddressFunction.Checked )
            {
                // Filter based on the function address
                RANGE_PARSE_4BYTE range = new RANGE_PARSE_4BYTE(textAddressRangeFunction);
                if( range.valid )
                    functionListOutput.clipCalls_addressDest(range);
            }
            if( checkAddressSource.Checked )
            {
                // Filter based on the call source address
                RANGE_PARSE_4BYTE range = new RANGE_PARSE_4BYTE(textAddressRangeSource);
                if (range.valid)
                    functionListOutput.clipCalls_addressSource(range);
            }

            // Perform the argument count filtering
            functionListOutput.clipCalls_argumentCount(argMinCount,argMaxCount);

            // Perform the argument searching
            if( args != null )
                functionListOutput.clipCalls_argument(args);

            // Filter based on the string arguments
            switch(argStringSelection)
            {
                case 1:
                    // Any call
                    break;
                case 2:
                    // Only calls with strings
                    functionListOutput.clipCalls_hasStringArgument();
                    break;
                case 3:
                    // Calls with string match
                    functionListOutput.clipCalls_hasStringArgumentMatch(textStringMatch.Text, checkStringCaseSensitive.Checked);
                    break;
            }

            // Filter based on the binary dereference arguments

            // Validate the data
            byte[] binaryData;
            if (!readByteHexString(textBinaryMatch.Text, out binaryData))
            {
                // Invalid hex string
                textBinaryMatch.BackColor = Color.MediumVioletRed;
            }
            else
            {
                // Valid hex string
                textBinaryMatch.BackColor = Color.White;
            }

            switch (argBinarySelection)
            {
                case 1:
                    // Any call
                    break;
                case 2:
                    // Only calls with a partial binary match
                    functionListOutput.clipCalls_hasBinaryArgumentMatch(binaryData, false);
                    break;
                case 3:
                    // Only calls with a starts-with binary match
                    functionListOutput.clipCalls_hasBinaryArgumentMatch(binaryData, true);
                    break;
            }

            // Perform the call type filtering
            if( radioTypeInter.Checked || radioTypeIntra.Checked )
                functionListOutput.clipCalls_type((radioTypeInter.Checked ? 1 : 2));

            // Perform the call count filtering and clip the resulting functions
            functionListOutput.clipFunctions_CallCount(minCallCount, maxCallCount);

            // Update the displays
            functionGrid.Rows.Clear();
            functionGrid.RowCount = functionListOutput.getCount();
            functionGrid.Invalidate();
            this.Update();
            labelCallsBefore.Text = string.Concat(functionList.getCallCount().ToString(), " calls before filtering.");
            labelCallsAfter.Text = string.Concat(functionListOutput.getCallCount().ToString(), " calls after filtering.");

            labelFunctionsBefore.Text = string.Concat(functionList.getCount().ToString(), " functions before filtering.");
            labelFunctionsAfter.Text = string.Concat(functionListOutput.getCount().ToString(), " functions after filtering.");
        }
        private void menuBreakdownThread_Click(object sender, EventArgs e)
        {
            if (functionList == null) return;
            // Breakdown the function list based on the thread

            // First generate a list of unique stack heaps
            List<HEAP_INFO> heaps = functionList.getStackHeapList();

            if (heaps.Count > 1)
            {
                // Now create a function list for each heap, filtered to each heap range
                foreach (HEAP_INFO heap in heaps)
                {
                    // Create the filter range object
                    RANGE_PARSE_4BYTE range = new RANGE_PARSE_4BYTE((uint)heap.heapAddress,
                                                      (uint) (heap.heapAddress + heap.heapLength));

                    // Create a cloned and filtered copy of the function list
                    oFunctionList newList = functionList.Clone();
                    newList.clipCalls_addressStack(range);

                    // Add this filtered function list to the breakdown
                    controlVisPlayBar.addTimeSeriesFromFunctionList(newList,
                                                                    "thread stack " + heap.heapAddress.ToString("X"));
                }

                // Resize the playbar panel
                autosizePlaybar();
            }
            else
            {
                MessageBox.Show("Only one thread was found, so this recording cannot be broken down by thread.","Unable to break down by thread",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
        }
        private void menuBreakdownModule_Click(object sender, EventArgs e)
        {
            if (functionList == null) return;
            // Break the function list down by the module of the call destination.

            // First generate a list of unique heaps
            List<HEAP_INFO> heaps = functionList.getModuleList();

            if (heaps.Count > 1)
            {
                // Now create a function list for each heap, filtered to each heap range
                foreach (HEAP_INFO heap in heaps)
                {
                    // Create the filter range object
                    RANGE_PARSE_4BYTE range = new RANGE_PARSE_4BYTE((uint)heap.heapAddress,
                                                      (uint) (heap.heapAddress + heap.heapLength));

                    // Create a cloned and filtered copy of the function list
                    oFunctionList newList = functionList.Clone();
                    newList.clipCalls_addressDest(range);

                    // Add this filtered function list to the breakdown
                    controlVisPlayBar.addTimeSeriesFromFunctionList(newList,
                                                                    (heap.associatedModule != null
                                                                         ? heap.associatedModule.ModuleName
                                                                         : "unknown, " + heap.heapAddress.ToString("X")));
                }

                // Resize the playbar panel
                autosizePlaybar();
            }
        }
        private void menuAddPlotModule_Click(object sender, EventArgs e)
        {
            // The user would like to add a plot for a specific module

            // First generate the list of heaps
            List<HEAP_INFO> heaps = functionList.getModuleList();

            // Find the name of the module we are looking for
            int i = 0;
            for(i = 0; i < moduleToolStripMenuItem1.DropDownItems.Count; i++)
                if(moduleToolStripMenuItem1.DropDownItems[i] == sender)
                    break;

            if( moduleToolStripMenuItem1.DropDownItems[i] == sender )
            {
                // We found the module we are looking for

                // Associate the module with a heap
                int j = 0;
                for (j = 0; j < heaps.Count; j++)
                    if (moduleToolStripMenuItem1.DropDownItems[i].Text.CompareTo(heaps[j].associatedModule.ModuleName) == 0)
                        break;

                if (moduleToolStripMenuItem1.DropDownItems[i].Text.CompareTo(heaps[j].associatedModule.ModuleName) == 0)
                {
                    // We found the heap

                    // Create the filter range object
                    RANGE_PARSE_4BYTE range = new RANGE_PARSE_4BYTE((uint)heaps[j].heapAddress,
                                                      (uint)(heaps[j].heapAddress + heaps[j].heapLength));

                    // Create a cloned and filtered copy of the function list
                    oFunctionList newList = functionList.Clone();
                    newList.clipCalls_addressDest(range);

                    // Add this filtered function list to the breakdown
                    controlVisPlayBar.addTimeSeriesFromFunctionList(newList,
                                                                    (heaps[j].associatedModule != null
                                                                         ? heaps[j].associatedModule.ModuleName
                                                                         : "unknown, " + heaps[j].heapAddress.ToString("X")));

                    // Resize the playbar panel
                    autosizePlaybar();
                }
            }
        }