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;
*/
static MonoJitInfo *
mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoContext *ctx,
- MonoContext *new_ctx, char **trace, MonoLMF **lmf, int *native_offset)
+ MonoContext *new_ctx, char **trace, MonoLMF **lmf, int *native_offset,
+ gboolean *managed)
{
MonoJitInfo *ji;
gpointer ip = MONO_CONTEXT_GET_IP (ctx);
if (native_offset)
*native_offset = -1;
+ if (managed)
+ *managed = FALSE;
+
if (ji != NULL) {
char *source_location, *tmpaddr, *fname;
gint32 address, iloffset;
if (native_offset)
*native_offset = address;
+ if (managed)
+ if (!ji->method->wrapper_type)
+ *managed = TRUE;
+
if (trace) {
if (mono_debug_format != MONO_DEBUG_FORMAT_NONE)
mono_debug_make_symbols ();
*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);
MonoLMF *lmf = jit_tls->lmf;
MonoJitInfo *ji;
gint native_offset, il_offset;
+ gboolean managed;
MonoContext ctx, new_ctx;
while (MONO_CONTEXT_GET_BP (&ctx) < jit_tls->end_of_stack) {
- ji = mono_arch_find_jit_info (domain, jit_tls, &ctx, &new_ctx, NULL, &lmf, &native_offset);
+ 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, user_data))
+ if (func (ji->method, native_offset, il_offset, managed, user_data))
return;
ctx = new_ctx;
MONO_CONTEXT_SET_IP (&ctx, ves_icall_get_frame_info);
MONO_CONTEXT_SET_BP (&ctx, __builtin_frame_address (0));
- do {
- ji = mono_arch_find_jit_info (domain, jit_tls, &ctx, &new_ctx, NULL, &lmf, native_offset);
- g_assert (ji);
+ skip++;
+ do {
+ ji = mono_arch_find_jit_info (domain, jit_tls, &ctx, &new_ctx, NULL, &lmf, native_offset, NULL);
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);
char *trace = NULL;
ji = mono_arch_find_jit_info (domain, jit_tls, ctx, &new_ctx,
- test_only ? &trace : NULL, &lmf, NULL);
+ 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 ();
}
+