diff options
author | Thays Grazia <thaystg@gmail.com> | 2020-04-08 15:57:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-08 15:57:01 +0300 |
commit | 165f4b03417a1e18c8c6db3d93a7a4916d77488a (patch) | |
tree | f75584b0fa09702ec18e8bef67d40dcb49bc1782 /mcs/class | |
parent | b04dc7e6a48cbda8b9c6a2e553eec846e7f2892e (diff) |
[2020-02][debugger] Fix NOT_IMPLEMENTED while debugging. (#19450)
* Backporting this, and after this I will backport the bump protocol for this PR.
* Bump API snapshot submodule
Co-authored-by: monojenkins <jo.shields+jenkins@xamarin.com>
Diffstat (limited to 'mcs/class')
4 files changed, 35 insertions, 4 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 03724b7f7bc..70de4ad7bea 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs @@ -409,6 +409,9 @@ namespace Mono.Debugger.Soft public ErrorCode ErrorCode { get; set; } + public string ErrorMessage { + get; set; + } } /* @@ -792,10 +795,12 @@ 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 && len > offset) + ErrorMsg = ReadString (); } public CommandSet CommandSet { @@ -810,6 +815,10 @@ namespace Mono.Debugger.Soft get; set; } + public string ErrorMsg { + get; internal set; + } + public int Offset { get { return offset; @@ -1792,7 +1801,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/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs index 12274864d4c..f85e807201f 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/VirtualMachine.cs @@ -371,7 +371,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); } } @@ -887,13 +887,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 diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs index e6b79fdd406..2f77ac510c6 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest-app.cs @@ -617,6 +617,7 @@ public class Tests : TestsBase, ITest2 ss_multi_thread (); return 0; } + test_invalid_argument_assembly_get_type (); return 3; } @@ -645,6 +646,10 @@ public class Tests : TestsBase, ITest2 LocalReflectClass.RunMe (); } + public static void test_invalid_argument_assembly_get_type () { + + } + public static void breakpoints () { /* Call these early so it is JITted by the time a breakpoint is placed on it */ bp3 (); diff --git a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs index d6ca7dc3255..a8f12094bbd 100644 --- a/mcs/class/Mono.Debugger.Soft/Test/dtest.cs +++ b/mcs/class/Mono.Debugger.Soft/Test/dtest.cs @@ -5202,6 +5202,18 @@ public class DebuggerTests } [Test] + public void InvalidArgumentAssemblyGetType () { + Event e = run_until ("test_invalid_argument_assembly_get_type"); + var assembly = entry_point.DeclaringType.Assembly; + try { + var type = assembly.GetType ("System.Collections.Generic.Dictionary<double, float>.Main"); + } + catch (CommandException ex) { + Assert.AreEqual(ex.ErrorMessage, "Unexpected assembly-qualified type \"System.Collections.Generic.Dictionary<double, float>.Main\" was provided"); + } + } + + [Test] public void CheckSuspendPolicySentWhenLaunchSuspendYes () { vm.Exit (0); var port = GetFreePort (); |