Exemple #1
0
 public bool OpenLinkRequest(Database.LinkRequestTable link, Database.TableReference tableLink, Database.Table table)
 {
     using (ScopeDebugContext.String("OpenLinkRequest"))
     {
         if (link.LinkToOpen.RowWhere != null && link.LinkToOpen.RowWhere.Count > 0)
         {
             Database.Table filteredTable = table;
             if (table.GetMetaData().defaultFilter != null)
             {
                 filteredTable = table.GetMetaData().defaultFilter.CreateFilter(table);
             }
             var  whereUnion  = new Database.View.WhereUnion(link.LinkToOpen.RowWhere, null, null, null, null, m_UIState.CurrentMode.GetSchema(), filteredTable, link.SourceView == null ? null : link.SourceView.ExpressionParsingContext);
             long rowToSelect = whereUnion.GetIndexFirstMatch(link.SourceRow);
             if (rowToSelect < 0)
             {
                 DebugUtility.LogWarning("Could not find entry in target table '" + link.LinkToOpen.TableName + "'");
                 return(false);
             }
             DebugUtility.DebugLog("Opening table '" + link.LinkToOpen.TableName + "' at row " + rowToSelect);
             OpenTable(tableLink, table, new Database.CellPosition(rowToSelect, 0));
         }
         else
         {
             OpenTable(tableLink, table, new Database.CellPosition(0, 0));
         }
         return(true);
     }
 }
Exemple #2
0
        void OpenLinkRequest(Database.LinkRequestTable link, bool focus)
        {
            //TODO this code is the same as the one inSpreadsheetPane, should be put together
            UIElementsHelper.SetVisibility(VisualElements[2], m_ActiveMode.snapshot.nativeAllocationSites.Count > 0 && m_CurrentTableView == TableDisplayMode.Allocations);

            var tableRef = new Database.TableReference(link.LinkToOpen.TableName, link.Parameters);
            var table    = m_ActiveMode.SchemaToDisplay.GetTableByReference(tableRef);

            if (table == null)
            {
                UnityEngine.Debug.LogError("No table named '" + link.LinkToOpen.TableName + "' found.");
                return;
            }
            if (link.LinkToOpen.RowWhere != null && link.LinkToOpen.RowWhere.Count > 0)
            {
                Database.Table filteredTable = table;
                if (table.GetMetaData().defaultFilter != null)
                {
                    filteredTable = table.GetMetaData().defaultFilter.CreateFilter(table);
                }
                Database.Operation.ExpressionParsingContext expressionParsingContext = null;
                if (link.SourceView != null)
                {
                    expressionParsingContext = link.SourceView.ExpressionParsingContext;
                }
                var whereUnion = new Database.View.WhereUnion(link.LinkToOpen.RowWhere, null, null, null, null, m_ActiveMode.SchemaToDisplay, filteredTable, expressionParsingContext);
                var indices    = whereUnion.GetMatchingIndices(link.SourceRow);
                var newTab     = new Database.Operation.IndexedTable(table, new ArrayRange(indices));
                OpenTable(tableRef, newTab, focus);
            }
            else
            {
                OpenTable(tableRef, table, new Database.CellPosition(0, 0), focus);
            }
        }
        void OpenMetricData(Treemap.IMetricValue metric, bool focus)
        {
            if (metric is Treemap.ManagedObjectMetric)
            {
                var m = (Treemap.ManagedObjectMetric)metric;

                if (m_CurrentTableTypeFilter == metric.GetGroupName())
                {
                    var builder = new Database.View.Where.Builder("Index", Database.Operation.Operator.Equal, new Database.Operation.Expression.MetaExpression(metric.GetObjectUID().ToString(), true));

                    var whereStatement = builder.Build(null, null, null, null, null, m_Spreadsheet.DisplayTable, null); //yeah we could add a no param Build() too..
                    var row            = whereStatement.GetFirstMatchIndex(-1);

                    if (row > 0)
                    {
                        m_Spreadsheet.Goto(new Database.CellPosition(row, 0));
                        return;
                    }
                }

                var lr = new Database.LinkRequestTable();
                lr.LinkToOpen           = new Database.TableLink();
                lr.LinkToOpen.TableName = TableName;
                lr.SourceTable          = null;
                lr.SourceColumn         = null;
                lr.SourceRow            = -1;
                lr.Parameters.AddValue(ObjectTable.ObjParamName, m.m_Object.PtrObject);
                lr.Parameters.AddValue(ObjectTable.TypeParamName, m.m_Object.ITypeDescription);
                OpenLinkRequest(lr, focus, metric.GetGroupName());
            }
            else if (metric is Treemap.NativeObjectMetric)
            {
                var m = (Treemap.NativeObjectMetric)metric;

                if (m_CurrentTableTypeFilter == metric.GetGroupName())
                {
                    var builder        = new Database.View.Where.Builder("NativeInstanceId", Database.Operation.Operator.Equal, new Database.Operation.Expression.MetaExpression(m_UIState.snapshotMode.snapshot.nativeObjects.instanceId[m.m_ObjectIndex].ToString(), true));
                    var whereStatement = builder.Build(null, null, null, null, null, m_Spreadsheet.DisplayTable, null); //yeah we could add a no param Build() too..
                    var row            = whereStatement.GetFirstMatchIndex(-1);

                    if (row > 0)
                    {
                        m_Spreadsheet.Goto(new Database.CellPosition(row, 0));
                        return;
                    }
                }
                var lr = new Database.LinkRequestTable();
                lr.LinkToOpen           = new Database.TableLink();
                lr.LinkToOpen.TableName = TableName;
                var instanceId = m_UIState.snapshotMode.snapshot.nativeObjects.instanceId[m.m_ObjectIndex];
                var b          = new Database.View.Where.Builder("NativeInstanceId", Database.Operation.Operator.Equal, new Database.Operation.Expression.MetaExpression(instanceId.ToString(), true));
                lr.LinkToOpen.RowWhere = new System.Collections.Generic.List <Database.View.Where.Builder>();
                lr.LinkToOpen.RowWhere.Add(b);
                lr.SourceTable  = null;
                lr.SourceColumn = null;
                lr.SourceRow    = -1;
                OpenLinkRequest(lr, focus, metric.GetGroupName());
            }
        }
        void OpenLinkRequest(Database.LinkRequestTable link, bool focus, string tableTypeFilter = null, bool select = true)
        {
            List <Where.Builder> tableFilterWhere = null;

            m_CurrentTableTypeFilter = tableTypeFilter;
            if (tableTypeFilter != null)
            {
                tableFilterWhere = new List <Where.Builder>();
                tableFilterWhere.Add(new Where.Builder("Type", Database.Operation.Operator.Equal, new Database.Operation.Expression.MetaExpression(tableTypeFilter, true)));
            }
            //TODO this code is the same as the one inSpreadsheetPane, should be put together
            using (ScopeDebugContext.String("OpenLinkRequest"))
            {
                var tableRef = new Database.TableReference(link.LinkToOpen.TableName, link.Parameters);
                var table    = m_UIState.snapshotMode.SchemaToDisplay.GetTableByReference(tableRef);
                if (table == null)
                {
                    UnityEngine.Debug.LogError("No table named '" + link.LinkToOpen.TableName + "' found.");
                    return;
                }
                if (link.LinkToOpen.RowWhere != null && link.LinkToOpen.RowWhere.Count > 0)
                {
                    if (table.GetMetaData().defaultFilter != null)
                    {
                        table = table.GetMetaData().defaultFilter.CreateFilter(table);
                    }
                    Database.Operation.ExpressionParsingContext expressionParsingContext = null;
                    if (link.SourceView != null)
                    {
                        expressionParsingContext = link.SourceView.ExpressionParsingContext;
                    }
                    if (tableFilterWhere != null && tableFilterWhere.Count > 0)
                    {
                        table = FilterTable(table, link.SourceRow, tableFilterWhere);
                    }
                    var  whereUnion  = new WhereUnion(link.LinkToOpen.RowWhere, null, null, null, null, m_UIState.snapshotMode.SchemaToDisplay, table, expressionParsingContext);
                    long rowToSelect = whereUnion.GetIndexFirstMatch(link.SourceRow);
                    if (rowToSelect < 0)
                    {
                        UnityEngine.Debug.LogError("Could not find entry in target table '" + link.LinkToOpen.TableName + "'");
                        return;
                    }
                    OpenTable(tableRef, table, new Database.CellPosition(rowToSelect, 0), focus, select);
                }
                else if (tableFilterWhere != null && tableFilterWhere.Count > 0)
                {
                    table = FilterTable(table, link.SourceRow, tableFilterWhere);
                    OpenTable(tableRef, table, new Database.CellPosition(0, 0), focus, select);
                }
                else
                {
                    OpenTable(tableRef, table, new Database.CellPosition(0, 0), focus, select);
                }
            }
        }
        void OpenGroupData(Treemap.Group group)
        {
            var lr = new Database.LinkRequestTable();

            lr.LinkToOpen           = new Database.TableLink();
            lr.LinkToOpen.TableName = ObjectAllTable.TableName;
            lr.SourceTable          = null;
            lr.SourceColumn         = null;
            lr.SourceRow            = -1;
            OpenLinkRequest(lr, false, group._name, false);
        }
Exemple #6
0
        public void OpenLinkRequest(Database.LinkRequestTable link)
        {
            var tableRef = new Database.TableReference(link.LinkToOpen.TableName, link.Parameters);
            var table    = m_UIState.CurrentMode.GetSchema().GetTableByReference(tableRef);

            if (table == null)
            {
                UnityEngine.Debug.LogError("No table named '" + link.LinkToOpen.TableName + "' found.");
                return;
            }
            OpenLinkRequest(link, tableRef, table);
        }
        public void OnSelectRegions(ulong minAddr, ulong maxAddr)
        {
            if (minAddr == maxAddr)
            {
                return;
            }

            var lr = new Database.LinkRequestTable();

            lr.LinkToOpen = new Database.TableLink();

            if (CurrentTableView == TableDisplayMode.Objects)
            {
                lr.LinkToOpen.TableName = ObjectAllTable.TableName;

                lr.LinkToOpen.RowWhere = new List <Database.View.Where.Builder>();
                lr.LinkToOpen.RowWhere.Add(new Database.View.Where.Builder("Address", Database.Operation.Operator.GreaterEqual, new Expression.MetaExpression(minAddr.ToString(), false)));
                lr.LinkToOpen.RowWhere.Add(new Database.View.Where.Builder("Address", Database.Operation.Operator.Less, new Expression.MetaExpression(maxAddr.ToString(), false)));
            }

            if (CurrentTableView == TableDisplayMode.Allocations)
            {
                lr.LinkToOpen.TableName = "RawNativeAllocation";
                lr.LinkToOpen.RowWhere  = new List <Database.View.Where.Builder>();
                lr.LinkToOpen.RowWhere.Add(new Database.View.Where.Builder("address", Database.Operation.Operator.GreaterEqual, new Expression.MetaExpression(minAddr.ToString(), false)));
                lr.LinkToOpen.RowWhere.Add(new Database.View.Where.Builder("address", Database.Operation.Operator.Less, new Expression.MetaExpression(maxAddr.ToString(), false)));
            }

            if (CurrentTableView == TableDisplayMode.Regions)
            {
                lr.LinkToOpen.TableName = "RawNativeMemoryRegion";
                lr.LinkToOpen.RowWhere  = new List <Database.View.Where.Builder>();
                lr.LinkToOpen.RowWhere.Add(new Database.View.Where.Builder("addressBase", Database.Operation.Operator.GreaterEqual, new Expression.MetaExpression(minAddr.ToString(), false)));
                lr.LinkToOpen.RowWhere.Add(new Database.View.Where.Builder("addressBase", Database.Operation.Operator.Less, new Expression.MetaExpression(maxAddr.ToString(), false)));
            }

            lr.SourceTable  = null;
            lr.SourceColumn = null;
            lr.SourceRow    = -1;
            OpenLinkRequest(lr, true);

            if (m_Spreadsheet.RowCount > 0)
            {
                m_Spreadsheet.SelectedRow = 0;
            }
        }
        public void ShowAllObjects(Treemap.IMetricValue itemCopyToSelect, bool focus)
        {
            // TODO: Fix history zooming UX
            focus = false;

            Treemap.IMetricValue itemToSelect = null;
            m_TreeMap.ClearMetric();
            if (m_CurrentCodeType == CodeType.Unknown || m_CurrentCodeType == CodeType.Managed)
            {
                foreach (var managedObject in m_UIState.snapshotMode.snapshot.CrawledData.ManagedObjects)
                {
                    if (managedObject.Size > 0)
                    {
                        var o = new Treemap.ManagedObjectMetric(m_UIState.snapshotMode.snapshot, managedObject);
                        if (o.IsSame(itemCopyToSelect))
                        {
                            itemToSelect = o;
                        }
                        m_TreeMap.AddMetric(o);
                    }
                }
            }
            if (m_CurrentCodeType == CodeType.Unknown || m_CurrentCodeType == CodeType.Native)
            {
                for (int i = 0; i != m_UIState.snapshotMode.snapshot.nativeObjects.Count; ++i)
                {
                    if (m_UIState.snapshotMode.snapshot.nativeObjects.size[i] > 0)
                    {
                        var o = new Treemap.NativeObjectMetric(m_UIState.snapshotMode.snapshot, i);
                        if (o.IsSame(itemCopyToSelect))
                        {
                            itemToSelect = o;
                        }
                        m_TreeMap.AddMetric(o);
                    }
                }
            }
            m_TreeMap.UpdateMetric();

            if (itemToSelect != null)
            {
                OpenMetricData(itemToSelect, focus);
            }
            else
            {
                try
                {
                    using (new Service <IDebugContextService> .ScopeService(new DebugContextService()))
                    {
                        var lr = new Database.LinkRequestTable();
                        lr.LinkToOpen           = new Database.TableLink();
                        lr.LinkToOpen.TableName = ObjectAllTable.TableName;
                        lr.SourceTable          = null;
                        lr.SourceColumn         = null;
                        lr.SourceRow            = -1;
                        OpenLinkRequest(lr, false, null, false);
                    }
                }
                catch (ExitGUIException)
                {
                    throw;
                }
                catch (Exception e)
                {
                    throw new Exception(DebugUtility.GetExceptionHelpMessage(e));
                }
            }
        }
Exemple #9
0
        public void ShowAllObjects(Treemap.ObjectMetric itemCopyToSelect, bool focus)
        {
            // TODO: Fix history zooming UX
            focus = false;

            Treemap.ObjectMetric itemToSelect = default(Treemap.ObjectMetric);
            m_TreeMap.ClearMetric();
            if (m_CurrentCodeType == CodeType.Unknown || m_CurrentCodeType == CodeType.Managed)
            {
                var managedObjects = m_UIState.snapshotMode.snapshot.CrawledData.ManagedObjects;
                for (int i = 0; i < managedObjects.Count; ++i)
                {
                    var managedObject = managedObjects[i];
                    if (managedObject.Size > 0)
                    {
                        var o = new Treemap.ObjectMetric(managedObject.ManagedObjectIndex, m_UIState.snapshotMode.snapshot, Treemap.ObjectMetricType.Managed);
                        if (o.Equals(itemCopyToSelect))
                        {
                            itemToSelect = o;
                        }
                        m_TreeMap.AddMetric(o);
                    }
                }
            }
            if (m_CurrentCodeType == CodeType.Unknown || m_CurrentCodeType == CodeType.Native)
            {
                for (int i = 0; i != m_UIState.snapshotMode.snapshot.nativeObjects.Count; ++i)
                {
                    if (m_UIState.snapshotMode.snapshot.nativeObjects.size[i] > 0)
                    {
                        var o = new Treemap.ObjectMetric(i, m_UIState.snapshotMode.snapshot, Treemap.ObjectMetricType.Native);
                        if (o.Equals(itemCopyToSelect))
                        {
                            itemToSelect = o;
                        }
                        m_TreeMap.AddMetric(o);
                    }
                }
            }
            m_TreeMap.UpdateMetric();

            if (!itemToSelect.Equals(default(Treemap.ObjectMetric)))
            {
                OpenMetricData(itemToSelect, focus);
            }
            else
            {
                try
                {
                    var lr = new Database.LinkRequestTable();
                    lr.LinkToOpen           = new Database.TableLink();
                    lr.LinkToOpen.TableName = ObjectAllTable.TableName;
                    lr.SourceTable          = null;
                    lr.SourceColumn         = null;
                    lr.SourceRow            = -1;
                    OpenLinkRequest(lr, false, null, false);
                }
                catch (Exception)
                {
                    throw;
                }
            }
        }