コード例 #1
0
        /// <summary>
        /// Attach a cdb debugger to the given process.
        /// </summary>
        /// <param name="process">Process to debug.</param>
        public CdbSession(Process process)
        {
            if (process == null)
            {
                throw new ArgumentNullException("process");
            }
            if (process.HasExited)
            {
                throw new ApplicationException(string.Format("Cannot attach to process '{0}' is has already exited.", process.Id));
            }

            targetProcess = process;
            cdbProxy      = AttachDebugger(process);
        }
コード例 #2
0
        public ManagedDebugStrategy(CdbCommunicationProxy cdbProxy)
        {
            session = cdbProxy;

            // Load SOS extensions. For CLR40, there is no mscorwks.dll, SOS is installed
            // in the same directory as CLR.exe.
#if TESTBUILD_CLR40
            string result = session.SendCommand(".loadby sos clr");
#else
            string result = session.SendCommand(".loadby sos mscorwks");
#endif
            if (result.ToLowerInvariant().Contains("unable to find module"))
            {
                throw new ApplicationException("Failed to load 'SOS'.");
            }
            session.SendCommand(".cxr");
        }