Browse Source

Merge branch 'master' of git://github.com/icsharpcode/ILSpy

pull/205/head
Pent Ploompuu 14 years ago
parent
commit
475ce0e827
  1. 14
      Debugger/Debugger.Core/Breakpoint.cs
  2. 2
      Debugger/ILSpy.Debugger/Commands/DebuggerCommands.cs
  3. 3
      Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs
  4. 8
      ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs
  5. 4
      ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs
  6. 9
      ICSharpCode.Decompiler/ITextOutput.cs
  7. 21
      ICSharpCode.Decompiler/PlainTextOutput.cs
  8. 5
      ILSpy/Bookmarks/MemberBookmark.cs
  9. 2
      ILSpy/Languages/Language.cs
  10. 2
      ILSpy/SearchPane.cs
  11. 23
      ILSpy/TextView/AvalonEditTextOutput.cs
  12. 2
      ILSpy/TextView/DecompilerTextView.cs
  13. 6
      ILSpy/TreeNodes/TypeTreeNode.cs

14
Debugger/Debugger.Core/Breakpoint.cs

@ -45,11 +45,6 @@ namespace Debugger @@ -45,11 +45,6 @@ namespace Debugger
set { line = value; }
}
public string TypeName {
get;
set;
}
public int Column {
get { return column; }
protected set { column = value; }
@ -75,6 +70,10 @@ namespace Debugger @@ -75,6 +70,10 @@ namespace Debugger
}
}
public string TypeName {
get; protected set;
}
protected virtual void OnHit(BreakpointEventArgs e)
{
if (Hit != null) {
@ -176,12 +175,11 @@ namespace Debugger @@ -176,12 +175,11 @@ namespace Debugger
public class ILBreakpoint : Breakpoint
{
public ILBreakpoint(NDebugger debugger, string typeName, string memberReferenceName, int line, int metadataToken, int offset, bool enabled)
public ILBreakpoint(NDebugger debugger, string typeName, int line, int metadataToken, int offset, bool enabled)
{
this.Debugger = debugger;
this.Line = line;
this.TypeName = typeName;
this.MemberReferenceName = memberReferenceName;
this.MetadataToken = metadataToken;
this.ILOffset = offset;
this.Enabled = enabled;
@ -191,8 +189,6 @@ namespace Debugger @@ -191,8 +189,6 @@ namespace Debugger
public int ILOffset { get; private set; }
public string MemberReferenceName { get; private set; }
public override bool SetBreakpoint(Module module)
{
SourcecodeSegment segment = SourcecodeSegment.CreateForIL(module, this.Line, (int)MetadataToken, ILOffset);

2
Debugger/ILSpy.Debugger/Commands/DebuggerCommands.cs

@ -83,7 +83,7 @@ namespace ICSharpCode.ILSpy.Debugger.Commands @@ -83,7 +83,7 @@ namespace ICSharpCode.ILSpy.Debugger.Commands
public override void Execute(object parameter)
{
DebugInformation.LoadedAssemblies = MainWindow.Instance.CurrentAssemblyList.GetAssemblies().Select(a => a.AssemblyDefinition);
}
protected static IDebugger CurrentDebugger {

3
Debugger/ILSpy.Debugger/Services/Debugger/WindowsDebugger.cs

@ -549,7 +549,6 @@ namespace ICSharpCode.ILSpy.Debugger.Services @@ -549,7 +549,6 @@ namespace ICSharpCode.ILSpy.Debugger.Services
breakpoint = new ILBreakpoint(
debugger,
bookmark.MemberReference.DeclaringType.FullName,
bookmark.MemberReference.FullName,
bookmark.LineNumber,
bookmark.MemberReference.MetadataToken.ToInt32(),
bookmark.ILRange.From,
@ -817,6 +816,8 @@ namespace ICSharpCode.ILSpy.Debugger.Services @@ -817,6 +816,8 @@ namespace ICSharpCode.ILSpy.Debugger.Services
int ilOffset = frame.IP;
string fullName = debugType.FullNameWithoutGenericArguments;
DebugInformation.LoadedAssemblies = MainWindow.Instance.CurrentAssemblyList.GetAssemblies().Select(a => a.AssemblyDefinition);
if (DebugInformation.LoadedAssemblies == null)
throw new NullReferenceException("No DebugData assemblies!");
else {

8
ICSharpCode.Decompiler/Ast/TextOutputFormatter.cs

@ -163,7 +163,7 @@ namespace ICSharpCode.Decompiler.Ast @@ -163,7 +163,7 @@ namespace ICSharpCode.Decompiler.Ast
foreach (var range in ranges) {
mapping.MemberCodeMappings.Add(new SourceCodeMapping {
ILInstructionOffset = range,
SourceCodeLine = output.CurrentLine,
SourceCodeLine = output.Location.Line,
MemberMapping = mapping
});
}
@ -176,10 +176,10 @@ namespace ICSharpCode.Decompiler.Ast @@ -176,10 +176,10 @@ namespace ICSharpCode.Decompiler.Ast
if (predicate(node)) {
var n = node as AttributedNode;
int c = 0;
int attributesCount = 0;
if (n != null)
c = n.Attributes.Count;
node.AddAnnotation(Tuple.Create(output.CurrentLine + c, output.CurrentColumn));
attributesCount = n.Attributes.Count;
node.AddAnnotation(new TextOutputLocation { Line = output.Location.Line + attributesCount, Column = output.Location.Column});
}
nodeStack.Push(node);

4
ICSharpCode.Decompiler/Disassembler/MethodBodyDisassembler.cs

@ -91,7 +91,7 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -91,7 +91,7 @@ namespace ICSharpCode.Decompiler.Disassembler
// add IL code mappings - used in debugger
methodMapping.MemberCodeMappings.Add(
new SourceCodeMapping() {
SourceCodeLine = output.CurrentLine,
SourceCodeLine = output.Location.Line,
ILInstructionOffset = new ILRange { From = inst.Offset, To = inst.Next == null ? method.Body.CodeSize : inst.Next.Offset },
MemberMapping = methodMapping
});
@ -194,7 +194,7 @@ namespace ICSharpCode.Decompiler.Disassembler @@ -194,7 +194,7 @@ namespace ICSharpCode.Decompiler.Disassembler
if (currentMethodMapping != null) {
currentMethodMapping.MemberCodeMappings.Add(
new SourceCodeMapping() {
SourceCodeLine = output.CurrentLine,
SourceCodeLine = output.Location.Line,
ILInstructionOffset = new ILRange { From = inst.Offset, To = inst.Next == null ? codeSize : inst.Next.Offset },
MemberMapping = currentMethodMapping
});

9
ICSharpCode.Decompiler/ITextOutput.cs

@ -23,8 +23,7 @@ namespace ICSharpCode.Decompiler @@ -23,8 +23,7 @@ namespace ICSharpCode.Decompiler
{
public interface ITextOutput
{
int CurrentLine { get; }
int CurrentColumn { get; }
TextOutputLocation Location { get; }
void Indent();
void Unindent();
@ -38,6 +37,12 @@ namespace ICSharpCode.Decompiler @@ -38,6 +37,12 @@ namespace ICSharpCode.Decompiler
void MarkFoldEnd();
}
public sealed class TextOutputLocation
{
public int Line { get; set; }
public int Column { get; set; }
}
public static class TextOutputExtensions
{
public static void Write(this ITextOutput output, string format, params object[] args)

21
ICSharpCode.Decompiler/PlainTextOutput.cs

@ -28,8 +28,7 @@ namespace ICSharpCode.Decompiler @@ -28,8 +28,7 @@ namespace ICSharpCode.Decompiler
readonly TextWriter writer;
int indent;
bool needsIndent;
int lineNumber = 1;
int columnNumber = 1;
TextOutputLocation location = new TextOutputLocation { Line = 1, Column = 1};
public PlainTextOutput(TextWriter writer)
{
@ -43,12 +42,8 @@ namespace ICSharpCode.Decompiler @@ -43,12 +42,8 @@ namespace ICSharpCode.Decompiler
this.writer = new StringWriter();
}
public int CurrentLine {
get { return lineNumber; }
}
public int CurrentColumn {
get { return columnNumber; }
public TextOutputLocation Location {
get { return location; }
}
public override string ToString()
@ -72,7 +67,7 @@ namespace ICSharpCode.Decompiler @@ -72,7 +67,7 @@ namespace ICSharpCode.Decompiler
needsIndent = false;
for (int i = 0; i < indent; i++) {
writer.Write('\t');
columnNumber += TAB_SIZE - 1;
location.Column += TAB_SIZE - 1;
}
}
}
@ -81,22 +76,22 @@ namespace ICSharpCode.Decompiler @@ -81,22 +76,22 @@ namespace ICSharpCode.Decompiler
{
WriteIndent();
writer.Write(ch);
columnNumber++;
location.Column++;
}
public void Write(string text)
{
WriteIndent();
writer.Write(text);
columnNumber += text.Length;
location.Column += text.Length;
}
public void WriteLine()
{
lineNumber++;
location.Line++;
writer.WriteLine();
needsIndent = true;
columnNumber = TAB_SIZE * indent;
location.Column = TAB_SIZE * indent;
}
public void WriteDefinition(string text, object definition)

5
ILSpy/Bookmarks/MemberBookmark.cs

@ -21,6 +21,7 @@ using System.Windows; @@ -21,6 +21,7 @@ using System.Windows;
using System.Windows.Input;
using System.Windows.Media;
using ICSharpCode.Decompiler;
using ICSharpCode.NRefactory.CSharp;
using ICSharpCode.NRefactory.TypeSystem;
using Mono.Cecil;
@ -91,9 +92,9 @@ namespace ICSharpCode.ILSpy.Bookmarks @@ -91,9 +92,9 @@ namespace ICSharpCode.ILSpy.Bookmarks
public int LineNumber {
get {
var t = node.Annotation<Tuple<int, int>>();
var t = node.Annotation<TextOutputLocation>();
if (t != null)
return t.Item1;
return t.Line;
return 0;
}
}

2
ILSpy/Languages/Language.cs

@ -207,7 +207,7 @@ namespace ICSharpCode.ILSpy @@ -207,7 +207,7 @@ namespace ICSharpCode.ILSpy
var nodes = TreeTraversal
.PreOrder((AstNode)builder.CompilationUnit, n => n.Children)
.Where(n => n is AttributedNode && n.Annotation<Tuple<int, int>>() != null);
.Where(n => n is AttributedNode && n.Annotation<TextOutputLocation>() != null);
OnDecompilationFinished(new DecompileEventArgs {
CodeMappings = builder.CodeMappings,

2
ILSpy/SearchPane.cs

@ -398,7 +398,7 @@ namespace ICSharpCode.ILSpy @@ -398,7 +398,7 @@ namespace ICSharpCode.ILSpy
case TypeCode.Int64:
TypeCode tc = Type.GetTypeCode(val.GetType());
if (tc >= TypeCode.SByte && tc <= TypeCode.UInt64)
return Convert.ToInt64(val) == (long)searchTermLiteralValue;
return CSharpPrimitiveCast.Cast(TypeCode.Int64, val, false).Equals(searchTermLiteralValue);
else
return false;
case TypeCode.Single:

23
ILSpy/TextView/AvalonEditTextOutput.cs

@ -65,7 +65,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -65,7 +65,7 @@ namespace ICSharpCode.ILSpy.TextView
/// </summary>
public sealed class AvalonEditTextOutput : ISmartTextOutput
{
int lineNumber = 1;
TextOutputLocation location = new TextOutputLocation { Line = 1, Column = 1 };
int lastLineStart = 0;
readonly StringBuilder b = new StringBuilder();
@ -117,6 +117,13 @@ namespace ICSharpCode.ILSpy.TextView @@ -117,6 +117,13 @@ namespace ICSharpCode.ILSpy.TextView
get { return b.Length; }
}
public TextOutputLocation Location {
get {
location.Column = b.Length - lastLineStart + 1;
return location;
}
}
#region Text Document
TextDocument textDocument;
@ -188,7 +195,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -188,7 +195,7 @@ namespace ICSharpCode.ILSpy.TextView
b.AppendLine();
needsIndent = true;
lastLineStart = b.Length;
lineNumber++;
location.Line++;
if (this.TextLength > LengthLimit) {
throw new OutputLengthExceededException();
}
@ -236,17 +243,5 @@ namespace ICSharpCode.ILSpy.TextView @@ -236,17 +243,5 @@ namespace ICSharpCode.ILSpy.TextView
this.UIElements.Add(new KeyValuePair<int, Lazy<UIElement>>(this.TextLength, new Lazy<UIElement>(element)));
}
}
public int CurrentLine {
get {
return lineNumber;
}
}
public int CurrentColumn {
get {
return b.Length - lastLineStart + 1;
}
}
}
}

2
ILSpy/TextView/DecompilerTextView.cs

@ -456,7 +456,7 @@ namespace ICSharpCode.ILSpy.TextView @@ -456,7 +456,7 @@ namespace ICSharpCode.ILSpy.TextView
int ilOffset = DebugInformation.DebugStepInformation.Item2;
int line;
MemberReference member;
if (!DebugInformation.CodeMappings.ContainsKey(token))
if (DebugInformation.CodeMappings == null || !DebugInformation.CodeMappings.ContainsKey(token))
return;
DebugInformation.CodeMappings[token].GetInstructionByTokenAndOffset(token, ilOffset, out member, out line);

6
ILSpy/TreeNodes/TypeTreeNode.cs

@ -81,10 +81,10 @@ namespace ICSharpCode.ILSpy.TreeNodes @@ -81,10 +81,10 @@ namespace ICSharpCode.ILSpy.TreeNodes
if (!settings.ShowInternalApi && !IsPublicAPI)
return FilterResult.Hidden;
if (settings.SearchTermMatches(type.Name)) {
if (type.IsNested && !settings.Language.ShowMember(type))
return FilterResult.Hidden;
else
if (settings.Language.ShowMember(type))
return FilterResult.Match;
else
return FilterResult.Hidden;
} else {
return FilterResult.Recurse;
}

Loading…
Cancel
Save