Esempio n. 1
0
 public void DrawExceptionSelectControls(PlottedGraph plot)
 {
     if (plot.HighlightedExceptionNodes.Any() && ImGui.Button("Clear"))
     {
         plot.RemoveHighlightedNodes(_activeHighlights.SelectedExceptionNodes, CONSTANTS.HighlightType.Exceptions);
         _activeHighlights.SelectedExceptionNodes.Clear();
     }
 }
Esempio n. 2
0
        private void DrawExceptionSelectBox(PlottedGraph plot)
        {
            uint[]? exceptionNodes = plot.InternalProtoGraph.GetExceptionNodes();
            if (exceptionNodes is null || exceptionNodes.Length == 0)
            {
                string caption = $"No exceptions recorded in thread ID {_ActiveGraph?.TID}";
                ImGuiUtils.DrawRegionCenteredText(caption);
                return;
            }

            string[] labels = exceptionNodes.Select(x => x.ToString()).ToArray();
            if (ImGui.BeginTable("##ExceptionsTable", 2, ImGuiTableFlags.ScrollY | ImGuiTableFlags.RowBg, ImGui.GetContentRegionAvail() - new Vector2(10, _activeHighlights.SelectedExceptionNodes.Any() ? 30 : 0)))
            {
                ImGui.TableSetupColumn("Address", ImGuiTableColumnFlags.WidthFixed, 160);
                ImGui.TableSetupColumn("Module");
                ImGui.TableSetupScrollFreeze(0, 1);
                ImGui.TableHeadersRow();

                foreach (uint nodeidx in exceptionNodes)
                {
                    NodeData?n = plot.InternalProtoGraph.GetNode(nodeidx);

                    if (n is not null)
                    {
                        ImGui.TableNextRow();
                        if (ImGui.TableNextColumn())
                        {
                            if (ImGui.Selectable($"0x{n.Address:X}", _activeHighlights.SelectedExceptionNodes.Contains(nodeidx), ImGuiSelectableFlags.SpanAllColumns))
                            {
                                if (_activeHighlights.SelectedExceptionNodes.Contains(nodeidx))
                                {
                                    _activeHighlights.SelectedExceptionNodes.Remove(nodeidx);
                                    plot.RemoveHighlightedNodes(new List <uint> {
                                        nodeidx
                                    }, CONSTANTS.HighlightType.Exceptions);
                                }
                                else
                                {
                                    _activeHighlights.SelectedExceptionNodes.Add(nodeidx);
                                    plot.AddHighlightedNodes(new List <uint> {
                                        nodeidx
                                    }, CONSTANTS.HighlightType.Exceptions);
                                }
                            }
                        }
                        if (ImGui.TableNextColumn())
                        {
                            ImGui.Text(System.IO.Path.GetFileName(plot.InternalProtoGraph.ProcessData.GetModulePath(n.GlobalModuleID)));
                        }
                    }
                }
                ImGui.EndTable();
            }
        }
Esempio n. 3
0
 private static void HandleMouseoverSym(PlottedGraph plot, moduleEntry module_modentry, symbolInfo syminfo)
 {
     module_modentry.symbols[syminfo.address] = syminfo;
     if (syminfo.hovered)
     {
         plot.AddHighlightedNodes(syminfo.threadNodes, CONSTANTS.HighlightType.Externals);
     }
     else
     {
         plot.RemoveHighlightedNodes(syminfo.threadNodes, CONSTANTS.HighlightType.Externals);
     }
 }
Esempio n. 4
0
        public void DrawAddressSelectBox(PlottedGraph plot)
        {
            if (ImGui.ListBox("##AddrListbox", ref selitem,
                              _activeHighlights.SelectedAddresses.Select(ad => $"0x{ad:X}").ToArray(),
                              _activeHighlights.SelectedAddresses.Count))
            {
                ulong address = _activeHighlights.SelectedAddresses[selitem];
                _activeHighlights.SelectedAddresses.RemoveAt(selitem);
                plot.HighlightedAddresses.Remove(address);
                List <uint> nodes = plot.InternalProtoGraph.ProcessData.GetNodesAtAddress(address, plot.TID);

                plot.LayoutState.Lock.EnterUpgradeableReadLock();
                plot.RemoveHighlightedNodes(nodes, CONSTANTS.HighlightType.Addresses);
                plot.LayoutState.Lock.ExitUpgradeableReadLock();
            }
        }
Esempio n. 5
0
        private void DrawSymbolsSelectControls(PlottedGraph plot)
        {
            float height = 30;

            if (_activeHighlights.selectedHighlightTab == 0)
            {
                if (ImGui.BeginChild(ImGui.GetID("highlightSymsControls"), new Vector2(ImGui.GetContentRegionAvail().X, height)))
                {
                    ImGui.AlignTextToFramePadding();
                    ImGui.Text($"{_activeHighlights.SelectedSymbols.Count} highlighted symbols ({plot.HighlightedSymbolNodes.Count} nodes)");
                    ImGui.SameLine();
                    ImGui.Dummy(new Vector2(6, 10));
                    ImGui.SameLine();
                    if (ImGui.Button("Clear"))
                    {
                        foreach (var sym in _activeHighlights.SelectedSymbols)
                        {
                            symbolInfo symdat = _activeHighlights.displayedModules[sym.moduleID].symbols[sym.address];
                            symdat.selected = false;
                            _activeHighlights.displayedModules[sym.moduleID].symbols[sym.address] = symdat;
                        }

                        plot.LayoutState.Lock.EnterUpgradeableReadLock();
                        plot.RemoveHighlightedNodes(plot.HighlightedSymbolNodes, CONSTANTS.HighlightType.Externals);
                        plot.LayoutState.Lock.ExitUpgradeableReadLock();

                        _activeHighlights.SelectedSymbols.Clear();
                    }

                    /*
                     * ImGui.SameLine(ImGui.GetContentRegionAvail().X - 100);
                     * ImGui.PushStyleColor(ImGuiCol.Button, Themes.GetThemeColourUINT(Themes.eThemeColour.GraphBackground));
                     * ImGui.PushStyleColor(ImGuiCol.Text, WritableRgbaFloat.ToUint(Color.Cyan));
                     * if (ImGui.Button("Highlight Colour"))
                     * {
                     *  //todo: highlight colour picker
                     * }
                     * ImGui.PopStyleColor();
                     * ImGui.PopStyleColor();
                     */

                    ImGui.EndChild();
                }
            }
        }
Esempio n. 6
0
        private void HandleSelectedSym(PlottedGraph plot, moduleEntry module_modentry, symbolInfo syminfo)
        {
            syminfo.selected = !syminfo.selected;
            module_modentry.symbols[syminfo.address] = syminfo;

            plot.LayoutState.Lock.EnterUpgradeableReadLock();
            plot.LayoutState.GetAttributes(plot.ActiveLayoutStyle, out float[]? attribsArray);


            if (syminfo.selected)
            {
                plot.AddHighlightedNodes(syminfo.threadNodes, CONSTANTS.HighlightType.Externals);
                _activeHighlights.SelectedSymbols.Add(syminfo);
            }
            else
            {
                plot.RemoveHighlightedNodes(syminfo.threadNodes, CONSTANTS.HighlightType.Externals);
                _activeHighlights.SelectedSymbols = _activeHighlights.SelectedSymbols.Where(s => s.address != syminfo.address).ToList();
            }
            plot.LayoutState.Lock.ExitUpgradeableReadLock();
        }