示例#1
0
        /// <summary>
        /// Processes the given access path.
        /// </summary>
        /// <param name="path">The path.</param>
        public void ProcessPath(MemoryPath path)
        {
            Global    = path.Global;
            CallLevel = path.CallLevel;

            foreach (PathSegment segment in path.PathSegments)
            {
                Next(segment);
            }
        }
示例#2
0
        /// <summary>
        /// Prevents a default instance of the <see cref="MemoryPath"/> class from being created
        /// in order to make new path use one of static methods in this class.
        ///
        /// New path will extends existing path by new segment.
        /// </summary>
        /// <param name="parentPath">The parent path.</param>
        /// <param name="pathSegment">The path segment.</param>
        private MemoryPath(MemoryPath parentPath, PathSegment pathSegment)
        {
            List <PathSegment> path = new List <PathSegment>(parentPath.PathSegments);

            path.Add(pathSegment);

            IsDirect  = parentPath.IsDirect && pathSegment.IsDirect;
            Global    = parentPath.Global;
            CallLevel = parentPath.CallLevel;

            PathSegments = new ReadOnlyCollection <PathSegment>(path);
        }
示例#3
0
        /// <summary>
        /// Gets the snapshot entry of temporary index associated with this memory entry.
        /// </summary>
        /// <param name="context">The context.</param>
        private SnapshotEntry getTemporary(SnapshotBase context)
        {
            Snapshot snapshot = SnapshotEntry.ToSnapshot(context);

            if (temporaryLocation == null)
            {
                temporaryIndex = snapshot.CreateTemporary();
                MergeWithinSnapshotWorker mergeWorker = new MergeWithinSnapshotWorker(snapshot);
                mergeWorker.MergeMemoryEntry(temporaryIndex, dataEntry);

                temporaryLocation = new SnapshotEntry(MemoryPath.MakePathTemporary(temporaryIndex));
            }

            return(temporaryLocation);
        }
示例#4
0
        /// <summary>
        /// Creates the snapshot entry for the given variable name.
        /// </summary>
        /// <param name="variable">The variable name.</param>
        /// <param name="global">Determines whether variable is global or local.</param>
        /// <param name="callLevel">The call level.</param>
        internal static ReadWriteSnapshotEntryBase CreateVariableEntry(AnalysisFramework.VariableIdentifier variable, GlobalContext global, int callLevel)
        {
            MemoryPath path;

            if (variable.IsUnknown)
            {
                path = MemoryPath.MakePathAnyVariable(global, callLevel);
            }
            else
            {
                var names = from name in variable.PossibleNames select name.Value;
                path = MemoryPath.MakePathVariable(names, global, callLevel);
            }

            return(new SnapshotEntry(path, variable));
        }
示例#5
0
        /// <summary>
        /// Read memory represented by given field identifier resolved on current
        /// snapshot entry (resulting snapshot entry can encapsulate merging, alias resolving and
        /// other stuff based on nondeterminism of identifier and current snapshot entry)
        /// </summary>
        /// <param name="context">Context snapshot where operation is proceeded</param>
        /// <param name="field">Identifier of an field</param>
        /// <returns>
        /// Snapshot entry representing field resolving on current entry
        /// </returns>
        protected override ReadWriteSnapshotEntryBase readField(SnapshotBase context, AnalysisFramework.VariableIdentifier field)
        {
            MemoryPath newPath;

            if (field.IsUnknown)
            {
                newPath = MemoryPath.MakePathAnyField(path);
            }
            else
            {
                var names = from name in field.PossibleNames select name.Value;
                newPath = MemoryPath.MakePathField(path, names);
            }

            return(new SnapshotEntry(newPath, variableId));
        }
示例#6
0
        /// <summary>
        /// Read memory represented by given index identifier resolved on current
        /// snapshot entry (resulting snapshot entry can encapsulate merging, alias resolving and
        /// other stuff based on nondeterminism of identifier and current snapshot entry)
        /// </summary>
        /// <param name="context">Context snapshot where operation is proceeded</param>
        /// <param name="index">Identifier of an index</param>
        /// <returns>
        /// Snapshot entry representing index resolving on current entry
        /// </returns>
        protected override ReadWriteSnapshotEntryBase readIndex(SnapshotBase context, MemberIdentifier index)
        {
            MemoryPath newPath;

            if (index.IsAny)
            {
                newPath = MemoryPath.MakePathAnyIndex(path);
            }
            else if (index.IsUnknown)
            {
                newPath = MemoryPath.MakePathUnknownIndex(path);
            }
            else
            {
                newPath = MemoryPath.MakePathIndex(path, index.PossibleNames);
            }

            return(new SnapshotEntry(newPath, variableId));
        }
示例#7
0
        /// <summary>
        /// Creates the snapshot entry for the given variable name.
        /// </summary>
        /// <param name="name">The name of control variable.</param>
        /// <param name="global">Determines whether variable is global or local.</param>
        /// <param name="callLevel">The call level.</param>
        /// <returns>New snapshot entry for the given variable name.</returns>
        internal static ReadWriteSnapshotEntryBase CreateControlEntry(VariableName name, GlobalContext global, int callLevel)
        {
            MemoryPath path = MemoryPath.MakePathControl(new string[] { name.ToString() }, global, callLevel);

            return(new SnapshotEntry(path));
        }
示例#8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SnapshotEntry"/> class.
 /// </summary>
 /// <param name="path">The variable acces path.</param>
 /// <param name="variableId">The variable unique identifier.</param>
 private SnapshotEntry(MemoryPath path, AnalysisFramework.VariableIdentifier variableId)
 {
     this.path       = path;
     this.variableId = variableId;
 }
示例#9
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SnapshotEntry"/> class.
        /// </summary>
        /// <param name="path">The variable acces path.</param>
        internal SnapshotEntry(MemoryPath path)
        {
            this.path = path;

            this.variableId = null;
        }
示例#10
0
 /// <summary>
 /// Makes the path which extends given path by indicies with given names.
 /// </summary>
 /// <param name="parentPath">The parent path.</param>
 /// <param name="names">The names.</param>
 /// <returns>New path which extends given path by indicies with given names</returns>
 public static MemoryPath MakePathIndex(MemoryPath parentPath, IEnumerable <string> names)
 {
     return(new MemoryPath(parentPath, new IndexPathSegment(names)));
 }
示例#11
0
 /// <summary>
 /// Makes the path which extends given path by unknown index.
 /// </summary>
 /// <param name="parentPath">The parent path.</param>
 /// <returns>New path which extends given path by unknown index</returns>
 public static MemoryPath MakePathUnknownIndex(MemoryPath parentPath)
 {
     return(new MemoryPath(parentPath, new IndexPathSegment(false)));
 }
示例#12
0
 /// <summary>
 /// Makes the path which extends given path by any index.
 /// </summary>
 /// <param name="parentPath">The parent path.</param>
 /// <returns>New path which extends given path by any index</returns>
 public static MemoryPath MakePathAnyIndex(MemoryPath parentPath)
 {
     return(new MemoryPath(parentPath, new IndexPathSegment(true)));
 }
示例#13
0
 /// <summary>
 /// Makes the path which extends given path by any field.
 /// </summary>
 /// <param name="parentPath">The parent path.</param>
 /// <returns>New path which extends given path by any field</returns>
 public static MemoryPath MakePathAnyField(MemoryPath parentPath)
 {
     return(new MemoryPath(parentPath, new FieldPathSegment(true)));
 }