Skip to content

Commit b8aac3e

Browse files
committed
Allow the debugger to build with the Tiny runtime
These changes are mirrored from the IL2CPP repo.
1 parent ce7bab8 commit b8aac3e

File tree

9 files changed

+788
-153
lines changed

9 files changed

+788
-153
lines changed

mono/metadata/appdomain.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,9 @@ mono_domain_get_id (MonoDomain *domain);
8686
MONO_API const char *
8787
mono_domain_get_friendly_name (MonoDomain *domain);
8888

89+
MonoAssembly*
90+
m_domain_get_corlib (MonoDomain *domain);
91+
8992
MONO_API mono_bool
9093
mono_domain_set (MonoDomain *domain, mono_bool force);
9194

mono/metadata/class-inlines.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,4 +93,10 @@ mono_class_has_static_metadata (MonoClass *klass)
9393
return klass->type_token && !klass->image->dynamic && !mono_class_is_ginst (klass);
9494
}
9595

96+
static inline gboolean
97+
m_class_is_initialized (MonoClass* klass)
98+
{
99+
return klass->inited;
100+
}
101+
96102
#endif

mono/metadata/domain.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,12 @@ mono_domain_get_friendly_name (MonoDomain *domain)
13211321
return domain->friendly_name;
13221322
}
13231323

1324+
MonoAssembly*
1325+
m_domain_get_corlib (MonoDomain *domain)
1326+
{
1327+
return domain->domain->mbr.obj.vtable->klass->image->assembly;
1328+
}
1329+
13241330
/*
13251331
* mono_domain_alloc:
13261332
*

mono/metadata/metadata.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6720,6 +6720,13 @@ mono_type_get_class (MonoType *type)
67206720
return type->data.klass;
67216721
}
67226722

6723+
MonoGenericClass*
6724+
m_type_get_generic_class (MonoType *type)
6725+
{
6726+
/* FIXME: review the runtime users before adding the assert here */
6727+
return type->data.generic_class;
6728+
}
6729+
67236730
/**
67246731
* mono_type_get_array_type:
67256732
* \param type the \c MonoType operated on

mono/metadata/metadata.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ mono_type_get_signature (MonoType *type);
351351
MONO_API MonoClass*
352352
mono_type_get_class (MonoType *type);
353353

354+
MonoGenericClass*
355+
m_type_get_generic_class (MonoType *type);
356+
354357
MONO_API MonoArrayType*
355358
mono_type_get_array_type (MonoType *type);
356359

mono/mini/debugger-agent.c

Lines changed: 160 additions & 143 deletions
Large diffs are not rendered by default.

mono/mini/il2cpp-c-types.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,10 @@ typedef void (*Il2CppDomainFunc) (MonoDomain *domain, void* user_data);
107107
typedef void (*emit_assembly_load_callback)(void*, void*);
108108
typedef void(*emit_type_load_callback)(void*, void*, void*);
109109

110+
#ifdef __cplusplus
111+
extern "C" {
112+
#endif
113+
110114
void il2cpp_set_thread_state_background(MonoThread* thread);
111115
void* il2cpp_domain_get_agent_info(MonoAppDomain* domain);
112116
void il2cpp_domain_set_agent_info(MonoAppDomain* domain, void* agentInfo);
@@ -115,4 +119,8 @@ void* il2cpp_gc_alloc_fixed(size_t size);
115119
void il2cpp_gc_free_fixed(void* address);
116120
const char* il2cpp_domain_get_name(MonoDomain* domain);
117121

122+
#ifdef __cplusplus
123+
}
124+
#endif
125+
118126
#endif

mono/mini/il2cpp-compat.h

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@
5858
#define mono_image_get_entry_point il2cpp_mono_image_get_entry_point
5959
#define mono_image_get_filename il2cpp_mono_image_get_filename
6060
#define mono_image_get_guid il2cpp_mono_image_get_guid
61+
#define mono_image_is_dynamic il2cpp_mono_image_is_dynamic
6162
#define mono_type_get_class il2cpp_mono_type_get_class
63+
#define m_type_get_generic_class il2cpp_m_type_get_generic_class
6264
#define mono_type_is_struct il2cpp_mono_type_is_struct
6365
#define mono_type_is_reference il2cpp_mono_type_is_reference
6466
#define mono_metadata_free_mh il2cpp_mono_metadata_free_mh
@@ -147,7 +149,8 @@
147149
#define mono_class_is_nullable il2cpp_mono_class_is_nullable
148150
#define mono_class_get_generic_container il2cpp_mono_class_get_generic_container
149151
#define mono_class_setup_interfaces il2cpp_mono_class_setup_interfaces
150-
#define mono_class_get_methods_by_name il2cpp_mono_class_get_methods_by_name
152+
#define mono_class_get_methods_by_name il2cpp_mono_class_get_methods_by_name
153+
#define mono_class_is_valuetype il2cpp_class_is_valuetype
151154
#define mono_ldtoken_checked il2cpp_mono_ldtoken_checked
152155
#define mono_class_from_generic_parameter_internal il2cpp_mono_class_from_generic_parameter_internal
153156
#define mono_class_load_from_name il2cpp_mono_class_load_from_name
@@ -167,6 +170,7 @@
167170
#define mono_field_static_get_value_checked il2cpp_mono_field_static_get_value_checked
168171
#define mono_field_static_get_value_for_thread il2cpp_mono_field_static_get_value_for_thread
169172
#define mono_field_get_value_object_checked il2cpp_mono_field_get_value_object_checked
173+
#define mono_field_get_offset il2cpp_field_get_offset
170174
#define mono_object_new_checked il2cpp_mono_object_new_checked
171175
#define mono_ldstr_checked il2cpp_mono_ldstr_checked
172176
#define mono_runtime_try_invoke il2cpp_mono_runtime_try_invoke
@@ -238,6 +242,7 @@
238242
#define mono_field_get_type il2cpp_field_get_type
239243
#define mono_method_get_name il2cpp_method_get_name
240244
#define mono_class_get_type il2cpp_class_get_type
245+
#define mono_class_get_byref_type il2cpp_mono_class_get_byref_type
241246
#define mono_method_get_class il2cpp_method_get_class
242247
#define mono_class_get_image il2cpp_class_get_image
243248
#define mono_class_get_interfaces il2cpp_class_get_interfaces
@@ -259,6 +264,14 @@
259264
#undef mono_field_is_deleted
260265
#define mono_field_is_deleted il2cpp_field_is_deleted
261266
#define mono_domain_get_assemblies_iter il2cpp_domain_get_assemblies_iter
267+
#define mono_property_get_name il2cpp_property_get_name
268+
#define mono_property_get_set_method il2cpp_property_get_set_method
269+
#define mono_property_get_get_method il2cpp_property_get_get_method
270+
#define mono_property_get_parent il2cpp_property_get_parent
271+
#define m_domain_get_corlib il2cpp_m_domain_get_corlib
272+
#define mono_generic_class_get_context il2cpp_mono_generic_class_get_context
273+
274+
#define m_class_is_initialized il2cpp_m_class_is_initialized
262275

263276
#undef mono_domain_assemblies_lock
264277
#define mono_domain_assemblies_lock
@@ -464,5 +477,12 @@ const MonoType* il2cpp_get_type_from_index(int index);
464477
const MonoType* il2cpp_get_type_from_method_context(MonoType* type, const MonoMethod* method);
465478
const MonoType* il2cpp_type_inflate(MonoType* type, const MonoGenericContext* context);
466479
void il2cpp_debugger_get_method_execution_context_and_header_Info(const MonoMethod* method, uint32_t* executionContextInfoCount, const Il2CppMethodExecutionContextInfo **executionContextInfo, const Il2CppMethodHeaderInfo **headerInfo, const Il2CppMethodScope **scopes);
467-
480+
Il2CppThreadUnwindState* il2cpp_debugger_get_thread_context ();
481+
MonoGenericContext* il2cpp_mono_generic_class_get_context (MonoGenericClass *gclass);
482+
MonoType* il2cpp_mono_class_get_byref_type (MonoClass *klass);
483+
mono_bool il2cpp_mono_image_is_dynamic(MonoImage *image);
484+
MonoGenericClass* il2cpp_m_type_get_generic_class(MonoType* type);
485+
const MonoAssembly* il2cpp_m_method_get_assembly(MonoMethod* method);
486+
const MonoAssembly* il2cpp_m_domain_get_corlib (MonoDomain *domain);
487+
mono_bool il2cpp_m_class_is_initialized (MonoClass* klass);
468488
#endif // RUNTIME_IL2CPP

0 commit comments

Comments
 (0)