public static int OpenUI(IntPtr client, [MarshalAs(UnmanagedType.LPStr)] string args) { string[] arguments = args.Split(" ".ToCharArray()); bool showModal = false; if (arguments.Length > 0 && !bool.TryParse(arguments[0], out showModal)) { showModal = false; } try { IDebugClient debugClient = (IDebugClient)Marshal.GetUniqueObjectForIUnknown(client); DbgEngDll.InitializeContext(debugClient); new Task(() => { if (showModal) { InteractiveWindow.ShowModalWindow(); } else { InteractiveWindow.ShowWindow(); } }).Start(); return(0); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return(ex.HResult); } }
public DbgEngDumpInitialization(string dumpPath, string defaultModuleName, string symbolPath = DefaultDumpPath, bool addSymbolServer = true, bool useDia = true, bool useDwarf = false) : base(dumpPath, defaultModuleName, FixSymbolPath(symbolPath, addSymbolServer)) { IDebugClient client = DebugClient.OpenDumpFile(DumpPath, SymbolPath); DbgEngDll.InitializeContext(client); if (!useDia && !useDwarf) { Context.InitializeDebugger(Context.Debugger); } else if (useDwarf) { Context.InitializeDebugger(Context.Debugger, new DwarfSymbolProvider.DwarfSymbolProvider()); } }
public DbgEngDumpInitialization(string dumpPath, string defaultModuleName, string symbolPath = DefaultDumpPath, bool addSymbolServer = true, bool useDia = true, bool useDwarf = false, bool useILCodeGen = false) : base(dumpPath, defaultModuleName, FixSymbolPath(symbolPath, addSymbolServer), useILCodeGen) { // Clear all processes being debugged with DbgEng.dll... (Context.Debugger as DbgEngDll)?.Client?.EndSession(DebugEnd.ActiveTerminate); IDebugClient client = DebugClient.OpenDumpFile(DumpPath, SymbolPath); DbgEngDll.InitializeContext(client); if (!useDia && !useDwarf) { Context.InitializeDebugger(Context.Debugger); } else if (useDwarf) { Context.InitializeDebugger(Context.Debugger, new DwarfSymbolProvider.DwarfSymbolProvider()); } }
/// <summary> /// Initializes the test class with the specified process file. /// </summary> /// <param name="processPath">Path to the process to be started.</param> /// <param name="processArguments">Arguments for process to be started.</param> /// <param name="symbolPath">Symbol path.</param> /// <param name="addSymbolServer">if set to <c>true</c> symbol server will be added to the symbol path.</param> /// <param name="debugEngineOptions">Debug create options. Default is to start in break mode, and break on process exit.</param> protected static void InitializeProcess(string processPath, string processArguments, string symbolPath, bool addSymbolServer = true, uint debugEngineOptions = (uint)(Defines.DebugEngoptInitialBreak | Defines.DebugEngoptFinalBreak)) { processPath = GetAbsoluteBinPath(processPath); symbolPath = GetAbsoluteBinPath(symbolPath); if (addSymbolServer) { symbolPath += ";srv*"; } // Disable caching. // Context.EnableUserCastedVariableCaching = false; Context.EnableVariableCaching = false; IDebugClient client = DebugClient.OpenProcess(processPath, processArguments, symbolPath, debugEngineOptions); DbgEngDll.InitializeContext(client); }
protected override void ProcessRecord() { ConnectionState state = ConnectionState.GetConnectionState(); state.IsConnected = true; state.ProcessPath = ProcessPath; if (SymbolPath == null) { SymbolPath = "srv*"; } IDebugClient client = DebugClient.OpenProcess(ProcessPath, null, SymbolPath, (uint)(Defines.DebugEngoptInitialBreak | Defines.DebugEngoptFinalBreak)); WriteDebug("Connection successfully initialized"); DbgEngDll.InitializeContext(client); }
private static int ExecuteAction(IntPtr client, Action action) { try { IDebugClient debugClient = (IDebugClient)Marshal.GetUniqueObjectForIUnknown(client); DbgEngDll.InitializeContext(debugClient); Context.ClrProvider = new CLR.ClrMdProvider(); DbgEngDll dbgEngDll = Context.Debugger as DbgEngDll; dbgEngDll.ExecuteAction(action); } catch (Exception ex) { Console.WriteLine(ex.ToString()); return(ex.HResult); } finally { DbgEngDll.InitializeContext(null); } return(0); }
/// <summary> /// Initializes debugger as DbgEng from the specified debug client interface. /// </summary> /// <param name="debugClient">The debug client interface that will initialize debugger.</param> private static void InitializeDbgEng(IDebugClient debugClient) { DbgEngDll.InitializeContext(debugClient); Context.InitializeDebugger(Context.Debugger, new DwarfSymbolProvider.DwarfSymbolProvider()); Context.ClrProvider = new CLR.ClrMdProvider(); }