LoadConfiguration() public method

public LoadConfiguration ( ) : bool
return bool
Exemplo n.º 1
0
        internal CommandLineInterpreter(DebuggerOptions options, bool is_interactive)
        {
            if (options.HasDebugFlags)
                Report.Initialize (options.DebugOutput, options.DebugFlags);
            else
                Report.Initialize ();

            Configuration = new DebuggerConfiguration ();
            #if HAVE_XSP
            if (options.StartXSP)
                Configuration.SetupXSP ();
            else
                Configuration.LoadConfiguration ();
            #else
            Configuration.LoadConfiguration ();
            #endif

            Configuration.SetupCLI ();

            interpreter = new Interpreter (is_interactive, Configuration, options);
            interpreter.CLI = this;

            engine = interpreter.DebuggerEngine;
            parser = new LineParser (engine);

            if (!interpreter.IsScript) {
                line_editor = new LineEditor ("mdb");

                line_editor.AutoCompleteEvent += delegate (string text, int pos) {
                    return engine.Completer.Complete (text, pos);
                };

                Console.CancelKeyPress += control_c_event;
            }

            interrupt_event = new ST.AutoResetEvent (false);
            nested_break_state_event = new ST.AutoResetEvent (false);

            main_loop_stack = new Stack<MainLoop> ();
            main_loop_stack.Push (new MainLoop (interpreter));

            main_thread = new ST.Thread (new ST.ThreadStart (main_thread_main));
            main_thread.IsBackground = true;
        }
Exemplo n.º 2
0
 public void StartMdb(string cmdLine)
 {
     string[] args = cmdLine.Split(' ');
     DebuggerConfiguration config = new DebuggerConfiguration ();
     config.LoadConfiguration ();
     DebuggerOptions options = DebuggerOptions.ParseCommandLine (args);
     System.Console.WriteLine ("Mono Debugger");
     EmonicLineInterpreter interpreter = new EmonicLineInterpreter (config, options);
     interpreter.RunMainLoop();
     // we don't want an automatic breakpoint in Main(), and we want to be able
     // to set a breakpoint there, so we delete the automatic one
     EmonicLineInterpreter.AddCmd("delete 1");
 }
		public void AttachToProcess (long pid, DebuggerSessionOptions sessionOptions)
		{
			Report.Initialize ();

			this.SessionOptions = sessionOptions;
			DebuggerConfiguration config = new DebuggerConfiguration ();
			mdbAdaptor.Configuration = config;
			mdbAdaptor.InitializeConfiguration ();
			config.LoadConfiguration ();
			debugger = new MD.Debugger (config);

			DebuggerOptions options = DebuggerOptions.ParseCommandLine (new string[0]);
			options.StopInMain = false;
			session = new MD.DebuggerSession (config, options, "main", (IExpressionParser) null);
			mdbAdaptor.Session = session;
			
			Process proc = debugger.Attach (session, (int)pid);
			OnInitialized (debugger, proc);
			
			ST.ThreadPool.QueueUserWorkItem (delegate {
				NotifyStarted ();
			});
		}
		public void Run (MonoDebuggerStartInfo startInfo, DebuggerSessionOptions sessionOptions)
		{
			try {
				if (startInfo == null)
					throw new ArgumentNullException ("startInfo");
			
				Console.WriteLine ("MDB version: " + mdbAdaptor.MdbVersion);
				
				this.SessionOptions = sessionOptions;
				mdbAdaptor.StartInfo = startInfo;

				Report.Initialize ();

				DebuggerConfiguration config = new DebuggerConfiguration ();
				config.LoadConfiguration ();
				mdbAdaptor.Configuration = config;
				mdbAdaptor.InitializeConfiguration ();
				
				debugger = new MD.Debugger (config);
				
				debugger.ModuleLoadedEvent += OnModuleLoadedEvent;
				debugger.ModuleUnLoadedEvent += OnModuleUnLoadedEvent;
				
				debugger.ProcessReachedMainEvent += delegate (MD.Debugger deb, MD.Process proc) {
					OnInitialized (deb, proc);
				};

				if (startInfo.IsXsp) {
					mdbAdaptor.SetupXsp ();
					config.FollowFork = false;
				}
				config.OpaqueFileNames = false;
				
				DebuggerOptions options = DebuggerOptions.ParseCommandLine (new string[] { startInfo.Command } );
				options.WorkingDirectory = startInfo.WorkingDirectory;
				Environment.CurrentDirectory = startInfo.WorkingDirectory;
				options.StopInMain = false;
				
				if (!string.IsNullOrEmpty (startInfo.Arguments))
					options.InferiorArgs = ToArgsArray (startInfo.Arguments);
				
				if (startInfo.EnvironmentVariables != null) {
					foreach (KeyValuePair<string,string> env in startInfo.EnvironmentVariables)
						options.SetEnvironment (env.Key, env.Value);
				}
				session = new MD.DebuggerSession (config, options, "main", null);
				mdbAdaptor.Session = session;
				mdbAdaptor.InitializeSession ();
				
				ST.ThreadPool.QueueUserWorkItem (delegate {
					// Run in a thread to avoid a deadlock, since NotifyStarted calls back to the client.
					NotifyStarted ();
					debugger.Run(session);
				});

			} catch (Exception e) {
				Console.WriteLine ("error: " + e.ToString ());
				throw;
			}
		}