Skip to content

Commit 95ab5eb

Browse files
author
Brian Raderman
committed
Fixes for il2cpp debugger running with Visual Studio for Mac:
* Returning an empty "list" of custom attributes for types, fields, properties, and methods instead of a not-implemented error. * Updating debugger ASSEMBLY_GET_NAME command to use Il2Cpp code for generating the fully qualified name with public key tokens. The Mono code generates invalid strings for the token with the Il2Cpp assembly name data, which will cause the VSfM debug client to disconnect.
1 parent e2d3ddd commit 95ab5eb

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

mono/mini/debugger-agent.c

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9418,14 +9418,17 @@ assembly_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
94189418
case CMD_ASSEMBLY_GET_NAME: {
94199419
gchar *name;
94209420
MonoAssembly *mass = ass;
9421+
#ifdef RUNTIME_IL2CPP
9422+
name = il2cpp_assembly_get_full_name(mass);
9423+
#else
94219424
name = g_strdup_printf (
94229425
"%s, Version=%d.%d.%d.%d, Culture=%s, PublicKeyToken=%s%s",
94239426
mass->aname.name,
94249427
mass->aname.major, mass->aname.minor, mass->aname.build, mass->aname.revision,
94259428
mass->aname.culture && *mass->aname.culture ? mass->aname.culture : "neutral",
94269429
mass->aname.public_key_token[0] ? (char *)mass->aname.public_key_token : "null",
94279430
(mass->aname.flags & ASSEMBLYREF_RETARGETABLE_FLAG) ? ", Retargetable=Yes" : "");
9428-
9431+
#endif
94299432
buffer_add_string (buf, name);
94309433
g_free (name);
94319434
break;
@@ -9775,7 +9778,8 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
97759778
return err;
97769779
break;
97779780
#else
9778-
return ERR_NOT_IMPLEMENTED;
9781+
buffer_add_int (buf, 0);
9782+
return ERR_NONE;
97799783
#endif //RUNTIME_IL2CPP
97809784
}
97819785
case CMD_TYPE_GET_FIELD_CATTRS: {
@@ -9802,7 +9806,8 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
98029806
return err;
98039807
break;
98049808
#else
9805-
return ERR_NOT_IMPLEMENTED;
9809+
buffer_add_int (buf, 0);
9810+
return ERR_NONE;
98069811
#endif //RUNTIME_IL2CPP
98079812
}
98089813
case CMD_TYPE_GET_PROPERTY_CATTRS: {
@@ -9829,7 +9834,8 @@ type_commands_internal (int command, MonoClass *klass, MonoDomain *domain, guint
98299834
return err;
98309835
break;
98319836
#else
9832-
return ERR_NOT_IMPLEMENTED;
9837+
buffer_add_int (buf, 0);
9838+
return ERR_NONE;
98339839
#endif //RUNTIME_IL2CPP
98349840
}
98359841
case CMD_TYPE_GET_VALUES:
@@ -10707,7 +10713,8 @@ method_commands_internal (int command, MonoMethod *method, MonoDomain *domain, g
1070710713
return err;
1070810714
break;
1070910715
#else
10710-
return ERR_NOT_IMPLEMENTED;
10716+
buffer_add_int (buf, 0);
10717+
return ERR_NONE;
1071110718
#endif //RUNTIME_IL2CPP
1071210719
}
1071310720
case CMD_METHOD_MAKE_GENERIC_METHOD: {

mono/mini/il2cpp-compat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,5 +445,6 @@ MonoClass* il2cpp_generic_class_get_container_class(MonoGenericClass *gclass);
445445
void il2cpp_mono_thread_detach(MonoThread* thread);
446446
MonoClass* il2cpp_mono_get_string_class (void);
447447
Il2CppSequencePoint* il2cpp_get_sequence_point(int id);
448+
char* il2cpp_assembly_get_full_name(MonoAssembly *assembly);
448449

449450
#endif // RUNTIME_IL2CPP

mono/mini/il2cpp-stubs.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1490,5 +1490,12 @@ Il2CppSequencePoint* il2cpp_get_sequence_point(int id)
14901490
return NULL;
14911491
#endif
14921492
}
1493+
1494+
char* il2cpp_assembly_get_full_name(MonoAssembly *assembly)
1495+
{
1496+
std::string s = il2cpp::vm::AssemblyName::AssemblyNameToString(assembly->aname);
1497+
return g_strdup(s.c_str());
1498+
}
1499+
14931500
}
14941501
#endif // RUNTIME_IL2CPP

0 commit comments

Comments
 (0)