Browse Source

Evaluate release code - disable optimization in JIT and NGen...

pull/191/merge
Eusebiu Marcu 15 years ago
parent
commit
a68e6c3cb2
  1. 7
      Debugger/Debugger.Core/ManagedCallback.cs
  2. 3
      Debugger/Debugger.Core/Module.cs
  3. 6
      Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs
  4. 21
      ILSpy/Commands/DebuggerCommands.cs

7
Debugger/Debugger.Core/ManagedCallback.cs

@ -320,7 +320,12 @@ namespace Debugger @@ -320,7 +320,12 @@ namespace Debugger
EnterCallback(PausedReason.Other, "CreateProcess", pProcess);
// Process is added in NDebugger.Start
// disable NGen
ICorDebugProcess2 pProcess2 = pProcess as ICorDebugProcess2;
if (pProcess2 != null && Process.DebugMode == DebugModeFlag.Debug) {
pProcess2.SetDesiredNGENCompilerFlags((uint)CorDebugJITCompilerFlags.CORDEBUG_JIT_DISABLE_OPTIMIZATION);
}
ExitCallback();
}

3
Debugger/Debugger.Core/Module.cs

@ -189,7 +189,6 @@ namespace Debugger @@ -189,7 +189,6 @@ namespace Debugger
this.appDomain = appDomain;
this.process = appDomain.Process;
this.corModule = corModule;
SetJITCompilerFlags();
metaData = new MetaDataImport(corModule);
@ -200,6 +199,8 @@ namespace Debugger @@ -200,6 +199,8 @@ namespace Debugger
name = System.IO.Path.GetFileName(FullPath);
}
SetJITCompilerFlags();
LoadSymbolsFromDisk(process.Options.SymbolsSearchPaths);
ResetJustMyCodeStatus();
}

6
Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs

@ -155,6 +155,9 @@ namespace ILSpy.Debugger.Services @@ -155,6 +155,9 @@ namespace ILSpy.Debugger.Services
DebugStarting(this, EventArgs.Empty);
try {
// set the JIT flag for evaluating optimized code
Process.DebugMode = DebugModeFlag.Debug;
Process process = debugger.Start(processStartInfo.FileName,
processStartInfo.WorkingDirectory,
processStartInfo.Arguments);
@ -206,6 +209,9 @@ namespace ILSpy.Debugger.Services @@ -206,6 +209,9 @@ namespace ILSpy.Debugger.Services
DebugStarting(this, EventArgs.Empty);
try {
// set the JIT flag for evaluating optimized code
Process.DebugMode = DebugModeFlag.Debug;
Process process = debugger.Attach(existingProcess);
attached = true;
SelectProcess(process);

21
ILSpy/Commands/DebuggerCommands.cs

@ -2,6 +2,7 @@ @@ -2,6 +2,7 @@
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
@ -80,9 +81,23 @@ namespace ICSharpCode.ILSpy.Commands @@ -80,9 +81,23 @@ namespace ICSharpCode.ILSpy.Commands
}
}
protected void StartDebugging(Process process)
protected void StartExecutable(string fileName)
{
CurrentDebugger.Start(new ProcessStartInfo {
FileName = fileName,
WorkingDirectory = Path.GetDirectoryName(fileName)
});
Finish();
}
protected void StartAttaching(Process process)
{
CurrentDebugger.Attach(process);
Finish();
}
protected void Finish()
{
EnableDebuggerUI(false);
CurrentDebugger.DebugStopped += OnDebugStopped;
CurrentDebugger.IsProcessRunningChanged += CurrentDebugger_IsProcessRunningChanged;
@ -158,7 +173,7 @@ namespace ICSharpCode.ILSpy.Commands @@ -158,7 +173,7 @@ namespace ICSharpCode.ILSpy.Commands
if (!CurrentDebugger.IsDebugging) {
var window = new AttachToProcessWindow { Owner = MainWindow.Instance };
if (window.ShowDialog() == true) {
StartDebugging(window.SelectedProcess);
StartAttaching(window.SelectedProcess);
}
}
}
@ -291,7 +306,7 @@ namespace ICSharpCode.ILSpy.Commands @@ -291,7 +306,7 @@ namespace ICSharpCode.ILSpy.Commands
if (!CurrentDebugger.IsDebugging) {
// execute the process
this.StartDebugging(Process.Start(fileName));
this.StartExecutable(fileName);
}
}
}

Loading…
Cancel
Save