/* * Todo: add ability to tag all frames in a range e.g. thread 1 from a to b or all threads a to b0 */ /// <summary> /// Processes the specified arguments. /// </summary> /// <param name="args">The arguments.</param> /// <returns>Task.</returns> /// <exception cref="ArgumentNullException">args</exception> /// <exception cref="ArgumentOutOfRangeException"></exception> public void Process(string[] args) { if (args == null) { throw new ArgumentNullException(nameof(args)); } if (!args.Any()) { // list tags at the current position var tags = ServerClient.GetRecentTags(10); var output = FormatTagsForOutput(tags); DebugEngineProxy.WriteLine(output); } else { var command = args[0]; switch (command) { case "add": var addOptions = ExtractAddOptions(args.Skip(1)); AddTag(addOptions); break; // todo: edit, delete default: throw new ArgumentOutOfRangeException($"Unknown subcommand {command}"); } } }
/// <summary> /// Processes the specified arguments. /// </summary> /// <param name="args">The arguments.</param> /// <returns>Task.</returns> /// <exception cref="ArgumentNullException">args</exception> /// <exception cref="ArgumentOutOfRangeException"> /// args /// or /// args /// </exception> public void Process(string[] args) { if (args == null) { throw new ArgumentNullException(nameof(args)); } if (args.Length != 1) { throw new ArgumentOutOfRangeException(nameof(args), $"SettingsMethod expects exactly 1 argument, but was given {args.Length}"); } switch (args[0].ToLower()) { case "list": foreach (var settings in AllSettings) { DebugEngineProxy.WriteLine(settings.GetType().FullName); DebugEngineProxy.WriteLine(JsonConvert.SerializeObject(settings, Formatting.Indented)); } break; case "reload": McFlyExtension.PopulateSettings(); break; case "open": var p = System.Diagnostics.Process.Start(McFlyExtension.GetLogPath()); break; default: throw new ArgumentOutOfRangeException(nameof(args), $"Settings takes 3 commands: list, reload, or open. Found {args[0]}"); } }
/// <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> /// Processes the specified arguments. /// </summary> /// <param name="args">The arguments.</param> /// <returns>Task.</returns> public void Process(string[] args) { if (IsEmptyArgs(args)) { var commandListing = GetCommandListing(); DebugEngineProxy.WriteLine(commandListing); return; } if (IsSingleCommand(args)) { var commandHelp = GetCommandHelp(args[0]); DebugEngineProxy.WriteLine(commandHelp); } }