*
* Copyright 2009-2010 Novell, Inc.
* Copyright 2011 Xamarin Inc.
+ * Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <config.h>
init_jit_info_dbg_attrs (MonoJitInfo *ji)
{
static MonoClass *hidden_klass, *step_through_klass, *non_user_klass;
+ MonoError error;
MonoCustomAttrInfo *ainfo;
if (ji->dbg_attrs_inited)
if (!non_user_klass)
non_user_klass = mono_class_load_from_name (mono_defaults.corlib, "System.Diagnostics", "DebuggerNonUserCodeAttribute");
- ainfo = mono_custom_attrs_from_method (jinfo_get_method (ji));
+ ainfo = mono_custom_attrs_from_method_checked (jinfo_get_method (ji), &error);
+ mono_error_cleanup (&error); /* FIXME don't swallow the error? */
if (ainfo) {
if (mono_custom_attrs_has_attr (ainfo, hidden_klass))
ji->dbg_hidden = TRUE;
mono_custom_attrs_free (ainfo);
}
- ainfo = mono_custom_attrs_from_class (jinfo_get_method (ji)->klass);
+ ainfo = mono_custom_attrs_from_class_checked (jinfo_get_method (ji)->klass, &error);
+ mono_error_cleanup (&error); /* FIXME don't swallow the error? */
if (ainfo) {
if (mono_custom_attrs_has_attr (ainfo, step_through_klass))
ji->dbg_step_through = TRUE;
} else if (type == VALUE_TYPE_ID_NULL) {
*(MonoObject**)addr = NULL;
} else if (type == MONO_TYPE_VALUETYPE) {
+ MonoError error;
guint8 *buf2;
gboolean is_enum;
MonoClass *klass;
g_free (vtype_buf);
return err;
}
- *(MonoObject**)addr = mono_value_box (d, klass, vtype_buf);
+ *(MonoObject**)addr = mono_value_box_checked (d, klass, vtype_buf, &error);
+ mono_error_cleanup (&error);
g_free (vtype_buf);
} else {
char *name = mono_type_full_name (t);
static ErrorCode
decode_value (MonoType *t, MonoDomain *domain, guint8 *addr, guint8 *buf, guint8 **endbuf, guint8 *limit)
{
+ MonoError error;
ErrorCode err;
int type = decode_byte (buf, &buf, limit);
g_free (nullable_buf);
return err;
}
- mono_nullable_init (addr, mono_value_box (domain, mono_class_from_mono_type (targ), nullable_buf), mono_class_from_mono_type (t));
+ MonoObject *boxed = mono_value_box_checked (domain, mono_class_from_mono_type (targ), nullable_buf, &error);
+ if (!is_ok (&error)) {
+ mono_error_cleanup (&error);
+ return ERR_INVALID_OBJECT;
+ }
+ mono_nullable_init (addr, boxed, mono_class_from_mono_type (t));
g_free (nullable_buf);
*endbuf = buf;
return ERR_NONE;
ass = (MonoAssembly *)tmp->data;
if (ass->image) {
+ MonoError error;
type_resolve = TRUE;
- t = mono_reflection_get_type (ass->image, &info, ignore_case, &type_resolve);
+ /* FIXME really okay to call while holding locks? */
+ t = mono_reflection_get_type_checked (ass->image, &info, ignore_case, &type_resolve, &error);
+ mono_error_cleanup (&error);
if (t) {
g_ptr_array_add (res_classes, mono_type_get_class (t));
g_ptr_array_add (res_domains, domain);
break;
}
case CMD_ASSEMBLY_GET_TYPE: {
+ MonoError error;
char *s = decode_string (p, &p, end);
gboolean ignorecase = decode_byte (p, &p, end);
MonoTypeNameParse info;
} else {
if (info.assembly.name)
NOT_IMPLEMENTED;
- t = mono_reflection_get_type (ass->image, &info, ignorecase, &type_resolve);
+ t = mono_reflection_get_type_checked (ass->image, &info, ignorecase, &type_resolve, &error);
+ if (!is_ok (&error)) {
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
+ mono_reflection_free_type_info (&info);
+ g_free (s);
+ return ERR_INVALID_ARGUMENT;
+ }
}
buffer_add_typeid (buf, domain, t ? mono_class_from_mono_type (t) : NULL);
mono_reflection_free_type_info (&info);
if (err != ERR_NONE)
return err;
- cinfo = mono_custom_attrs_from_class (klass);
+ cinfo = mono_custom_attrs_from_class_checked (klass, &error);
+ if (!is_ok (&error)) {
+ mono_error_cleanup (&error); /* FIXME don't swallow the error message */
+ return ERR_LOADER_ERROR;
+ }
err = buffer_add_cattrs (buf, domain, klass->image, attr_klass, cinfo);
if (err != ERR_NONE)
if (err != ERR_NONE)
return err;
- cinfo = mono_custom_attrs_from_field (klass, field);
+ cinfo = mono_custom_attrs_from_field_checked (klass, field, &error);
+ if (!is_ok (&error)) {
+ mono_error_cleanup (&error); /* FIXME don't swallow the error message */
+ return ERR_LOADER_ERROR;
+ }
err = buffer_add_cattrs (buf, domain, klass->image, attr_klass, cinfo);
if (err != ERR_NONE)
if (err != ERR_NONE)
return err;
- cinfo = mono_custom_attrs_from_property (klass, prop);
+ cinfo = mono_custom_attrs_from_property_checked (klass, prop, &error);
+ if (!is_ok (&error)) {
+ mono_error_cleanup (&error); /* FIXME don't swallow the error message */
+ return ERR_LOADER_ERROR;
+ }
err = buffer_add_cattrs (buf, domain, klass->image, attr_klass, cinfo);
if (err != ERR_NONE)
break;
}
case CMD_METHOD_GET_DEBUG_INFO: {
+ MonoError error;
MonoDebugMethodInfo *minfo;
char *source_file;
int i, j, n_il_offsets;
GPtrArray *source_file_list;
MonoSymSeqPoint *sym_seq_points;
- header = mono_method_get_header (method);
+ header = mono_method_get_header_checked (method, &error);
if (!header) {
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
buffer_add_int (buf, 0);
buffer_add_string (buf, "");
buffer_add_int (buf, 0);
break;
}
case CMD_METHOD_GET_LOCALS_INFO: {
+ MonoError error;
int i, num_locals;
MonoDebugLocalsInfo *locals;
int *locals_map = NULL;
- header = mono_method_get_header (method);
- if (!header)
+ header = mono_method_get_header_checked (method, &error);
+ if (!header) {
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
return ERR_INVALID_ARGUMENT;
+ }
locals = mono_debug_lookup_locals (method);
if (!locals) {
}
break;
case CMD_METHOD_GET_BODY: {
+ MonoError error;
int i;
- header = mono_method_get_header (method);
+ header = mono_method_get_header_checked (method, &error);
if (!header) {
+ mono_error_cleanup (&error); /* FIXME don't swallow the error */
buffer_add_int (buf, 0);
if (CHECK_PROTOCOL_VERSION (2, 18))
break;
}
case CMD_METHOD_GET_CATTRS: {
+ MonoError error;
MonoClass *attr_klass;
MonoCustomAttrInfo *cinfo;
if (err != ERR_NONE)
return err;
- cinfo = mono_custom_attrs_from_method (method);
+ cinfo = mono_custom_attrs_from_method_checked (method, &error);
+ if (!is_ok (&error)) {
+ mono_error_cleanup (&error); /* FIXME don't swallow the error message */
+ return ERR_LOADER_ERROR;
+ }
err = buffer_add_cattrs (buf, domain, method->klass->image, attr_klass, cinfo);
if (err != ERR_NONE)
switch (command) {
case CMD_STACK_FRAME_GET_VALUES: {
+ MonoError error;
len = decode_int (p, &p, end);
- header = mono_method_get_header (frame->actual_method);
+ header = mono_method_get_header_checked (frame->actual_method, &error);
+ mono_error_assert_ok (&error); /* FIXME report error */
for (i = 0; i < len; ++i) {
pos = decode_int (p, &p, end);
break;
}
case CMD_STACK_FRAME_SET_VALUES: {
+ MonoError error;
guint8 *val_buf;
MonoType *t;
MonoDebugVarInfo *var;
len = decode_int (p, &p, end);
- header = mono_method_get_header (frame->actual_method);
+ header = mono_method_get_header_checked (frame->actual_method, &error);
+ mono_error_assert_ok (&error); /* FIXME report error */
for (i = 0; i < len; ++i) {
pos = decode_int (p, &p, end);