}
static MonoBBlock *
-mono_find_final_block (MonoFlowGraph *cfg, guint32 ip, int type)
+mono_find_final_block (MonoFlowGraph *cfg, guint32 ip, guint32 target, int type)
{
MonoMethod *method = cfg->method;
MonoBytecodeInfo *bcinfo = cfg->bcinfo;
for (i = 0; i < header->num_clauses; ++i) {
clause = &header->clauses [i];
- if (MONO_OFFSET_IN_HANDLER (clause, ip))
- return NULL;
- if (MONO_OFFSET_IN_CLAUSE (clause, ip)) {
+ if (MONO_OFFSET_IN_CLAUSE (clause, ip) &&
+ (!MONO_OFFSET_IN_CLAUSE (clause, target))) {
if (clause->flags & type) {
g_assert (bcinfo [clause->handler_offset].is_block_start);
return &cfg->bblocks [bcinfo [clause->handler_offset].block_id];
- } else
- return NULL;
+ }
}
}
return NULL;
/* fixme: fault handler */
- if ((hb = mono_find_final_block (cfg, cli_addr, MONO_EXCEPTION_CLAUSE_FINALLY))) {
+ if ((hb = mono_find_final_block (cfg, cli_addr, target, MONO_EXCEPTION_CLAUSE_FINALLY))) {
mark_reached (cfg, hb, NULL, 0);
t1 = mono_ctree_new_leaf (mp, MB_TERM_HANDLER);
t1->data.p = hb;
--- /dev/null
+using System;
+
+public class Test {
+
+ public static int Main (string[] args) {
+
+ int c = 0;
+ try {
+ try {
+ c = 0;
+ }
+ catch (Exception e) {
+ Console.WriteLine("Exception: {0}", e.Message);
+ }
+ finally {
+ Console.WriteLine("Finally... {0}", c++);
+ }
+ }
+ finally {
+ c++;
+ }
+
+ if (c != 2)
+ return 1;
+
+ return 0;
+ }
+}