Browse Source

fix some bugs in the ILSpy debugger integration

pull/685/head
Siegfried Pammer 10 years ago
parent
commit
51481d9230
  1. 2
      src/AddIns/Debugger/Debugger.Core/PdbSymbolSource.cs
  2. 38
      src/AddIns/DisplayBindings/ILSpyAddIn/DecompiledViewContent.cs
  3. 3
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyParser.cs
  4. 3
      src/AddIns/DisplayBindings/ILSpyAddIn/ILSpySymbolSource.cs

2
src/AddIns/Debugger/Debugger.Core/PdbSymbolSource.cs

@ -256,7 +256,7 @@ namespace Debugger @@ -256,7 +256,7 @@ namespace Debugger
var s = seqPoints[i];
if (s.ContainsLocation(line, column))
return s;
if (s.StartLine > line)
if (s.StartLine > line || (s.StartLine == line && s.StartColumn > column))
return s;
}
return null;

38
src/AddIns/DisplayBindings/ILSpyAddIn/DecompiledViewContent.cs

@ -27,6 +27,7 @@ using ICSharpCode.AvalonEdit.AddIn; @@ -27,6 +27,7 @@ using ICSharpCode.AvalonEdit.AddIn;
using ICSharpCode.AvalonEdit.Highlighting;
using ICSharpCode.Core;
using ICSharpCode.Decompiler;
using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.ILSpyAddIn;
using ICSharpCode.NRefactory;
using ICSharpCode.NRefactory.TypeSystem;
@ -39,12 +40,13 @@ namespace ICSharpCode.ILSpyAddIn @@ -39,12 +40,13 @@ namespace ICSharpCode.ILSpyAddIn
/// <summary>
/// Hosts a decompiled type.
/// </summary>
class DecompiledViewContent : AbstractViewContentWithoutFile
class DecompiledViewContent : AbstractViewContentWithoutFile, IPositionable
{
/// <summary>
/// Entity to jump to once decompilation has finished.
/// </summary>
string jumpToEntityIdStringWhenDecompilationFinished;
int jumpToLineWhenDecompilationFinished, jumpToColumnWhenDecompilationFinished;
bool decompilationFinished;
@ -72,6 +74,9 @@ namespace ICSharpCode.ILSpyAddIn @@ -72,6 +74,9 @@ namespace ICSharpCode.ILSpyAddIn
this.codeEditor.FileName = this.DecompiledTypeName.ToFileName();
this.codeEditor.ActiveTextEditor.IsReadOnly = true;
this.codeEditor.ActiveTextEditor.SyntaxHighlighting = HighlightingManager.Instance.GetDefinition("C#");
this.Services.RemoveService(typeof(IPositionable));
this.Services.AddService(typeof(IPositionable), this);
}
#endregion
@ -169,7 +174,10 @@ namespace ICSharpCode.ILSpyAddIn @@ -169,7 +174,10 @@ namespace ICSharpCode.ILSpyAddIn
codeEditor.Document.UndoStack.ClearAll();
this.decompilationFinished = true;
JumpToEntity(this.jumpToEntityIdStringWhenDecompilationFinished);
if (!string.IsNullOrEmpty(jumpToEntityIdStringWhenDecompilationFinished))
JumpToEntity(this.jumpToEntityIdStringWhenDecompilationFinished);
else
JumpTo(jumpToLineWhenDecompilationFinished, jumpToColumnWhenDecompilationFinished);
// update UI
//UpdateIconMargin();
@ -228,5 +236,31 @@ namespace ICSharpCode.ILSpyAddIn @@ -228,5 +236,31 @@ namespace ICSharpCode.ILSpyAddIn
}
#endregion
#region IPositionable implementation
public void JumpTo(int line, int column)
{
if (decompilationFinished) {
codeEditor.ActiveTextEditorAdapter.JumpTo(line, column);
} else {
jumpToLineWhenDecompilationFinished = line;
jumpToColumnWhenDecompilationFinished = column;
}
}
public int Line {
get {
return codeEditor.ActiveTextEditor.TextArea.Caret.Line;
}
}
public int Column {
get {
return codeEditor.ActiveTextEditor.TextArea.Caret.Column;
}
}
#endregion
}
}

3
src/AddIns/DisplayBindings/ILSpyAddIn/ILSpyParser.cs

@ -31,6 +31,7 @@ using ICSharpCode.NRefactory.Semantics; @@ -31,6 +31,7 @@ using ICSharpCode.NRefactory.Semantics;
using ICSharpCode.NRefactory.TypeSystem;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Dom.ClassBrowser;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Editor.Search;
using ICSharpCode.SharpDevelop.Parser;
using ICSharpCode.SharpDevelop.Project;
@ -48,7 +49,7 @@ namespace ICSharpCode.ILSpyAddIn @@ -48,7 +49,7 @@ namespace ICSharpCode.ILSpyAddIn
return fileName != null && fileName.StartsWith("ilspy://", StringComparison.OrdinalIgnoreCase);
}
readonly static ITextSource EmptyFileContent = new StringTextSource("");
readonly ITextSource EmptyFileContent = new StringTextSource("", new OnDiskTextSourceVersion(DateTime.MinValue));
public ITextSource GetFileContent(FileName fileName)
{

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

@ -29,7 +29,8 @@ namespace ICSharpCode.ILSpyAddIn @@ -29,7 +29,8 @@ 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;
// full parse info required to make ParserService caching possible...
return SD.ParserService.Parse(typeName.ToFileName()).UnresolvedFile as ILSpyUnresolvedFile;
}
public Debugger.SequencePoint GetSequencePoint(IMethod method, int iloffset)

Loading…
Cancel
Save