Exemple #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);
        }
Exemple #2
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 (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");
        }
Exemple #3
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 (IsKernelDebuggerEnabled)
            {
                throw new DebuggerException("Can not debug because kernel debugger is enabled");
            }
            if (string.IsNullOrEmpty(debuggeeVersion))
            {
                debuggeeVersion = GetDebuggerVersion();
            }
            this.debuggeeVersion = debuggeeVersion;

            corDebug = new ICorDebug(NativeMethods.CreateDebuggingInterfaceFromVersion(3, debuggeeVersion));

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

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

            TraceMessage("ICorDebug initialized, debugee version " + debuggeeVersion);
        }
Exemple #4
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 (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);

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

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

            TraceMessage("ICorDebug initialized");
        }
Exemple #5
0
 public ManagedCallbackProxy(NDebugger debugger, ManagedCallbackSwitch callbackSwitch)
 {
     this.debugger       = debugger;
     this.callbackSwitch = callbackSwitch;
 }
		/// <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();
			}
			this.debuggeeVersion = debuggeeVersion;
			
			corDebug = new ICorDebug(NativeMethods.CreateDebuggingInterfaceFromVersion(3, debuggeeVersion));
			
			managedCallbackSwitch = new ManagedCallbackSwitch(this);
			managedCallbackProxy = new ManagedCallbackProxy(this, managedCallbackSwitch);
			
			corDebug.Initialize();
			corDebug.SetManagedHandler(new ICorDebugManagedCallback(managedCallbackProxy));
			
			TraceMessage("ICorDebug initialized, debugee version " + debuggeeVersion);
		}
		public ManagedCallbackProxy(NDebugger debugger, ManagedCallbackSwitch callbackSwitch)
		{
			this.debugger = debugger;
			this.callbackSwitch = callbackSwitch;
		}
Exemple #8
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);
		}