Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/debugger-libs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs')
-rw-r--r--Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs74
1 files changed, 58 insertions, 16 deletions
diff --git a/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs b/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs
index a13543a..b15e68a 100644
--- a/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs
+++ b/Mono.Debugger.Soft/Mono.Debugger.Soft/TypeMirror.cs
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
+using System.Linq;
using System.Reflection;
using System.Threading.Tasks;
@@ -16,7 +17,7 @@ namespace Mono.Debugger.Soft
*/
public class TypeMirror : Mirror, IInvokable
{
- MethodMirror[] methods;
+ List<MethodMirror> methods;
AssemblyMirror ass;
ModuleMirror module;
FieldInfoMirror[] fields;
@@ -416,20 +417,26 @@ namespace Mono.Debugger.Soft
public MethodMirror[] GetMethods () {
if (methods == null) {
long[] ids = vm.conn.Type_GetMethods (id);
- MethodMirror[] m = new MethodMirror [ids.Length];
+ methods = new List<MethodMirror>(ids.Length);
for (int i = 0; i < ids.Length; ++i) {
- m [i] = vm.GetMethod (ids [i]);
+ methods.Add(vm.GetMethod (ids [i]));
}
- methods = m;
}
- return methods;
- }
-
- // FIXME: Sync this with Type
+ return methods.ToArray();
+ }
+ public void AddMethodIfNotExist (MethodMirror method)
+ {
+ if (!Array.Exists(GetMethods (), (m => m.GetId() == method.GetId()))) {
+ //is EnC
+ methods.Add (method);
+ }
+ }
+
+ // FIXME: Sync this with Type
public MethodMirror GetMethod (string name) {
- foreach (var m in GetMethods ())
- if (m.Name == name)
- return m;
+ foreach (var m in GetMethods ())
+ if (m.Name == name)
+ return m;
return null;
}
@@ -450,6 +457,12 @@ namespace Mono.Debugger.Soft
return fields;
}
+ public void ClearCachedDebugInfo ()
+ {
+ fields = null;
+ properties = null;
+ }
+
public FieldInfoMirror GetField (string name) {
if (name == null)
throw new ArgumentNullException ("name");
@@ -896,10 +909,19 @@ namespace Mono.Debugger.Soft
if (!iface_map.TryGetValue (interfaceType, out res))
throw new ArgumentException ("Interface not found", "interfaceType");
return res;
- }
-
- // Return whenever the type initializer of this type has ran
- // Since protocol version 2.23
+ }
+
+ public void ApplySourceChanges (SourceUpdate sourceUpdate)
+ {
+ var methods = GetMethods ();
+ foreach (var method in methods)
+ {
+ method.ApplySourceChanges (sourceUpdate);
+ }
+ }
+
+ // Return whenever the type initializer of this type has ran
+ // Since protocol version 2.23
public bool IsInitialized {
get {
vm.CheckProtocolVersion (2, 23);
@@ -908,5 +930,25 @@ namespace Mono.Debugger.Soft
return inited;
}
}
- }
+ }
+
+ public class SourceUpdate
+ {
+ public List<Tuple<int, int>> LineUpdates { get; } //Tuple<oldLine, newLine>
+ public string FileName { get; }
+
+ public SourceUpdate (string fileName)
+ {
+ this.FileName = fileName;
+ LineUpdates = new List<Tuple<int, int>> ();
+ }
+
+ internal int FindLineDiff (int lineNumber)
+ {
+ var line = LineUpdates.FirstOrDefault (item => item.Item1 + 1 == lineNumber);
+ if (line != null)
+ return line.Item2 - line.Item1;
+ return 0;
+ }
+ }
}