Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wasm][debugger] Fixing debugger tests errors #54664

Merged
merged 3 commits into from
Jun 24, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/mono/mono/mini/mini-wasm-debugger.c
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ mono_wasm_breakpoint_hit (void)
static gboolean
write_value_to_buffer (MdbgProtBuffer *buf, MonoTypeEnum type, const char* variableValue)
{
char* endptr;
char* endptr = NULL;
errno = 0;
buffer_add_byte (buf, type);
switch (type) {
Expand All @@ -268,7 +268,7 @@ write_value_to_buffer (MdbgProtBuffer *buf, MonoTypeEnum type, const char* varia
break;
case MONO_TYPE_I1: {
intmax_t val = strtoimax (variableValue, &endptr, 10);
if (errno != 0)
if (errno != 0 || variableValue == endptr)
return FALSE;
if (val >= -128 && val <= 127)
buffer_add_int (buf, val);
Expand All @@ -278,7 +278,7 @@ write_value_to_buffer (MdbgProtBuffer *buf, MonoTypeEnum type, const char* varia
}
case MONO_TYPE_U1: {
intmax_t val = strtoimax (variableValue, &endptr, 10);
if (errno != 0)
if (errno != 0 || variableValue == endptr)
return FALSE;
if (val >= 0 && val <= 255)
buffer_add_int (buf, val);
Expand All @@ -288,7 +288,7 @@ write_value_to_buffer (MdbgProtBuffer *buf, MonoTypeEnum type, const char* varia
}
case MONO_TYPE_I2: {
intmax_t val = strtoimax (variableValue, &endptr, 10);
if (errno != 0)
if (errno != 0 || variableValue == endptr)
return FALSE;
if (val >= -32768 && val <= 32767)
buffer_add_int (buf, val);
Expand All @@ -298,7 +298,7 @@ write_value_to_buffer (MdbgProtBuffer *buf, MonoTypeEnum type, const char* varia
}
case MONO_TYPE_U2: {
intmax_t val = strtoimax (variableValue, &endptr, 10);
if (errno != 0)
if (errno != 0 || variableValue == endptr)
return FALSE;
if (val >= 0 && val <= 65535)
buffer_add_int (buf, val);
Expand All @@ -308,7 +308,7 @@ write_value_to_buffer (MdbgProtBuffer *buf, MonoTypeEnum type, const char* varia
}
case MONO_TYPE_I4: {
intmax_t val = strtoimax (variableValue, &endptr, 10);
if (errno != 0)
if (errno != 0 || variableValue == endptr)
return FALSE;
if (val >= -2147483648 && val <= 2147483647)
buffer_add_int (buf, val);
Expand All @@ -318,7 +318,7 @@ write_value_to_buffer (MdbgProtBuffer *buf, MonoTypeEnum type, const char* varia
}
case MONO_TYPE_U4: {
intmax_t val = strtoimax (variableValue, &endptr, 10);
if (errno != 0)
if (errno != 0 || variableValue == endptr)
return FALSE;
if (val >= 0 && val <= 4294967295)
buffer_add_int (buf, val);
Expand All @@ -328,7 +328,7 @@ write_value_to_buffer (MdbgProtBuffer *buf, MonoTypeEnum type, const char* varia
}
case MONO_TYPE_I8: {
long long val = strtoll (variableValue, &endptr, 10);
if (errno != 0)
if (errno != 0 || variableValue == endptr)
return FALSE;
buffer_add_long (buf, val);
break;
Expand All @@ -342,14 +342,14 @@ write_value_to_buffer (MdbgProtBuffer *buf, MonoTypeEnum type, const char* varia
}
case MONO_TYPE_R4: {
gfloat val = strtof (variableValue, &endptr);
if (errno != 0)
if (errno != 0 || variableValue == endptr)
return FALSE;
buffer_add_int (buf, *((gint32*)(&val)));
break;
}
case MONO_TYPE_R8: {
gdouble val = strtof (variableValue, &endptr);
if (errno != 0)
if (errno != 0 || variableValue == endptr)
return FALSE;
buffer_add_long (buf, *((guint64*)(&val)));
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,7 @@ public async Task<bool> SetProtocolVersion(SessionId sessionId, CancellationToke
var command_params_writer = new MonoBinaryWriter(command_params);
command_params_writer.Write(MAJOR_VERSION);
command_params_writer.Write(MINOR_VERSION);
command_params_writer.Write((byte)0);

var ret_debugger_cmd_reader = await SendDebuggerAgentCommand<CmdVM>(sessionId, CmdVM.SetProtocolVersion, command_params, token);
return true;
Expand Down