/// <summary> /// Processes the internal. /// </summary> /// <param name="startingPosition">The starting position.</param> /// <param name="endingPosition">The ending position.</param> /// <param name="options">The options.</param> internal void ProcessInternal(Position startingPosition, Position endingPosition, IndexOptions options) { SetBreakpoints(options); TimeTravelFacade.SetPosition(startingPosition); // loop through all the set break points and record relevant values var frames = new List <Frame>(); Position last = null; /* * todo: PRIORITY FIX */ while (true) // todo: have better abstraction... while(!TimeTravelFacade.RunTo(endingPosition)) { DebugEngineProxy.RunUntilBreak(); var positions = TimeTravelFacade.Positions(); var breakRecord = positions.CurrentThreadResult; if (last == breakRecord.Position) { break; } var newFrames = CreateFramesForUpsert(positions, breakRecord, options); frames.AddRange(newFrames); foreach (var optionsMemoryRange in options?.MemoryRanges ?? new List <MemoryRange>()) { var bytes = DebugEngineProxy.ReadVirtualMemory(optionsMemoryRange); // todo: errors? ServerClient.AddMemoryRange(new MemoryChunk { MemoryRange = optionsMemoryRange, Bytes = bytes, Position = breakRecord.Position }); } last = breakRecord.Position; } try { ServerClient.UpsertFrames(frames); } catch (Exception e) { Log.Error($"Error persisting frames: {e.GetType().FullName} - {e.Message}"); DebugEngineProxy.WriteLine($"Error persisting frames: {e.GetType().FullName} - {e.Message}"); } }
/// <summary> /// Adds the tag. /// </summary> /// <param name="addOptions">The add options.</param> internal void AddTag(AddTagOptions addOptions) { var positions = TimeTravelFacade.Positions(); var current = positions.CurrentThreadResult; if (addOptions.IsAllThreadsAtPosition) // todo: extract methods { var threadIds = positions.Select(x => x.ThreadId); ServerClient.AddTag(current.Position, threadIds, addOptions.Text); } else { ServerClient.AddTag(current.Position, new[] { current.ThreadId }, addOptions.Text); } }
/// <summary> /// Upserts the current position. /// </summary> /// <param name="options">The options.</param> internal virtual void UpsertCurrentPosition(IndexOptions options) { var positions = TimeTravelFacade.Positions(); var frames = CreateFramesForUpsert(positions); ServerClient.UpsertFrames(frames); foreach (var optionsMemoryRange in options?.MemoryRanges ?? new List<MemoryRange>()) { var bytes = DebugEngineProxy.ReadVirtualMemory(optionsMemoryRange); // todo: errors? ServerClient.AddMemoryRange(new MemoryChunk { MemoryRange = optionsMemoryRange, Bytes = bytes, Position = positions.CurrentThreadResult.Position }); } }
/// <summary> /// Adds a tag. /// </summary> /// <param name="addOptions">The add options.</param> internal void AddTag(AddTagOptions addOptions) { var positions = TimeTravelFacade.Positions(); var current = positions.CurrentThreadResult; var tag = new Tag() { Title = addOptions.Title, Body = addOptions.Body, CreateDateUtc = DateTime.UtcNow }; if (addOptions.IsAllThreadsAtPosition) // todo: extract methods { var threadIds = positions.Select(x => x.ThreadId); ServerClient.AddTag(current.Position, threadIds, tag); } else { ServerClient.AddTag(current.Position, new[] { current.ThreadId }, tag); } }