Example #1
0
        public int AddPort(IDebugPortRequest2 pRequest, out IDebugPort2 ppPort) {
            string name;
            Marshal.ThrowExceptionForHR(pRequest.GetPortName(out name));

            if (name != PortName) {
                ppPort = null;
                return VSConstants.E_INVALIDARG;
            }

            ppPort = new DebugPort(this, pRequest);
            return VSConstants.S_OK;
        }
Example #2
0
        public int AddPort(IDebugPortRequest2 pRequest, out IDebugPort2 ppPort)
        {
            string name;

            Marshal.ThrowExceptionForHR(pRequest.GetPortName(out name));

            if (name != PortName)
            {
                ppPort = null;
                return(VSConstants.E_INVALIDARG);
            }

            ppPort = new DebugPort(this, pRequest);
            return(VSConstants.S_OK);
        }
Example #3
0
        public String GetServiceArgs()
        {
            StringBuilder sb = new StringBuilder();

            sb.Append("-service -name ").Append("\"");
            sb.Append(Name).Append("\"");

            if (Conf != null)
            {
                sb.Append(" -conf ").Append('"').Append(Conf).Append('"');
            }

            if (JavaHome != null)
            {
                sb.Append(" -java-home ").Append('"').Append(JavaHome).Append('"');
            }

            sb.Append(" -resin-home ").Append('"').Append(Home).Append('"');

            if (Root != null)
            {
                sb.Append(" -root-directory ").Append('"').Append(Root).Append('"');
            }

            if (Log != null)
            {
                sb.Append(" -log-directory ").Append('"').Append(Log).Append('"');
            }

            if (DynamicServer)
            {
                sb.Append(" -cluster ").Append(Cluster);
            }

            if (ElasticServer)
            {
                sb.Append(" --elastic-server ");
            }

            if (!String.IsNullOrEmpty(ElasticServerAddress))
            {
                sb.Append(" --elastic-server-address ").Append(ElasticServerAddress);
            }

            if (!String.IsNullOrEmpty(ElasticServerPort))
            {
                sb.Append(" --elastic-server-port ").Append(ElasticServerPort);
            }

            if (DynamicServer)
            {
                sb.Append(" -server ").Append("dyn-").Append(Cluster).Append('-').Append(Server);
            }
            else if (Server != null && !"".Equals(Server))
            {
                sb.Append(" -server ").Append(Server);
            }

            if (IsPreview)
            {
                sb.Append(" -preview");
            }

            if (DebugPort > 0)
            {
                sb.Append(" -debug-port ").Append(DebugPort.ToString());
            }

            if (JmxPort > 0)
            {
                sb.Append(" -jmx-port ").Append(JmxPort.ToString());
            }

            if (WatchdogPort > 0)
            {
                sb.Append(" -watchdog-port ").Append(WatchdogPort.ToString());
            }

            if (ExtraParams != null)
            {
                sb.Append(" ").Append(ExtraParams);
            }

            return(sb.ToString());
        }
Example #4
0
 public DebugProcess(DebugPort port, IRSession session)
 {
     _port      = port;
     _sessionId = session.Id;
     Session    = session;
 }
Example #5
0
        private static void PauseCurrentThread()
        {
            Hardware.Interrupts.Interrupts.InsideCriticalHandler = true;

            try
            {
#if DEBUGGER_INTERUPT_TRACE
                DebugPort.Write("Pause current thread:\n");

                DebugPort.Write(" > Current process: ");
                DebugPort.Write(ProcessManager.CurrentProcess.Name);
                DebugPort.Write("\n");

                FOS_System.String espStr = " > Current ESP : 0x--------\n";
                ExceptionMethods.FillString((uint)ExceptionMethods.StackPointer, 26, espStr);
                DebugPort.Write(espStr);
                FOS_System.String ebpStr = " > Current EBP : 0x--------\n";
                ExceptionMethods.FillString((uint)ExceptionMethods.BasePointer, 26, ebpStr);
                DebugPort.Write(ebpStr);

                DebugPort.Write(" > Checking thread is not debugger thread...\n");
#endif
                // Prevent pausing of the debugger thread (which can otherwise result in total system lock-up)
                if (ProcessManager.CurrentThread != MainThread)
                {
#if DEBUGGER_INTERUPT_TRACE
                    DebugPort.Write(" > Disabling debugger\n");
#endif
                    // Temporarily disable the debugger
                    Enabled = false;

#if DEBUGGER_INTERUPT_TRACE
                    DebugPort.Write(" > Calculating process id\n");
#endif
                    // Generate a unique identifier for the current process / thread pair.
                    UInt64 ProcessThreadId = (((UInt64)ProcessManager.CurrentProcess.Id) << 32) | ProcessManager.CurrentThread.Id;

#if DEBUGGER_INTERUPT_TRACE
                    DebugPort.Write(" > Checking suspended threads list\n");
#endif

#if DEBUG
                    bool SuspendAtAddessesContains = ThreadsToSuspendAtAddresses.Contains(ProcessThreadId);
                    // Should suspend the thread if EITHER: It is in the suspend list and not the suspend at addresses list
                    //                                  OR: It is in the suspend at addresses list and the process's current instruction address matches
                    //      Note: Current instruction address of the paused process not the current interrupt handler routine
                    bool ShouldSuspend = (!SuspendAtAddessesContains && ThreadsToSuspend.IndexOf(ProcessThreadId) > -1) ||
                                         (SuspendAtAddessesContains && ThreadsToSuspendAtAddresses[ProcessThreadId] == ProcessManager.CurrentThread.EIPFromInterruptStack);
#else
                    bool ShouldSuspend = ThreadsToSuspend.IndexOf(ProcessThreadId) > -1;
#endif

                    if (ShouldSuspend)
                    {
#if DEBUGGER_INTERUPT_TRACE
                        DebugPort.Write(" > Pausing");
                        PrintCurrentThread();
#endif

                        if (SuspendAtAddessesContains)
                        {
                            // Prevent recurring breaks
                            ThreadsToSuspendAtAddresses.Remove(ProcessThreadId);
                        }

                        // Suspend the thread
                        ProcessManager.CurrentThread.Debug_Suspend = true;
                        // Notify the host debugger that a thread has been suspended
                        NotifPort.Write(0xFE);

#if DEBUGGER_INTERUPT_TRACE
                        DebugPort.Write(" > Doing scheduler update...\n");
#endif

                        // Get the scheduler to do an update so we don't return to the same thread
                        Scheduler.UpdateCurrentState();

#if DEBUGGER_INTERUPT_TRACE
                        DebugPort.Write(" > New");
                        PrintCurrentThread();
#endif
                    }
                    // If the thread shouldn't be suspended, we might still be single-stepping to a particular address
                    else if (SuspendAtAddessesContains)
                    {
                        // If we are single stepping, (re)set the single step flag (Note: EFLAGS restored by IRet)
                        ProcessManager.CurrentThread.EFLAGSFromInterruptStack |= 0x0100u;
                    }

#if DEBUGGER_INTERUPT_TRACE
                    DebugPort.Write(" > Enabling debugger\n");
#endif
                    // Re-enable the debugger
                    Enabled = true;
                }
            }
            finally
            {
                Hardware.Interrupts.Interrupts.InsideCriticalHandler = false;
            }
        }
Example #6
0
 public int AddPort(IDebugPortRequest2 pRequest, out IDebugPort2 ppPort)
 {
     ppPort = new DebugPort(this, pRequest);
     return(VSConstants.S_OK);
 }
 public DebugProcess(DebugPort port, IRSession session) {
     _port = port;
     _sessionId = session.Id;
     Session = session;
 }
 public int AddPort(IDebugPortRequest2 pRequest, out IDebugPort2 ppPort) {
     ppPort = new DebugPort(this, pRequest);
     return VSConstants.S_OK;
 }