From 2657d9cb1ed6a4b9885943518f6fc5d69f4550dc Mon Sep 17 00:00:00 2001 From: Vlad Brezae Date: Mon, 17 Jul 2017 21:02:38 +0300 Subject: [PATCH] [runtime] Fix abort ignore when suspended in first instruction from finally block --- mono/mini/mini-exceptions.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/mono/mini/mini-exceptions.c b/mono/mini/mini-exceptions.c index c8e6b75b496..47350c4377b 100644 --- a/mono/mini/mini-exceptions.c +++ b/mono/mini/mini-exceptions.c @@ -349,7 +349,7 @@ is_address_protected (MonoJitInfo *ji, MonoJitExceptionInfo *ei, gpointer ip) for (i = 0; i < table->num_holes; ++i) { MonoTryBlockHoleJitInfo *hole = &table->holes [i]; - if (hole->clause == clause && hole->offset <= offset && hole->offset + hole->length > offset) + if (ji->clauses [hole->clause].try_offset == ji->clauses [clause].try_offset && hole->offset <= offset && hole->offset + hole->length > offset) return FALSE; } return TRUE; @@ -2917,7 +2917,7 @@ find_last_handler_block (StackFrameInfo *frame, MonoContext *ctx, gpointer data) continue; /*If ip points to the first instruction it means the handler block didn't start so we can leave its execution to the EH machinery*/ - if (ei->handler_start < ip && ip < ei->data.handler_end) { + if (ei->handler_start <= ip && ip < ei->data.handler_end) { pdata->ji = ji; pdata->ei = ei; pdata->ctx = *ctx; @@ -2941,7 +2941,7 @@ install_handler_block_guard (MonoJitInfo *ji, MonoContext *ctx) clause = &ji->clauses [i]; if (clause->flags != MONO_EXCEPTION_CLAUSE_FINALLY) continue; - if (clause->handler_start < ip && clause->data.handler_end > ip) + if (clause->handler_start <= ip && clause->data.handler_end > ip) break; } @@ -2949,10 +2949,6 @@ install_handler_block_guard (MonoJitInfo *ji, MonoContext *ctx) if (i == ji->num_clauses) return NULL; - /*If we stopped on the instruction right before the try, we haven't actually started executing it*/ - if (ip == clause->handler_start) - return NULL; - return mono_arch_install_handler_block_guard (ji, clause, ctx, mono_create_handler_block_trampoline ()); } -- 2.25.1