frame = tls->frames [0];
}
- if (ss_req->size == STEP_SIZE_LINE) {
+ if (ss_req->size == STEP_SIZE_LINE_COLUMN) {
if (frame) {
ss_req->last_method = frame->de.method;
ss_req->last_line = -1;
+ ss_req->last_column = -1;
minfo = mono_debug_lookup_method (frame->de.method);
if (minfo && frame->il_offset != -1) {
if (loc) {
ss_req->last_line = loc->row;
+ ss_req->last_column = loc->column;
g_free (loc);
}
}
buffer_add_string (buf, str);
}
+static void
+create_file_to_check_memory_address (void)
+{
+ if (file_check_valid_memory != -1)
+ return;
+ char *file_name = g_strdup_printf ("debugger_check_valid_memory.%d", mono_process_current_pid ());
+ filename_check_valid_memory = g_build_filename (g_get_tmp_dir (), file_name, (const char*)NULL);
+ file_check_valid_memory = open(filename_check_valid_memory, O_CREAT | O_WRONLY | O_APPEND, S_IWUSR);
+ g_free (file_name);
+}
+
+static gboolean
+valid_memory_address (gpointer addr, gint size)
+{
+#ifndef _MSC_VER
+ gboolean ret = TRUE;
+ create_file_to_check_memory_address ();
+ if(file_check_valid_memory < 0) {
+ return TRUE;
+ }
+ write (file_check_valid_memory, (gpointer)addr, 1);
+ if (errno == EFAULT) {
+ ret = FALSE;
+ }
+#else
+ int i = 0;
+ gboolean ret = FALSE;
+ __try {
+ for (i = 0; i < size; i++)
+ *((volatile char*)addr+i);
+ ret = TRUE;
+ } __except(1) {
+ return ret;
+ }
+#endif
+ return ret;
+}
+
static ErrorCode
vm_commands (int command, int id, guint8 *p, guint8 *end, Buffer *buf)
{
case MDBGPROT_CMD_VM_READ_MEMORY: {
guint8* memory = (guint8*)GINT_TO_POINTER (decode_long (p, &p, end));
int size = decode_int (p, &p, end);
+ if (!valid_memory_address(memory, size))
+ return ERR_INVALID_ARGUMENT;
PRINT_DEBUG_MSG (1, "MDBGPROT_CMD_VM_READ_MEMORY - [%p] - size - %d\n", memory, size);
buffer_add_byte_array (buf, memory, size);
break;
return cmd_stack_frame_get_this (frame, sig, buf, jit);
break;
}
+ case MDBGPROT_CMD_STACK_FRAME_SET_VALUES_2:
case CMD_STACK_FRAME_SET_VALUES: {
guint8 *val_buf;
MonoType *t;
for (i = 0; i < len; ++i) {
pos = decode_int (p, &p, end);
-
if (pos < 0) {
+ if (command == MDBGPROT_CMD_STACK_FRAME_SET_VALUES_2 && sig->hasthis) //0 == this
+ pos++;
pos = - pos - 1;
g_assert (pos >= 0 && GINT_TO_UINT32(pos) < jit->num_params);
buffer_add_long (buf, (gssize)frame->frame_addr);
break;
}
+ case MDBGPROT_CMD_STACK_FRAME_GET_COUNT: {
+ MonoDebugLocalsInfo *locals;
+ locals = mono_debug_lookup_locals (frame->de.method);
+ if (locals)
+ buffer_add_int (buf, locals->num_locals);
+ else
+ buffer_add_int (buf, 0);
+ break;
+ }
+ case MDBGPROT_CMD_STACK_FRAME_GET_PARAMETERS_COUNT: {
+ buffer_add_int (buf, jit->num_params + (sig->hasthis ? 1 : 0));
+ break;
+ }
default:
return ERR_NOT_IMPLEMENTED;
}
return ERR_NONE;
}
-static void
-create_file_to_check_memory_address (void)
-{
- if (file_check_valid_memory != -1)
- return;
- char *file_name = g_strdup_printf ("debugger_check_valid_memory.%d", mono_process_current_pid ());
- filename_check_valid_memory = g_build_filename (g_get_tmp_dir (), file_name, (const char*)NULL);
- file_check_valid_memory = open(filename_check_valid_memory, O_CREAT | O_WRONLY | O_APPEND, S_IWUSR);
- g_free (file_name);
-}
-
-static gboolean
-valid_memory_address (gpointer addr, gint size)
-{
-#ifndef _MSC_VER
- gboolean ret = TRUE;
- create_file_to_check_memory_address ();
- if(file_check_valid_memory < 0) {
- return TRUE;
- }
- write (file_check_valid_memory, (gpointer)addr, 1);
- if (errno == EFAULT) {
- ret = FALSE;
- }
-#else
- int i = 0;
- gboolean ret = FALSE;
- __try {
- for (i = 0; i < size; i++)
- *((volatile char*)addr+i);
- ret = TRUE;
- } __except(1) {
- return ret;
- }
-#endif
- return ret;
-}
-
static ErrorCode
pointer_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
{
len = decode_int (p, &p, end);
i = 0;
int field_token = decode_int (p, &p, end);
- gpointer iter = NULL;
-
- while ((f = mono_class_get_fields_internal (obj_type, &iter))) {
- if (mono_class_get_field_token (f) == field_token)
- goto set_field_value;
+ for (k = obj_type; k; k = m_class_get_parent (k)) {
+ gpointer iter = NULL;
+ while ((f = mono_class_get_fields_internal (k, &iter))) {
+ if (mono_class_get_field_token (f) == field_token)
+ goto set_field_value;
+ }
}
goto invalid_fieldid;
case CMD_OBJECT_REF_SET_VALUES:
mono_debug_free_method_async_debug_info (async_method);
}
- if (req->size != STEP_SIZE_LINE)
+ if (req->size != STEP_SIZE_LINE_COLUMN)
return TRUE;
/* Have to check whenever a different source line was reached */
PRINT_DEBUG_MSG (1, "[%p] No line number info for il offset %x, don't know if it's in the same line single stepping.\n", (gpointer) (gsize) mono_native_thread_id_get (), sp->il_offset);
req->last_method = method;
req->last_line = -1;
+ req->last_column = -1;
return hit;
- } else if (loc && method == req->last_method && loc->row == req->last_line) {
+ } else if (loc && method == req->last_method && loc->row == req->last_line && loc->column == req->last_column) {
int nframes;
rt_callbacks.ss_calculate_framecount (tls, ctx, FALSE, NULL, &nframes);
if (nframes == req->nframes) { // If the frame has changed we're clearly not on the same source line.
if (loc) {
req->last_method = method;
req->last_line = loc->row;
+ req->last_column = loc->column;
mono_debug_free_source_location (loc);
}