Exemple #1
0
        /// <summary>
        /// Opens the specified dump file.
        /// </summary>
        /// <param name="dumpFile">The dump file.</param>
        /// <param name="symbolPath">The symbol path.</param>
        public static IDebugClient OpenDumpFile(string dumpFile, string symbolPath)
        {
            IDebugClient   client  = DebugCreate();
            IDebugSymbols5 symbols = (IDebugSymbols5)client;
            IDebugControl7 control = (IDebugControl7)client;

            symbols.SetSymbolPathWide(symbolPath);
            client.OpenDumpFile(dumpFile);
            control.WaitForEvent(0, uint.MaxValue);
            symbols.SetSymbolPathWide(symbolPath);
            control.Execute(0, ".reload -f", 0);
            return(client);
        }
Exemple #2
0
        /// <summary>
        /// Starts a new process.
        /// </summary>
        /// <param name="processPath">Process path.</param>
        /// <param name="processArguments">Process arguments.</param>
        /// <param name="symbolPath">Symbol path.</param>
        /// <param name="debugEngineOptions">Debug engine options.</param>
        /// <returns></returns>
        public static IDebugClient OpenProcess(string processPath, string processArguments, string symbolPath, uint debugEngineOptions)
        {
            string processCommandLine = processPath + " " + processArguments;

            IDebugClient   client  = DebugCreate();
            IDebugSymbols5 symbols = (IDebugSymbols5)client;
            IDebugControl7 control = (IDebugControl7)client;

            symbols.SetSymbolPathWide(symbolPath);
            control.SetEngineOptions(debugEngineOptions);
            client.CreateProcessAndAttach(0, processCommandLine, DebugCreateProcess.DebugOnlyThisProcess, 0, 0);
            control.WaitForEvent(0, uint.MaxValue);
            symbols.SetSymbolPathWide(symbolPath);
            control.Execute(0, ".reload -f", 0);
            return(client);
        }
Exemple #3
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);
        }