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. 12
      src/AddIns/Debugger/Debugger.Core/StackFrame.cs
  3. 7
      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"));
}

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

@ -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)
{
for (int i = 0; i < this.MethodInfo.Parameters.Count; i++) {
if (this.MethodInfo.Parameters[i].Name == name) {
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) {
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];
if (checkCapturedVariables) {
LocalVariable capturedVariable;
if (HasCapturedVariable(param.Name, out capturedVariable))
return capturedVariable.GetValue(this);
}
return new Value(this.AppDomain, GetArgumentCorValue(index));
}

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

@ -134,9 +134,11 @@ namespace ICSharpCode.ILSpyAddIn @@ -134,9 +134,11 @@ namespace ICSharpCode.ILSpyAddIn
{
if (name == null)
throw new ArgumentNullException("name");
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>

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