diff options
author | David Karlaš <david.karlas@gmail.com> | 2017-06-16 09:41:17 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-16 09:41:17 +0300 |
commit | c329548380f72280e46526f9161e45961a3ff60f (patch) | |
tree | 125e3d4d6d0f1d376ae0ebdfd8d7398ab2e431d4 /mcs/class/Mono.Debugger.Soft | |
parent | a21319d1cacfcaeeebff0c5ff16070f87dba34ba (diff) | |
parent | 9549385e47a9f85b98a8190c39b935f2813b2f9c (diff) |
Merge pull request #5042 from mono/sdbSyncDebuggerLibs
Upstreaming changes from mono/debugger-libs to Mono.Debugger.Soft
Diffstat (limited to 'mcs/class/Mono.Debugger.Soft')
7 files changed, 47 insertions, 7 deletions
diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs index af3e1716ca4..602c827091d 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs @@ -2214,7 +2214,7 @@ namespace Mono.Debugger.Soft internal ValueImpl[] Type_GetValues (long id, long[] fields, long thread_id) { int len = fields.Length; PacketReader r; - if (thread_id != 0) + if (thread_id != 0 && Version.AtLeast(2, 3)) r = SendReceive (CommandSet.TYPE, (int)CmdType.GET_VALUES_2, new PacketWriter ().WriteId (id).WriteId (thread_id).WriteInt (len).WriteIds (fields)); else r = SendReceive (CommandSet.TYPE, (int)CmdType.GET_VALUES, new PacketWriter ().WriteId (id).WriteInt (len).WriteIds (fields)); diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ILInterpreter.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ILInterpreter.cs index 8a2a3ef939c..4c2b33ee99e 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ILInterpreter.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ILInterpreter.cs @@ -30,6 +30,11 @@ namespace Mono.Debugger.Soft if (args != null && args.Length != 0) throw new NotSupportedException (); + //If method is virtual we can't optimize(execute IL) because it's maybe + //overriden... call runtime to invoke overriden version... + if (method.IsVirtual) + throw new NotSupportedException (); + if (method.IsStatic || method.DeclaringType.IsValueType || this_val == null || !(this_val is ObjectMirror)) throw new NotSupportedException (); @@ -350,6 +355,12 @@ namespace Mono.Debugger.Soft } catch { throw new NotSupportedException (); } + } else if (method.ReturnType.IsEnum && primitive != null) { + try { + res = method.VirtualMachine.CreateEnumMirror (method.ReturnType, primitive); + } catch { + throw new NotSupportedException (); + } } return res; diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs index fb10f7117c3..24c247285cd 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs @@ -59,7 +59,7 @@ namespace Mono.Debugger.Soft sb.Append (ReturnType.Name); sb.Append (' '); if (type_namespace != String.Empty) - sb.Append (type_namespace + "."); + sb.Append (type_namespace).Append ("."); sb.Append(type_name); sb.Append(":"); sb.Append(Name); diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs index c92f2240ef8..2b9ab2a51e7 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs @@ -102,6 +102,18 @@ namespace Mono.Debugger.Soft } } + public int EndLineNumber { + get { + return Location.EndLineNumber; + } + } + + public int EndColumnNumber { + get { + return Location.EndColumnNumber; + } + } + public bool IsDebuggerInvoke { get { return (flags & StackFrameFlags.DEBUGGER_INVOKE) != 0; diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs index 5dbe5eb1fb5..938a4ca8a8c 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/ThreadMirror.cs @@ -13,6 +13,8 @@ namespace Mono.Debugger.Soft ManualResetEvent fetchingEvent = new ManualResetEvent (false); ThreadInfo info; StackFrame[] frames; + bool threadStateInvalid = true; + ThreadState threadState; internal ThreadMirror (VirtualMachine vm, long id) : base (vm, id) { } @@ -30,6 +32,7 @@ namespace Mono.Debugger.Soft internal void InvalidateFrames () { cacheInvalid = true; + threadStateInvalid = true; } internal void FetchFrames (bool mustFetch = false) { @@ -91,7 +94,11 @@ namespace Mono.Debugger.Soft public ThreadState ThreadState { get { - return (ThreadState)vm.conn.Thread_GetState (id); + if (threadStateInvalid) { + threadState = (ThreadState) vm.conn.Thread_GetState (id); + threadStateInvalid = false; + } + return threadState; } } diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs index 9d7c9881ab9..40b7d631556 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs @@ -665,7 +665,7 @@ namespace Mono.Debugger.Soft return res; } - internal ValueImpl EncodeValue (Value v) { + internal ValueImpl EncodeValue (Value v, List<Value> duplicates = null) { if (v is PrimitiveValue) { object val = (v as PrimitiveValue).Value; if (val == null) @@ -675,16 +675,22 @@ namespace Mono.Debugger.Soft } else if (v is ObjectMirror) { return new ValueImpl { Type = ElementType.Object, Objid = (v as ObjectMirror).Id }; } else if (v is StructMirror) { - return new ValueImpl { Type = ElementType.ValueType, Klass = (v as StructMirror).Type.Id, Fields = EncodeValues ((v as StructMirror).Fields) }; + if (duplicates == null) + duplicates = new List<Value> (); + if (duplicates.Contains (v)) + return new ValueImpl { Type = (ElementType)ValueTypeId.VALUE_TYPE_ID_NULL, Objid = 0 }; + duplicates.Add (v); + + return new ValueImpl { Type = ElementType.ValueType, Klass = (v as StructMirror).Type.Id, Fields = EncodeValues ((v as StructMirror).Fields, duplicates) }; } else { throw new NotSupportedException (); } } - internal ValueImpl[] EncodeValues (IList<Value> values) { + internal ValueImpl[] EncodeValues (IList<Value> values, List<Value> duplicates = null) { ValueImpl[] res = new ValueImpl [values.Count]; for (int i = 0; i < values.Count; ++i) - res [i] = EncodeValue (values [i]); + res [i] = EncodeValue (values [i], duplicates); return res; } diff --git a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachineManager.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachineManager.cs index 211a0df302b..141913a228c 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachineManager.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachineManager.cs @@ -5,6 +5,7 @@ using System.IO; using System.Net; using System.Net.Sockets; using System.Runtime.Remoting.Messaging; +using System.Text; namespace Mono.Debugger.Soft { @@ -95,6 +96,9 @@ namespace Mono.Debugger.Soft info.FileName = "valgrind"; info.UseShellExecute = false; + info.StandardErrorEncoding = Encoding.UTF8; + info.StandardOutputEncoding = Encoding.UTF8; + ITargetProcess p; if (options != null && options.CustomProcessLauncher != null) p = new ProcessWrapper (options.CustomProcessLauncher (info)); |