diff options
author | Jeffrey Stedfast <fejj@gnome.org> | 2012-08-02 00:43:20 +0400 |
---|---|---|
committer | Jeffrey Stedfast <fejj@gnome.org> | 2012-08-02 00:43:20 +0400 |
commit | 417d5f188baffa571432c08f2ffcce7fc797fbb4 (patch) | |
tree | 5db0618e7e55dd6af85d65dcb238e195e23af66c /main/contrib | |
parent | 3a6448e1b4712b9bb98466fb387320cb9409eab7 (diff) |
[Mono.Debugger.Soft] Updated
Diffstat (limited to 'main/contrib')
8 files changed, 97 insertions, 15 deletions
diff --git a/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs b/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs index 1c9e4f58bb..319a92bfdf 100644 --- a/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs +++ b/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs @@ -43,6 +43,7 @@ namespace Mono.Debugger.Soft public int max_il_offset; public int[] il_offsets; public int[] line_numbers; + public int[] column_numbers; public SourceInfo[] source_files; } @@ -79,6 +80,24 @@ namespace Mono.Debugger.Soft class MethodBodyInfo { public byte[] il; + public ExceptionClauseInfo[] clauses; + } + + struct ExceptionClauseInfo { + public ExceptionClauseFlags flags; + public int try_offset; + public int try_length; + public int handler_offset; + public int handler_length; + public int filter_offset; + public long catch_type_id; + } + + enum ExceptionClauseFlags { + None = 0x0, + Filter = 0x1, + Finally = 0x2, + Fault = 0x4, } struct ParamInfo { @@ -376,7 +395,7 @@ namespace Mono.Debugger.Soft * with newer runtimes, and vice versa. */ internal const int MAJOR_VERSION = 2; - internal const int MINOR_VERSION = 17; + internal const int MINOR_VERSION = 20; enum WPSuspendPolicy { NONE = 0, @@ -1672,6 +1691,7 @@ namespace Mono.Debugger.Soft info.il_offsets = new int [n_il_offsets]; info.line_numbers = new int [n_il_offsets]; info.source_files = new SourceInfo [n_il_offsets]; + info.column_numbers = new int [n_il_offsets]; for (int i = 0; i < n_il_offsets; ++i) { info.il_offsets [i] = res.ReadInt (); info.line_numbers [i] = res.ReadInt (); @@ -1681,6 +1701,10 @@ namespace Mono.Debugger.Soft } else { info.source_files [i] = sources [0]; } + if (Version.AtLeast (2, 19)) + info.column_numbers [i] = res.ReadInt (); + else + info.column_numbers [i] = 0; } return info; @@ -1757,6 +1781,28 @@ namespace Mono.Debugger.Soft for (int i = 0; i < info.il.Length; ++i) info.il [i] = (byte)res.ReadByte (); + if (Version.AtLeast (2, 18)) { + info.clauses = new ExceptionClauseInfo [res.ReadInt ()]; + + for (int i = 0; i < info.clauses.Length; ++i) { + var clause = new ExceptionClauseInfo { + flags = (ExceptionClauseFlags) res.ReadInt (), + try_offset = res.ReadInt (), + try_length = res.ReadInt (), + handler_offset = res.ReadInt (), + handler_length = res.ReadInt (), + }; + + if (clause.flags == ExceptionClauseFlags.None) + clause.catch_type_id = res.ReadId (); + else if (clause.flags == ExceptionClauseFlags.Filter) + clause.filter_offset = res.ReadInt (); + + info.clauses [i] = clause; + } + } else + info.clauses = new ExceptionClauseInfo [0]; + return info; } diff --git a/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/Location.cs b/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/Location.cs index a2020a5da4..0624095b28 100644 --- a/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/Location.cs +++ b/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/Location.cs @@ -10,7 +10,7 @@ namespace Mono.Debugger.Soft string source_file; int line_number; byte[] hash; - //int column_number; + int column_number; internal Location (VirtualMachine vm, MethodMirror method, long native_addr, int il_offset, string source_file, int line_number, int column_number, byte[] hash) : base (vm, 0) { this.method = method; @@ -19,7 +19,7 @@ namespace Mono.Debugger.Soft this.source_file = source_file; this.line_number = line_number; this.hash = hash; - //this.column_number = column_number; + this.column_number = column_number; } public MethodMirror Method { @@ -46,6 +46,13 @@ namespace Mono.Debugger.Soft } } + // Since protocol version 2.19, 0 in earlier protocol versions + public int ColumnNumber { + get { + return column_number; + } + } + // MD5 hash of source file // Since protocol version 2.14, null in earlier protocol versions public byte[] SourceFileHash { diff --git a/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodBodyMirror.cs b/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodBodyMirror.cs index c03f4cdb47..c383005a0d 100644 --- a/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodBodyMirror.cs +++ b/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodBodyMirror.cs @@ -4,6 +4,7 @@ using System.Text; using Mono.Cecil.Cil; using Mono.Cecil.Metadata; using System.IO; +using System.Linq; using System.Reflection; namespace Mono.Debugger.Soft @@ -11,11 +12,11 @@ namespace Mono.Debugger.Soft public class MethodBodyMirror : Mirror { MethodMirror method; - byte[] il; + MethodBodyInfo info; - internal MethodBodyMirror (VirtualMachine vm, MethodMirror method, byte[] il) : base (vm, 0) { + internal MethodBodyMirror (VirtualMachine vm, MethodMirror method, MethodBodyInfo info) : base (vm, 0) { this.method = method; - this.il = il; + this.info = info; } public MethodMirror Method { @@ -24,13 +25,29 @@ namespace Mono.Debugger.Soft } } + public List<ILExceptionHandler> ExceptionHandlers { + get { + vm.CheckProtocolVersion (2, 18); + return info.clauses.Select (c => + { + var handler = new ILExceptionHandler (c.try_offset, c.try_length, (ILExceptionHandlerType) c.flags, c.handler_offset, c.handler_length); + if (c.flags == ExceptionClauseFlags.None) + handler.CatchType = vm.GetType (c.catch_type_id); + else if (c.flags == ExceptionClauseFlags.Filter) + handler.FilterOffset = c.filter_offset; + + return handler; + }).ToList (); + } + } + public byte[] GetILAsByteArray () { - return il; + return info.il; } public List<ILInstruction> Instructions { get { - return ReadCilBody (new BinaryReader (new MemoryStream (il)), il.Length); + return ReadCilBody (new BinaryReader (new MemoryStream (info.il)), info.il.Length); } } diff --git a/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs b/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs index 3034a01d33..85cf83d8dd 100644 --- a/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs +++ b/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/MethodMirror.cs @@ -249,7 +249,7 @@ namespace Mono.Debugger.Soft if (body == null) { MethodBodyInfo info = vm.conn.Method_GetBody (id); - body = new MethodBodyMirror (vm, this, info.il); + body = new MethodBodyMirror (vm, this, info); } return body; } @@ -303,24 +303,26 @@ namespace Mono.Debugger.Soft var line_numbers = LineNumbers; IList<Location> res = new Location [ILOffsets.Count]; for (int i = 0; i < il_offsets.Count; ++i) - res [i] = new Location (vm, this, -1, il_offsets [i], debug_info.source_files [i].source_file, line_numbers [i], 0, debug_info.source_files [i].hash); + res [i] = new Location (vm, this, -1, il_offsets [i], debug_info.source_files [i].source_file, line_numbers [i], debug_info.column_numbers [i], debug_info.source_files [i].hash); locations = res; } return locations; } } - internal int il_offset_to_line_number (int il_offset, out string src_file, out byte[] src_hash) { + internal int il_offset_to_line_number (int il_offset, out string src_file, out byte[] src_hash, out int column_number) { if (debug_info == null) debug_info = vm.conn.Method_GetDebugInfo (id); // FIXME: Optimize this src_file = null; src_hash = null; + column_number = 0; for (int i = debug_info.il_offsets.Length - 1; i >= 0; --i) { if (debug_info.il_offsets [i] <= il_offset) { src_file = debug_info.source_files [i].source_file; src_hash = debug_info.source_files [i].hash; + column_number = debug_info.column_numbers [i]; return debug_info.line_numbers [i]; } } diff --git a/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs b/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs index 034c6fc8a7..ef3a6db79d 100644 --- a/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs +++ b/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/StackFrame.cs @@ -44,13 +44,14 @@ namespace Mono.Debugger.Soft int line_number; string src_file = null; byte[] hash = null; + int column_number = 0; if (il_offset == -1) line_number = -1; else - line_number = method.il_offset_to_line_number (il_offset, out src_file, out hash); + line_number = method.il_offset_to_line_number (il_offset, out src_file, out hash, out column_number); - location = new Location (vm, Method, 0, il_offset, src_file != null ? src_file : method.SourceFile, line_number, 0, hash); + location = new Location (vm, Method, 0, il_offset, src_file != null ? src_file : method.SourceFile, line_number, column_number, hash); } return location; } diff --git a/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/StepEventRequest.cs b/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/StepEventRequest.cs index b193a05c9b..8559acb66c 100644 --- a/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/StepEventRequest.cs +++ b/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/StepEventRequest.cs @@ -19,7 +19,10 @@ namespace Mono.Debugger.Soft */ public enum StepFilter { None = 0, - StaticCtor = 1 + StaticCtor = 1, + /* Since protocol version 2.20 */ + /* Methods which have the [DebuggerHidden] attribute */ + DebuggerHidden = 2, } public sealed class StepEventRequest : EventRequest { diff --git a/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs b/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs index c1693e683f..61c284dfcf 100644 --- a/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs +++ b/main/contrib/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs @@ -140,6 +140,12 @@ namespace Mono.Debugger.Soft notify_vm_event (EventType.VMDisconnect, SuspendPolicy.None, 0, 0, null); } + [Obsolete ("This method was poorly named; use the Detach() method instead")] + public void Dispose () + { + Detach (); + } + public void ForceDisconnect () { conn.ForceDisconnect (); diff --git a/main/contrib/Mono.Debugger.Soft/mono-git-revision b/main/contrib/Mono.Debugger.Soft/mono-git-revision index 3e54d16ca4..44b907a147 100644 --- a/main/contrib/Mono.Debugger.Soft/mono-git-revision +++ b/main/contrib/Mono.Debugger.Soft/mono-git-revision @@ -1 +1 @@ -f1f1ba6a165a17e2a62dbca9bcd2c56608aa6a3d +174030f7e67f9c4d905a4403e3f514fe9f0b85bf |