diff options
author | Thays Grazia <thaystg@gmail.com> | 2020-03-26 22:51:57 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-26 22:51:57 +0300 |
commit | ce4c00e288c56d6f942ce26583d5da5314593ae8 (patch) | |
tree | 0e7f380d29acbcf04f5a134f98cf4194a669ae8d /Mono.Debugger.Soft | |
parent | 715cc0a778cb4b5979b3869c06f659201b5ac86a (diff) |
Bump protocol and implement reading error message when receive an INVALID_ARGUMENT. (#303)
https://github.com/mono/mono/pull/19318
Diffstat (limited to 'Mono.Debugger.Soft')
-rw-r--r-- | Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs | 16 | ||||
-rw-r--r-- | Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs | 9 |
2 files changed, 20 insertions, 5 deletions
diff --git a/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs b/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs index 3673e42..3829995 100644 --- a/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs +++ b/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs @@ -406,6 +406,10 @@ namespace Mono.Debugger.Soft public ErrorCode ErrorCode { get; set; } + + public string ErrorMessage { + get; set; + } } /* @@ -433,7 +437,7 @@ namespace Mono.Debugger.Soft * with newer runtimes, and vice versa. */ internal const int MAJOR_VERSION = 2; - internal const int MINOR_VERSION = 55; + internal const int MINOR_VERSION = 56; enum WPSuspendPolicy { NONE = 0, @@ -789,16 +793,22 @@ namespace Mono.Debugger.Soft // For reply packets offset = 0; - ReadInt (); // length + var len = ReadInt (); // length ReadInt (); // id ReadByte (); // flags ErrorCode = ReadShort (); + if (ErrorCode == (int)Mono.Debugger.Soft.ErrorCode.INVALID_ARGUMENT && connection.Version.AtLeast (2, 56) && len > offset) + ErrorMsg = ReadString (); } public CommandSet CommandSet { get; set; } + public string ErrorMsg { + get; internal set; + } + public int Command { get; set; } @@ -1648,7 +1658,7 @@ namespace Mono.Debugger.Soft LogPacket (packetId, encoded_packet, reply, command_set, command, watch); if (r.ErrorCode != 0) { if (ErrorHandler != null) - ErrorHandler (this, new ErrorHandlerEventArgs () { ErrorCode = (ErrorCode)r.ErrorCode }); + ErrorHandler (this, new ErrorHandlerEventArgs () { ErrorCode = (ErrorCode)r.ErrorCode, ErrorMessage = r.ErrorMsg}); throw new NotImplementedException ("No error handler set."); } else { return r; diff --git a/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs b/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs index 03ff0bf..8cfbac7 100644 --- a/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs +++ b/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs @@ -354,7 +354,7 @@ namespace Mono.Debugger.Soft case ErrorCode.NO_SEQ_POINT_AT_IL_OFFSET: throw new ArgumentException ("Cannot set breakpoint on the specified IL offset."); default: - throw new CommandException (args.ErrorCode); + throw new CommandException (args.ErrorCode, args.ErrorMessage); } } @@ -794,13 +794,18 @@ namespace Mono.Debugger.Soft public class CommandException : Exception { - internal CommandException (ErrorCode error_code) : base ("Debuggee returned error code " + error_code + ".") { + internal CommandException (ErrorCode error_code, string error_message) : base ("Debuggee returned error code " + error_code + (error_message == null || error_message.Length == 0 ? "." : " - " + error_message + ".")) { ErrorCode = error_code; + ErrorMessage = error_message; } public ErrorCode ErrorCode { get; set; } + + public string ErrorMessage { + get; internal set; + } } public class VMNotSuspendedException : InvalidOperationException |