/// <summary> /// Consumes all symbols from provider copying them to the destination. /// </summary> /// <param name="destination">Destination.</param> /// <param name="source">Source.</param> private static void CopyRest(ICollection <Symbol> destination, ISymbolProvider source) { while (!source.Empty) { destination.Add(source.Consume()); } }
public frmGoToAll(bool allowOutOfScope, bool showFilesAndConstants) { InitializeComponent(); Icon = Properties.Resources.Find; _symbolProvider = DebugWorkspaceManager.GetSymbolProvider(); _allowOutOfScope = allowOutOfScope; _showFilesAndConstants = showFilesAndConstants; tlpResults.SuspendLayout(); for (int i = 0; i < MaxResultCount; i++) { ctrlSearchResult searchResult = new ctrlSearchResult(); searchResult.Dock = DockStyle.Top; searchResult.BackColor = i % 2 == 0 ? SystemColors.ControlLight : SystemColors.ControlLightLight; searchResult.Visible = false; searchResult.Click += SearchResult_Click; searchResult.DoubleClick += SearchResult_DoubleClick; tlpResults.Controls.Add(searchResult, 0, i); tlpResults.RowStyles.Add(new RowStyle(SizeType.AutoSize)); _results.Add(searchResult); } tlpResults.ResumeLayout(); UpdateResults(); }
/// <summary> /// Resolves value of the function call in compile time if possible. /// </summary> public static Optional <object> TryResolve(BoundGlobalFunctionCall x, ISymbolProvider model) { if (x.Name.IsDirect && x.ArgumentsInSourceOrder.All(arg => arg.Value.ConstantValue.HasValue)) { // direct func name with all arguments resolved: // take the function name ignoring current namespace resolution, simple names only: var name = x.NameOpt.HasValue ? x.NameOpt.Value : x.Name.NameValue; if (name.IsSimpleName) { var args = x.ArgumentsInSourceOrder; switch (name.Name.Value) { case "function_exists": if (args.Length == 1) { // TRUE <=> function name is defined unconditionally in a reference library (PE assembly) var str = args[0].Value.ConstantValue.Value as string; if (str != null) { var tmp = model.ResolveFunction(NameUtils.MakeQualifiedName(str, true)); if (tmp is PEMethodSymbol || (tmp is AmbiguousMethodSymbol && ((AmbiguousMethodSymbol)tmp).Ambiguities.All(f => f is PEMethodSymbol))) { return(new Optional <object>(true)); } } } break; } } } // return(default(Optional <object>)); }
/// <summary> /// Consumes a symbol from oldSymbols, and puts it into destination and/or tails of oldSymbols. Handles overlapping with newSymbols. /// The head of a symbol is the part from start of the *old* symbol till the start of the *new* one. /// The tail of the symbol is the part from the end of the *new* symbol till the end of the *old*. /// This function copies over the head to the destination and adds a tail to the tail set (of course /// when it makes sense). /// </summary> /// <param name="newSymbols">Provider of new symbols.</param> /// <param name="destination">Destination container.</param> /// <param name="oldSymbols">OldSymbolsProvider, symbols provider.</param> /// <param name="createdSymbols">Container with the symbols that got created during merging.</param> /// <param name="deletedSymbols">Container with the symbols that got got replaced/deleted during merging.</param> private void AddSymbolWithHashing(OldSymbolProvider oldSymbols, ISymbolProvider newSymbols, ICollection <Symbol> destination, ICollection <Symbol> createdSymbols, ICollection <Symbol> deletedSymbols) { var consumedSymbolType = oldSymbols.CurrentType; var symbolToAdd = oldSymbols.Consume(); //If there is no symbol to potentially overlap just copy the orignal one if (newSymbols.Empty) { destination.Add(symbolToAdd); return; } if (consumedSymbolType == OldSymbolProvider.SymbolType.Original) { deletedSymbols.Add(symbolToAdd); } //If the symbol to add starts before the new one, add its head to the destination. if (symbolToAdd.Start < newSymbols.Current.Start) { Symbol symbolHead; symbolToAdd.TryGetRightTrimmed(newSymbols.Current.Start, out symbolHead); //If there are symbols on the tail list, check if the trimming would produce the same interval. //If so, we skip the current addition. We do so, because in such case we want to preserve the top (most inner-one) former symbol. //We need, however, to process the possible remainder, a new tail might be generated. Symbol trimmedTail; if (!oldSymbols.HasNextTail || !oldSymbols.NextTail.TryGetRightTrimmed(newSymbols.Current.Start, out trimmedTail) || comparer.Compare(symbolHead, trimmedTail) != 0) { destination.Add(symbolHead); createdSymbols.Add(symbolHead); } } if (newSymbols.Current.Length == 0 && symbolToAdd.Start == newSymbols.Current.Start) { destination.Add(symbolToAdd); return; } //if there is something behind it add it to the new symbols list if (symbolToAdd.End > newSymbols.Current.End) { Symbol symbolTail; symbolToAdd.TryGetLeftTrimmed(newSymbols.Current.End, out symbolTail); oldSymbols.AddTail(symbolTail); #if DEBUG DebugAssert.AssertFalse( newSymbols.Current.Overlaps(symbolTail), "New symbol overlaps with created tail! Old and new symbols should not overlap." ); #endif return; } //There is one another case. Where the overlapping candidate completely overshadows the symbol. //Don't do anything, the overshadowed symbol got deleted anyways and no new symbol gets created. }
public LocalSymbolProvider(ISymbolProvider /*!*/ model, FlowContext /*!*/ ctx) { Debug.Assert(model != null); Debug.Assert(ctx != null); _model = model; _ctx = ctx; }
public FieldView(Field <IAnimal> field, IConsoleOutput consoleOutput, IConsoleWindow consoleWindow, ISymbolProvider animalSymbolProvider, IStringDrawer stringDrawer, StringBuilder fieldAsStringBuilder) : this(field) { _consoleOutput = consoleOutput; _consoleWindow = consoleWindow; _animalSymbolProvider = animalSymbolProvider; _fieldAsStringBuilder = fieldAsStringBuilder; _stringDrawer = stringDrawer; }
// Use this for initialization void Start() { symbolProvider = GetComponent <ISymbolProvider>(); currentLevel = (int)PlayerPrefs.GetFloat("game.currentlevel", 1); StartLevel(currentLevel); }
private string Execute(string command, params string[] parameters) { IDebuggerEngine debugger = Context.Debugger; ISymbolProvider symbolProvider = Context.SymbolProvider; string output = DbgEngDll.ExecuteAndCapture(command, parameters); Context.InitializeDebugger(debugger, symbolProvider); return(output); }
/// <summary> /// Initializes a new instance of the <see cref="PerModuleSymbolProvider" /> class. /// </summary> /// <param name="fallbackSymbolProvider">The fall-back symbol provider.</param> public PerModuleSymbolProvider(ISymbolProvider fallbackSymbolProvider = null) { FallbackSymbolProvider = fallbackSymbolProvider ?? Context.SymbolProvider; if (FallbackSymbolProvider == null) { FallbackSymbolProvider = Context.Debugger?.GetDefaultSymbolProvider(); } modules = GlobalCache.Caches.CreateDictionaryCache <Module, ISymbolProviderModule>(LoadModule); runtimeCodeTypeAndOffsetCache = GlobalCache.Caches.CreateDictionaryCache <Tuple <Process, ulong>, Tuple <CodeType, int> >(GetRuntimeCodeTypeAndOffset); }
/// <summary> /// Initializes the Context with the specified debugger engine interface. /// It will also <see cref="IDebuggerEngine.EndSession"/> for previous debugger engine. /// </summary> /// <param name="debuggerEngine">The debugger engine interface.</param> /// <param name="symbolProvider">The symbol provider interface.</param> public static void InitializeDebugger(IDebuggerEngine debuggerEngine, ISymbolProvider symbolProvider) { if (Debugger != debuggerEngine) { Debugger?.EndSession(); } ClearCache(); Debugger = debuggerEngine; SymbolProvider = symbolProvider; }
/// <summary> /// Consumes whole cake from provider /// </summary> /// <param name="destination">Destination.</param> /// <param name="source">Source.</param> private static void CopyCake(ICollection <Symbol> destination, ISymbolProvider source) { Symbol cakeBase = source.Current; destination.Add(source.Consume()); // copy base //"move cake" - while current old symbol is contained in base copy it while (!source.Empty && cakeBase.Contains(source.Current)) { destination.Add(source.Consume()); } }
public static void ImportDbgFile(string dbgPath, bool silent = false) { _symbolProvider = null; _symbolProvider = new DbgImporter(); (_symbolProvider as DbgImporter).Import(dbgPath, silent); SymbolProviderChanged?.Invoke(_symbolProvider); LabelManager.RefreshLabels(); SymbolProviderChanged?.Invoke(_symbolProvider); }
public SymbolCodeDataProvider(CpuType type, ISymbolProvider symbolProvider, SourceFileInfo file) { //_prgRom = DebugApi.GetMemoryState(SnesMemoryType.PrgRom); _cpuType = type; _symbolProvider = symbolProvider; _file = file; _lineCount = file.Data.Length; string filename = file.Name.ToLower(); _isC = filename.EndsWith(".h") || filename.EndsWith(".c"); }
public virtual void RefreshCode(ISymbolProvider symbolProvider, SourceFileInfo file) { _symbolProvider = symbolProvider; if (file == null) { this._provider = new CodeDataProvider(CpuType.Cpu); } else { this._provider = new SymbolCodeDataProvider(CpuType.Cpu, symbolProvider, file); } }
public static bool TryResolveFile(ISymbolProvider model, SourceRoutineSymbol routine, BoundExpression expr, out IPhpScriptTypeSymbol script) { script = null; if (expr.ConstantValue.TryConvertToString(out var path)) { // include (path) script = model.ResolveFile(path); } else if (expr is BoundPseudoConst pc1 && pc1.ConstType == BoundPseudoConst.Types.File) // __FILE__ { script = routine.ContainingFile; }
public static string GetDetailedSummary(this IOutputResult result, ISymbolProvider symbolProvider = null, bool includeExceptions = true) { symbolProvider = symbolProvider ?? new DefaultSymbolProvider(); var builder = new StringBuilder(); AppendOperations(result.GetOperationResults(), builder, symbolProvider); AppendOutput(result.OutputEntries, builder, symbolProvider); if (includeExceptions) { AppendExceptions(result.GetExceptions(), builder); } return(builder.ToString()); }
private void DebugWorkspaceManager_SymbolProviderChanged(ISymbolProvider symbolProvider) { _symbolProvider = symbolProvider; if (_symbolProvider == null && _inSourceView) { ToggleView(); } if (_manager?.Provider != null) { UpdateSourceFileDropdown(); UpdateCode(); } }
public void Initialize(IDisassemblyManager manager, BaseStyleProvider styleProvider) { _manager = manager; _styleProvider = styleProvider; _symbolProvider = DebugWorkspaceManager.GetSymbolProvider(); ctrlCode.StyleProvider = _styleProvider; ctrlCode.ShowContentNotes = false; ctrlCode.ShowMemoryValues = true; ctrlCode.ExtendedMarginWidth = manager.ByteCodeSize * 4; ctrlCode.AddressSize = manager.AddressSize; UpdateSourceFileDropdown(); _manager.RefreshCode(_inSourceView ? _symbolProvider : null, _inSourceView ? cboSourceFile.SelectedItem as SourceFileInfo : null); }
internal NativeHeap(NativeRuntime runtime, NativeModule[] modules) : base(runtime) { NativeRuntime = runtime; _modules = modules; _symProvider = runtime.DataTarget.SymbolProvider; if (_symProvider == null) throw new InvalidOperationException("You must set DataTarget.SymbolProvider to enumerate the heap on a .Net Native runtime."); _mrtModule = FindMrtModule(); CreateFreeType(); InitSegments(runtime); }
internal NativeHeap(NativeRuntime runtime, NativeModule[] modules) : base(runtime) { NativeRuntime = runtime; _modules = modules; _symProvider = runtime.DataTarget.SymbolProvider; if (_symProvider == null) { throw new InvalidOperationException("You must set DataTarget.SymbolProvider to enumerate the heap on a .Net Native runtime."); } _mrtModule = FindMrtModule(); CreateFreeType(); InitSegments(runtime); }
// Use this for initialization void Start() { symbolProvider = GetComponentsInParent <ISymbolProvider>()[0]; checkpointSymbols = GetComponentInParent <Gameplay>(); RemoveAllSymbols(); if (symbolProvider != null) { StartCoroutine(AddSymbols()); } else { Debug.LogWarning("symbol provider not set"); } }
private static void Build(Blog b, ISymbolProvider[] providers) { FileSystem = new VirtualFileSystem(); Console.WriteLine("Loading posts..."); List<Post> posts = new List<Post>(b.GetPosts()); Console.WriteLine($"Loaded {posts.Count} posts!"); Console.WriteLine("Loading templates..."); List<Template> templates = new List<Template>(); Console.WriteLine("Building posts..."); Console.WriteLine("Loading pages..."); List<CodeFile> pages = new List<CodeFile>(); Console.WriteLine("Building pages..."); Console.WriteLine("Saving..."); FileSystem.Save(b.OutputFolder); Console.WriteLine("Moving resources..."); }
/// <summary> /// Initializes a new instance of the <see cref="DiaSymbolProvider"/> class. /// </summary> /// <param name="fallbackSymbolProvider">The fall-back symbol provider.</param> public DiaSymbolProvider(ISymbolProvider fallbackSymbolProvider = null) : base(fallbackSymbolProvider) { }
public override void RefreshCode(ISymbolProvider symbolProvider, SourceFileInfo file) { this._provider = new CodeDataProvider(CpuType.Gameboy); }
private static void AppendOutput(IEnumerable <OutputEntry> entries, StringBuilder builder, ISymbolProvider symbolProvider) { var entriesList = entries.ToList(); if (entriesList.Count != 0) { builder.AppendLine().AppendLine("Output:"); entriesList.ForEach(x => builder.Append($"{symbolProvider.GetSymbol(x.Type)} {x.Message}\r\n")); } }
// Use this for initialization void Start() { symbolProvider = GetComponent<ISymbolProvider>(); currentLevel = (int)PlayerPrefs.GetFloat("game.currentlevel", 1); StartLevel(currentLevel); }
public GlobalSymbolProvider(PhpCompilation compilation) { Contract.ThrowIfNull(compilation); _compilation = compilation; _next = new SourceSymbolProvider(compilation.SourceSymbolCollection); }
// Use this for initialization void Start() { symbolProvider = GetComponentsInParent<ISymbolProvider>()[0]; checkpointSymbols = GetComponentInParent<Gameplay>(); RemoveAllSymbols(); if (symbolProvider != null) { StartCoroutine(AddSymbols()); } else { Debug.LogWarning("symbol provider not set"); } }
public SymbolSelectorViewModel(ISymbolProvider symbolProvider, ISymbolThemeService symbolThemeService) { _symbolThemeService = symbolThemeService; Symbols = symbolProvider.SymbolThemes; }
public RunListener(ISymbolProvider symbolProvider = null) { _symbolProvider = symbolProvider ?? new DefaultSymbolProvider(); }
public DataTargetBuilder WithSymbolProvider(ISymbolProvider symbolProvider) { Mock.Setup(target => target.SymbolProvider).Returns(symbolProvider); return(this); }
/// <summary> /// Initializes a new instance of the <see cref="EngineSymbolProviderModule" /> class. /// </summary> /// <param name="module">The engine module.</param> /// <param name="xmlModule">The XML module description.</param> /// <param name="symbolProvider">The engine symbol provider.</param> public EngineSymbolProviderModule(CsDebugScript.Module module, XmlModule xmlModule, ISymbolProvider symbolProvider) { if (string.IsNullOrEmpty(xmlModule.Name)) { xmlModule.Name = module.Name; } Name = xmlModule.Name; Namespace = xmlModule.Namespace; EngineModule = module; EngineModuleProvider = symbolProvider.GetSymbolProviderModule(module); symbolsById = new DictionaryCache <uint, Symbol>(CreateSymbol); symbolsByName = new DictionaryCache <string, Symbol>(FindSymbol); }
/// <summary> /// Initializes the Context with the specified debugger engine interface. /// </summary> /// <param name="debuggerEngine">The debugger engine interface.</param> /// <param name="symbolProvider">The symbol provider interface.</param> public static void InitializeDebugger(IDebuggerEngine debuggerEngine, ISymbolProvider symbolProvider) { ClearCache(); Debugger = debuggerEngine; SymbolProvider = symbolProvider; }
public GlobalSymbolProvider(PhpCompilation compilation) { _compilation = compilation ?? throw new ArgumentNullException(nameof(compilation)); _next = new SourceSymbolProvider(compilation.SourceSymbolCollection); }