Beispiel #1
0
        /// <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 (debuggeeVersion != null && debuggeeVersion.Length > 1) {
             *      this.debuggeeVersion = debuggeeVersion;
             * } else {
             *      this.debuggeeVersion = GetDebuggerVersion();
             * }
             * int debug_ver = 3;
             * if (debuggeeVersion.StartsWith("v1") || debuggeeVersion.StartsWith("v2")) {
             *      debug_ver = 3; // 2.0 CLR
             *      TraceMessage("Debugger interface version: v2.0");
             * } else {
             *      debug_ver = 4; // 4.0 CLR
             *      TraceMessage("Debugger interface version: v4.0");
             * }*/
            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 = new ICorDebug(NativeMethods.CreateDebuggingInterfaceFromVersion(debuggerVersion, debuggeeVersion));

            managedCallbackSwitch = new ManagedCallbackSwitch(this);
            managedCallbackProxy  = new ManagedCallbackProxy(this, managedCallbackSwitch);

            corDebug.Initialize();
            corDebug.SetManagedHandler(new ICorDebugManagedCallback(managedCallbackProxy));

            TraceMessage("ICorDebug initialized, debugee version " + debuggeeVersion);
        }
Beispiel #2
0
 private void InitializeDebugger()
 {
     _debuggerInterface.Initialize();
     _managedCallback = new ManagedCallbackProxy(new ManagedCallback(this));
     _debuggerInterface.SetManagedHandler(_managedCallback);
 }