Skip to content

Commit c4e698c

Browse files
authored
Merge pull request #724 from Unity-Technologies/unity-master-staging
MonoBleedingEdge Fixes for Trunk Debugger fixes and a few functions that were missed in migration to master.
2 parents 8681288 + e1cc84f commit c4e698c

15 files changed

+314
-157
lines changed

README.md

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,53 @@
1+
Unity
2+
============================
3+
This is Unity Technologies fork of the open source mono project.
4+
5+
### Versions
6+
Each Unity release contains two versions of Mono. One older version (Mono) is embedded into the Editor and Players. Another newer version (MonoBleedingEdge) is used to run tools and tests.
7+
8+
In newer Unity versions (2017.1+) this MonoBleedingEdge version can be used in the Editor and Players via enabling an Experimental player setting.
9+
10+
### Branch Naming Convention
11+
Branches for released Unity versions are of the form unity-\<version\>\[-mbe\][-staging\]. The '-staging' suffix is used as a branch for PRs to target with potential changes. The '-mbe' suffix indicates the branch is for the MonoBleedingEdge version of Mono mentioned above.
12+
13+
### Branches
14+
15+
#### Trunk
16+
* [unity-staging (PR to this branch for Mono)](https://github.com/Unity-Technologies/mono/tree/unity-staging)
17+
* [unity-trunk](https://github.com/Unity-Technologies/mono/tree/unity-trunk)
18+
* [unity-master-staging (PR to this branch for MonoBleedingEdge)](https://github.com/Unity-Technologies/mono/tree/unity-master-staging)
19+
* [unity-master](https://github.com/Unity-Technologies/mono/tree/unity-master)
20+
21+
#### 2017.3
22+
* [unity-2017.3-staging](https://github.com/Unity-Technologies/mono/tree/unity-2017.3-staging)
23+
* [unity-2017.3](https://github.com/Unity-Technologies/mono/tree/unity-2017.3)
24+
* [unity-2017.3-mbe-staging](https://github.com/Unity-Technologies/mono/tree/unity-2017.3-mbe-staging)
25+
* [unity-2017.3-mbe](https://github.com/Unity-Technologies/mono/tree/unity-2017.3-mbe)
26+
27+
#### 2017.2
28+
* [unity-2017.2-staging](https://github.com/Unity-Technologies/mono/tree/unity-2017.2-staging)
29+
* [unity-2017.2](https://github.com/Unity-Technologies/mono/tree/unity-2017.2)
30+
* [unity-2017.2-mbe-staging](https://github.com/Unity-Technologies/mono/tree/unity-2017.2-mbe-staging)
31+
* [unity-2017.2-mbe](https://github.com/Unity-Technologies/mono/tree/unity-2017.2-mbe)
32+
33+
#### 2017.1
34+
* [unity-2017.1-staging](https://github.com/Unity-Technologies/mono/tree/unity-2017.1-staging)
35+
* [unity-2017.1](https://github.com/Unity-Technologies/mono/tree/unity-2017.1)
36+
* [unity-2017.1-mbe-staging](https://github.com/Unity-Technologies/mono/tree/unity-2017.1-mbe-staging)
37+
* [unity-2017.1-mbe](https://github.com/Unity-Technologies/mono/tree/unity-2017.1-mbe)
38+
39+
#### 5.6
40+
* [unity-5.6-staging](https://github.com/Unity-Technologies/mono/tree/unity-5.6-staging)
41+
* [unity-5.6](https://github.com/Unity-Technologies/mono/tree/unity-5.6)
42+
* [unity-5.6-mbe-staging](https://github.com/Unity-Technologies/mono/tree/unity-5.6-mbe-staging)
43+
* [unity-5.6-mbe](https://github.com/Unity-Technologies/mono/tree/unity-5.6-mbe)
44+
45+
46+
47+
48+
Mono
49+
============================
50+
151
Mono is a software platform designed to allow developers to easily
252
create cross platform applications. It is an open source
353
implementation of Microsoft's .NET Framework based on the ECMA

mono/metadata/loader.c

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,6 +1263,22 @@ mono_lookup_pinvoke_call (MonoMethod *method, const char **exc_class, const char
12631263
}
12641264
}
12651265

1266+
if (mono_get_find_plugin_callback ())
1267+
{
1268+
const char* unity_new_scope = mono_get_find_plugin_callback () (new_scope);
1269+
if (unity_new_scope == NULL)
1270+
{
1271+
if (exc_class)
1272+
{
1273+
*exc_class = "DllNotFoundException";
1274+
*exc_arg = new_scope;
1275+
}
1276+
return NULL;
1277+
}
1278+
1279+
new_scope = unity_new_scope;
1280+
}
1281+
12661282
/*
12671283
* Try loading the module using a variety of names
12681284
*/

mono/metadata/unity-utils.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,26 @@ mono_unity_g_free(void *ptr)
142142
g_free (ptr);
143143
}
144144

145+
146+
MONO_API MonoClass*
147+
mono_custom_attrs_get_attrs (MonoCustomAttrInfo *ainfo, gpointer *iter)
148+
{
149+
int index = -1;
150+
if (!iter)
151+
return NULL;
152+
if (!*iter)
153+
{
154+
*iter = 1;
155+
return ainfo->attrs[0].ctor->klass;
156+
}
157+
158+
index = GPOINTER_TO_INT (*iter);
159+
if (index >= ainfo->num_attrs)
160+
return NULL;
161+
*iter = GINT_TO_POINTER (index + 1);
162+
return ainfo->attrs[index].ctor->klass;
163+
}
164+
145165
MONO_API gboolean
146166
mono_class_is_inflated (MonoClass *klass)
147167
{

mono/metadata/unity-utils.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,8 @@ MONO_API MonoClass* mono_unity_class_get(MonoImage* image, guint32 type_token);
163163
MONO_API gpointer mono_unity_alloc(gsize size);
164164
MONO_API void mono_unity_g_free (void *ptr);
165165

166-
// hack, FIXME jon
166+
MONO_API MonoClass* mono_custom_attrs_get_attrs (MonoCustomAttrInfo *ainfo, gpointer *iter);
167+
167168
typedef size_t (*RemapPathFunction)(const char* path, char* buffer, size_t buffer_len);
168169
MONO_API void mono_unity_register_path_remapper (RemapPathFunction func);
169170
gboolean

mono/mini/Makefile.am.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,8 @@ common_sources = \
561561
type-checking.c \
562562
lldb.h \
563563
lldb.c \
564-
pmip_my_callstack.h \
565-
pmip_my_callstack.c \
564+
mixed_callstack_plugin.h \
565+
mixed_callstack_plugin.c \
566566
memory-access.c \
567567
mini-profiler.c
568568

mono/mini/debugger-agent.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4924,6 +4924,8 @@ clear_breakpoints_for_domain (MonoDomain *domain)
49244924
if (inst->domain == domain) {
49254925
#ifndef IL2CPP_MONO_DEBUGGER
49264926
remove_breakpoint (inst);
4927+
#else
4928+
inst->seq_point->isActive = FALSE;
49274929
#endif
49284930

49294931
g_free (inst);
@@ -11048,7 +11050,7 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
1104811050
void *var;
1104911051
#endif
1105011052

11051-
t = &frame->actual_method->klass->byval_arg;
11053+
t = VM_CLASS_GET_TYPE(VM_METHOD_GET_DECLARING_TYPE(frame->actual_method));
1105211054
/* Checked by the sender */
1105311055
g_assert (MONO_TYPE_ISSTRUCT (t));
1105411056

@@ -11071,7 +11073,7 @@ frame_commands (int command, guint8 *p, guint8 *end, Buffer *buf)
1107111073
}
1107211074
#else
1107311075
GetVariable (tls, frame, kMethodVariableKindC_This, 0, &t, &var);
11074-
il2cpp_set_var (val_buf, var, t);
11076+
il2cpp_set_var(val_buf, var, VM_CLASS_GET_THIS_ARG(VM_METHOD_GET_DECLARING_TYPE(frame->actual_method)));
1107511077
#endif
1107611078
break;
1107711079
}
@@ -11884,7 +11886,7 @@ unity_process_breakpoint_inner(DebuggerTlsData *tls, gboolean from_signal, Il2Cp
1188411886

1188511887
for (j = 0; j < bp->children->len; ++j) {
1188611888
inst = (BreakpointInstance *)g_ptr_array_index(bp->children, j);
11887-
if (inst->il_offset == bp->il_offset) {
11889+
if (inst->il_offset == sequencePoint->ilOffset) {
1188811890
if (bp->req->event_kind == EVENT_KIND_STEP) {
1188911891
for (int j = 0; j < bp->children->len; ++j)
1189011892
{

mono/mini/mini-runtime.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@
8484
#include "mini-llvm.h"
8585
#include "debugger-agent.h"
8686
#include "lldb.h"
87+
#include "mixed_callstack_plugin.h"
8788

8889
#ifdef MONO_ARCH_LLVM_SUPPORTED
8990
#ifdef ENABLE_LLVM
@@ -498,6 +499,7 @@ mono_tramp_info_register_internal (MonoTrampInfo *info, MonoDomain *domain, gboo
498499

499500
mono_save_trampoline_xdebug_info (info);
500501
mono_lldb_save_trampoline_info (info);
502+
mixed_callstack_plugin_save_trampoline_info (info);
501503

502504
#ifdef MONO_ARCH_HAVE_UNWIND_TABLE
503505
if (!aot)
@@ -3907,6 +3909,9 @@ mini_init (const char *filename, const char *runtime_version)
39073909
mono_lldb_init ("");
39083910
mono_dont_free_domains = TRUE;
39093911
}
3912+
if (g_hasenv ("UNITY_MIXED_CALLSTACK")) {
3913+
mixed_callstack_plugin_init ("");
3914+
}
39103915

39113916
#ifdef XDEBUG_ENABLED
39123917
char *mono_xdebug = g_getenv ("MONO_XDEBUG");

mono/mini/mini-trampolines.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
#include "mini.h"
2323
#include "lldb.h"
24+
#include "mixed_callstack_plugin.h"
2425

2526
#ifndef DISABLE_INTERPRETER
2627
#include "interp/interp.h"
@@ -1384,6 +1385,7 @@ mono_create_specific_trampoline (gpointer arg1, MonoTrampolineType tramp_type, M
13841385
else
13851386
code = mono_arch_create_specific_trampoline (arg1, tramp_type, domain, &len);
13861387
mono_lldb_save_specific_trampoline_info (arg1, tramp_type, domain, code, len);
1388+
mixed_callstack_plugin_save_specific_trampoline_info (arg1, tramp_type, domain, code, len);
13871389
if (code_len)
13881390
*code_len = len;
13891391
return code;

mono/mini/mini.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
#include "llvm-runtime.h"
7979
#include "mini-llvm.h"
8080
#include "lldb.h"
81+
#include "mixed_callstack_plugin.h"
8182

8283
MonoCallSpec *mono_jit_trace_calls;
8384
MonoMethodDesc *mono_inject_async_exc_method;
@@ -3859,6 +3860,7 @@ mini_method_compile (MonoMethod *method, guint32 opts, MonoDomain *domain, JitFl
38593860
if (!cfg->compile_aot) {
38603861
mono_save_xdebug_info (cfg);
38613862
mono_lldb_save_method_info (cfg);
3863+
mixed_callstack_plugin_save_method_info (cfg);
38623864
}
38633865

38643866
if (cfg->verbose_level >= 2) {

0 commit comments

Comments
 (0)