Example #1
0
 public ActionCompletedEventArgs(Error?error, ActionProfileOptions action, MacroEvaluatorTransientValues transients, ActionRunResult runResult = null)
 {
     Error      = error;
     Action     = action;
     Transients = transients;
     RunResult  = runResult;
 }
Example #2
0
        public MacroEvaluator(
            IProjectProperties projectProperties,
            MacroEvaluatorTransientValues values,
            AsyncLazy <IReadOnlyDictionary <string, string> > remoteEnvironment,
            Options.DebuggerOptions debuggerOptions,
            Options.ProfileOptions profileOptions)
        {
            _projectProperties = projectProperties;
            _remoteEnvironment = remoteEnvironment;
            _profileOptions    = profileOptions;

            // Predefined macros
            _macroCache = new Dictionary <string, string>
            {
                { RadMacros.ActiveSourceFullPath, values.ActiveSourceFullPath },
                { RadMacros.ActiveSourceDir, values.ActiveSourceDir },
                { RadMacros.ActiveSourceFile, values.ActiveSourceFile },
                { RadMacros.ActiveSourceFileLine, values.ActiveSourceLine.ToString() },
                { RadMacros.Watches, string.Join(":", values.Watches) },
                { RadMacros.AWatches, string.Join(":", debuggerOptions.GetAWatchSnapshot()) },
                { RadMacros.BreakLine, string.Join(":", values.BreakLines ?? new[] { 0u }) },
                { RadMacros.DebugAppArgs, debuggerOptions.AppArgs },
                { RadMacros.DebugAppArgs2, debuggerOptions.AppArgs2 },
                { RadMacros.DebugAppArgs3, debuggerOptions.AppArgs3 },
                { RadMacros.Counter, debuggerOptions.Counter.ToString() },
                { RadMacros.NGroups, debuggerOptions.NGroups.ToString() },
                { RadMacros.GroupSize, debuggerOptions.GroupSize.ToString() }
            };
        }
Example #3
0
        public async Task TransientValuesTestAsync()
        {
            var props      = new Mock <IProjectProperties>();
            var transients = new MacroEvaluatorTransientValues(sourceLine: 666, sourcePath: @"B:\welcome\home",
                                                               new[] { 13u }, new ReadOnlyCollection <string>(new[] { "m", "c", "ride" }));
            var evaluator = new MacroEvaluator(props.Object, transients, EmptyRemoteEnv, new DebuggerOptions(), new ProfileOptions());

            var result = await evaluator.GetMacroValueAsync(RadMacros.Watches);

            Assert.True(result.TryGetResult(out var evaluated, out _));
            Assert.Equal("m:c:ride", evaluated);

            result = await evaluator.EvaluateAsync($"$({RadMacros.ActiveSourceDir})\\$({RadMacros.ActiveSourceFile}):$({RadMacros.ActiveSourceFileLine}), stop at $({RadMacros.BreakLine})");

            Assert.True(result.TryGetResult(out evaluated, out _));
            Assert.Equal(@"B:\welcome\home:666, stop at 13", evaluated);

            transients = new MacroEvaluatorTransientValues(0, "nofile", new[] { 20u, 1u, 9u }, new ReadOnlyCollection <string>(new[] { "watch" }));
            evaluator  = new MacroEvaluator(props.Object, transients, EmptyRemoteEnv, new DebuggerOptions(), new ProfileOptions());
            result     = await evaluator.EvaluateAsync($"-l $({RadMacros.BreakLine})");

            Assert.True(result.TryGetResult(out evaluated, out _));
            Assert.Equal("-l 20:1:9", evaluated);
        }