Browse Source

fix #364: Stack Pad is horribly slow with "Show argument values" option active

pull/411/head
Siegfried Pammer 11 years ago
parent
commit
3752197b37
  1. 6
      src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.cs
  2. 22
      src/AddIns/Debugger/Debugger.Core/StackFrame.cs
  3. 19
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyDecompilerService.cs
  4. 1
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpySymbolSource.cs

6
src/AddIns/Debugger/Debugger.AddIn/Pads/CallStackPad.cs

@ -157,7 +157,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -157,7 +157,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
return new CallStackItem() {
Frame = frame,
ImageSource = SD.ResourceService.GetImageSource("Icons.16x16.Method"),
Name = GetFullName(frame),
Name = GetFullName(frame, hasSymbols),
HasSymbols = hasSymbols,
};
} else {
@ -172,7 +172,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -172,7 +172,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
}
}
internal static string GetFullName(StackFrame frame)
static string GetFullName(StackFrame frame, bool hasSymbols)
{
StringBuilder name = new StringBuilder(64);
if (DebuggingOptions.Instance.ShowModuleNames) {
@ -193,7 +193,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads @@ -193,7 +193,7 @@ namespace ICSharpCode.SharpDevelop.Gui.Pads
}
if (DebuggingOptions.Instance.ShowArgumentValues) {
try {
name.Append(frame.GetArgumentValue(i).AsString(100));
name.Append(frame.GetArgumentValue(i, hasSymbols).AsString(100));
} catch (GetValueException) {
name.Append(ResourceService.GetString("Global.NA"));
}

22
src/AddIns/Debugger/Debugger.Core/StackFrame.cs

@ -178,7 +178,7 @@ namespace Debugger @@ -178,7 +178,7 @@ namespace Debugger
fromToList.Add(range.To);
}
}
if (stepIn) {
Stepper stepInStepper = Stepper.StepIn(this, fromToList.ToArray(), "normal");
this.Thread.CurrentStepIn = stepInStepper;
@ -282,13 +282,15 @@ namespace Debugger @@ -282,13 +282,15 @@ namespace Debugger
}
/// <summary> Gets argument with a given name </summary>
public Value GetArgumentValue(string name)
public Value GetArgumentValue(string name, bool checkCapturedVariables = true)
{
if (checkCapturedVariables) {
LocalVariable capturedVar;
if (HasCapturedVariable(name, out capturedVar))
return capturedVar.GetValue(this);
}
for (int i = 0; i < this.MethodInfo.Parameters.Count; i++) {
if (this.MethodInfo.Parameters[i].Name == name) {
LocalVariable capturedVar;
if (HasCapturedVariable(name, out capturedVar))
return capturedVar.GetValue(this);
return GetArgumentValue(i);
}
}
@ -297,12 +299,14 @@ namespace Debugger @@ -297,12 +299,14 @@ namespace Debugger
/// <summary> Gets argument with a given index </summary>
/// <param name="index"> Zero-based index </param>
public Value GetArgumentValue(int index)
public Value GetArgumentValue(int index, bool checkCapturedVariables = true)
{
var param = this.MethodInfo.Parameters[index];
LocalVariable capturedVariable;
if (HasCapturedVariable(param.Name, out capturedVariable))
return capturedVariable.GetValue(this);
if (checkCapturedVariables) {
LocalVariable capturedVariable;
if (HasCapturedVariable(param.Name, out capturedVariable))
return capturedVariable.GetValue(this);
}
return new Value(this.AppDomain, GetArgumentCorValue(index));
}

19
src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyDecompilerService.cs

@ -88,7 +88,7 @@ namespace ICSharpCode.ILSpyAddIn @@ -88,7 +88,7 @@ namespace ICSharpCode.ILSpyAddIn
public ISet<AssemblyDefinition> ResolvedAssemblies {
get { return resolvedAssemblies; }
}
public ILSpyAssemblyResolver(FileName fileName)
: base(fileName)
{
@ -134,8 +134,10 @@ namespace ICSharpCode.ILSpyAddIn @@ -134,8 +134,10 @@ namespace ICSharpCode.ILSpyAddIn
{
if (name == null)
throw new ArgumentNullException("name");
var astBuilder = CreateAstBuilder(name, cancellationToken);
return new ILSpyFullParseInformation(ILSpyUnresolvedFile.Create(name, astBuilder), null, astBuilder.SyntaxTree);
using (DebugTimer.Time("DecompileType: " + name.ToFileName())) {
var astBuilder = CreateAstBuilder(name, cancellationToken);
return new ILSpyFullParseInformation(ILSpyUnresolvedFile.Create(name, astBuilder), null, astBuilder.SyntaxTree);
}
}
static AstBuilder CreateAstBuilder(DecompiledTypeReference name, CancellationToken cancellationToken = default(CancellationToken))
@ -152,11 +154,6 @@ namespace ICSharpCode.ILSpyAddIn @@ -152,11 +154,6 @@ namespace ICSharpCode.ILSpyAddIn
astBuilder.AddType(typeDefinition);
return astBuilder;
}
static ILSpyUnresolvedFile DoDecompile(DecompiledTypeReference name, CancellationToken cancellationToken = default(CancellationToken))
{
return ILSpyUnresolvedFile.Create(name, CreateAstBuilder(name, cancellationToken));
}
}
public class DecompiledTypeReference : IEquatable<DecompiledTypeReference>
@ -231,7 +228,7 @@ namespace ICSharpCode.ILSpyAddIn @@ -231,7 +228,7 @@ namespace ICSharpCode.ILSpyAddIn
{
return object.Equals(this.AssemblyFile, other.AssemblyFile) && this.Type == other.Type;
}
public override int GetHashCode()
{
int hashCode = 0;
@ -242,7 +239,7 @@ namespace ICSharpCode.ILSpyAddIn @@ -242,7 +239,7 @@ namespace ICSharpCode.ILSpyAddIn
}
return hashCode;
}
public static bool operator ==(DecompiledTypeReference lhs, DecompiledTypeReference rhs) {
if (ReferenceEquals(lhs, rhs))
return true;
@ -250,7 +247,7 @@ namespace ICSharpCode.ILSpyAddIn @@ -250,7 +247,7 @@ namespace ICSharpCode.ILSpyAddIn
return false;
return lhs.Equals(rhs);
}
public static bool operator !=(DecompiledTypeReference lhs, DecompiledTypeReference rhs) {
return !(lhs == rhs);
}

1
src/AddIns/DisplayBindings/ILSpyAddIn/ILSpySymbolSource.cs

@ -28,6 +28,7 @@ namespace ICSharpCode.ILSpyAddIn @@ -28,6 +28,7 @@ namespace ICSharpCode.ILSpyAddIn
{
var typeName = DecompiledTypeReference.FromTypeDefinition(method.DeclaringTypeDefinition);
if (typeName == null) return null;
SD.Log.DebugFormatted("GetSymbols for: {0}", typeName.ToFileName());
return SD.ParserService.ParseFile(typeName.ToFileName()) as ILSpyUnresolvedFile;
}

Loading…
Cancel
Save