Skip to content

Commit ba92569

Browse files
committed
Implement mono_unity_backtrace_from_context same as old mono for now (case 1074280)
1 parent e452eea commit ba92569

File tree

2 files changed

+27
-7
lines changed

2 files changed

+27
-7
lines changed

mono/metadata/unity-utils.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1098,13 +1098,6 @@ mono_unity_domain_set_config (MonoDomain *domain, const char *base_dir, const ch
10981098
mono_domain_set_config (domain, base_dir, config_file_name);
10991099
}
11001100

1101-
// only needed on OSX
1102-
MONO_API int
1103-
mono_unity_backtrace_from_context (void* context, void* array[], int count)
1104-
{
1105-
return 0;
1106-
}
1107-
11081101
MONO_API MonoException*
11091102
mono_unity_loader_get_last_error_and_error_prepare_exception ()
11101103
{

mono/mini/mini-exceptions.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2712,6 +2712,33 @@ static void print_process_map (void)
27122712

27132713
static gboolean handle_crash_loop = FALSE;
27142714

2715+
MONO_API int
2716+
mono_unity_backtrace_from_context (void* context, void* array[], int count)
2717+
{
2718+
#ifdef MONO_ARCH_HAVE_SIGCTX_TO_MONOCTX
2719+
MonoContext mctx;
2720+
void* ip = 0;
2721+
void** bp = 0;
2722+
int idx = 0;
2723+
2724+
mono_sigctx_to_monoctx(context, &mctx);
2725+
2726+
ip = (void*)MONO_CONTEXT_GET_IP(&mctx);
2727+
bp = (void**)MONO_CONTEXT_GET_BP(&mctx);
2728+
2729+
while(ip && bp && count-- > 0)
2730+
{
2731+
array[idx++] = ip;
2732+
2733+
ip = bp[1];
2734+
bp = (void**)bp[0];
2735+
}
2736+
2737+
return idx;
2738+
#else
2739+
return 0;
2740+
#endif
2741+
}
27152742
/*
27162743
* mono_handle_native_crash:
27172744
*

0 commit comments

Comments
 (0)