frame = MONO_CONTEXT_GET_BP (ctx);
- max_stack = lmf ? lmf : jit_tls->end_of_stack;
+ max_stack = lmf && lmf->method ? lmf : jit_tls->end_of_stack;
*new_ctx = *ctx;
MONO_CONTEXT_SET_IP (new_ctx, frame->return_address);
frame = frame->next;
MONO_CONTEXT_SET_BP (new_ctx, frame);
-
- /* stop if we detect an unexpected managed frame */
- if (mono_jit_info_table_find (domain, frame->return_address)) {
+
+ /* stop if !frame or when we detect an unexpected managed frame */
+ if (!frame || mono_jit_info_table_find (domain, frame->return_address)) {
if (trace) {
g_free (*trace);
*trace = NULL;
}
}
- if (!lmf)
- g_assert_not_reached ();
-
+ //if (!lmf)
+ //g_assert_not_reached ();
+
if (trace) {
g_free (*trace);
*trace = NULL;
*new_ctx = *ctx;
+ if (!(*lmf)->method)
+ return (gpointer)-1;
+
if (trace)
*trace = g_strdup_printf ("in (unmanaged) %s", mono_method_full_name ((*lmf)->method, TRUE));
MonoArray *res;
MonoArray *ta = exc->trace_ips;
int i, len;
+
+ if (ta == NULL) {
+ /* Exception is not thrown yet */
+ return mono_array_new (domain, mono_defaults.stack_frame_class, 0);
+ }
len = mono_array_length (ta);
gpointer ip = mono_array_get (ta, gpointer, i);
ji = mono_jit_info_table_find (domain, ip);
+ if (ji == NULL) {
+ /* Unmanaged frame */
+ mono_array_set (res, gpointer, i, sf);
+ continue;
+ }
+
g_assert (ji != NULL);
sf->method = mono_method_get_object (domain, ji->method, NULL);
ji = mono_arch_find_jit_info (domain, jit_tls, &ctx, &new_ctx, NULL, &lmf, &native_offset, &managed);
g_assert (ji);
-
+
+ if (ji == (gpointer)-1)
+ return;
+
il_offset = mono_debug_il_offset_from_address (ji->method, native_offset);
if (func (ji->method, native_offset, il_offset, managed, user_data))
MONO_CONTEXT_SET_IP (&ctx, ves_icall_get_frame_info);
MONO_CONTEXT_SET_BP (&ctx, __builtin_frame_address (0));
+ skip++;
+
do {
ji = mono_arch_find_jit_info (domain, jit_tls, &ctx, &new_ctx, NULL, &lmf, native_offset, NULL);
- g_assert (ji);
-
ctx = new_ctx;
- if (MONO_CONTEXT_GET_BP (&ctx) >= jit_tls->end_of_stack)
+ if (!ji || ji == (gpointer)-1 || MONO_CONTEXT_GET_BP (&ctx) >= jit_tls->end_of_stack)
return FALSE;
- } while (skip-- > 0);
+ if (ji->method->wrapper_type == MONO_WRAPPER_RUNTIME_INVOKE)
+ continue;
+
+ skip--;
+
+ } while (skip >= 0);
*method = mono_method_get_object (domain, ji->method, NULL);
*iloffset = mono_debug_il_offset_from_address (ji->method, *native_offset);
ji = mono_arch_find_jit_info (domain, jit_tls, ctx, &new_ctx,
test_only ? &trace : NULL, &lmf, NULL, NULL);
+
if (!ji) {
- g_warning ("Exception insinde function without unwind info");
+ g_warning ("Exception inside function without unwind info");
g_assert_not_reached ();
}
- if (ji->method != mono_start_method) {
-
- if (test_only) {
+ if (ji != (gpointer)-1) {
+ if (test_only && ji->method->wrapper_type != MONO_WRAPPER_RUNTIME_INVOKE) {
char *tmp, *strace;
trace_ips = g_list_append (trace_ips, MONO_CONTEXT_GET_IP (ctx));
strace = g_strdup ("");
else
strace = mono_string_to_utf8 (((MonoException*)obj)->stack_trace);
-
+
tmp = g_strdup_printf ("%s%s\n", strace, trace);
g_free (strace);
*ctx = new_ctx;
- if (ji->method == mono_start_method || MONO_CONTEXT_GET_BP (ctx) >= jit_tls->end_of_stack) {
+ if ((ji == (gpointer)-1) || MONO_CONTEXT_GET_BP (ctx) >= jit_tls->end_of_stack) {
if (!test_only) {
jit_tls->lmf = lmf;
jit_tls->abort_func (obj);
g_assert_not_reached ();
}
+