コード例 #1
0
        /// <summary>
        /// Attaches debugger to the already running specified process.
        /// </summary>
        /// <param name="processId">The process identifier.</param>
        /// <param name="attachFlags">The attaching flags.</param>
        /// <param name="symbolPaths">Array of paths where debugger will look for symbols.</param>
        public static void AttachToProcess(uint processId, DebugAttach attachFlags = DebugAttach.Noninvasive, params string[] symbolPaths)
        {
            IDebugClient   debugClient = DebugClient.DebugCreate();
            IDebugSymbols5 symbols     = (IDebugSymbols5)debugClient;
            IDebugControl7 control     = (IDebugControl7)debugClient;

            symbols.SetSymbolPathWide(string.Join(";", symbolPaths));
            debugClient.AttachProcess(0, processId, attachFlags);
            control.WaitForEvent(0, uint.MaxValue);
            InitializeDbgEng(debugClient);
        }
コード例 #2
0
ファイル: Debugger.cs プロジェクト: leculver/WinDbgCs
        private Dumper(string applicationPath, string dumpPath, bool miniDump)
        {
            this.dumpPath = dumpPath;
            this.miniDump = miniDump;

            // Create debugging client
            IDebugClient clientBase = DebugClient.DebugCreate();

            // Cast to upper clients
            client  = (IDebugClient7)clientBase;
            control = (IDebugControl7)client;
            client.SetEventCallbacks(this);
            client.CreateProcessAndAttach(0, applicationPath, 0x00000002);
        }
コード例 #3
0
ファイル: DebugEngine.cs プロジェクト: samshine/Squalr
        public void Attach()
        {
            Task.Run(() =>
            {
                this.Client = DebugClient.DebugCreate();

                IDebugClient7 client   = this.Client as IDebugClient7;
                IDebugControl6 control = this.Client as IDebugControl6;

                client.SetOutputCallbacksWide(new OutputCallBacks());
                client.SetEventCallbacksWide(new EventCallBacks(control));


                this.Client.AttachProcess(0, unchecked ((UInt32)this.SystemProcess.Id), DebugAttach.InvasiveNoInitialBreak);

                while (true)
                {
                    control.WaitForEvent(0, UInt32.MaxValue);
                }
            });
        }