Beispiel #1
0
 protected DbgEngineImpl(DbgEngineImplDependencies deps, DbgManager dbgManager, DbgStartKind startKind)
 {
     if (deps == null)
     {
         throw new ArgumentNullException(nameof(deps));
     }
     StartKind                          = startKind;
     lockObj                            = new object();
     toEngineAppDomain                  = new Dictionary <DnAppDomain, DbgEngineAppDomain>();
     toEngineModule                     = new Dictionary <CorModule, DbgEngineModule>();
     toEngineThread                     = new Dictionary <DnThread, DbgEngineThread>();
     toAssemblyModules                  = new Dictionary <DnAssembly, List <DnModule> >();
     stackFrameData                     = new StackFrameData();
     objectHolders                      = new HashSet <DnDebuggerObjectHolder>();
     debuggerSettings                   = deps.DebuggerSettings;
     dbgDotNetCodeRangeService          = deps.DotNetCodeRangeService;
     dbgDotNetNativeCodeLocationFactory = deps.DbgDotNetNativeCodeLocationFactory;
     dbgDotNetCodeLocationFactory       = deps.DbgDotNetCodeLocationFactory;
     this.dbgManager                    = dbgManager ?? throw new ArgumentNullException(nameof(dbgManager));
     dbgModuleMemoryRefreshedNotifier   = deps.DbgModuleMemoryRefreshedNotifier;
     clrDacProvider                     = deps.ClrDacProvider;
     clrDac         = NullClrDac.Instance;
     debuggerThread = new DebuggerThread("CorDebug");
     debuggerThread.CallDispatcherRun();
     dotNetValuesToCloseOnContinue = new List <DbgDotNetValueImpl>();
     valuesToCloseNow      = new List <DbgCorValueHolder>();
     dmdRuntime            = DmdRuntimeFactory.CreateRuntime(new DmdEvaluatorImpl(this), IntPtr.Size == 4 ? DmdImageFileMachine.I386 : DmdImageFileMachine.AMD64);
     toDynamicModuleHelper = new Dictionary <CorModule, DmdDynamicModuleHelperImpl>();
     DmdDispatcher         = new DmdDispatcherImpl(this);
     RawMetadataService    = deps.RawMetadataService;
 }
Beispiel #2
0
        public override void Load(ILSpySettings settings)
        {
            var s = DebuggerSettings.Instance;

            s.Load(settings);
            this.settings = s;
        }
        public ActionResult Compile(string source)
        {
            //Use settings from the My Documents folder, in a hosted / multi-tenant environment, this will have to change.  This works for local machine for now
            var settings = new DebuggerSettings(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments));

#if DEBUG
            settings.compilerPaths[SourceLanguage.CSharp] = Server.MapPath("~") + @"bin\Compilers\CSharp\";
            settings.compilerPaths[SourceLanguage.Python] = Server.MapPath("~") + @"bin\Compilers\Python\";
#else
            settings.compilerPaths[SourceLanguage.CSharp] = Server.MapPath("~") + @"Compilers\CSharp\";
            settings.compilerPaths[SourceLanguage.Python] = Server.MapPath("~") + @"Compilers\Python\";
#endif


            Neo.Debugger.Core.Utils.Compiler compiler = new Neo.Debugger.Core.Utils.Compiler(settings);
            compiler.SendToLog += Compiler_SendToLog;

            Directory.CreateDirectory(settings.path);
            var fileName = Path.Combine(settings.path, "DebugContract.cs");

            bool success = compiler.CompileContract(source, fileName, Debugger.Core.Data.SourceLanguage.CSharp);

            if (success)
            {
                compiler.Log("Contract compiled successfully.");
            }

            return(Json(success));
        }
Beispiel #4
0
 ThreadsOperationsImpl(IThreadsVM threadsVM, DebuggerSettings debuggerSettings, Lazy <ReferenceNavigatorService> referenceNavigatorService, Lazy <DbgCallStackService> dbgCallStackService)
 {
     this.threadsVM                 = threadsVM;
     this.debuggerSettings          = debuggerSettings;
     this.referenceNavigatorService = referenceNavigatorService;
     this.dbgCallStackService       = dbgCallStackService;
 }
        static void Main(string[] args)
        {
            Console.WriteLine("NEO Developer Shell - " + DebuggerUtils.DebuggerVersion);
            var settings = new DebuggerSettings(Directory.GetCurrentDirectory());
            var shell    = new DebuggerShell(settings);

            shell.AddCommand(new ExitCommand());

            if (args.Length > 0)
            {
                shell.Execute("load " + args[0], OutputMessage);
            }

            while (true)
            {
                Console.Write(">");
                var input = Console.ReadLine();

                if (string.IsNullOrEmpty(input))
                {
                    continue;
                }

                if (!shell.Execute(input, OutputMessage))
                {
                    Console.WriteLine("Unknown command. Type HELP for list of commands.");
                }
            }
        }
Beispiel #6
0
 DbgMetadataServiceImpl(DbgModuleIdProviderService dbgModuleIdProviderService, DbgInMemoryModuleService dbgInMemoryModuleService, DsDocumentProvider dsDocumentProvider, IDsDocumentService documentService, DebuggerSettings debuggerSettings)
 {
     this.dbgModuleIdProviderService = dbgModuleIdProviderService;
     this.dbgInMemoryModuleService   = dbgInMemoryModuleService;
     this.dsDocumentProvider         = dsDocumentProvider;
     this.documentService            = documentService;
     this.debuggerSettings           = debuggerSettings;
 }
 DbgEngineImplDependencies(DebuggerSettings debuggerSettings, Lazy <DbgDotNetCodeLocationFactory> dbgDotNetCodeLocationFactory, DbgModuleMemoryRefreshedNotifier2 dbgModuleMemoryRefreshedNotifier, DbgRawMetadataService rawMetadataService, DbgEngineStepperFactory dbgEngineStepperFactory)
 {
     DebuggerSettings                 = debuggerSettings;
     DbgDotNetCodeLocationFactory     = dbgDotNetCodeLocationFactory;
     DbgModuleMemoryRefreshedNotifier = dbgModuleMemoryRefreshedNotifier;
     RawMetadataService               = rawMetadataService;
     EngineStepperFactory             = dbgEngineStepperFactory;
 }
Beispiel #8
0
 ModulesOperationsImpl(IModulesVM modulesVM, DebuggerSettings debuggerSettings, Lazy <ModulesSaver> modulesSaver, Lazy <MemoryWindowService> memoryWindowService, Lazy <ReferenceNavigatorService> referenceNavigatorService, Lazy <IModuleLoader> moduleLoader)
 {
     this.modulesVM                 = modulesVM;
     this.debuggerSettings          = debuggerSettings;
     this.modulesSaver              = modulesSaver;
     this.memoryWindowService       = memoryWindowService;
     this.referenceNavigatorService = referenceNavigatorService;
     this.moduleLoader              = moduleLoader;
 }
Beispiel #9
0
        public static DebuggerSettings LoadDebuggerSettings(ILSpySettings settings)
        {
            XElement         e = settings[DEBUGGER_SETTINGS];
            DebuggerSettings s = new DebuggerSettings();

            s.ShowWarnings    = (bool?)e.Attribute(SHOW_WARNINGS) ?? s.ShowWarnings;
            s.AskForArguments = (bool?)e.Attribute(ASK_ARGUMENTS) ?? s.AskForArguments;

            return(s);
        }
Beispiel #10
0
 ModuleBreakpointsOperationsImpl(IModuleBreakpointsVM moduleBreakpointsVM, DebuggerSettings debuggerSettings, Lazy <DbgModuleBreakpointsService> dbgModuleBreakpointsService, Lazy <ISettingsServiceFactory> settingsServiceFactory, IPickSaveFilename pickSaveFilename, IPickFilename pickFilename, IMessageBoxService messageBoxService)
 {
     this.moduleBreakpointsVM         = moduleBreakpointsVM;
     this.debuggerSettings            = debuggerSettings;
     this.dbgModuleBreakpointsService = dbgModuleBreakpointsService;
     this.settingsServiceFactory      = settingsServiceFactory;
     this.pickSaveFilename            = pickSaveFilename;
     this.pickFilename      = pickFilename;
     this.messageBoxService = messageBoxService;
 }
Beispiel #11
0
 ProcessesOperationsImpl(UIDispatcher uiDispatcher, IProcessesVM processesVM, DebuggerSettings debuggerSettings, Lazy <DbgManager> dbgManager, Lazy <ShowAttachToProcessDialog> showAttachToProcessDialog, Lazy <ReferenceNavigatorService> referenceNavigatorService, Lazy <DbgCallStackService> dbgCallStackService)
 {
     this.uiDispatcher              = uiDispatcher;
     this.processesVM               = processesVM;
     this.debuggerSettings          = debuggerSettings;
     this.dbgManager                = dbgManager;
     this.showAttachToProcessDialog = showAttachToProcessDialog;
     this.referenceNavigatorService = referenceNavigatorService;
     this.dbgCallStackService       = dbgCallStackService;
 }
Beispiel #12
0
 DbgEngineImplDependencies(DbgDotNetCodeRangeService dbgDotNetCodeRangeService, DebuggerSettings debuggerSettings, Lazy <DbgDotNetNativeCodeLocationFactory> dbgDotNetNativeCodeLocationFactory, Lazy <DbgDotNetCodeLocationFactory> dbgDotNetCodeLocationFactory, ClrDacProvider clrDacProvider, DbgModuleMemoryRefreshedNotifier2 dbgModuleMemoryRefreshedNotifier, DbgRawMetadataService rawMetadataService)
 {
     DotNetCodeRangeService             = dbgDotNetCodeRangeService;
     DebuggerSettings                   = debuggerSettings;
     DbgDotNetNativeCodeLocationFactory = dbgDotNetNativeCodeLocationFactory;
     DbgDotNetCodeLocationFactory       = dbgDotNetCodeLocationFactory;
     ClrDacProvider = clrDacProvider;
     DbgModuleMemoryRefreshedNotifier = dbgModuleMemoryRefreshedNotifier;
     RawMetadataService = rawMetadataService;
 }
 VariablesWindowOperationsImpl(DebuggerSettings debuggerSettings, DbgEvalFormatterSettings dbgEvalFormatterSettings, Lazy <DbgLanguageService> dbgLanguageService, Lazy <DbgObjectIdService> dbgObjectIdService, Lazy <WatchExpressionsService> watchExpressionsService, Lazy <ToolWindows.Memory.MemoryWindowService> memoryWindowService, Lazy <IPickSaveFilename> pickSaveFilename, Lazy <IMessageBoxService> messageBoxService)
 {
     this.debuggerSettings         = debuggerSettings;
     this.dbgEvalFormatterSettings = dbgEvalFormatterSettings;
     this.dbgLanguageService       = dbgLanguageService;
     this.dbgObjectIdService       = dbgObjectIdService;
     this.watchExpressionsService  = watchExpressionsService;
     this.memoryWindowService      = memoryWindowService;
     this.pickSaveFilename         = pickSaveFilename;
     this.messageBoxService        = messageBoxService;
 }
Beispiel #14
0
 CallStackOperationsImpl(ICallStackVM callStackVM, DebuggerSettings debuggerSettings, CallStackDisplaySettings callStackDisplaySettings, Lazy <ReferenceNavigatorService> referenceNavigatorService, Lazy <DbgCallStackService> dbgCallStackService, Lazy <ShowCodeBreakpointSettingsService> showCodeBreakpointSettingsService, Lazy <DbgCodeBreakpointSerializerService> dbgCodeBreakpointSerializerService, Lazy <DbgCodeBreakpointsService> dbgCodeBreakpointsService, Lazy <DbgManager> dbgManager)
 {
     this.callStackVM                        = callStackVM;
     this.debuggerSettings                   = debuggerSettings;
     this.callStackDisplaySettings           = callStackDisplaySettings;
     this.referenceNavigatorService          = referenceNavigatorService;
     this.dbgCallStackService                = dbgCallStackService;
     this.showCodeBreakpointSettingsService  = showCodeBreakpointSettingsService;
     this.dbgCodeBreakpointSerializerService = dbgCodeBreakpointSerializerService;
     this.dbgCodeBreakpointsService          = dbgCodeBreakpointsService;
     this.dbgManager = dbgManager;
 }
        public DebuggerShell(DebuggerSettings settings)
        {
            this._settings = settings;

            this.Debugger = new DebugManager(_settings);

            AddCommand(new HelpCommand());
            AddCommand(new LoadCommand());
            AddCommand(new ContractCommand());
            AddCommand(new InputCommand());
            AddCommand(new StorageCommand());
        }
Beispiel #16
0
 ValueNodesVMFactoryImpl(UIDispatcher uiDispatcher, ITreeViewService treeViewService, LanguageEditValueProviderFactory languageEditValueProviderFactory, DbgValueNodeImageReferenceService dbgValueNodeImageReferenceService, DebuggerSettings debuggerSettings, DbgEvalFormatterSettings dbgEvalFormatterSettings, DbgObjectIdService dbgObjectIdService, IClassificationFormatMapService classificationFormatMapService, ITextBlockContentInfoFactory textBlockContentInfoFactory, IMenuService menuService, IWpfCommandService wpfCommandService)
 {
     uiDispatcher.VerifyAccess();
     this.uiDispatcher    = uiDispatcher;
     this.treeViewService = treeViewService;
     this.languageEditValueProviderFactory  = languageEditValueProviderFactory;
     this.dbgValueNodeImageReferenceService = dbgValueNodeImageReferenceService;
     this.debuggerSettings               = debuggerSettings;
     this.dbgEvalFormatterSettings       = dbgEvalFormatterSettings;
     this.dbgObjectIdService             = dbgObjectIdService;
     this.classificationFormatMapService = classificationFormatMapService;
     this.textBlockContentInfoFactory    = textBlockContentInfoFactory;
     this.menuService       = menuService;
     this.wpfCommandService = wpfCommandService;
 }
Beispiel #17
0
 CallStackOperationsImpl(ICallStackVM callStackVM, DebuggerSettings debuggerSettings, CallStackDisplaySettings callStackDisplaySettings, IMessageBoxService messageBoxService, Lazy <ReferenceNavigatorService> referenceNavigatorService, Lazy <DbgCallStackService> dbgCallStackService, Lazy <ShowCodeBreakpointSettingsService> showCodeBreakpointSettingsService, Lazy <DbgCodeBreakpointSerializerService> dbgCodeBreakpointSerializerService, Lazy <DbgCodeBreakpointsService> dbgCodeBreakpointsService, Lazy <DbgManager> dbgManager, Lazy <DbgLanguageService> dbgLanguageService, Lazy <DbgShowNativeCodeService> dbgShowNativeCodeService)
 {
     this.callStackVM                        = callStackVM;
     this.debuggerSettings                   = debuggerSettings;
     this.callStackDisplaySettings           = callStackDisplaySettings;
     this.messageBoxService                  = messageBoxService;
     this.referenceNavigatorService          = referenceNavigatorService;
     this.dbgCallStackService                = dbgCallStackService;
     this.showCodeBreakpointSettingsService  = showCodeBreakpointSettingsService;
     this.dbgCodeBreakpointSerializerService = dbgCodeBreakpointSerializerService;
     this.dbgCodeBreakpointsService          = dbgCodeBreakpointsService;
     this.dbgManager               = dbgManager;
     this.dbgLanguageService       = dbgLanguageService;
     this.dbgShowNativeCodeService = dbgShowNativeCodeService;
 }
        public DebuggerShell(DebugManager debugger)
        {
            this.Debugger  = debugger;
            this._settings = debugger.Settings;

            AddCommand(new HelpCommand());
            AddCommand(new LoadCommand());
            AddCommand(new ContractCommand());
            AddCommand(new InvokeCommand());
            AddCommand(new StorageCommand());
            AddCommand(new BreakpointCommand());
            AddCommand(new FileCommand());
            AddCommand(new RunCommand());
            AddCommand(new StepCommand());
        }
Beispiel #19
0
 DebuggerImpl(Lazy <IMessageBoxService> messageBoxService, Lazy <IAppWindow> appWindow, Lazy <IDocumentTabService> documentTabService, Lazy <DbgManager> dbgManager, Lazy <StartDebuggingOptionsProvider> startDebuggingOptionsProvider, Lazy <ShowAttachToProcessDialog> showAttachToProcessDialog, Lazy <TextViewBreakpointService> textViewBreakpointService, Lazy <DbgCodeBreakpointsService> dbgCodeBreakpointsService, Lazy <DbgCallStackService> dbgCallStackService, Lazy <ReferenceNavigatorService> referenceNavigatorService, Lazy <DbgTextViewCodeLocationService> dbgTextViewCodeLocationService, Lazy <DbgExceptionFormatterService> dbgExceptionFormatterService, DebuggerSettings debuggerSettings)
 {
     this.messageBoxService              = messageBoxService;
     this.appWindow                      = appWindow;
     this.documentTabService             = documentTabService;
     this.dbgManager                     = dbgManager;
     this.startDebuggingOptionsProvider  = startDebuggingOptionsProvider;
     this.showAttachToProcessDialog      = showAttachToProcessDialog;
     this.textViewBreakpointService      = textViewBreakpointService;
     this.dbgCodeBreakpointsService      = dbgCodeBreakpointsService;
     this.dbgCallStackService            = dbgCallStackService;
     this.referenceNavigatorService      = referenceNavigatorService;
     this.dbgTextViewCodeLocationService = dbgTextViewCodeLocationService;
     this.dbgExceptionFormatterService   = dbgExceptionFormatterService;
     this.debuggerSettings               = debuggerSettings;
 }
Beispiel #20
0
        static void Main(string[] args)
        {
            Console.WriteLine("NEO Developer Shell - " + DebuggerUtils.DebuggerVersion);
            var settings = new DebuggerSettings(Directory.GetCurrentDirectory());
            var debugger = new DebugManager(settings);
            var shell    = new DebuggerShell(debugger);

            shell.AddCommand(new ExitCommand());

            if (args.Length > 0)
            {
                var input = args[0].Replace("'", "\"");
                if (input.StartsWith("\"") && input.EndsWith("\""))
                {
                    input = input.Substring(1, input.Length - 2);
                }

                var lines = input.Split(';');
                foreach (var line in lines)
                {
                    if (!string.IsNullOrEmpty(line))
                    {
                        Console.WriteLine(line);
                        shell.Execute(line, OutputMessage);
                    }
                }
            }

            while (true)
            {
                Console.ForegroundColor = ConsoleColor.Gray;
                Console.Write(">");
                var input = Console.ReadLine();

                if (string.IsNullOrEmpty(input))
                {
                    continue;
                }

                if (!shell.Execute(input, OutputMessage))
                {
                    Console.WriteLine("Unknown command. Type HELP for list of commands.");
                }
            }
        }
Beispiel #21
0
        public void Save(XElement root)
        {
            var      s       = (DebuggerSettings)this.DataContext;
            XElement section = new XElement(DEBUGGER_SETTINGS);

            section.SetAttributeValue(SHOW_WARNINGS, s.ShowWarnings);
            section.SetAttributeValue(ASK_ARGUMENTS, s.AskForArguments);

            XElement existingElement = root.Element(DEBUGGER_SETTINGS);

            if (existingElement != null)
            {
                existingElement.ReplaceWith(section);
            }
            else
            {
                root.Add(section);
            }

            currentDebuggerSettings = null;             // invalidate cached settings
        }
Beispiel #22
0
 GoToInMemoryModuleStatement(Lazy <DbgCallStackService> dbgCallStackService, Lazy <ReferenceNavigatorService> referenceNavigatorService, DebuggerSettings debuggerSettings)
 {
     this.dbgCallStackService          = dbgCallStackService;
     this.referenceNavigatorService    = referenceNavigatorService;
     debuggerSettings.PropertyChanged += DebuggerSettings_PropertyChanged;
 }
Beispiel #23
0
 public TheTagger(IClassificationTag classificationTag, DebuggerSettings debuggerSettings)
 {
     this.classificationTag = classificationTag;
     this.debuggerSettings  = debuggerSettings;
 }
Beispiel #24
0
 NumberTaggerProvider(IClassificationTypeRegistryService classificationTypeRegistryService, DebuggerSettings debuggerSettings)
 {
     stringClassificationTag = new ClassificationTag(classificationTypeRegistryService.GetClassificationType(ThemeClassificationTypeNames.Number));
     this.debuggerSettings   = debuggerSettings;
 }
Beispiel #25
0
 ProcessFormatterProvider(DebuggerSettings debuggerSettings) => this.debuggerSettings = debuggerSettings;
Beispiel #26
0
 public DebugManager(DebuggerSettings settings)
 {
     Settings      = settings;
     this.profiler = new ProfilerContext();
 }
Beispiel #27
0
 SwitchToDebuggedProcess(DebuggerSettings debuggerSettings) => this.debuggerSettings = debuggerSettings;
Beispiel #28
0
 CallStackFormatterProvider(DebuggerSettings debuggerSettings) => this.debuggerSettings = debuggerSettings;
Beispiel #29
0
 IsDebuggerPresentHook(DebuggerSettings debuggerSettings) => this.debuggerSettings = debuggerSettings;
Beispiel #30
0
 ExceptionConditionsChecker(Lazy <DbgExceptionSettingsService> dbgExceptionSettingsService, DebuggerSettings debuggerSettings)
 {
     this.dbgExceptionSettingsService = dbgExceptionSettingsService;
     this.debuggerSettings            = debuggerSettings;
 }