未验证 提交 f1e131a4 编写于 作者: M monojenkins 提交者: GitHub

[sdb] Add support for function pointers. (#42936)

Co-authored-by: Nvargaz <vargaz@users.noreply.github.com>
上级 8cb35183
......@@ -5439,7 +5439,8 @@ buffer_add_value_full (Buffer *buf, MonoType *t, void *addr, MonoDomain *domain,
case MONO_TYPE_U:
/* Treat it as a vtype */
goto handle_vtype;
case MONO_TYPE_PTR: {
case MONO_TYPE_PTR:
case MONO_TYPE_FNPTR: {
gssize val = *(gssize*)addr;
buffer_add_byte (buf, t->type);
......@@ -5683,6 +5684,7 @@ decode_value_internal (MonoType *t, int type, MonoDomain *domain, guint8 *addr,
!(type == VALUE_TYPE_ID_FIXED_ARRAY) &&
!(t->type == MONO_TYPE_U && type == MONO_TYPE_VALUETYPE) &&
!(t->type == MONO_TYPE_PTR && type == MONO_TYPE_I8) &&
!(t->type == MONO_TYPE_FNPTR && type == MONO_TYPE_I8) &&
!(t->type == MONO_TYPE_GENERICINST && type == MONO_TYPE_VALUETYPE) &&
!(t->type == MONO_TYPE_VALUETYPE && type == MONO_TYPE_OBJECT)) {
char *name = mono_type_full_name (t);
......@@ -5733,6 +5735,7 @@ decode_value_internal (MonoType *t, int type, MonoDomain *domain, guint8 *addr,
*(guint64*)addr = decode_long (buf, &buf, limit);
break;
case MONO_TYPE_PTR:
case MONO_TYPE_FNPTR:
/* We send these as I8, so we get them back as such */
g_assert (type == MONO_TYPE_I8);
*(gssize*)addr = decode_long (buf, &buf, limit);
......@@ -8003,7 +8006,7 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
// FIXME: Can't decide whenever a class represents a byref type
if (FALSE)
b |= (1 << 0);
if (type->type == MONO_TYPE_PTR)
if (type->type == MONO_TYPE_PTR || type->type == MONO_TYPE_FNPTR)
b |= (1 << 1);
if (!type->byref && (((type->type >= MONO_TYPE_BOOLEAN) && (type->type <= MONO_TYPE_R8)) || (type->type == MONO_TYPE_I) || (type->type == MONO_TYPE_U)))
b |= (1 << 2);
......
......@@ -793,6 +793,7 @@ stackval_from_data (MonoType *type, stackval *result, const void *data, gboolean
result->data.nati = *(mono_i*)data;
return;
case MONO_TYPE_PTR:
case MONO_TYPE_FNPTR:
result->data.p = *(gpointer*)data;
return;
case MONO_TYPE_U4:
......@@ -916,7 +917,8 @@ stackval_to_data (MonoType *type, stackval *val, void *data, gboolean pinvoke)
mono_gc_wbarrier_generic_store_internal (p, val->data.o);
return;
}
case MONO_TYPE_PTR: {
case MONO_TYPE_PTR:
case MONO_TYPE_FNPTR: {
gpointer *p = (gpointer *) data;
*p = val->data.p;
return;
......@@ -987,6 +989,7 @@ stackval_to_data_addr (MonoType *type, stackval *val)
case MONO_TYPE_OBJECT:
case MONO_TYPE_ARRAY:
case MONO_TYPE_PTR:
case MONO_TYPE_FNPTR:
return &val->data.p;
case MONO_TYPE_VALUETYPE:
if (m_class_is_enumtype (type->data.klass))
......@@ -1216,6 +1219,7 @@ static InterpMethodArguments* build_args_from_sig (MonoMethodSignature *sig, Int
case MONO_TYPE_I:
case MONO_TYPE_U:
case MONO_TYPE_PTR:
case MONO_TYPE_FNPTR:
case MONO_TYPE_SZARRAY:
case MONO_TYPE_CLASS:
case MONO_TYPE_OBJECT:
......@@ -1284,6 +1288,7 @@ static InterpMethodArguments* build_args_from_sig (MonoMethodSignature *sig, Int
case MONO_TYPE_I:
case MONO_TYPE_U:
case MONO_TYPE_PTR:
case MONO_TYPE_FNPTR:
case MONO_TYPE_SZARRAY:
case MONO_TYPE_CLASS:
case MONO_TYPE_OBJECT:
......@@ -1347,6 +1352,7 @@ static InterpMethodArguments* build_args_from_sig (MonoMethodSignature *sig, Int
case MONO_TYPE_I:
case MONO_TYPE_U:
case MONO_TYPE_PTR:
case MONO_TYPE_FNPTR:
case MONO_TYPE_SZARRAY:
case MONO_TYPE_CLASS:
case MONO_TYPE_OBJECT:
......@@ -1709,6 +1715,7 @@ dump_stackval (GString *str, stackval *s, MonoType *type)
case MONO_TYPE_OBJECT:
case MONO_TYPE_ARRAY:
case MONO_TYPE_PTR:
case MONO_TYPE_FNPTR:
case MONO_TYPE_I:
case MONO_TYPE_U:
g_string_append_printf (str, "[%p] ", s->data.p);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册