MONO_CONTEXT_SET_BP (&ctx, sp);
MONO_CONTEXT_SET_IP (&ctx, ip);
+ if (mono_object_isinst (exc, mono_defaults.exception_class)) {
+ MonoException *mono_ex = (MonoException*)exc;
+ mono_ex->stack_trace = NULL;
+ }
mono_arch_handle_exception (&ctx, exc, FALSE);
setcontext(&ctx);
MonoArray *ta = exc->trace_ips;
int i, len;
+ if (ta == NULL) {
+ return mono_array_new (domain, mono_defaults.stack_frame_class, 0);
+ }
+
len = mono_array_length (ta);
res = mono_array_new (domain, mono_defaults.stack_frame_class,
gpointer ip = mono_array_get (ta, gpointer, i);
ji = mono_jit_info_table_find (domain, ip);
- g_assert (ji != NULL);
+ if (ji == NULL) {
+ mono_array_set (res, gpointer, i, sf);
+ continue;
+ }
sf->method = mono_method_get_object (domain, ji->method, NULL);
sf->native_offset = (char *)ip - (char *)ji->code_start;
/*------------------------------------------------------------------*/
void
-mono_jit_walk_stack (MonoStackWalk func, gpointer user_data) {
+mono_jit_walk_stack (MonoStackWalk func, gboolean do_il_offset, gpointer user_data) {
MonoDomain *domain = mono_domain_get ();
MonoJitTlsData *jit_tls = TlsGetValue (mono_jit_tls_id);
MonoLMF *lmf = jit_tls->lmf;
if (ji == (gpointer)-1)
return;
- il_offset = mono_debug_il_offset_from_address (ji->method, native_offset, domain);
+ il_offset = do_il_offset ? mono_debug_il_offset_from_address (ji->method, native_offset, domain): -1;
if (func (ji->method, native_offset, il_offset, managed, user_data))
return;
if (test_only && ji->method->wrapper_type != MONO_WRAPPER_RUNTIME_INVOKE && mono_ex) {
char *tmp, *strace;
- trace_ips = g_list_append (trace_ips, MONO_CONTEXT_GET_IP (ctx));
+ trace_ips = g_list_prepend (trace_ips, MONO_CONTEXT_GET_IP (ctx));
if (!mono_ex->stack_trace)
strace = g_strdup ("");
((ei->flags == MONO_EXCEPTION_CLAUSE_FILTER &&
call_filter (ctx, ei->data.filter, obj)))) {
if (test_only) {
- if (mono_ex)
+ if (mono_ex) {
+ trace_ips = g_list_reverse (trace_ips);
mono_ex->trace_ips = glist_to_array (trace_ips);
+ }
g_list_free (trace_ips);
g_free (trace);
return TRUE;
jit_tls->abort_func (obj);
g_assert_not_reached ();
} else {
- if (mono_ex)
+ if (mono_ex) {
+ trace_ips = g_list_reverse (trace_ips);
mono_ex->trace_ips = glist_to_array (trace_ips);
+ }
g_list_free (trace_ips);
return FALSE;
}