public MetaDataImport(ICorDebugModule pModule) { Guid guid = new Guid("{ 0x7dac8207, 0xd3ae, 0x4c75, { 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44 } }"); metaData = (IMetaDataImport)pModule.GetMetaDataInterface(ref guid); TrackedComObjects.Track(metaData); }
public ISymUnmanagedReader GetSymReader(IStream stream) { try { ISymUnmanagedBinder symBinder = new Debugger.Interop.CorSym.CorSymBinder_SxSClass(); TrackedComObjects.Track(symBinder); return(symBinder.GetReaderFromStream(metaData, stream)); } catch (COMException) { return(null); } }
public ISymUnmanagedReader GetSymReader(string fullname, string searchPath) { try { ISymUnmanagedBinder symBinder = new Debugger.Interop.CorSym.CorSymBinder_SxSClass(); TrackedComObjects.Track(symBinder); return(symBinder.GetReaderForFile(metaData, fullname, searchPath)); } catch (COMException) { return(null); } }
/// <summary> /// Prepares the debugger /// </summary> /// <param name="debuggeeVersion">Version of the program to debug - eg. "v1.1.4322" /// If null, the version of the executing process will be used</param> internal void InitDebugger(string debuggeeVersion) { if (IsKernelDebuggerEnabled) { throw new DebuggerException("Can not debug because kernel debugger is enabled"); } if (string.IsNullOrEmpty(debuggeeVersion)) { debuggeeVersion = GetDebuggerVersion(); TraceMessage("Debuggee version: Unknown (assuming " + debuggeeVersion + ")"); } else { TraceMessage("Debuggee version: " + debuggeeVersion); } this.debuggeeVersion = debuggeeVersion; int debuggerVersion; // The CLR does not provide 4.0 debugger interface for older versions if (debuggeeVersion.StartsWith("v1") || debuggeeVersion.StartsWith("v2")) { debuggerVersion = 3; // 2.0 CLR TraceMessage("Debugger interface version: v2.0"); } else { debuggerVersion = 4; // 4.0 CLR TraceMessage("Debugger interface version: v4.0"); } corDebug = NativeMethods.CreateDebuggingInterfaceFromVersion(debuggerVersion, debuggeeVersion); TrackedComObjects.Track(corDebug); managedCallbackSwitch = new ManagedCallbackSwitch(this); managedCallbackProxy = new ManagedCallbackProxy(this, managedCallbackSwitch); corDebug.Initialize(); corDebug.SetManagedHandler(managedCallbackProxy); TraceMessage("ICorDebug initialized"); }
/// <summary> /// Load symbols for dynamic module /// (as of .NET 4.0) /// </summary> public void LoadSymbolsDynamic() { if (this.CorModule is ICorDebugModule3 && this.IsDynamic) { Guid guid = new Guid(0, 0, 0, 0xc0, 0, 0, 0, 0, 0, 0, 70); try { symReader = (ISymUnmanagedReader)((ICorDebugModule3)this.CorModule).CreateReaderForInMemorySymbols(guid); } catch (COMException e) { // 0x80131C3B The application did not supply symbols when it loaded or created this module, or they are not yet available. if ((uint)e.ErrorCode == 0x80131C3B) { process.TraceMessage("Failed to load dynamic symbols for " + this.Name); return; } throw; } TrackedComObjects.Track(symReader); process.TraceMessage("Loaded dynamic symbols for " + this.Name); OnSymbolsUpdated(); } }