Beispiel #1
0
        public void InitializeService()
        {
            if (useRemotingForThreadInterop)
            {
                // This needs to be called before instance of NDebugger is created
                new RemotingConfigurationHelpper(Application.StartupPath).Configure();
            }

            debugger = new NDebugger();

            debugger.Options = new Options(); // = DebuggingOptions.Instance;

            debugger.DebuggerTraceMessage += debugger_TraceMessage;
            debugger.Processes.Added      += debugger_ProcessStarted;
            debugger.Processes.Removed    += debugger_ProcessExited;

            DebuggerService.BreakPointAdded += delegate(object sender, BreakpointBookmarkEventArgs e)
            {
                AddBreakpoint(e.BreakpointBookmark);
            };

            foreach (BreakpointBookmark b in DebuggerService.Breakpoints)
            {
                AddBreakpoint(b);
            }

            if (Initialize != null)
            {
                Initialize(this, null);
            }
        }
        internal Process(NDebugger debugger, ICorDebugProcess corProcess)
        {
            this.debugger   = debugger;
            this.corProcess = corProcess;

            this.callbackInterface = new ManagedCallback(this);
        }
Beispiel #3
0
        public void InitializeService()
        {
            debugger = new NDebugger();

            //debugger.Options = DebuggingOptions.Instance;

            debugger.DebuggerTraceMessage += debugger_TraceMessage;
            debugger.Processes.Added      += debugger_ProcessStarted;
            debugger.Processes.Removed    += debugger_ProcessExited;

            DebuggerService.BreakPointAdded += delegate(object sender, BreakpointBookmarkEventArgs e)
            {
                AddBreakpoint(e.BreakpointBookmark);
            };

            foreach (BreakpointBookmark b in DebuggerService.Breakpoints)
            {
                AddBreakpoint(b);
            }

            if (Initialize != null)
            {
                Initialize(this, null);
            }
        }
Beispiel #4
0
        /// <summary>
        /// Create a new target VM for the giveb process id.
        /// </summary>
        /// <param name="pid">Process ID of the IKVM</param>
        internal TargetVM(int pid)
        {
            debugger = new NDebugger();
            System.Diagnostics.Process sysProcess = System.Diagnostics.Process.GetProcessById(pid);
            process         = debugger.Attach(sysProcess);
            process.Exited += new EventHandler(ProcessExited);

            process.ModuleLoaded += new EventHandler <ModuleEventArgs>(ModuleLoaded);
            process.Paused       += new EventHandler <ProcessEventArgs>(Paused);
            process.Resumed      += new EventHandler <ProcessEventArgs>(Resumed);
        }
Beispiel #5
0
        /// <summary>
        /// Create a new target VM for the giveb process id.
        /// </summary>
        /// <param name="pid">Process ID of the IKVM</param>
        internal TargetVM(int pid, JdwpEventHandler jdwpEventHandler)
        {
            this.jdwpEventHandler = jdwpEventHandler;
            debugger = new NDebugger();
            System.Diagnostics.Process sysProcess = System.Diagnostics.Process.GetProcessById(pid);
            process         = debugger.Attach(sysProcess);
            process.Exited += new EventHandler(ProcessExited);

            process.ModuleLoaded  += new EventHandler <ModuleEventArgs>(ModuleLoaded);
            process.Paused        += new EventHandler <ProcessEventArgs>(Paused);
            process.Resumed       += new EventHandler <ProcessEventArgs>(Resumed);
            process.ThreadStarted += new EventHandler <ThreadEventArgs>(ThreadStarted);
        }
Beispiel #6
0
        public void InitializeService()
        {
            List <ISymbolSource> symbolSources = new List <ISymbolSource>();

            symbolSources.Add(PdbSymbolSource);
            symbolSources.AddRange(AddInTree.BuildItems <ISymbolSource>("/SharpDevelop/Services/DebuggerService/SymbolSource", null, false));

            // init NDebugger
            CurrentDebugger               = new NDebugger();
            CurrentDebugger.Options       = DebuggingOptions.Instance;
            CurrentDebugger.SymbolSources = symbolSources;

            foreach (BreakpointBookmark b in SD.BookmarkManager.Bookmarks.OfType <BreakpointBookmark>())
            {
                AddBreakpoint(b);
            }

            SD.BookmarkManager.BookmarkAdded += (sender, e) => {
                BreakpointBookmark bm = e.Bookmark as BreakpointBookmark;
                if (bm != null)
                {
                    AddBreakpoint(bm);
                }
            };

            SD.BookmarkManager.BookmarkRemoved += (sender, e) => {
                BreakpointBookmark bm = e.Bookmark as BreakpointBookmark;
                if (bm != null)
                {
                    Breakpoint bp = bm.InternalBreakpointObject as Breakpoint;
                    CurrentDebugger.RemoveBreakpoint(bp);
                }
            };

            if (Initialize != null)
            {
                Initialize(this, null);
            }
        }
        public void InitializeService()
        {
            if (useRemotingForThreadInterop)
            {
                // This needs to be called before instance of NDebugger is created
                string path = RemotingConfigurationHelpper.GetLoadedAssemblyPath("Debugger.Core.dll");
                new RemotingConfigurationHelpper(path).Configure();
            }

            // get decompiler service
            var items = AddInTree.BuildItems <IDebuggerDecompilerService>("/SharpDevelop/Services/DebuggerDecompilerService", null, false);

            if (items.Count > 0)
            {
                debuggerDecompilerService = items[0];
            }

            // init NDebugger
            debugger         = new NDebugger();
            debugger.Options = DebuggingOptions.Instance;
            debugger.DebuggerTraceMessage += debugger_TraceMessage;
            debugger.Processes.Added      += debugger_ProcessStarted;
            debugger.Processes.Removed    += debugger_ProcessExited;

            DebuggerService.BreakPointAdded += delegate(object sender, BreakpointBookmarkEventArgs e) {
                AddBreakpoint(e.BreakpointBookmark);
            };

            foreach (BreakpointBookmark b in DebuggerService.Breakpoints)
            {
                AddBreakpoint(b);
            }

            if (Initialize != null)
            {
                Initialize(this, null);
            }
        }
Beispiel #8
0
 public void InitializeDebugger()
 {
     debuggerCore = debugger.DebuggerCore;
 }
Beispiel #9
0
 internal Breakpoint(NDebugger debugger, SourcecodeSegment sourcecodeSegment, bool enabled)
 {
     this.debugger          = debugger;
     this.sourcecodeSegment = sourcecodeSegment;
     this.enabled           = enabled;
 }
Beispiel #10
0
 public virtual void TestFixtureSetUp()
 {
     debugger = new NDebugger();
     debugger.MTA2STA.CallMethod = CallMethod.Manual;
 }
		public virtual void TestFixtureSetUp()
		{
			debugger = new NDebugger();
			debugger.MTA2STA.CallMethod = CallMethod.Manual;
		}
Beispiel #12
0
 public ManagedCallbackProxy(NDebugger debugger, ManagedCallbackSwitch callbackSwitch)
 {
     this.debugger       = debugger;
     this.callbackSwitch = callbackSwitch;
 }
Beispiel #13
0
 public ManagedCallbackSwitch(NDebugger debugger)
 {
     this.debugger = debugger;
 }
        static unsafe Process StartInternal(NDebugger debugger, string filename, string workingDirectory, string arguments)
        {
            debugger.TraceMessage("Executing " + filename);

            uint[] processStartupInfo = new uint[17];
            processStartupInfo[0] = sizeof(uint) * 17;
            uint[] processInfo = new uint[4];

            SafeFileHandle prnt_inp;
            SafeFileHandle prnt_out;
            SafeFileHandle prnt_err;
            SafeFileHandle input_handle;
            SafeFileHandle output_handle;
            SafeFileHandle err_handle;
//			CreatePipe(out prnt_out,out output_handle,false);
//			CreatePipe(out prnt_inp,out input_handle,true);
            STARTUPINFO startupInfo = new STARTUPINFO();

            startupInfo.cb = Marshal.SizeOf(startupInfo);

            SECURITY_ATTRIBUTES lpPipeAttributes = new SECURITY_ATTRIBUTES();

            lpPipeAttributes.bInheritHandle = true;
            //CreatePipe(out output_handle, out input_handle,lpPipeAttributes,0);
            CreatePipe(out prnt_inp, out input_handle, true);
            CreatePipe(out prnt_out, out output_handle, false);
            CreatePipe(out prnt_err, out err_handle, false);
            startupInfo.hStdInput  = input_handle;
            startupInfo.hStdOutput = output_handle;
            startupInfo.hStdError  = err_handle;
            ICorDebugProcess outProcess;
//			processStartupInfo[14] = (uint)GCHandle.Alloc(input_handle,GCHandleType.Pinned).AddrOfPinnedObject().ToInt32();
//			processStartupInfo[15] = (uint)GCHandle.Alloc(output_handle,GCHandleType.Pinned).AddrOfPinnedObject().ToInt32();
            StreamWriter standardInput = new StreamWriter(new FileStream(prnt_inp, FileAccess.Write, 0x1000, false), Encoding.GetEncoding(GetConsoleCP()), 0x1000);

            standardInput.AutoFlush = true;
            Encoding     encoding       = Encoding.GetEncoding(GetConsoleOutputCP());
            StreamReader standardOutput = new StreamReader(new FileStream(prnt_out, FileAccess.Read, 0x1000, false), encoding, true, 0x1000);
            StreamReader errorOutput    = new StreamReader(new FileStream(prnt_err, FileAccess.Read, 0x1000, false), encoding, true, 0x1000);

            if (workingDirectory == null || workingDirectory == "")
            {
                workingDirectory = System.IO.Path.GetDirectoryName(filename);
            }

            fixed(uint *pprocessStartupInfo = processStartupInfo)
            fixed(uint *pprocessInfo = processInfo)
            outProcess =
                debugger.CorDebug.CreateProcess(
                    filename,                             // lpApplicationName
                    // If we do not prepend " ", the first argument migh just get lost
                    " " + arguments,                      // lpCommandLine
                    ref _SECURITY_ATTRIBUTES.Default,     // lpProcessAttributes
                    ref _SECURITY_ATTRIBUTES.Default,     // lpThreadAttributes
                    1,                                    //TRUE                    // bInheritHandles
                    //0x00000010 /*CREATE_NEW_CONSOLE*/,    // dwCreationFlags
                    0x08000000,
                    IntPtr.Zero,                                                           // lpEnvironment
                    workingDirectory,                                                      // lpCurrentDirectory
                    startupInfo,
                    //(uint)pprocessStartupInfo,        // lpStartupInfo
                    (uint)pprocessInfo,                                                   // lpProcessInformation,
                    CorDebugCreateProcessFlags.DEBUG_NO_SPECIAL_OPTIONS                   // debuggingFlags
                    );

            Process p = new Process(debugger, outProcess);

            p.StandardInput  = standardInput;
            p.StandardOutput = standardOutput;
            p.StandardError  = errorOutput;
            return(p);
        }
 static public Process CreateProcess(NDebugger debugger, string filename, string workingDirectory, string arguments)
 {
     return(debugger.MTA2STA.Call <Process>(delegate {
         return StartInternal(debugger, filename, workingDirectory, arguments);
     }));
 }
 public DebuggerEventArgs(NDebugger debugger)
 {
     this.debugger = debugger;
 }