From 259ec2ef65a272ead111dba37617387864b188af Mon Sep 17 00:00:00 2001 From: Thays Grazia Date: Wed, 8 Apr 2020 16:35:29 -0300 Subject: [PATCH] [2020-02][debugger] Bump protocol for this commit https://github.com/mono/mono/pull/19248 (#19318) (#19473) * Bump protocol for this commit https://github.com/mono/mono/pull/19248 as suggested by @vargaz. * Fix coding convention. --- .../Mono.Debugger.Soft/Connection.cs | 4 ++-- mono/mini/debugger-agent.c | 22 ++++++++++++++-------- 2 files changed, 16 insertions(+), 10 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 70de4ad7bea..252959eb361 100644 --- a/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs +++ b/mcs/class/Mono.Debugger.Soft/Mono.Debugger.Soft/Connection.cs @@ -439,7 +439,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, @@ -799,7 +799,7 @@ namespace Mono.Debugger.Soft ReadInt (); // id ReadByte (); // flags ErrorCode = ReadShort (); - if (ErrorCode == (int)Mono.Debugger.Soft.ErrorCode.INVALID_ARGUMENT && len > offset) + if (ErrorCode == (int)Mono.Debugger.Soft.ErrorCode.INVALID_ARGUMENT && connection.Version.AtLeast (2, 56) && len > offset) ErrorMsg = ReadString (); } diff --git a/mono/mini/debugger-agent.c b/mono/mini/debugger-agent.c index 21e823e1790..577a499d95d 100644 --- a/mono/mini/debugger-agent.c +++ b/mono/mini/debugger-agent.c @@ -294,7 +294,7 @@ typedef struct { #define HEADER_LENGTH 11 #define MAJOR_VERSION 2 -#define MINOR_VERSION 55 +#define MINOR_VERSION 56 typedef enum { CMD_SET_VM = 1, @@ -6965,6 +6965,12 @@ get_types_for_source_file (gpointer key, gpointer value, gpointer user_data) } } +static void add_error_string (Buffer *buf, const char *str) +{ + if (CHECK_PROTOCOL_VERSION (2, 56)) + buffer_add_string (buf, str); +} + static ErrorCode vm_commands (int command, int id, guint8 *p, guint8 *end, Buffer *buf) { @@ -7269,7 +7275,7 @@ vm_commands (int command, int id, guint8 *p, guint8 *end, Buffer *buf) ignore_case = decode_byte (p, &p, end); if (!mono_reflection_parse_type_checked (name, &info, error)) { - buffer_add_string (buf, mono_error_get_message (error)); + add_error_string (buf, mono_error_get_message (error)); mono_error_cleanup (error); g_free (name); mono_reflection_free_type_info (&info); @@ -7780,7 +7786,7 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf) g_free (s); mono_domain_set_fast (d, TRUE); char* error_msg = g_strdup_printf ("Unexpected assembly-qualified type %s was provided", original_s); - buffer_add_string (buf, error_msg); + add_error_string (buf, error_msg); g_free (error_msg); g_free (original_s); return ERR_INVALID_ARGUMENT; @@ -7792,7 +7798,7 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf) g_free (s); mono_domain_set_fast (d, TRUE); char* error_msg = g_strdup_printf ("Invalid type name %s", original_s); - buffer_add_string (buf, error_msg); + add_error_string (buf, error_msg); g_free (error_msg); g_free (original_s); return ERR_INVALID_ARGUMENT; @@ -7858,7 +7864,7 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf) error_init (error); MonoClass* mono_class = mono_class_get_checked (ass->image, token, error); if (!is_ok (error)) { - buffer_add_string (buf, mono_error_get_message (error)); + add_error_string (buf, mono_error_get_message (error)); mono_error_cleanup (error); return ERR_INVALID_ARGUMENT; } @@ -7875,7 +7881,7 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf) error_init (error); MonoMethod* mono_method = mono_get_method_checked (ass->image, token, NULL, NULL, error); if (!is_ok (error)) { - buffer_add_string (buf, mono_error_get_message (error)); + add_error_string (buf, mono_error_get_message (error)); mono_error_cleanup (error); return ERR_INVALID_ARGUMENT; } @@ -8728,7 +8734,7 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g header = mono_method_get_header_checked (method, error); if (!header) { - buffer_add_string (buf, mono_error_get_message (error)); + add_error_string (buf, mono_error_get_message (error)); mono_error_cleanup (error); /* FIXME don't swallow the error */ return ERR_INVALID_ARGUMENT; } @@ -9560,7 +9566,7 @@ string_commands (int command, guint8 *p, guint8 *end, Buffer *buf) if (!is_ok (error)) { if (s) g_free (s); - buffer_add_string (buf, mono_error_get_message (error)); + add_error_string (buf, mono_error_get_message (error)); return ERR_INVALID_ARGUMENT; } buffer_add_string (buf, s); -- 2.11.4.GIT