2 * exception.c: exception support
5 * Dietmar Maurer (dietmar@ximian.com)
7 * (C) 2001 Ximian, Inc.
15 #include <mono/arch/x86/x86-codegen.h>
16 #include <mono/metadata/appdomain.h>
17 #include <mono/metadata/tabledefs.h>
18 #include <mono/metadata/threads.h>
19 #include <mono/metadata/debug-helpers.h>
20 #include <mono/metadata/exception.h>
24 #include "debug-private.h"
26 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
27 # define SC_EAX sc_eax
28 # define SC_EBX sc_ebx
29 # define SC_ECX sc_ecx
30 # define SC_EDX sc_edx
31 # define SC_EBP sc_ebp
32 # define SC_EIP sc_eip
33 # define SC_ESP sc_esp
34 # define SC_EDI sc_edi
35 # define SC_ESI sc_esi
48 typedef struct sigcontext MonoContext;
50 #define MONO_CONTEXT_SET_IP(ctx,ip) do { (ctx)->SC_EIP = (long)ip; } while (0);
51 #define MONO_CONTEXT_SET_BP(ctx,bp) do { (ctx)->SC_EBP = (long)bp; } while (0);
53 #define MONO_CONTEXT_GET_IP(ctx) ((gpointer)((ctx)->SC_EIP))
54 #define MONO_CONTEXT_GET_BP(ctx) ((gpointer)((ctx)->SC_EBP))
56 #ifdef MONO_USE_EXC_TABLES
58 /*************************************/
59 /* STACK UNWINDING STUFF */
60 /*************************************/
62 /* These definitions are from unwind-dw2.c in glibc 2.2.5 */
65 #define DWARF_FRAME_REGISTERS 17
67 typedef struct frame_state
73 long reg_or_offset[DWARF_FRAME_REGISTERS+1];
74 unsigned short cfa_reg;
75 unsigned short retaddr_column;
76 char saved[DWARF_FRAME_REGISTERS+1];
80 get_sigcontext_reg (struct sigcontext *ctx, int dwarf_regnum)
82 switch (dwarf_regnum) {
100 g_assert_not_reached ();
107 set_sigcontext_reg (struct sigcontext *ctx, int dwarf_regnum, long value)
109 switch (dwarf_regnum) {
138 g_assert_not_reached ();
142 typedef struct frame_state * (*framesf) (void *, struct frame_state *);
144 static framesf frame_state_for = NULL;
146 static gboolean inited = FALSE;
148 typedef char ** (*get_backtrace_symbols_type) (void *__const *__array, int __size);
150 static get_backtrace_symbols_type get_backtrace_symbols = NULL;
153 init_frame_state_for (void)
158 * There are two versions of __frame_state_for: one in libgcc.a and the
159 * other in glibc.so. We need the version from glibc.
160 * For more info, see this:
161 * http://gcc.gnu.org/ml/gcc/2002-08/msg00192.html
163 if ((module = g_module_open ("libc.so.6", G_MODULE_BIND_LAZY))) {
165 if (!g_module_symbol (module, "__frame_state_for", (gpointer*)&frame_state_for))
166 frame_state_for = NULL;
168 if (!g_module_symbol (module, "backtrace_symbols", (gpointer*)&get_backtrace_symbols)) {
169 get_backtrace_symbols = NULL;
170 frame_state_for = NULL;
173 g_module_close (module);
179 /* mono_arch_has_unwind_info:
181 * Tests if a function has an DWARF exception table able to restore
182 * all caller saved registers.
185 mono_arch_has_unwind_info (gconstpointer addr)
187 struct frame_state state_in;
188 struct frame_state *res;
191 init_frame_state_for ();
193 if (!frame_state_for)
198 memset (&state_in, 0, sizeof (state_in));
200 /* offset 10 is just a guess, but it works for all methods tested */
201 if ((res = frame_state_for ((char *)addr + 10, &state_in))) {
203 if (res->saved [X86_EBX] != 1 ||
204 res->saved [X86_EDI] != 1 ||
205 res->saved [X86_EBP] != 1 ||
206 res->saved [X86_ESI] != 1) {
218 void *return_address;
222 x86_unwind_native_frame (MonoDomain *domain, MonoJitTlsData *jit_tls, struct sigcontext *ctx,
223 struct sigcontext *new_ctx, MonoLMF *lmf, char **trace)
225 struct stack_frame *frame;
228 struct frame_state state_in;
229 struct frame_state *res;
235 init_frame_state_for ();
237 if (!frame_state_for)
240 frame = MONO_CONTEXT_GET_BP (ctx);
242 max_stack = lmf && lmf->method ? lmf : jit_tls->end_of_stack;
246 memset (&state_in, 0, sizeof (state_in));
248 while ((gpointer)frame->next < (gpointer)max_stack) {
249 gpointer ip, addr = frame->return_address;
251 char *tmp, **symbols;
254 ip = MONO_CONTEXT_GET_IP (new_ctx);
255 symbols = get_backtrace_symbols (&ip, 1);
257 tmp = g_strdup_printf ("%s\nin (unmanaged) %s", *trace, symbols [0]);
259 tmp = g_strdup_printf ("in (unmanaged) %s", symbols [0]);
266 if ((res = frame_state_for (addr, &state_in))) {
269 cfa = (gint8*) (get_sigcontext_reg (new_ctx, res->cfa_reg) + res->cfa_offset);
270 frame = (struct stack_frame *)((gint8*)cfa - 8);
271 for (i = 0; i < DWARF_FRAME_REGISTERS + 1; i++) {
272 int how = res->saved[i];
274 g_assert ((how == 0) || (how == 1));
277 val = * (long*) ((gint8*)cfa + res->reg_or_offset[i]);
278 set_sigcontext_reg (new_ctx, i, val);
281 new_ctx->esp = (long)cfa;
283 if (res->saved [X86_EBX] == 1 &&
284 res->saved [X86_EDI] == 1 &&
285 res->saved [X86_EBP] == 1 &&
286 res->saved [X86_ESI] == 1 &&
287 (ji = mono_jit_info_table_find (domain, frame->return_address))) {
288 //printf ("FRAME CFA %s\n", mono_method_full_name (ji->method, TRUE));
293 //printf ("FRAME %p %p %p\n", frame, MONO_CONTEXT_GET_IP (new_ctx), mono_jit_info_table_find (domain, MONO_CONTEXT_GET_IP (new_ctx)));
295 MONO_CONTEXT_SET_IP (new_ctx, frame->return_address);
297 MONO_CONTEXT_SET_BP (new_ctx, frame);
299 /* stop if !frame or when we detect an unexpected managed frame */
300 if (!frame || mono_jit_info_table_find (domain, frame->return_address)) {
311 //g_assert_not_reached ();
323 * arch_get_restore_context:
325 * Returns a pointer to a method which restores a previously saved sigcontext.
328 arch_get_restore_context (void)
330 static guint8 *start = NULL;
336 /* restore_contect (struct sigcontext *ctx) */
337 /* we do not restore X86_EAX, X86_EDX */
339 start = code = g_malloc (1024);
342 x86_mov_reg_membase (code, X86_EAX, X86_ESP, 4, 4);
344 /* get return address, stored in EDX */
345 x86_mov_reg_membase (code, X86_EDX, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, SC_EIP), 4);
347 x86_mov_reg_membase (code, X86_EBX, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, SC_EBX), 4);
349 x86_mov_reg_membase (code, X86_EDI, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, SC_EDI), 4);
351 x86_mov_reg_membase (code, X86_ESI, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, SC_ESI), 4);
353 x86_mov_reg_membase (code, X86_ESP, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, SC_ESP), 4);
355 x86_mov_reg_membase (code, X86_EBP, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, SC_EBP), 4);
357 /* jump to the saved IP */
358 x86_jump_reg (code, X86_EDX);
364 * arch_get_call_filter:
366 * Returns a pointer to a method which calls an exception filter. We
367 * also use this function to call finally handlers (we pass NULL as
368 * @exc object in this case).
371 arch_get_call_filter (void)
373 static guint8 start [64];
374 static int inited = 0;
381 /* call_filter (struct sigcontext *ctx, unsigned long eip, gpointer exc) */
384 x86_push_reg (code, X86_EBP);
385 x86_mov_reg_reg (code, X86_EBP, X86_ESP, 4);
386 x86_push_reg (code, X86_EBX);
387 x86_push_reg (code, X86_EDI);
388 x86_push_reg (code, X86_ESI);
391 x86_mov_reg_membase (code, X86_EAX, X86_EBP, 8, 4);
393 x86_mov_reg_membase (code, X86_ECX, X86_EBP, 12, 4);
395 x86_push_reg (code, X86_EBP);
397 x86_push_membase (code, X86_EBP, 16);
399 x86_mov_reg_membase (code, X86_EBP, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, SC_EBP), 4);
400 /* restore registers used by global register allocation (EBX & ESI) */
401 x86_mov_reg_membase (code, X86_EBX, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, SC_EBX), 4);
402 x86_mov_reg_membase (code, X86_ESI, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, SC_ESI), 4);
403 x86_mov_reg_membase (code, X86_EDI, X86_EAX, G_STRUCT_OFFSET (struct sigcontext, SC_EDI), 4);
404 /* save the ESP - this is used by endfinally */
405 x86_mov_membase_reg (code, X86_EBP, mono_exc_esp_offset, X86_ESP, 4);
406 /* call the handler */
407 x86_call_reg (code, X86_ECX);
408 x86_alu_reg_imm (code, X86_ADD, X86_ESP, 4);
410 x86_pop_reg (code, X86_EBP);
411 /* restore saved regs */
412 x86_pop_reg (code, X86_ESI);
413 x86_pop_reg (code, X86_EDI);
414 x86_pop_reg (code, X86_EBX);
418 g_assert ((code - start) < 64);
423 throw_exception (unsigned long eax, unsigned long ecx, unsigned long edx, unsigned long ebx,
424 unsigned long esi, unsigned long edi, unsigned long ebp, MonoObject *exc,
425 unsigned long eip, unsigned long esp)
427 static void (*restore_context) (struct sigcontext *);
428 struct sigcontext ctx;
430 if (!restore_context)
431 restore_context = arch_get_restore_context ();
433 /* adjust eip so that it point into the call instruction */
446 mono_arch_handle_exception (&ctx, exc, FALSE);
447 restore_context (&ctx);
449 g_assert_not_reached ();
453 * arch_get_throw_exception:
455 * Returns a function pointer which can be used to raise
456 * exceptions. The returned function has the following
457 * signature: void (*func) (MonoException *exc);
458 * For example to raise an arithmetic exception you can use:
460 * x86_push_imm (code, mono_get_exception_arithmetic ());
461 * x86_call_code (code, arch_get_throw_exception ());
465 mono_arch_get_throw_exception (void)
467 static guint8 start [24];
468 static int inited = 0;
477 x86_push_reg (code, X86_ESP);
478 x86_push_membase (code, X86_ESP, 4); /* IP */
479 x86_push_membase (code, X86_ESP, 12); /* exception */
480 x86_push_reg (code, X86_EBP);
481 x86_push_reg (code, X86_EDI);
482 x86_push_reg (code, X86_ESI);
483 x86_push_reg (code, X86_EBX);
484 x86_push_reg (code, X86_EDX);
485 x86_push_reg (code, X86_ECX);
486 x86_push_reg (code, X86_EAX);
487 x86_call_code (code, throw_exception);
488 /* we should never reach this breakpoint */
489 x86_breakpoint (code);
491 g_assert ((code - start) < 24);
496 * arch_get_throw_exception_by_name:
498 * Returns a function pointer which can be used to raise
499 * corlib exceptions. The returned function has the following
500 * signature: void (*func) (char *exc_name);
501 * For example to raise an arithmetic exception you can use:
503 * x86_push_imm (code, "ArithmeticException");
504 * x86_call_code (code, arch_get_throw_exception_by_name ());
508 mono_arch_get_throw_exception_by_name (void)
510 static guint8 start [32];
511 static int inited = 0;
520 x86_push_membase (code, X86_ESP, 4); /* exception name */
521 x86_push_imm (code, "System");
522 x86_push_imm (code, mono_defaults.exception_class->image);
523 x86_call_code (code, mono_exception_from_name);
524 x86_alu_reg_imm (code, X86_ADD, X86_ESP, 12);
525 /* save the newly create object (overwrite exception name)*/
526 x86_mov_membase_reg (code, X86_ESP, 4, X86_EAX, 4);
527 x86_jump_code (code, mono_arch_get_throw_exception ());
529 g_assert ((code - start) < 32);
535 glist_to_array (GList *list)
537 MonoDomain *domain = mono_domain_get ();
544 len = g_list_length (list);
545 res = mono_array_new (domain, mono_defaults.int_class, len);
547 for (i = 0; list; list = list->next, i++)
548 mono_array_set (res, gpointer, i, list->data);
553 /* mono_arch_find_jit_info:
555 * This function is used to gather information from @ctx. It return the
556 * MonoJitInfo of the corresponding function, unwinds one stack frame and
557 * stores the resulting context into @new_ctx. It also stores a string
558 * describing the stack location into @trace (if not NULL), and modifies
559 * the @lmf if necessary. @native_offset return the IP offset from the
560 * start of the function or -1 if that info is not available.
563 mono_arch_find_jit_info (MonoDomain *domain, MonoJitTlsData *jit_tls, MonoJitInfo *res, MonoContext *ctx,
564 MonoContext *new_ctx, char **trace, MonoLMF **lmf, int *native_offset,
568 gpointer ip = MONO_CONTEXT_GET_IP (ctx);
570 ji = mono_jit_info_table_find (domain, ip);
582 char *source_location, *tmpaddr, *fname;
583 gint32 address, iloffset;
588 if (*lmf && (MONO_CONTEXT_GET_BP (ctx) >= (gpointer)(*lmf)->ebp)) {
589 /* remove any unused lmf */
590 *lmf = (*lmf)->previous_lmf;
593 address = (char *)ip - (char *)ji->code_start;
596 *native_offset = address;
599 if (!ji->method->wrapper_type)
603 if (mono_debug_format != MONO_DEBUG_FORMAT_NONE)
604 mono_debug_make_symbols ();
606 source_location = mono_debug_source_location_from_address (ji->method, address, NULL);
607 iloffset = mono_debug_il_offset_from_address (ji->method, address);
608 source_location = NULL;
612 tmpaddr = g_strdup_printf ("<0x%05x>", address);
614 tmpaddr = g_strdup_printf ("[0x%05x]", iloffset);
616 fname = mono_method_full_name (ji->method, TRUE);
619 *trace = g_strdup_printf ("in %s (at %s) %s", tmpaddr, source_location, fname);
621 *trace = g_strdup_printf ("in %s %s", tmpaddr, fname);
624 g_free (source_location);
629 /* restore caller saved registers */
630 if (ji->used_regs & X86_EBX_MASK) {
631 new_ctx->SC_EBX = *((int *)ctx->SC_EBP + offset);
634 if (ji->used_regs & X86_EDI_MASK) {
635 new_ctx->SC_EDI = *((int *)ctx->SC_EBP + offset);
638 if (ji->used_regs & X86_ESI_MASK) {
639 new_ctx->SC_ESI = *((int *)ctx->SC_EBP + offset);
642 new_ctx->SC_ESP = ctx->SC_EBP;
643 /* we substract 1, so that the IP points into the call instruction */
644 new_ctx->SC_EIP = *((int *)ctx->SC_EBP + 1) - 1;
645 new_ctx->SC_EBP = *((int *)ctx->SC_EBP);
649 #ifdef MONO_USE_EXC_TABLES
650 } else if ((ji = x86_unwind_native_frame (domain, jit_tls, ctx, new_ctx, *lmf, trace))) {
662 *trace = g_strdup_printf ("in (unmanaged) %s", mono_method_full_name ((*lmf)->method, TRUE));
664 if ((ji = mono_jit_info_table_find (domain, (gpointer)(*lmf)->eip))) {
667 memset (res, 0, sizeof (MonoJitInfo));
668 res->method = (*lmf)->method;
671 new_ctx->SC_ESI = (*lmf)->esi;
672 new_ctx->SC_EDI = (*lmf)->edi;
673 new_ctx->SC_EBX = (*lmf)->ebx;
674 new_ctx->SC_EBP = (*lmf)->ebp;
675 new_ctx->SC_EIP = (*lmf)->eip;
676 /* the lmf is always stored on the stack, so the following
677 * expression points to a stack location which can be used as ESP */
678 new_ctx->SC_ESP = (unsigned long)&((*lmf)->eip);
680 *lmf = (*lmf)->previous_lmf;
690 ves_icall_get_trace (MonoException *exc, gint32 skip, MonoBoolean need_file_info)
692 MonoDomain *domain = mono_domain_get ();
694 MonoArray *ta = exc->trace_ips;
698 /* Exception is not thrown yet */
699 return mono_array_new (domain, mono_defaults.stack_frame_class, 0);
702 len = mono_array_length (ta);
704 res = mono_array_new (domain, mono_defaults.stack_frame_class, len > skip ? len - skip : 0);
706 for (i = skip; i < len; i++) {
708 MonoStackFrame *sf = (MonoStackFrame *)mono_object_new (domain, mono_defaults.stack_frame_class);
709 gpointer ip = mono_array_get (ta, gpointer, i);
711 ji = mono_jit_info_table_find (domain, ip);
713 /* Unmanaged frame */
714 mono_array_set (res, gpointer, i, sf);
718 g_assert (ji != NULL);
720 sf->method = mono_method_get_object (domain, ji->method, NULL);
721 sf->native_offset = (char *)ip - (char *)ji->code_start;
723 sf->il_offset = mono_debug_il_offset_from_address (ji->method, sf->native_offset);
726 if (need_file_info) {
729 filename = mono_debug_source_location_from_address (ji->method, sf->native_offset, &sf->line);
732 sf->filename = filename? mono_string_new (domain, filename): NULL;
738 mono_array_set (res, gpointer, i, sf);
745 mono_jit_walk_stack (MonoStackWalk func, gpointer user_data) {
746 MonoDomain *domain = mono_domain_get ();
747 MonoJitTlsData *jit_tls = TlsGetValue (mono_jit_tls_id);
748 MonoLMF *lmf = jit_tls->lmf;
749 MonoJitInfo *ji, rji;
750 gint native_offset, il_offset;
753 MonoContext ctx, new_ctx;
755 MONO_CONTEXT_SET_IP (&ctx, __builtin_return_address (0));
756 MONO_CONTEXT_SET_BP (&ctx, __builtin_frame_address (1));
758 while (MONO_CONTEXT_GET_BP (&ctx) < jit_tls->end_of_stack) {
760 ji = mono_arch_find_jit_info (domain, jit_tls, &rji, &ctx, &new_ctx, NULL, &lmf, &native_offset, &managed);
763 if (ji == (gpointer)-1)
766 il_offset = mono_debug_il_offset_from_address (ji->method, native_offset);
768 if (func (ji->method, native_offset, il_offset, managed, user_data))
776 ves_icall_get_frame_info (gint32 skip, MonoBoolean need_file_info,
777 MonoReflectionMethod **method,
778 gint32 *iloffset, gint32 *native_offset,
779 MonoString **file, gint32 *line, gint32 *column)
781 MonoDomain *domain = mono_domain_get ();
782 MonoJitTlsData *jit_tls = TlsGetValue (mono_jit_tls_id);
783 MonoLMF *lmf = jit_tls->lmf;
784 MonoJitInfo *ji, rji;
785 MonoContext ctx, new_ctx;
787 MONO_CONTEXT_SET_IP (&ctx, ves_icall_get_frame_info);
788 MONO_CONTEXT_SET_BP (&ctx, __builtin_frame_address (0));
793 ji = mono_arch_find_jit_info (domain, jit_tls, &rji, &ctx, &new_ctx, NULL, &lmf, native_offset, NULL);
797 if (!ji || ji == (gpointer)-1 || MONO_CONTEXT_GET_BP (&ctx) >= jit_tls->end_of_stack)
800 if (ji->method->wrapper_type == MONO_WRAPPER_RUNTIME_INVOKE)
807 *method = mono_method_get_object (domain, ji->method, NULL);
808 *iloffset = mono_debug_il_offset_from_address (ji->method, *native_offset);
811 if (need_file_info) {
814 filename = mono_debug_source_location_from_address (ji->method, *native_offset, line);
817 *file = filename? mono_string_new (domain, filename): NULL;
827 * arch_handle_exception:
828 * @ctx: saved processor state
829 * @obj: the exception object
830 * @test_only: only test if the exception is caught, but dont call handlers
835 mono_arch_handle_exception (MonoContext *ctx, gpointer obj, gboolean test_only)
837 MonoDomain *domain = mono_domain_get ();
838 MonoJitInfo *ji, rji;
839 static int (*call_filter) (MonoContext *, gpointer, gpointer) = NULL;
840 MonoJitTlsData *jit_tls = TlsGetValue (mono_jit_tls_id);
841 MonoLMF *lmf = jit_tls->lmf;
842 GList *trace_ips = NULL;
844 g_assert (ctx != NULL);
846 MonoException *ex = mono_get_exception_null_reference ();
847 ex->message = mono_string_new (domain,
848 "Object reference not set to an instance of an object");
849 obj = (MonoObject *)ex;
852 g_assert (mono_object_isinst (obj, mono_defaults.exception_class));
855 call_filter = arch_get_call_filter ();
857 g_assert (jit_tls->end_of_stack);
858 g_assert (jit_tls->abort_func);
861 MonoContext ctx_cp = *ctx;
862 if (mono_jit_trace_calls)
863 g_print ("EXCEPTION handling: %s\n", mono_object_class (obj)->name);
864 if (!mono_arch_handle_exception (&ctx_cp, obj, TRUE)) {
865 if (mono_break_on_exc) {
866 if (mono_debug_format != MONO_DEBUG_FORMAT_NONE)
867 mono_debug_make_symbols ();
870 mono_unhandled_exception (obj);
878 ji = mono_arch_find_jit_info (domain, jit_tls, &rji, ctx, &new_ctx,
879 test_only ? &trace : NULL, &lmf, NULL, NULL);
881 g_warning ("Exception inside function without unwind info");
882 g_assert_not_reached ();
885 if (ji != (gpointer)-1) {
887 if (test_only && ji->method->wrapper_type != MONO_WRAPPER_RUNTIME_INVOKE) {
890 trace_ips = g_list_append (trace_ips, MONO_CONTEXT_GET_IP (ctx));
892 if (!((MonoException*)obj)->stack_trace)
893 strace = g_strdup ("");
895 strace = mono_string_to_utf8 (((MonoException*)obj)->stack_trace);
897 tmp = g_strdup_printf ("%s%s\n", strace, trace);
900 ((MonoException*)obj)->stack_trace = mono_string_new (domain, tmp);
905 if (ji->num_clauses) {
908 g_assert (ji->clauses);
910 for (i = 0; i < ji->num_clauses; i++) {
911 MonoJitExceptionInfo *ei = &ji->clauses [i];
913 if (ei->try_start <= MONO_CONTEXT_GET_IP (ctx) &&
914 MONO_CONTEXT_GET_IP (ctx) <= ei->try_end) {
916 if ((ei->flags == MONO_EXCEPTION_CLAUSE_NONE &&
917 mono_object_isinst (obj, mono_class_get (ji->method->klass->image, ei->data.token))) ||
918 ((ei->flags == MONO_EXCEPTION_CLAUSE_FILTER &&
919 call_filter (ctx, ei->data.filter, obj)))) {
921 ((MonoException*)obj)->trace_ips = glist_to_array (trace_ips);
922 g_list_free (trace_ips);
925 if (mono_jit_trace_calls)
926 g_print ("EXCEPTION: catch found at clause %d of %s\n", i, mono_method_full_name (ji->method, TRUE));
927 MONO_CONTEXT_SET_IP (ctx, ei->handler_start);
928 *((gpointer *)((char *)MONO_CONTEXT_GET_BP (ctx) + ji->exvar_offset)) = obj;
932 if (!test_only && ei->try_start <= MONO_CONTEXT_GET_IP (ctx) &&
933 MONO_CONTEXT_GET_IP (ctx) < ei->try_end &&
934 (ei->flags & MONO_EXCEPTION_CLAUSE_FINALLY)) {
935 if (mono_jit_trace_calls)
936 g_print ("EXCEPTION: finally clause %d of %s\n", i, mono_method_full_name (ji->method, TRUE));
937 call_filter (ctx, ei->handler_start, NULL);
949 if ((ji == (gpointer)-1) || MONO_CONTEXT_GET_BP (ctx) >= jit_tls->end_of_stack) {
952 jit_tls->abort_func (obj);
953 g_assert_not_reached ();
955 ((MonoException*)obj)->trace_ips = glist_to_array (trace_ips);
956 g_list_free (trace_ips);
962 g_assert_not_reached ();