public DebuggerStartInfo CreateDebuggerStartInfo(ExecutionCommand command)
        {
            AspNetExecutionCommand cmd       = (AspNetExecutionCommand)command;
            MonoDebuggerStartInfo  startInfo = MonoDebuggerSessionFactory.CreateDebuggerStartInfo(cmd.TargetRuntime);

            string xspPath = Path.Combine(startInfo.MonoPrefix, "lib" + Path.DirectorySeparatorChar + "mono" + Path.DirectorySeparatorChar);

            if (cmd.ClrVersion == ClrVersion.Net_1_1)
            {
                xspPath += Path.Combine("1.0", "xsp.exe");
            }
            else
            {
                xspPath += Path.Combine("2.0", "xsp2.exe");
            }

            startInfo.IsXsp            = true;
            startInfo.UserCodeOnly     = true;
            startInfo.Command          = xspPath;
            startInfo.WorkingDirectory = cmd.BaseDirectory;
            startInfo.Arguments        = cmd.XspParameters.GetXspParameters().Trim();

            string binDir = Path.Combine(cmd.BaseDirectory, "bin");

            startInfo.UserModules = new List <string> ();
            foreach (string file in Directory.GetFiles(binDir))
            {
                if (file.EndsWith(".dll") || file.EndsWith(".exe"))
                {
                    startInfo.UserModules.Add(file);
                }
            }

            return(startInfo);
        }
Beispiel #2
0
        public static MonoDebuggerStartInfo CreateDebuggerStartInfo(TargetRuntime tr)
        {
            if (tr == null)
            {
                tr = MonoDevelop.Core.Runtime.SystemAssemblyService.DefaultRuntime;
            }
            MonoDebuggerStartInfo startInfo = new MonoDebuggerStartInfo();
            MonoTargetRuntime     mtr       = (MonoTargetRuntime)tr;

            startInfo.ServerEnvironment = mtr.EnvironmentVariables;
            startInfo.MonoPrefix        = mtr.Prefix;
            return(startInfo);
        }
Beispiel #3
0
        public DebuggerStartInfo CreateDebuggerStartInfo(ExecutionCommand command)
        {
            DotNetExecutionCommand cmd       = (DotNetExecutionCommand)command;
            MonoDebuggerStartInfo  startInfo = CreateDebuggerStartInfo(cmd.TargetRuntime);

            startInfo.Command          = cmd.Command;
            startInfo.Arguments        = cmd.Arguments;
            startInfo.WorkingDirectory = cmd.WorkingDirectory;
            if (cmd.EnvironmentVariables.Count > 0)
            {
                foreach (KeyValuePair <string, string> val in cmd.EnvironmentVariables)
                {
                    startInfo.EnvironmentVariables [val.Key] = val.Value;
                }
            }
            return(startInfo);
        }
Beispiel #4
0
        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;
            }
        }